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

[201911] Multi asic show interface support #1070

Merged
merged 1 commit into from
Aug 27, 2020
Merged

Conversation

arlakshm
Copy link
Contributor

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan [email protected]

- What I did
Support the following commands for multi ASIC

  • show interface status
  • show interface description

2 new options have added

  • [-n, --namespace] to allow user to display the information for given namespaces
    If this option is not present the information from all the namespaces will be displayed

  • [-d, --display] to allow user to display information related both internal and external interfaces
    If this option is not present only external interfaces/neighbors will be display

One single ASIC platform, this options ignored, so the behavior remains unchanged

- How I did it

  • Add argparse intfutil script
  • Change the IntfDescription and IntfStatus classes to get the information from all namespaces.
  • Add changes to filter out the internal ports from display
  • Add support for -n and -d click options

- How to verify it
Help menu

root@sonic:/home/admin# show interface description -h
Usage: show interface description [OPTIONS] [INTERFACENAME]

  Show interface status, protocol and description

Options:
  -d, --display [all|frontend]    Show internal interfaces  [default:
                                  frontend]
  -n, --namespace [asic0|asic1|asic2|asic3|asic4|asic5]
                                  Namespace name or all
  --verbose                       Enable verbose output
  -?, -h, --help                  Show this message and exit.
root@sonic:/home/admin# show interface status -h
Usage: show interface status [OPTIONS] [INTERFACENAME]

  Show Interface status information

Options:
  -d, --display [all|frontend]    Show internal interfaces  [default:
                                  frontend]
  -n, --namespace [asic0|asic1|asic2|asic3|asic4|asic5]
                                  Namespace name or all
  --verbose                       Enable verbose output
  -?, -h, --help                  Show this message and exit.

Handling for invalid namespaces

root@sonic:/home/admin# show interface description -n asic -d all
Usage: show interface description [OPTIONS] [INTERFACENAME]

Error: Invalid value for "--namespace" / "-n": invalid choice: asic. (choose from asic0, asic1, asic2, asic3, asic4, asic5)

Sample output

root@sonic:/home/admin# show interface description -n asic0
  Interface    Oper    Admin         Alias               Description
-----------  ------  -------  ------------  ------------------------
  Ethernet0      up       up   Ethernet1/1  ARISTA01T2:Ethernet3/1/1
  Ethernet4      up       up   Ethernet1/2  ARISTA01T2:Ethernet3/2/1
  Ethernet8    down     down   Ethernet1/3               Ethernet1/3
 Ethernet12    down     down   Ethernet1/4               Ethernet1/4
 Ethernet16      up       up   Ethernet1/5  ARISTA03T2:Ethernet3/1/1
 Ethernet20      up       up   Ethernet1/6  ARISTA03T2:Ethernet3/2/1
 Ethernet24    down     down   Ethernet1/7               Ethernet1/7
 Ethernet28    down     down   Ethernet1/8               Ethernet1/8
 Ethernet32    down     down   Ethernet1/9               Ethernet1/9
 Ethernet36    down     down  Ethernet1/10              Ethernet1/10
 Ethernet40    down     down  Ethernet1/11              Ethernet1/11
 Ethernet44    down     down  Ethernet1/12              Ethernet1/12
 Ethernet48    down     down  Ethernet1/13              Ethernet1/13
 Ethernet52    down     down  Ethernet1/14              Ethernet1/14
 Ethernet56    down     down  Ethernet1/15              Ethernet1/15
 Ethernet60    down     down  Ethernet1/16              Ethernet1/16
root@sonic:/home/admin# show interface description -n asic0 -d all
    Interface    Oper    Admin          Alias               Description
-------------  ------  -------  -------------  ------------------------
    Ethernet0      up       up    Ethernet1/1  ARISTA01T2:Ethernet3/1/1
    Ethernet4      up       up    Ethernet1/2  ARISTA01T2:Ethernet3/2/1
    Ethernet8    down     down    Ethernet1/3               Ethernet1/3
   Ethernet12    down     down    Ethernet1/4               Ethernet1/4
   Ethernet16      up       up    Ethernet1/5  ARISTA03T2:Ethernet3/1/1
   Ethernet20      up       up    Ethernet1/6  ARISTA03T2:Ethernet3/2/1
   Ethernet24    down     down    Ethernet1/7               Ethernet1/7
   Ethernet28    down     down    Ethernet1/8               Ethernet1/8
   Ethernet32    down     down    Ethernet1/9               Ethernet1/9
   Ethernet36    down     down   Ethernet1/10              Ethernet1/10
   Ethernet40    down     down   Ethernet1/11              Ethernet1/11
   Ethernet44    down     down   Ethernet1/12              Ethernet1/12
   Ethernet48    down     down   Ethernet1/13              Ethernet1/13
   Ethernet52    down     down   Ethernet1/14              Ethernet1/14
   Ethernet56    down     down   Ethernet1/15              Ethernet1/15
   Ethernet60    down     down   Ethernet1/16              Ethernet1/16
 Ethernet-BP0      up       up   Ethernet-BP0          ASIC4:Eth0-ASIC4
 Ethernet-BP4      up       up   Ethernet-BP4          ASIC4:Eth1-ASIC4
 Ethernet-BP8      up       up   Ethernet-BP8          ASIC4:Eth2-ASIC4
Ethernet-BP12      up       up  Ethernet-BP12          ASIC4:Eth3-ASIC4
Ethernet-BP16      up       up  Ethernet-BP16          ASIC4:Eth4-ASIC4
Ethernet-BP20      up       up  Ethernet-BP20          ASIC4:Eth5-ASIC4
Ethernet-BP24      up       up  Ethernet-BP24          ASIC4:Eth6-ASIC4
Ethernet-BP28      up       up  Ethernet-BP28          ASIC4:Eth7-ASIC4
Ethernet-BP32      up       up  Ethernet-BP32          ASIC5:Eth0-ASIC5
Ethernet-BP36      up       up  Ethernet-BP36          ASIC5:Eth1-ASIC5
Ethernet-BP40      up       up  Ethernet-BP40          ASIC5:Eth2-ASIC5
Ethernet-BP44      up       up  Ethernet-BP44          ASIC5:Eth3-ASIC5
Ethernet-BP48      up       up  Ethernet-BP48          ASIC5:Eth4-ASIC5
Ethernet-BP52      up       up  Ethernet-BP52          ASIC5:Eth5-ASIC5
Ethernet-BP56      up       up  Ethernet-BP56          ASIC5:Eth6-ASIC5
Ethernet-BP60      up       up  Ethernet-BP60          ASIC5:Eth7-ASIC5

UT results

============================= test session starts ==============================
platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
rootdir: /sonic/src/sonic-utilities, inifile: pytest.ini
plugins: cov-2.4.0
collected 75 items

sonic-utilities-tests/acl_loader_test.py ....
sonic-utilities-tests/aclshow_test.py ..........
sonic-utilities-tests/drops_group_test.py .......
sonic-utilities-tests/feature_test.py .........
sonic-utilities-tests/filter_fdb_entries_test.py ..........
sonic-utilities-tests/intfstat_test.py ........
sonic-utilities-tests/intfutil_test.py ........
sonic-utilities-tests/multi_asic_intfutil_test.py .........
sonic-utilities-tests/port2alias_test.py ....
sonic-utilities-tests/psu_test.py ...
sonic-utilities-tests/sfp_test.py ...

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <[email protected]>
@arlakshm arlakshm requested review from jleveque and abdosi August 25, 2020 13:29
@lgtm-com
Copy link

lgtm-com bot commented Aug 25, 2020

This pull request introduces 3 alerts and fixes 3 when merging 71d2f48 into b0ac781 - view on LGTM.com

new alerts:

  • 1 for First parameter of a method is not named 'self'
  • 1 for Unused import
  • 1 for Variable defined multiple times

fixed alerts:

  • 2 for Unused local variable
  • 1 for Unused import

@arlakshm arlakshm merged commit df04a4d into 201911 Aug 27, 2020
@arlakshm arlakshm deleted the masic_intfutil_201911 branch August 27, 2020 22:13
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
Fix error when running 'show lldp table' or 'show lldp neighbor'
through SSH command. (sonic-net#1067)
[201911]: Multi asic show interface support (sonic-net#1070)
[counterpoll] Add new FC group for port buffer drop counters
(sonic-net#1024)
[201911] show interface portchannel support for Multi ASIC
(sonic-net#1071)
Fix a typo in mellanox_buffer_migrator (sonic-net#1090)
Fix pfcwd stats crash with invalid queue name (sonic-net#1077)
[PFCWD] Fix issue with "pfcwd show stats" command during SONiC init
(sonic-net#1018)
enable watchdog before running platform specific reboot plugin
(sonic-net#1037)
Add namespace of the process in the coredump filename. (sonic-net#1091)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant