Skip to content

Commit

Permalink
[masic] 'show interfaces counters' reminds to use '-d all' option to …
Browse files Browse the repository at this point in the history
…check for internal links (sonic-net#2466)

Print reminder to check internal links on multi-asic platforms
Signed-off-by: Wenyi Zhang <wenyizhang@microsoft.com>
  • Loading branch information
wenyiz2021 committed Feb 3, 2023
1 parent c60f771 commit 838d6a1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
5 changes: 4 additions & 1 deletion scripts/portstat
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,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):
"""
Expand Down Expand Up @@ -517,7 +519,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',
Expand Down
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,11 @@ 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
return show

33 changes: 32 additions & 1 deletion tests/portstat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,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 = """\
Expand All @@ -68,6 +71,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
Expand All @@ -76,13 +82,19 @@
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 = """\
IFACE STATE RX_OK RX_BPS RX_PPS RX_UTIL RX_ERR RX_DRP RX_OVR TX_OK TX_BPS TX_PPS TX_UTIL TX_ERR TX_DRP TX_OVR
--------- ------- ------- -------- -------- --------- -------- -------- -------- ------- -------- -------- --------- -------- -------- --------
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 = """\
Expand All @@ -94,6 +106,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 = """\
Expand All @@ -103,13 +118,19 @@
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
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
--------- ------- ------- -------- --------- -------- -------- -------- ------- -------- --------- -------- -------- --------
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 = """\
Expand All @@ -122,6 +143,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 = """\
Expand All @@ -132,6 +156,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 = """\
Expand All @@ -142,7 +169,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"""

Expand Down

0 comments on commit 838d6a1

Please sign in to comment.