Skip to content

Commit

Permalink
[pfcstat] add the new tools to show and clear command (sonic-net#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
hui-ma authored and lguohan committed Apr 11, 2018
1 parent 5e476d6 commit ca11c15
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
12 changes: 12 additions & 0 deletions clear/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ####
#
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def get_test_suite():
'scripts/port2alias',
'scripts/portconfig',
'scripts/portstat',
'scripts/pfcstat',
'scripts/queuestat',
'scripts/reboot',
'scripts/teamshow'
],
Expand Down
47 changes: 47 additions & 0 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...")
Expand Down

0 comments on commit ca11c15

Please sign in to comment.