Merge "NSX|V3: ensure provider securiry updates are done"
This commit is contained in:
commit
c1ee02253f
@ -2860,6 +2860,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||||||
|
|
||||||
with db_api.context_manager.writer.using(context):
|
with db_api.context_manager.writer.using(context):
|
||||||
original_port = super(NsxV3Plugin, self).get_port(context, id)
|
original_port = super(NsxV3Plugin, self).get_port(context, id)
|
||||||
|
self._remove_provider_security_groups_from_list(original_port)
|
||||||
port_data = port['port']
|
port_data = port['port']
|
||||||
nsx_lswitch_id, nsx_lport_id = nsx_db.get_nsx_switch_and_port_id(
|
nsx_lswitch_id, nsx_lport_id = nsx_db.get_nsx_switch_and_port_id(
|
||||||
context.session, id)
|
context.session, id)
|
||||||
@ -2918,6 +2919,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||||||
raise n_exc.InvalidInput(error_message=msg)
|
raise n_exc.InvalidInput(error_message=msg)
|
||||||
self._update_mac_learning_state(context, id,
|
self._update_mac_learning_state(context, id,
|
||||||
mac_learning_state)
|
mac_learning_state)
|
||||||
|
self._remove_provider_security_groups_from_list(updated_port)
|
||||||
|
|
||||||
address_bindings = self._build_address_bindings(updated_port)
|
address_bindings = self._build_address_bindings(updated_port)
|
||||||
if port_security and address_bindings:
|
if port_security and address_bindings:
|
||||||
|
@ -344,7 +344,20 @@ class ProviderSecurityGroupExtTestCase(
|
|||||||
|
|
||||||
class TestNSXv3ProviderSecurityGrp(test_nsxv3_plugin.NsxV3PluginTestCaseMixin,
|
class TestNSXv3ProviderSecurityGrp(test_nsxv3_plugin.NsxV3PluginTestCaseMixin,
|
||||||
ProviderSecurityGroupExtTestCase):
|
ProviderSecurityGroupExtTestCase):
|
||||||
pass
|
|
||||||
|
def test_update_port_remove_provider_sg(self):
|
||||||
|
# need to create provider security group first.
|
||||||
|
self._create_provider_security_group()
|
||||||
|
with self.port(tenant_id=self._tenant_id) as p:
|
||||||
|
body = {'port': {'provider_security_groups': []}}
|
||||||
|
req = self.new_update_request('ports', body, p['port']['id'])
|
||||||
|
port = self.deserialize(self.fmt, req.get_response(self.api))
|
||||||
|
# confirm that the group has been removed.
|
||||||
|
self.assertEqual([], port['port']['provider_security_groups'])
|
||||||
|
# make sure that the security groups did not contain the provider
|
||||||
|
# security group
|
||||||
|
self.assertEqual(p['port']['security_groups'],
|
||||||
|
port['port']['security_groups'])
|
||||||
|
|
||||||
|
|
||||||
class TestNSXvProviderSecurityGroup(test_nsxv_plugin.NsxVPluginV2TestCase,
|
class TestNSXvProviderSecurityGroup(test_nsxv_plugin.NsxVPluginV2TestCase,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user