Skip to content

Commit 64d8cff

Browse files
committed
fix: fix port does not exist error test_bgp_queue
Signed-off-by: Austin Pham <austinpham@microsoft.com>
1 parent 41164f9 commit 64d8cff

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

tests/bgp/test_bgp_queue.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def get_queue_counters(asichost, port, queue):
1919
Return the counter for a given queue in given port
2020
"""
2121
cmd = "show queue counters {}".format(port)
22-
output = asichost.command(cmd)['stdout_lines']
22+
output = asichost.command(cmd, new_format=True)['stdout_lines']
23+
2324
txq = "UC{}".format(queue)
2425
for line in output:
2526
fields = line.split()

tests/common/devices/sonic_asic.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,12 @@ def create_ssh_tunnel_sai_rpc(self):
407407
" -L *:{}:{}:{} localhost").format(self.get_rpc_port_ssh_tunnel(), ns_docker_if_ipv4,
408408
self._RPC_PORT_FOR_SSH_TUNNEL))
409409

410-
def command(self, cmdstr):
410+
def command(self, cmdstr, new_format=False):
411411
"""
412412
Prepend 'ip netns' option for commands meant for this ASIC
413413
414+
If new format is provided (new_format=True) we use the syntax "{cmd} -n asic{index}" instead.
415+
414416
Args:
415417
cmdstr
416418
Returns:
@@ -419,7 +421,10 @@ def command(self, cmdstr):
419421
if not self.sonichost.is_multi_asic or self.namespace == DEFAULT_NAMESPACE:
420422
return self.sonichost.command(cmdstr)
421423

422-
cmdstr = "sudo ip netns exec {} {}".format(self.namespace, cmdstr)
424+
if new_format:
425+
cmdstr = "sudo {} {}".format(cmdstr, self.cli_ns_option)
426+
else:
427+
cmdstr = "sudo ip netns exec {} {}".format(self.namespace, cmdstr)
423428

424429
return self.sonichost.command(cmdstr)
425430

0 commit comments

Comments
 (0)