Add Local IP constants and exceptions

Partial-Bug: #1930200
Change-Id: I785c6c3fa600d9dcf6a41a527f07e1e4b1ddda52
This commit is contained in:
Oleg Bondarev 2021-08-10 11:42:00 +03:00
parent 65df195563
commit 5e9ced2793
3 changed files with 51 additions and 0 deletions

View File

@ -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'

View File

@ -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")

View File

@ -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.")