From 08132e213d90772af3a2e34b62a8094ec86ab06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20J=C3=B3zefczyk?= Date: Mon, 2 Mar 2020 09:59:58 +0100 Subject: [PATCH] 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 --- .../ml2/drivers/ovn/mech_driver/test_mech_driver.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py index f4c8ec7fa85..f720cf1b471 100644 --- a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py +++ b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py @@ -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)