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

[masic] 'show interfaces counters' reminds to use '-d all' option to check for internal links #2466

Merged
merged 44 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9213252
'show interfaces counters' on multi-asci platforms by default show ex…
wenyiz2021 Oct 31, 2022
0ac1563
Update cli.py
wenyiz2021 Oct 31, 2022
f45a60b
fix semgrep -- exit from process
wenyiz2021 Oct 31, 2022
f738b2f
remove masic_run_command_int_ext_and_alert
wenyiz2021 Nov 1, 2022
ee01dcb
add reminder
wenyiz2021 Nov 1, 2022
d175262
remove calling masic_run_command_int_ext_and_alert
wenyiz2021 Nov 1, 2022
d29c6da
Update __init__.py
wenyiz2021 Nov 3, 2022
0a5c728
remove spaces
wenyiz2021 Nov 3, 2022
9b8e8b2
change prints before output
wenyiz2021 Nov 8, 2022
6b8d639
Merge branch 'sonic-net:master' into show_int_counters
wenyiz2021 Nov 8, 2022
de68e95
unit tests
wenyiz2021 Nov 8, 2022
034f6e4
add line
wenyiz2021 Nov 8, 2022
063acb4
change unit test to run CLI
wenyiz2021 Nov 8, 2022
88442c5
add fixture setup_interf_counters_commands
wenyiz2021 Nov 8, 2022
58cc31a
Update portstat_test.py
wenyiz2021 Nov 8, 2022
74f3665
Update portstat_test.py
wenyiz2021 Nov 8, 2022
e472894
Delete conftest.py
wenyiz2021 Nov 8, 2022
ffc085e
Update portstat_test.py
wenyiz2021 Nov 8, 2022
e3a4efb
Revert "Delete conftest.py"
wenyiz2021 Nov 8, 2022
b8d1846
refine unit test
wenyiz2021 Nov 15, 2022
9d6cc99
add teardown
wenyiz2021 Nov 15, 2022
ffb3569
separate class TestShowIntCountersMasic
wenyiz2021 Nov 15, 2022
14a0438
Update conftest.py
wenyiz2021 Nov 16, 2022
f0c9b93
move print to end
wenyiz2021 Dec 1, 2022
8df1ebe
Update portstat_test.py
wenyiz2021 Dec 1, 2022
074dea8
Update portstat_test.py
wenyiz2021 Dec 2, 2022
b0d0209
reuse existing class
wenyiz2021 Dec 2, 2022
4568210
remove new class
wenyiz2021 Dec 2, 2022
480ce00
Update portstat_test.py
wenyiz2021 Dec 2, 2022
c0e2954
use new masic class
wenyiz2021 Dec 2, 2022
d7a9e72
Update portstat_test.py
wenyiz2021 Dec 2, 2022
1b47b34
Update portstat_test.py
wenyiz2021 Dec 2, 2022
062c16e
Update portstat_test.py
wenyiz2021 Dec 2, 2022
c63dde3
Update portstat_test.py
wenyiz2021 Dec 2, 2022
9a0c2cf
Update portstat_test.py
wenyiz2021 Dec 3, 2022
4d126ef
delete change in show/interfaces/__init__.py
wenyiz2021 Jan 6, 2023
87b35de
remove line
wenyiz2021 Jan 6, 2023
54d0f62
Update portstat
wenyiz2021 Jan 6, 2023
9657a06
Update portstat_test.py
wenyiz2021 Jan 6, 2023
20635d7
add empty lines
wenyiz2021 Jan 6, 2023
492b0ed
remove outdated line
wenyiz2021 Jan 6, 2023
ef188f9
add print for -p option too
wenyiz2021 Jan 6, 2023
aeb925a
Update portstat_test.py
wenyiz2021 Jan 6, 2023
c56017c
syntax fix
wenyiz2021 Jan 6, 2023
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 @@ -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")
wenyiz2021 marked this conversation as resolved.
Show resolved Hide resolved

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 @@ -310,9 +310,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