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 (#2466)

Print reminder to check internal links on multi-asic platforms
Signed-off-by: Wenyi Zhang <[email protected]>
  • Loading branch information
wenyiz2021 authored and StormLiangMS committed Feb 10, 2023
1 parent 15026e1 commit 28f6b12
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
5 changes: 4 additions & 1 deletion scripts/portstat
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,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
Expand Down
33 changes: 32 additions & 1 deletion tests/portstat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """\
Expand All @@ -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
Expand All @@ -94,13 +100,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 @@ -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 = """\
Expand All @@ -121,13 +136,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 @@ -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 = """\
Expand 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 = """\
Expand All @@ -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"""

Expand Down

0 comments on commit 28f6b12

Please sign in to comment.