diff --git a/neutron/extensions/l3_ext_gw_mode.py b/neutron/extensions/l3_ext_gw_mode.py index ac8fa94b4a0..63db0e30f5f 100644 --- a/neutron/extensions/l3_ext_gw_mode.py +++ b/neutron/extensions/l3_ext_gw_mode.py @@ -13,58 +13,10 @@ # 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_ext_gw_mode as apidef from neutron_lib.api import extensions -from neutron.extensions import l3 +class L3_ext_gw_mode(extensions.APIExtensionDescriptor): -EXTENDED_ATTRIBUTES_2_0 = { - 'routers': {l3.EXTERNAL_GW_INFO: - {'allow_post': True, - 'allow_put': True, - 'is_visible': True, - 'default': None, - 'enforce_policy': True, - 'validate': - {'type:dict_or_nodata': - {'network_id': {'type:uuid': None, 'required': True}, - 'enable_snat': {'type:boolean': None, 'required': False, - 'convert_to': - converters.convert_to_boolean}, - 'external_fixed_ips': { - 'convert_list_to': converters.convert_kvp_list_to_dict, - 'type:fixed_ips': None, - 'default': None, - 'required': False} - } - }}}} - - -class L3_ext_gw_mode(extensions.ExtensionDescriptor): - - @classmethod - def get_name(cls): - return "Neutron L3 Configurable external gateway mode" - - @classmethod - def get_alias(cls): - return "ext-gw-mode" - - @classmethod - def get_description(cls): - return ("Extension of the router abstraction for specifying whether " - "SNAT should occur on the external gateway") - - @classmethod - def get_updated(cls): - return "2013-03-28T10:00:00-00:00" - - def get_required_extensions(self): - return ["router"] - - def get_extended_resources(self, version): - if version == "2.0": - return dict(EXTENDED_ATTRIBUTES_2_0.items()) - else: - return {} + api_definition = apidef diff --git a/neutron/tests/unit/extensions/test_l3_ext_gw_mode.py b/neutron/tests/unit/extensions/test_l3_ext_gw_mode.py index 71172c09a53..a7780e79763 100644 --- a/neutron/tests/unit/extensions/test_l3_ext_gw_mode.py +++ b/neutron/tests/unit/extensions/test_l3_ext_gw_mode.py @@ -18,6 +18,7 @@ import copy import mock import netaddr +from neutron_lib.api.definitions import l3_ext_gw_mode as l3gwm_apidef from neutron_lib import constants from neutron_lib import context as nctx from neutron_lib.plugins import directory @@ -34,7 +35,6 @@ from neutron.db import l3_db from neutron.db import l3_gwmode_db from neutron.db.models import l3 as l3_models from neutron.extensions import l3 -from neutron.extensions import l3_ext_gw_mode from neutron.objects import network as net_obj from neutron.objects import ports as port_obj from neutron.objects import subnet as subnet_obj @@ -60,7 +60,7 @@ class TestExtensionManager(object): # Simulate extension of L3 attribute map for key in l3.RESOURCE_ATTRIBUTE_MAP.keys(): l3.RESOURCE_ATTRIBUTE_MAP[key].update( - l3_ext_gw_mode.EXTENDED_ATTRIBUTES_2_0.get(key, {})) + l3gwm_apidef.RESOURCE_ATTRIBUTE_MAP.get(key, {})) return l3.L3.get_resources() def get_actions(self):