From e2f1dc844f308e477c4daa6a1952e9503e47d2d2 Mon Sep 17 00:00:00 2001 From: Hui Ma Date: Wed, 11 Apr 2018 00:31:46 +0000 Subject: [PATCH] [pfcstat] add the new tools to show and clear command --- 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 b66e966c52..bc25f70116 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 bad1a5f5cf..0fa6ac92f3 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 abf1558667..66a7aec1a0 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 ...")