diff --git a/neutron_lib/callbacks/resources.py b/neutron_lib/callbacks/resources.py index 2bc6736b0..5e632e2dc 100644 --- a/neutron_lib/callbacks/resources.py +++ b/neutron_lib/callbacks/resources.py @@ -14,6 +14,7 @@ ADDRESS_GROUP = 'address_group' AGENT = 'agent' FLOATING_IP = 'floatingip' +LOCAL_IP_ASSOCIATION = 'local_ip_association' NETWORK = 'network' NETWORKS = 'networks' PORT = 'port' diff --git a/neutron_lib/constants.py b/neutron_lib/constants.py index 5d442880e..b4f4bcbe3 100644 --- a/neutron_lib/constants.py +++ b/neutron_lib/constants.py @@ -52,6 +52,7 @@ DEVICE_OWNER_HA_REPLICATED_INT = (DEVICE_OWNER_NETWORK_PREFIX + DEVICE_OWNER_ROUTER_INTF = DEVICE_OWNER_NETWORK_PREFIX + "router_interface" DEVICE_OWNER_ROUTER_GW = DEVICE_OWNER_NETWORK_PREFIX + "router_gateway" DEVICE_OWNER_FLOATINGIP = DEVICE_OWNER_NETWORK_PREFIX + "floatingip" +DEVICE_OWNER_LOCAL_IP = DEVICE_OWNER_NETWORK_PREFIX + "local_ip" DEVICE_OWNER_DHCP = DEVICE_OWNER_NETWORK_PREFIX + "dhcp" DEVICE_OWNER_DVR_INTERFACE = (DEVICE_OWNER_NETWORK_PREFIX + "router_interface_distributed") diff --git a/neutron_lib/exceptions/local_ip.py b/neutron_lib/exceptions/local_ip.py new file mode 100644 index 000000000..cc3a4c8c1 --- /dev/null +++ b/neutron_lib/exceptions/local_ip.py @@ -0,0 +1,49 @@ +# Copyright 2021 Huawei, Inc. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from neutron_lib._i18n import _ +from neutron_lib import exceptions + + +class LocalIPNotFound(exceptions.NotFound): + message = _("Local IP %(id)s could not be found.") + + +class LocalIPInUse(exceptions.InUse): + message = _("Local IP %(id)s is still associated with one or more ports.") + + +class LocalIPNoIP(exceptions.InvalidInput): + message = _("Specified Port %(port_id)s has no fixed IPs configured.") + + +class LocalIPRequestedIPNotFound(exceptions.InvalidInput): + message = _("Specified Port %(port_id)s does not have " + "requested IP address: %(ip)s.") + + +class LocalIPNoRequestedIP(exceptions.InvalidInput): + message = _("Specified Port %(port_id)s has several IPs, " + "should specify exact IP address to use for Local IP.") + + +class LocalIPPortOrNetworkRequired(exceptions.InvalidInput): + message = _("Either Port ID or Network ID must be specified " + "for Local IP create.") + + +class LocalIPAssociationNotFound(exceptions.NotFound): + message = _("Local IP %(local_ip_id)s association with port %(port_id)s " + "could not be found.")