Skip to content

Commit 2a6a06c

Browse files
authored
[portstat CLI] don't print reminder if use json format (sonic-net#2670)
* no print if use json format * add print for chassis
1 parent ee6d213 commit 2a6a06c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/portstat

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ from collections import OrderedDict, namedtuple
1717
from natsort import natsorted
1818
from tabulate import tabulate
1919
from sonic_py_common import multi_asic
20+
from sonic_py_common import device_info
2021

2122
# mock the redis for unit test purposes #
2223
try:
@@ -337,8 +338,8 @@ class Portstat(object):
337338
print(table_as_json(table, header))
338339
else:
339340
print(tabulate(table, header, tablefmt='simple', stralign='right'))
340-
if multi_asic.is_multi_asic():
341-
print("\nReminder: Please execute 'show interface counters -d all' to include internal links\n")
341+
if multi_asic.is_multi_asic() or device_info.is_chassis():
342+
print("\nReminder: Please execute 'show interface counters -d all' to include internal links\n")
342343

343344
def cnstat_intf_diff_print(self, cnstat_new_dict, cnstat_old_dict, intf_list):
344345
"""
@@ -555,8 +556,8 @@ class Portstat(object):
555556
print(table_as_json(table, header))
556557
else:
557558
print(tabulate(table, header, tablefmt='simple', stralign='right'))
558-
if multi_asic.is_multi_asic():
559-
print("\nReminder: Please execute 'show interface counters -d all' to include internal links\n")
559+
if multi_asic.is_multi_asic() or device_info.is_chassis():
560+
print("\nReminder: Please execute 'show interface counters -d all' to include internal links\n")
560561

561562
def main():
562563
parser = argparse.ArgumentParser(description='Display the ports state and counters',

0 commit comments

Comments
 (0)