Change way of retrieving LSP in virtual_port functional tests

Sometimes we had a situation, where Logical_Switch_Port type
received by IDL had a different type, that type set in the
NBDB. We changed the way we retrieve the LS from DB, to not
loop over rows in table, but call db_find_rows() instead.
With this change after about 40 retries of functional tests we
don't spot the same issue again.

Change-Id: I07c081d1984b26a10a4d854d17117cfeaac7f8ac
Related-Bug: 1862618
This commit is contained in:
Maciej Józefczyk 2020-03-02 09:59:58 +01:00
parent f97ae3d6f8
commit 08132e213d
1 changed files with 4 additions and 3 deletions

View File

@ -232,9 +232,10 @@ class TestVirtualPorts(base.TestOVNFunctionalBase):
return self._update_allowed_address_pair(port_id, [])
def _find_port_row(self, port_id):
for row in self.nb_api._tables['Logical_Switch_Port'].rows.values():
if row.name == port_id:
return row
cmd = self.nb_api.db_find_rows(
'Logical_Switch_Port', ('name', '=', port_id))
rows = cmd.execute(check_error=True)
return rows[0] if rows else None
def _is_ovn_port_type(self, port_id, port_type):
ovn_vport = self._find_port_row(port_id)