From 87e99989216309aa4fda101ed9f38b1d8c9f8e91 Mon Sep 17 00:00:00 2001 From: Boden R Date: Thu, 11 Jan 2018 15:43:17 -0700 Subject: [PATCH] use api attributes from neutron-lib This patch moves the code over to neutron-lib's version of the RESOURCE_ATTRIBUTE_MAP in prep for neutron commit Iaacee584d499c4d33d6d2dd9609c7ac0f2cfc386 Change-Id: I09ad5d3a079ffe4494a5f609443be632f1cc9a21 --- vmware_nsx/api_replay/utils.py | 3 +-- vmware_nsx/tests/unit/nsx_v3/test_api_replay.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/vmware_nsx/api_replay/utils.py b/vmware_nsx/api_replay/utils.py index c3fe51d410..700657e818 100644 --- a/vmware_nsx/api_replay/utils.py +++ b/vmware_nsx/api_replay/utils.py @@ -14,7 +14,6 @@ # under the License. -from neutron.api.v2 import attributes from neutron_lib.api import attributes as lib_attrs from oslo_config import cfg from oslo_utils import uuidutils @@ -27,7 +26,7 @@ def _fixup_res_dict(context, attr_name, res_dict, check_allow_post=True): # for the id field if one is not found ONLY if running in api_replay_mode. if cfg.CONF.api_replay_mode and 'id' not in res_dict: res_dict['id'] = uuidutils.generate_uuid() - attr_info = attributes.RESOURCE_ATTRIBUTE_MAP[attr_name] + attr_info = lib_attrs.RESOURCES[attr_name] attr_ops = lib_attrs.AttributeInfo(attr_info) try: attr_ops.populate_project_id(context, res_dict, True) diff --git a/vmware_nsx/tests/unit/nsx_v3/test_api_replay.py b/vmware_nsx/tests/unit/nsx_v3/test_api_replay.py index 36793c61f9..135956e60f 100644 --- a/vmware_nsx/tests/unit/nsx_v3/test_api_replay.py +++ b/vmware_nsx/tests/unit/nsx_v3/test_api_replay.py @@ -15,7 +15,7 @@ from vmware_nsx.tests.unit.nsx_v3 import test_plugin -from neutron.api.v2 import attributes +from neutron_lib.api import attributes from neutron_lib.plugins import directory from oslo_config import cfg @@ -39,7 +39,7 @@ class TestApiReplay(test_plugin.NsxV3PluginTestCaseMixin): # Revert the attributes map back to normal for attr_name in ('ports', 'networks', 'security_groups', 'security_group_rules', 'routers', 'policies'): - attr_info = attributes.RESOURCE_ATTRIBUTE_MAP[attr_name] + attr_info = attributes.RESOURCES[attr_name] attr_info['id']['allow_post'] = False super(TestApiReplay, self).tearDown()