[functional tests] compatibility with ovsdbapp>=2.4.2

ovsdbapp>=2.4.2 handles cleanup of Chassis_Private record
with chassis delete so we don't need explicit delete.
The compatibility part can be dropped when we update
requirements.txt to ovsdbapp>=2.4.2.

Closes-Bug: #2066263
Change-Id: I45c6e6a1c3536cf4f2d90b01a3577eec9eaf3743
(cherry picked from commit 20b9893e34)
(cherry picked from commit 4221f706ce)
This commit is contained in:
yatinkarel 2024-05-21 18:36:39 +05:30
parent de0e7341a9
commit d1c5eac0a8
2 changed files with 13 additions and 4 deletions

View File

@ -28,6 +28,7 @@ from oslo_config import cfg
from oslo_log import log
from oslo_utils import timeutils
from oslo_utils import uuidutils
from ovsdbapp.backend.ovs_idl import idlutils
from neutron.agent.linux import utils
from neutron.api import extensions as exts
@ -444,6 +445,13 @@ class TestOVNFunctionalBase(test_plugin.Ml2PluginV2TestCase,
def del_fake_chassis(self, chassis, if_exists=True):
self.sb_api.chassis_del(
chassis, if_exists=if_exists).execute(check_error=True)
if self.sb_api.is_table_present('Chassis_Private'):
self.sb_api.db_destroy(
'Chassis_Private', chassis).execute(check_error=True)
try:
if self.sb_api.is_table_present('Chassis_Private'):
self.sb_api.db_destroy(
'Chassis_Private', chassis).execute(check_error=True)
except idlutils.RowNotFound:
# NOTE(ykarel ): ovsdbapp >= 2.4.2 handles Chassis_Private
# record delete with chassis
# try/except can be dropped when neutron requirements.txt
# include ovsdbapp>=2.4.2
pass

View File

@ -1236,7 +1236,8 @@ class TestAgentApi(base.TestOVNFunctionalBase):
# then Chassis_Private.chassis = []; both metadata and controller
# agents will still be present in the agent list.
agent_event = AgentWaitEvent(self.mech_driver, [self.chassis],
events=(event.RowEvent.ROW_UPDATE,))
events=(event.RowEvent.ROW_UPDATE,
event.RowEvent.ROW_DELETE,))
self.sb_api.idl.notify_handler.watch_event(agent_event)
self.sb_api.chassis_del(self.chassis).execute(check_error=True)
self.assertTrue(agent_event.wait())