From 88688fb1082d01ae6f742b03c711faa4735a4109 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Mon, 30 Apr 2018 22:13:42 +0000 Subject: [PATCH] Use extension fip-port-details from neutron-lib The fip-port-details extension's API definition was added into neutron-lib with https://review.openstack.org/#/c/534882/ This patch consumes it by using the API definition. It also bumps the requires to use neutron-lib 1.14.0 NeutronLibImpact Change-Id: I9a93c0aef247f6145f3a55a44d08844d74b44eff --- neutron/extensions/_fip_port_details_lib.py | 43 ------------------- neutron/extensions/fip_port_details.py | 3 +- .../unit/extensions/test_fip_port_details.py | 6 +-- 3 files changed, 4 insertions(+), 48 deletions(-) delete mode 100644 neutron/extensions/_fip_port_details_lib.py diff --git a/neutron/extensions/_fip_port_details_lib.py b/neutron/extensions/_fip_port_details_lib.py deleted file mode 100644 index a08661d9343..00000000000 --- a/neutron/extensions/_fip_port_details_lib.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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. - -""" -TODO(hongbin): This module should be deleted once neutron-lib containing -https://review.openstack.org/#/c/534882/ change is released. -""" - -from neutron_lib.api.definitions import l3 -from neutron_lib import constants - - -PORT_DETAILS = 'port_details' - -ALIAS = 'fip-port-details' -IS_SHIM_EXTENSION = False -IS_STANDARD_ATTR_EXTENSION = False -NAME = 'Floating IP Port Details Extension' -DESCRIPTION = 'Add port_details attribute to Floating IP resource' -UPDATED_TIMESTAMP = '2018-04-09T10:00:00-00:00' -RESOURCE_ATTRIBUTE_MAP = { - l3.FLOATINGIPS: { - PORT_DETAILS: { - 'allow_post': False, 'allow_put': False, - 'default': constants.ATTR_NOT_SPECIFIED, - 'is_visible': True - } - } -} -SUB_RESOURCE_ATTRIBUTE_MAP = {} -ACTION_MAP = {} -REQUIRED_EXTENSIONS = [l3.ALIAS] -OPTIONAL_EXTENSIONS = [] -ACTION_STATUS = {} diff --git a/neutron/extensions/fip_port_details.py b/neutron/extensions/fip_port_details.py index 4a3123c0879..aeee589b627 100644 --- a/neutron/extensions/fip_port_details.py +++ b/neutron/extensions/fip_port_details.py @@ -10,10 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +from neutron_lib.api.definitions import fip_port_details as apidef from neutron_lib.api import extensions -from neutron.extensions import _fip_port_details_lib as apidef - class Fip_port_details(extensions.APIExtensionDescriptor): """Extension class adding port_details to Floating IP.""" diff --git a/neutron/tests/unit/extensions/test_fip_port_details.py b/neutron/tests/unit/extensions/test_fip_port_details.py index 06102100db8..3b9cda332f2 100644 --- a/neutron/tests/unit/extensions/test_fip_port_details.py +++ b/neutron/tests/unit/extensions/test_fip_port_details.py @@ -12,10 +12,10 @@ # under the License. # +from neutron_lib.api.definitions import fip_port_details as apidef from oslo_config import cfg from neutron.db import l3_fip_port_details -from neutron.extensions import _fip_port_details_lib as apiref from neutron.extensions import l3 from neutron.tests.unit.extensions import test_l3 @@ -36,13 +36,13 @@ class TestFloatingIPPortDetailsIntPlugin( test_l3.TestL3NatIntPlugin, l3_fip_port_details.Fip_port_details_db_mixin): supported_extension_aliases = ["external-net", "router", - apiref.ALIAS] + apidef.ALIAS] class TestFloatingIPPortDetailsL3NatServicePlugin( test_l3.TestL3NatServicePlugin, l3_fip_port_details.Fip_port_details_db_mixin): - supported_extension_aliases = ["router", apiref.ALIAS] + supported_extension_aliases = ["router", apidef.ALIAS] class FloatingIPPortDetailsDBTestCaseBase(test_l3.L3NatTestCaseMixin):