From 2dc17968b6fa95289aa98fa30ff57eb87afaf231 Mon Sep 17 00:00:00 2001 From: wenyiz2021 <91497961+wenyiz2021@users.noreply.github.com> Date: Fri, 6 Jan 2023 15:24:02 -0800 Subject: [PATCH] [masic] 'show interfaces counters' reminds to use '-d all' option to check for internal links (#2466) Print reminder to check internal links on multi-asic platforms Signed-off-by: Wenyi Zhang --- scripts/portstat | 5 ++++- tests/conftest.py | 2 +- tests/portstat_test.py | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/scripts/portstat b/scripts/portstat index 3c3c5117f3..0e3b9c438c 100755 --- a/scripts/portstat +++ b/scripts/portstat @@ -337,6 +337,8 @@ class Portstat(object): print(table_as_json(table, header)) else: print(tabulate(table, header, tablefmt='simple', stralign='right')) + if multi_asic.is_multi_asic(): + print("\nReminder: Please execute 'show interface counters -d all' to include internal links\n") def cnstat_intf_diff_print(self, cnstat_new_dict, cnstat_old_dict, intf_list): """ @@ -553,7 +555,8 @@ class Portstat(object): print(table_as_json(table, header)) else: print(tabulate(table, header, tablefmt='simple', stralign='right')) - + if multi_asic.is_multi_asic(): + print("\nReminder: Please execute 'show interface counters -d all' to include internal links\n") def main(): parser = argparse.ArgumentParser(description='Display the ports state and counters', diff --git a/tests/conftest.py b/tests/conftest.py index f4c29f828b..96b80df3e1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -331,9 +331,9 @@ def setup_bgp_commands(): @pytest.fixture def setup_ip_route_commands(): import show.main as show - return show + @pytest.fixture def setup_fib_commands(): import show.main as show diff --git a/tests/portstat_test.py b/tests/portstat_test.py index 2a70d0befc..d418a16feb 100644 --- a/tests/portstat_test.py +++ b/tests/portstat_test.py @@ -75,6 +75,9 @@ --------- ------- ------- -------- --------- -------- -------- -------- ------- -------- --------- -------- -------- -------- Ethernet0 U 8 0.00 B/s 0.00% 10 100 N/A 10 0.00 B/s 0.00% N/A N/A N/A Ethernet4 U 4 0.00 B/s 0.00% 0 1,000 N/A 40 0.00 B/s 0.00% N/A N/A N/A + +Reminder: Please execute 'show interface counters -d all' to include internal links + """ multi_asic_all_intf_counters = """\ @@ -86,6 +89,9 @@ Ethernet-BP4 U 8 0.00 B/s 0.00% 0 1,000 N/A 80 0.00 B/s 0.00% N/A N/A N/A Ethernet-BP256 U 8 0.00 B/s 0.00% 10 100 N/A 10 0.00 B/s 0.00% N/A N/A N/A Ethernet-BP260 U 4 0.00 B/s 0.00% 0 1,000 N/A 40 0.00 B/s 0.00% N/A N/A N/A + +Reminder: Please execute 'show interface counters -d all' to include internal links + """ multi_asic_intf_counters_asic0 = """\ IFACE STATE RX_OK RX_BPS RX_UTIL RX_ERR RX_DRP RX_OVR TX_OK TX_BPS TX_UTIL TX_ERR TX_DRP TX_OVR @@ -94,6 +100,9 @@ Ethernet4 U 4 0.00 B/s 0.00% 0 1,000 N/A 40 0.00 B/s 0.00% N/A N/A N/A Ethernet-BP0 U 6 0.00 B/s 0.00% 0 1,000 N/A 60 0.00 B/s 0.00% N/A N/A N/A Ethernet-BP4 U 8 0.00 B/s 0.00% 0 1,000 N/A 80 0.00 B/s 0.00% N/A N/A N/A + +Reminder: Please execute 'show interface counters -d all' to include internal links + """ multi_asic_external_intf_counters_printall = """\ @@ -101,6 +110,9 @@ --------- ------- ------- -------- -------- --------- -------- -------- -------- ------- -------- -------- --------- -------- -------- -------- Ethernet0 U 8 0.00 B/s 0.00/s 0.00% 10 100 N/A 10 0.00 B/s 0.00/s 0.00% N/A N/A N/A Ethernet4 U 4 0.00 B/s 0.00/s 0.00% 0 1,000 N/A 40 0.00 B/s 0.00/s 0.00% N/A N/A N/A + +Reminder: Please execute 'show interface counters -d all' to include internal links + """ multi_asic_intf_counters_printall = """\ @@ -112,6 +124,9 @@ Ethernet-BP4 U 8 0.00 B/s 0.00/s 0.00% 0 1,000 N/A 80 0.00 B/s 0.00/s 0.00% N/A N/A N/A Ethernet-BP256 U 8 0.00 B/s 0.00/s 0.00% 10 100 N/A 10 0.00 B/s 0.00/s 0.00% N/A N/A N/A Ethernet-BP260 U 4 0.00 B/s 0.00/s 0.00% 0 1,000 N/A 40 0.00 B/s 0.00/s 0.00% N/A N/A N/A + +Reminder: Please execute 'show interface counters -d all' to include internal links + """ multi_asic_intf_counters_asic0_printall = """\ @@ -121,6 +136,9 @@ Ethernet4 U 4 0.00 B/s 0.00/s 0.00% 0 1,000 N/A 40 0.00 B/s 0.00/s 0.00% N/A N/A N/A Ethernet-BP0 U 6 0.00 B/s 0.00/s 0.00% 0 1,000 N/A 60 0.00 B/s 0.00/s 0.00% N/A N/A N/A Ethernet-BP4 U 8 0.00 B/s 0.00/s 0.00% 0 1,000 N/A 80 0.00 B/s 0.00/s 0.00% N/A N/A N/A + +Reminder: Please execute 'show interface counters -d all' to include internal links + """ multi_asic_intf_counters_period = """\ The rates are calculated within 3 seconds period @@ -128,6 +146,9 @@ --------- ------- ------- -------- --------- -------- -------- -------- ------- -------- --------- -------- -------- -------- Ethernet0 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A Ethernet4 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A + +Reminder: Please execute 'show interface counters -d all' to include internal links + """ multi_asic_intf_counters_period_all = """\ @@ -140,6 +161,9 @@ Ethernet-BP4 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A Ethernet-BP256 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A Ethernet-BP260 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A + +Reminder: Please execute 'show interface counters -d all' to include internal links + """ multi_asic_intf_counter_period_asic_all = """\ @@ -150,6 +174,9 @@ Ethernet4 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A Ethernet-BP0 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A Ethernet-BP4 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A + +Reminder: Please execute 'show interface counters -d all' to include internal links + """ mutli_asic_intf_counters_after_clear = """\ @@ -160,7 +187,11 @@ Ethernet-BP0 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A Ethernet-BP4 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A Ethernet-BP256 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A -Ethernet-BP260 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A""" +Ethernet-BP260 U 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A + +Reminder: Please execute 'show interface counters -d all' to include internal links +""" + intf_invalid_asic_error = """ValueError: Unknown Namespace asic99"""