Fix security group broken code & tests

Commit I34e41a128f28211f2e7ab814a2611ce22620fcf3 broke the MH plugin
security groups + some other SG tests.
This patches fixes those.

Change-Id: I9634583ce22f4c1be53283495426905979c9ea81
This commit is contained in:
Adit Sarfaty 2019-01-24 14:57:53 +02:00
parent d07d4f0d12
commit baafb2a16a
3 changed files with 6 additions and 5 deletions

View File

@ -2486,7 +2486,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
if not security_group:
raise ext_sg.SecurityGroupNotFound(id=security_group_id)
# Check for duplicate rules
self._check_for_duplicate_rules(context, s)
self._check_for_duplicate_rules(context, security_group_id, s)
# gather all the existing security group rules since we need all
# of them to PUT to NSX.
existing_rules = self.get_security_group_rules(

View File

@ -18,6 +18,7 @@ import webob.exc
from neutron.db import db_base_plugin_v2
from neutron.db import securitygroups_db
from neutron.extensions import securitygroup as ext_sg
from neutron.tests.unit.db import test_db_base_plugin_v2
from neutron.tests.unit.extensions import test_securitygroup
from neutron_lib import context
from neutron_lib.db import api as db_api
@ -131,7 +132,7 @@ class ProviderSecurityGroupExtTestCase(
def setUp(self, plugin=PLUGIN_NAME, ext_mgr=None):
super(ProviderSecurityGroupExtTestCase, self).setUp(
plugin=plugin, ext_mgr=ext_mgr)
self._tenant_id = 'foobar'
self._tenant_id = test_db_base_plugin_v2.TEST_TENANT_ID
# add provider group attributes
ext_sg.Securitygroup().update_attributes_map(
provider_sg.EXTENDED_ATTRIBUTES_2_0)

View File

@ -18,6 +18,7 @@ import webob.exc
from neutron.extensions import securitygroup as ext_sg
from neutron.tests.unit.api import test_extensions
from neutron.tests.unit.db import test_db_base_plugin_v2
from neutron.tests.unit.extensions import test_securitygroup
from neutron_lib import constants
from neutron_lib import context
@ -44,7 +45,7 @@ class SecGroupPolicyExtensionTestCase(
return_value="6.2.3"):
super(SecGroupPolicyExtensionTestCase, self).setUp(
plugin=plugin, ext_mgr=ext_mgr)
self._tenant_id = 'foobar'
self._tenant_id = test_db_base_plugin_v2.TEST_TENANT_ID
# add policy & logging security group attribute
ext_sg.Securitygroup().update_attributes_map(
ext_policy.RESOURCE_ATTRIBUTE_MAP)
@ -59,8 +60,7 @@ class SecGroupPolicyExtensionTestCase(
'policy': policy_id,
'description': description if description else '',
'logging': logging}}
security_group_req = self.new_create_request('security-groups', body)
return security_group_req.get_response(self.ext_api)
return self._create_security_group_response(self.fmt, body)
def _get_secgroup_with_policy(self):
policy_id = 'policy-5'