Do not "grep" the output of an empty list
If a command returns an empty list, the "grep" command will exit with error. In the ``OvnFdbAgingTest`` test case, we need to retrieve the OVN SB FDB table to read the MAC address. The output is something like this (one single register): $ ovn-sbctl list FDB _uuid : 7422a4fb-fb01-47b5-b408-1b59470f0e9d dp_key : 1 mac : "fa:16:3e:69:a9:f9" port_key : 7 timestamp : 1726246598759 It is possible to output the MAC address by adding the needed filters to the command: $ ovn-sbctl --format=list --bare --columns=mac list FDB fa:16:3e:69:a9:f9 Related-Bug: #OSPRH-893 Change-Id: Iaca410d9943a39e76f86ec51b5292ed896f8088b
This commit is contained in:
parent
28d64df58a
commit
363e3564a9
@ -38,7 +38,8 @@ class OvnFdbAgingTest(wb_base.BaseTempestTestCaseOvn):
|
||||
|
||||
def _check_mac_in_ovn_sb_fdb(self, mac_address, is_present=True):
|
||||
def _check_mac():
|
||||
cmd = '{} list FDB | grep mac'.format(self.sbctl)
|
||||
cmd = ('{} --format=list --bare --columns=mac list FDB; '
|
||||
'true').format(self.sbctl)
|
||||
fdb_list = self.run_on_master_controller(cmd).lower()
|
||||
if is_present:
|
||||
return mac_address.lower() in fdb_list
|
||||
|
Loading…
x
Reference in New Issue
Block a user