Browse Source

Merge "[OVN] Don't set virtual port type on ports with similar addresses" into stable/stein

tags/6.1.1
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
6c4be81f73
2 changed files with 18 additions and 2 deletions
  1. +3
    -2
      networking_ovn/common/ovn_client.py
  2. +15
    -0
      networking_ovn/tests/functional/test_mech_driver.py

+ 3
- 2
networking_ovn/common/ovn_client.py View File

@@ -199,8 +199,9 @@ class OVNClient(object):
def get_virtual_port_parents(self, virtual_ip, port):
ls = self._nb_idl.ls_get(utils.ovn_name(port['network_id'])).execute(
check_error=True)
return [lsp.name for lsp in ls.ports for ps in lsp.port_security
if lsp.name != port['id'] and virtual_ip in ps]
return [lsp.name for lsp in ls.ports
if lsp.name != port['id'] and
virtual_ip in utils.get_ovn_port_addresses(lsp)]

def _get_port_options(self, port, qos_options=None):
context = n_context.get_admin_context()


+ 15
- 0
networking_ovn/tests/functional/test_mech_driver.py View File

@@ -412,3 +412,18 @@ class TestVirtualPorts(base.TestOVNFunctionalBase):
ovn_vport.options)
self.assertNotIn(ovn_const.LSP_OPTIONS_VIRTUAL_IP_KEY,
ovn_vport.options)

def test_virtual_port_not_set_similiar_address(self):
# Create one port
self._create_port(fixed_ip='10.0.0.110')
# Create second port with similar IP, so that
# string matching will return True
second_port = self._create_port(fixed_ip='10.0.0.11')

# Assert the virtual port has not been set.
ovn_vport = self._find_port_row(second_port['id'])
self.assertEqual("", ovn_vport.type)
self.assertNotIn(ovn_const.LSP_OPTIONS_VIRTUAL_PARENTS_KEY,
ovn_vport.options)
self.assertNotIn(ovn_const.LSP_OPTIONS_VIRTUAL_IP_KEY,
ovn_vport.options)

Loading…
Cancel
Save