Browse Source

Merge "NSX|P: Fix port security update for network"

tags/16.0.0
Zuul 3 months ago
committed by Gerrit Code Review
parent
commit
4124f0c10e
3 changed files with 43 additions and 0 deletions
  1. +3
    -0
      vmware_nsx/plugins/nsx_p/plugin.py
  2. +20
    -0
      vmware_nsx/tests/unit/nsx_p/test_plugin.py
  3. +20
    -0
      vmware_nsx/tests/unit/nsx_v3/test_plugin.py

+ 3
- 0
vmware_nsx/plugins/nsx_p/plugin.py View File

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



+ 20
- 0
vmware_nsx/tests/unit/nsx_p/test_plugin.py View File

@@ -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,


+ 20
- 0
vmware_nsx/tests/unit/nsx_v3/test_plugin.py View File

@@ -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…
Cancel
Save