From ca11c1533fce57365824902c9bc382cb0b269554 Mon Sep 17 00:00:00 2001 From: hui-ma Date: Wed, 11 Apr 2018 02:34:07 -0700 Subject: [PATCH] [pfcstat] add the new tools to show and clear command (#238) --- clear/main.py | 12 ++++++++++++ setup.py | 2 ++ show/main.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/clear/main.py b/clear/main.py index b66e966c5223..bc25f7011632 100755 --- a/clear/main.py +++ b/clear/main.py @@ -182,6 +182,18 @@ def counters(): command = "portstat -c" run_command(command) +@cli.command() +def queuecounters(): + """Clear queue counters""" + command = "queuestat -c" + run_command(command) + +@cli.command() +def pfccounters(): + """Clear pfc counters""" + command = "pfcstat -c" + run_command(command) + # # 'arp' command #### # diff --git a/setup.py b/setup.py index bad1a5f5cf2e..0fa6ac92f369 100644 --- a/setup.py +++ b/setup.py @@ -51,6 +51,8 @@ def get_test_suite(): 'scripts/port2alias', 'scripts/portconfig', 'scripts/portstat', + 'scripts/pfcstat', + 'scripts/queuestat', 'scripts/reboot', 'scripts/teamshow' ], diff --git a/show/main.py b/show/main.py index abf1558667a7..66a7aec1a018 100755 --- a/show/main.py +++ b/show/main.py @@ -323,6 +323,53 @@ def portchannel(): """Show PortChannel information""" run_command("teamshow") +# +# 'pfc' group ("show pfc ...") +# + +@cli.group(cls=AliasedGroup, default_if_no_args=False) +def pfc(): + """Show details of the priority-flow-control (pfc) """ + pass + +# 'counters' subcommand ("show interfaces pfccounters") +@pfc.command() +@click.option('-c', '--clear', is_flag=True) +def counters(clear): + """Show pfc counters""" + + cmd = "pfcstat" + + if clear: + cmd += " -c" + + run_command(cmd) + +# +# 'queue' group ("show queue ...") +# + +@cli.group(cls=AliasedGroup, default_if_no_args=False) +def queue(): + """Show details of the queues """ + pass + +# 'queuecounters' subcommand ("show queue counters") +@queue.command() +@click.argument('interfacename', required=False) +@click.option('-c', '--clear', is_flag=True) +def counters(interfacename, clear): + """Show queue counters""" + + cmd = "queuestat" + + if clear: + cmd += " -c" + else: + if interfacename is not None: + cmd += " -p {}".format(interfacename) + + run_command(cmd) # # 'mac' command ("show mac ...")