Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pfcstat] add the new tools to show and clear command #238

Merged
merged 1 commit into from
Apr 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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