Merge "use api attributes from neutron-lib"

This commit is contained in:
Zuul 2018-01-13 08:15:44 +00:00 committed by Gerrit Code Review
commit bdeabecca7
2 changed files with 3 additions and 4 deletions
vmware_nsx
api_replay
tests/unit/nsx_v3

@ -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()