Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cherry pick to 202012] 'show int counters' reminds to add '-n' option for masics #2648

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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