Skip to content

Commit ca11c15

Browse files
hui-malguohan
authored andcommitted
[pfcstat] add the new tools to show and clear command (#238)
1 parent 5e476d6 commit ca11c15

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

clear/main.py

+12
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,18 @@ def counters():
182182
command = "portstat -c"
183183
run_command(command)
184184

185+
@cli.command()
186+
def queuecounters():
187+
"""Clear queue counters"""
188+
command = "queuestat -c"
189+
run_command(command)
190+
191+
@cli.command()
192+
def pfccounters():
193+
"""Clear pfc counters"""
194+
command = "pfcstat -c"
195+
run_command(command)
196+
185197
#
186198
# 'arp' command ####
187199
#

setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def get_test_suite():
5151
'scripts/port2alias',
5252
'scripts/portconfig',
5353
'scripts/portstat',
54+
'scripts/pfcstat',
55+
'scripts/queuestat',
5456
'scripts/reboot',
5557
'scripts/teamshow'
5658
],

show/main.py

+47
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,53 @@ def portchannel():
323323
"""Show PortChannel information"""
324324
run_command("teamshow")
325325

326+
#
327+
# 'pfc' group ("show pfc ...")
328+
#
329+
330+
@cli.group(cls=AliasedGroup, default_if_no_args=False)
331+
def pfc():
332+
"""Show details of the priority-flow-control (pfc) """
333+
pass
334+
335+
# 'counters' subcommand ("show interfaces pfccounters")
336+
@pfc.command()
337+
@click.option('-c', '--clear', is_flag=True)
338+
def counters(clear):
339+
"""Show pfc counters"""
340+
341+
cmd = "pfcstat"
342+
343+
if clear:
344+
cmd += " -c"
345+
346+
run_command(cmd)
347+
348+
#
349+
# 'queue' group ("show queue ...")
350+
#
351+
352+
@cli.group(cls=AliasedGroup, default_if_no_args=False)
353+
def queue():
354+
"""Show details of the queues """
355+
pass
356+
357+
# 'queuecounters' subcommand ("show queue counters")
358+
@queue.command()
359+
@click.argument('interfacename', required=False)
360+
@click.option('-c', '--clear', is_flag=True)
361+
def counters(interfacename, clear):
362+
"""Show queue counters"""
363+
364+
cmd = "queuestat"
365+
366+
if clear:
367+
cmd += " -c"
368+
else:
369+
if interfacename is not None:
370+
cmd += " -p {}".format(interfacename)
371+
372+
run_command(cmd)
326373

327374
#
328375
# 'mac' command ("show mac ...")

0 commit comments

Comments
 (0)