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
This commit is contained in:
parent
45ccd1eaa3
commit
87e9998921
@ -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)
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user