rehome l3 ext ha mode extension api definition
This patch rehomes the l3 ext ha mode extension's API definition into neutron-lib as well as its associated exceptions. UTs and a release note are also included. Change-Id: Ie407d56cdac6996133fcd855754185c74707e992
This commit is contained in:
@@ -32,6 +32,7 @@ from neutron_lib.api.definitions import ip_allocation
|
|||||||
from neutron_lib.api.definitions import l2_adjacency
|
from neutron_lib.api.definitions import l2_adjacency
|
||||||
from neutron_lib.api.definitions import l3
|
from neutron_lib.api.definitions import l3
|
||||||
from neutron_lib.api.definitions import l3_ext_gw_mode
|
from neutron_lib.api.definitions import l3_ext_gw_mode
|
||||||
|
from neutron_lib.api.definitions import l3_ext_ha_mode
|
||||||
from neutron_lib.api.definitions import logging
|
from neutron_lib.api.definitions import logging
|
||||||
from neutron_lib.api.definitions import logging_resource
|
from neutron_lib.api.definitions import logging_resource
|
||||||
from neutron_lib.api.definitions import network
|
from neutron_lib.api.definitions import network
|
||||||
@@ -79,6 +80,7 @@ _ALL_API_DEFINITIONS = {
|
|||||||
l2_adjacency,
|
l2_adjacency,
|
||||||
l3,
|
l3,
|
||||||
l3_ext_gw_mode,
|
l3_ext_gw_mode,
|
||||||
|
l3_ext_ha_mode,
|
||||||
logging,
|
logging,
|
||||||
logging_resource,
|
logging_resource,
|
||||||
network,
|
network,
|
||||||
|
45
neutron_lib/api/definitions/l3_ext_ha_mode.py
Normal file
45
neutron_lib/api/definitions/l3_ext_ha_mode.py
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
||||||
|
#
|
||||||
|
# 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.api import converters
|
||||||
|
from neutron_lib.api.definitions import l3
|
||||||
|
from neutron_lib import constants
|
||||||
|
|
||||||
|
|
||||||
|
HA_INFO = 'ha'
|
||||||
|
|
||||||
|
ALIAS = constants.L3_HA_MODE_EXT_ALIAS
|
||||||
|
IS_SHIM_EXTENSION = False
|
||||||
|
IS_STANDARD_ATTR_EXTENSION = False
|
||||||
|
NAME = 'HA Router extension'
|
||||||
|
API_PREFIX = ''
|
||||||
|
DESCRIPTION = 'Adds HA capability to routers.'
|
||||||
|
UPDATED_TIMESTAMP = '2014-04-26T00:00:00-00:00'
|
||||||
|
RESOURCE_NAME = l3.ROUTER
|
||||||
|
COLLECTION_NAME = l3.ROUTERS
|
||||||
|
RESOURCE_ATTRIBUTE_MAP = {
|
||||||
|
COLLECTION_NAME: {
|
||||||
|
HA_INFO: {
|
||||||
|
'allow_post': True, 'allow_put': True,
|
||||||
|
'default': constants.ATTR_NOT_SPECIFIED, 'is_visible': True,
|
||||||
|
'enforce_policy': True,
|
||||||
|
'convert_to': converters.convert_to_boolean_if_not_none
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SUB_RESOURCE_ATTRIBUTE_MAP = {}
|
||||||
|
ACTION_MAP = {}
|
||||||
|
REQUIRED_EXTENSIONS = [l3.ALIAS]
|
||||||
|
OPTIONAL_EXTENSIONS = []
|
||||||
|
ACTION_STATUS = {}
|
42
neutron_lib/exceptions/l3_ext_ha_mode.py
Normal file
42
neutron_lib/exceptions/l3_ext_ha_mode.py
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
||||||
|
#
|
||||||
|
# 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 MaxVRIDAllocationTriesReached(exceptions.NeutronException):
|
||||||
|
message = _("Failed to allocate a VRID in the network %(network_id)s "
|
||||||
|
"for the router %(router_id)s after %(max_tries)s tries.")
|
||||||
|
|
||||||
|
|
||||||
|
class NoVRIDAvailable(exceptions.Conflict):
|
||||||
|
message = _("No more Virtual Router Identifier (VRID) available when "
|
||||||
|
"creating router %(router_id)s. The limit of number "
|
||||||
|
"of HA Routers per tenant is 254.")
|
||||||
|
|
||||||
|
|
||||||
|
class HANetworkConcurrentDeletion(exceptions.Conflict):
|
||||||
|
message = _("Network for tenant %(tenant_id)s concurrently deleted.")
|
||||||
|
|
||||||
|
|
||||||
|
class HANetworkCIDRNotValid(exceptions.NeutronException):
|
||||||
|
message = _("The HA Network CIDR specified in the configuration file "
|
||||||
|
"isn't valid; %(cidr)s.")
|
||||||
|
|
||||||
|
|
||||||
|
class HAMaximumAgentsNumberNotValid(exceptions.NeutronException):
|
||||||
|
message = _("max_l3_agents_per_router %(max_agents)s config parameter "
|
||||||
|
"is not valid as it cannot be negative. It must be 1 or "
|
||||||
|
"greater. Alternatively, it can be 0 to mean unlimited.")
|
@@ -0,0 +1,20 @@
|
|||||||
|
# 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.api.definitions import l3_ext_ha_mode
|
||||||
|
from neutron_lib.tests.unit.api.definitions import base
|
||||||
|
|
||||||
|
|
||||||
|
class L3ExtHAModeDefinitionTestCase(base.DefinitionBaseTestCase):
|
||||||
|
extension_module = l3_ext_ha_mode
|
||||||
|
extension_resources = ()
|
||||||
|
extension_attributes = (l3_ext_ha_mode.HA_INFO,)
|
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- The ``l3-ha`` extension's API definition is now available in
|
||||||
|
``neutron_lib.api.definitions.l3_ext_ha_mode``.
|
||||||
|
- Exceptions related to the ``l3-ha`` extension are available in
|
||||||
|
``neutron_lib.api.exceptions.l3_ext_ha_mode``.
|
Reference in New Issue
Block a user