Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/bgp/test_bgp_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def get_queue_counters(asichost, port, queue):
Return the counter for a given queue in given port
"""
cmd = "show queue counters {}".format(port)
output = asichost.command(cmd)['stdout_lines']
output = asichost.command(cmd, new_format=True)['stdout_lines']

txq = "UC{}".format(queue)
for line in output:
fields = line.split()
Expand Down
9 changes: 7 additions & 2 deletions tests/common/devices/sonic_asic.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,12 @@ def create_ssh_tunnel_sai_rpc(self):
" -L *:{}:{}:{} localhost").format(self.get_rpc_port_ssh_tunnel(), ns_docker_if_ipv4,
self._RPC_PORT_FOR_SSH_TUNNEL))

def command(self, cmdstr):
def command(self, cmdstr, new_format=False):
"""
Prepend 'ip netns' option for commands meant for this ASIC

If new format is provided (new_format=True) we use the syntax "{cmd} -n asic{index}" instead.

Args:
cmdstr
Returns:
Expand All @@ -397,7 +399,10 @@ def command(self, cmdstr):
if not self.sonichost.is_multi_asic or self.namespace == DEFAULT_NAMESPACE:
return self.sonichost.command(cmdstr)

cmdstr = "sudo ip netns exec {} {}".format(self.namespace, cmdstr)
if new_format:
cmdstr = "sudo {} {}".format(cmdstr, self.cli_ns_option)
else:
cmdstr = "sudo ip netns exec {} {}".format(self.namespace, cmdstr)

return self.sonichost.command(cmdstr)

Expand Down