Skip to content

Commit 1f326ad

Browse files
authored
[show] Remove ability to clear counters from 'show' commands (#518)
1 parent 669d36d commit 1f326ad

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

show/main.py

+24-26
Original file line numberDiff line numberDiff line change
@@ -576,23 +576,19 @@ def status(interfacename, verbose):
576576
# 'counters' subcommand ("show interfaces counters")
577577
@interfaces.group(invoke_without_command=True)
578578
@click.option('-a', '--printall', is_flag=True)
579-
@click.option('-c', '--clear', is_flag=True)
580579
@click.option('-p', '--period')
581580
@click.option('--verbose', is_flag=True, help="Enable verbose output")
582581
@click.pass_context
583-
def counters(ctx, verbose, period, clear, printall):
582+
def counters(ctx, verbose, period, printall):
584583
"""Show interface counters"""
585584

586585
if ctx.invoked_subcommand is None:
587586
cmd = "portstat"
588587

589-
if clear:
590-
cmd += " -c"
591-
else:
592-
if printall:
593-
cmd += " -a"
594-
if period is not None:
595-
cmd += " -p {}".format(period)
588+
if printall:
589+
cmd += " -a"
590+
if period is not None:
591+
cmd += " -p {}".format(period)
596592

597593
run_command(cmd, display_cmd=verbose)
598594

@@ -631,16 +627,12 @@ def pfc():
631627

632628
# 'counters' subcommand ("show interfaces pfccounters")
633629
@pfc.command()
634-
@click.option('-c', '--clear', is_flag=True)
635630
@click.option('--verbose', is_flag=True, help="Enable verbose output")
636-
def counters(clear, verbose):
631+
def counters(verbose):
637632
"""Show pfc counters"""
638633

639634
cmd = "pfcstat"
640635

641-
if clear:
642-
cmd += " -c"
643-
644636
run_command(cmd, display_cmd=verbose)
645637

646638
# 'naming_mode' subcommand ("show interfaces naming_mode")
@@ -682,12 +674,11 @@ def queue():
682674
"""Show details of the queues """
683675
pass
684676

685-
# 'queuecounters' subcommand ("show queue counters")
677+
# 'counters' subcommand ("show queue counters")
686678
@queue.command()
687679
@click.argument('interfacename', required=False)
688-
@click.option('-c', '--clear', is_flag=True)
689680
@click.option('--verbose', is_flag=True, help="Enable verbose output")
690-
def counters(interfacename, clear, verbose):
681+
def counters(interfacename, verbose):
691682
"""Show queue counters"""
692683

693684
cmd = "queuestat"
@@ -696,44 +687,51 @@ def counters(interfacename, clear, verbose):
696687
if get_interface_mode() == "alias":
697688
interfacename = iface_alias_converter.alias_to_name(interfacename)
698689

699-
if clear:
700-
cmd += " -c"
701-
else:
702-
if interfacename is not None:
703-
cmd += " -p {}".format(interfacename)
690+
if interfacename is not None:
691+
cmd += " -p {}".format(interfacename)
704692

705693
run_command(cmd, display_cmd=verbose)
706694

707-
# watermarks subcommands ("show queue watermarks|persistent-watermarks")
695+
#
696+
# 'watermarks' subgroup ("show queue watermarks ...")
697+
#
708698

709699
@queue.group()
710700
def watermark():
711-
"""Show queue user WM"""
701+
"""Show user WM for queues"""
712702
pass
713703

704+
# 'unicast' subcommand ("show queue watermarks unicast")
714705
@watermark.command('unicast')
715706
def wm_q_uni():
716707
"""Show user WM for unicast queues"""
717708
command = 'watermarkstat -t q_shared_uni'
718709
run_command(command)
719710

711+
# 'multicast' subcommand ("show queue watermarks multicast")
720712
@watermark.command('multicast')
721713
def wm_q_multi():
722714
"""Show user WM for multicast queues"""
723715
command = 'watermarkstat -t q_shared_multi'
724716
run_command(command)
725717

718+
#
719+
# 'persistent-watermarks' subgroup ("show queue persistent-watermarks ...")
720+
#
721+
726722
@queue.group(name='persistent-watermark')
727723
def persistent_watermark():
728-
"""Show queue persistent WM"""
724+
"""Show persistent WM for queues"""
729725
pass
730726

727+
# 'unicast' subcommand ("show queue persistent-watermarks unicast")
731728
@persistent_watermark.command('unicast')
732729
def pwm_q_uni():
733-
"""Show persistent WM for persistent queues"""
730+
"""Show persistent WM for unicast queues"""
734731
command = 'watermarkstat -p -t q_shared_uni'
735732
run_command(command)
736733

734+
# 'multicast' subcommand ("show queue persistent-watermarks multicast")
737735
@persistent_watermark.command('multicast')
738736
def pwm_q_multi():
739737
"""Show persistent WM for multicast queues"""

0 commit comments

Comments
 (0)