Merge "NSX|P: Fix port security update for network"
This commit is contained in:
commit
4124f0c10e
|
@ -882,6 +882,9 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
|||
context, network_id, network)
|
||||
self._extension_manager.process_update_network(context, net_data,
|
||||
updated_net)
|
||||
if psec.PORTSECURITY in net_data:
|
||||
self._process_network_port_security_update(
|
||||
context, net_data, updated_net)
|
||||
self._process_l3_update(context, updated_net, network['network'])
|
||||
self._extend_network_dict_provider(context, updated_net)
|
||||
|
||||
|
|
|
@ -568,6 +568,26 @@ class NsxPTestNetworks(test_db_base_plugin_v2.TestNetworksV2,
|
|||
network['id'], data)
|
||||
self.assertEqual(policy_id, res['qos_policy_id'])
|
||||
|
||||
def test_update_network_port_sec(self):
|
||||
data = {'network': {
|
||||
'name': 'psec_net',
|
||||
'tenant_id': 'some_tenant',
|
||||
'admin_state_up': True,
|
||||
'shared': False,
|
||||
'port_security_enabled': True}}
|
||||
network = self.plugin.create_network(context.get_admin_context(),
|
||||
data)
|
||||
self.assertEqual(True, network['port_security_enabled'])
|
||||
data = {'network': {
|
||||
'id': network['id'],
|
||||
'admin_state_up': True,
|
||||
'shared': False,
|
||||
'port_security_enabled': False,
|
||||
'tenant_id': 'some_tenant'}}
|
||||
res = self.plugin.update_network(context.get_admin_context(),
|
||||
network['id'], data)
|
||||
self.assertEqual(False, res['port_security_enabled'])
|
||||
|
||||
|
||||
class NsxPTestPorts(common_v3.NsxV3TestPorts,
|
||||
common_v3.NsxV3SubnetMixin,
|
||||
|
|
|
@ -827,6 +827,26 @@ class TestNetworksV2(test_plugin.TestNetworksV2, NsxV3PluginTestCaseMixin):
|
|||
self.assertEqual('InvalidInput',
|
||||
res['NeutronError']['type'])
|
||||
|
||||
def test_update_network_port_sec(self):
|
||||
data = {'network': {
|
||||
'name': 'psec_net',
|
||||
'tenant_id': 'some_tenant',
|
||||
'admin_state_up': True,
|
||||
'shared': False,
|
||||
'port_security_enabled': True}}
|
||||
network = self.plugin.create_network(context.get_admin_context(),
|
||||
data)
|
||||
self.assertEqual(True, network['port_security_enabled'])
|
||||
data = {'network': {
|
||||
'id': network['id'],
|
||||
'admin_state_up': True,
|
||||
'shared': False,
|
||||
'port_security_enabled': False,
|
||||
'tenant_id': 'some_tenant'}}
|
||||
res = self.plugin.update_network(context.get_admin_context(),
|
||||
network['id'], data)
|
||||
self.assertEqual(False, res['port_security_enabled'])
|
||||
|
||||
|
||||
class TestSubnetsV2(common_v3.NsxV3TestSubnets, NsxV3PluginTestCaseMixin):
|
||||
|
||||
|
|
Loading…
Reference in New Issue