Merge "ovn_idl_impl: fix a logic bug in get_sg_port_groups"

This commit is contained in:
Zuul 2023-03-07 19:09:45 +00:00 committed by Gerrit Code Review
commit 962b4f9bb9
2 changed files with 3 additions and 3 deletions

View File

@ -803,7 +803,7 @@ class OvsdbNbOvnIdl(nb_impl_idl.OvnNbApiIdlImpl, Backend):
port_groups = {} port_groups = {}
for row in self._tables['Port_Group'].rows.values(): for row in self._tables['Port_Group'].rows.values():
name = getattr(row, 'name') name = getattr(row, 'name')
if not (ovn_const.OVN_SG_EXT_ID_KEY in row.external_ids or if (ovn_const.OVN_SG_EXT_ID_KEY not in row.external_ids or
name == ovn_const.OVN_DROP_PORT_GROUP_NAME): name == ovn_const.OVN_DROP_PORT_GROUP_NAME):
continue continue
data = {} data = {}

View File

@ -1474,7 +1474,6 @@ class TestOvnNbSync(base.TestOVNFunctionalBase):
db_pgs = [] db_pgs = []
for sg in self._list('security-groups')['security_groups']: for sg in self._list('security-groups')['security_groups']:
db_pgs.append(utils.ovn_port_group_name(sg['id'])) db_pgs.append(utils.ovn_port_group_name(sg['id']))
db_pgs.append(ovn_const.OVN_DROP_PORT_GROUP_NAME)
nb_pgs = _plugin_nb_ovn.get_sg_port_groups() nb_pgs = _plugin_nb_ovn.get_sg_port_groups()
@ -1484,7 +1483,8 @@ class TestOvnNbSync(base.TestOVNFunctionalBase):
if should_match: if should_match:
self.assertCountEqual(nb_pgs, db_pgs) self.assertCountEqual(nb_pgs, db_pgs)
self.assertCountEqual(mn_pgs, db_pgs) # pg_drop port group doesn't have corresponding neutron sg
self.assertEqual(len(mn_pgs), len(db_pgs) + 1)
else: else:
self.assertRaises(AssertionError, self.assertCountEqual, self.assertRaises(AssertionError, self.assertCountEqual,
nb_pgs, db_pgs) nb_pgs, db_pgs)