Skip to content

Commit 1097373

Browse files
authored
[show] Added alias interface mode support for 'show interfaces counters ...' command (#2468)
Fixes #2464 #### What I did This change fixed "show interfaces counters xxx" output nothing when naming mode is alias. #### How I did it Convert the alias name into interface name for "show interfaces counters -u xxx", "show interfaces counters detailed xxx" and "show interfaces counters rif xxx" subcommands. #### How to verify it 1. Set interface naming mode to alias. 2. Logout/Login. 3. Verify "show interfaces counters -i Eth1". 4. Verify "show interfaces counters rif Eth1". 5. Verify "show interfaces counters detailed Eth1". 6. Set interface naming mode to default. 7. Logout/Login 8. Repeat step 3~5.
1 parent 589375f commit 1097373

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

show/interfaces/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ def counters(ctx, verbose, period, interface, printall, namespace, display):
578578
if period is not None:
579579
cmd += " -p {}".format(period)
580580
if interface is not None:
581+
interface = try_convert_interfacename_from_alias(ctx, interface)
581582
cmd += " -i {}".format(interface)
582583
else:
583584
cmd += " -s {}".format(display)
@@ -643,10 +644,13 @@ def rates(verbose, period, namespace, display):
643644
def rif(interface, period, verbose):
644645
"""Show interface counters"""
645646

647+
ctx = click.get_current_context()
648+
646649
cmd = "intfstat"
647650
if period is not None:
648651
cmd += " -p {}".format(period)
649652
if interface is not None:
653+
interface = try_convert_interfacename_from_alias(ctx, interface)
650654
cmd += " -i {}".format(interface)
651655

652656
clicommon.run_command(cmd, display_cmd=verbose)
@@ -659,10 +663,13 @@ def rif(interface, period, verbose):
659663
def detailed(interface, period, verbose):
660664
"""Show interface counters detailed"""
661665

666+
ctx = click.get_current_context()
667+
662668
cmd = "portstat -l"
663669
if period is not None:
664670
cmd += " -p {}".format(period)
665671
if interface is not None:
672+
interface = try_convert_interfacename_from_alias(ctx, interface)
666673
cmd += " -i {}".format(interface)
667674

668675
clicommon.run_command(cmd, display_cmd=verbose)

0 commit comments

Comments
 (0)