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

show interface portchannel support for Multi ASIC #1005

Merged
merged 6 commits into from
Aug 24, 2020

Conversation

arlakshm
Copy link
Contributor

Add the multi ASIC specific options for the command show interface portchannel

Depends on the following PRs

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan arlakshm@microsoft.com

- What I did
Add support for multi ASIC CLI options for show interface portchannels
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 are not valid, so the behavior remains unchanged

- How I did it

  • Change the teamshow script to get the port channel information from all the Namespaces
  • Add support for -n and -d options
    This new options are ignored for single ASIC platforms

- How to verify it
Help menu on multi ASIC platforms


admin@sonic:~$ show interface portchannel -h
Usage: show interface portchannel [OPTIONS]

  Show PortChannel information

Options:
  -d, --display [all|frontend]    Show internal interfacees  [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.
admin@sonic:~$ 

Sample output for show interface portchannel

admin@sonic:~$ show interface portchannel 
Flags: A - active, I - inactive, Up - up, Dw - Down, N/A - not available,
       S - selected, D - deselected, * - not synced
  No.  Team Dev         Protocol     Ports
-----  ---------------  -----------  -----------------------------------------------------------------------------------------------------------------------------------------------
 1001  PortChannel1001  LACP(A)(Up)  Ethernet136(S)
 1002  PortChannel1002  LACP(A)(Up)  Ethernet0(S) Ethernet4(S)
 1003  PortChannel1003  LACP(A)(Up)  Ethernet144(S)
 1004  PortChannel1004  LACP(A)(Up)  Ethernet148(S)
 1005  PortChannel1005  LACP(A)(Up)  Ethernet20(S) Ethernet16(S)
 1006  PortChannel1006  LACP(A)(Up)  Ethernet152(S)
 1007  PortChannel1007  LACP(A)(Up)  Ethernet156(S)
 1008  PortChannel1008  LACP(A)(Up)  Ethernet64(S) Ethernet68(S)
 1009  PortChannel1009  LACP(A)(Up)  Ethernet168(S)
 1010  PortChannel1010  LACP(A)(Up)  Ethernet176(S)
 1011  PortChannel1011  LACP(A)(Up)  Ethernet80(S) Ethernet84(S)
 1012  PortChannel1012  LACP(A)(Up)  Ethernet180(S)
 1013  PortChannel1013  LACP(A)(Up)  Ethernet184(S)
 1014  PortChannel1014  LACP(A)(Up)  Ethernet188(S)
 1015  PortChannel1015  LACP(A)(Up)  Ethernet200(S)
 1016  PortChannel1016  LACP(A)(Up)  Ethernet208(S)
 1017  PortChannel1017  LACP(A)(Up)  Ethernet212(S)
 1018  PortChannel1018  LACP(A)(Up)  Ethernet216(S)
 1019  PortChannel1019  LACP(A)(Up)  Ethernet220(S)
 1020  PortChannel1020  LACP(A)(Up)  Ethernet232(S)
 1021  PortChannel1021  LACP(A)(Up)  Ethernet240(S)
 1022  PortChannel1022  LACP(A)(Up)  Ethernet244(S)
 1023  PortChannel1023  LACP(A)(Up)  Ethernet248(S)
 1024  PortChannel1024  LACP(A)(Up)  Ethernet252(S)

**Sample output for single ASIC **

admin@sonic:~$ show interface portchannel -n asic0
Flags: A - active, I - inactive, Up - up, Dw - Down, N/A - not available,
       S - selected, D - deselected, * - not synced
  No.  Team Dev         Protocol     Ports
-----  ---------------  -----------  ---------------------------
 1002  PortChannel1002  LACP(A)(Up)  Ethernet0(S) Ethernet4(S)
 1005  PortChannel1005  LACP(A)(Up)  Ethernet20(S) Ethernet16(S)

admin@sonic:~$ show interface portchannel -n asic0 -d all
Flags: A - active, I - inactive, Up - up, Dw - Down, N/A - not available,
       S - selected, D - deselected, * - not synced
  No.  Team Dev         Protocol     Ports
-----  ---------------  -----------  ---------------------------------------------------------------------------------------------------------------------------------------
 1002  PortChannel1002  LACP(A)(Up)  Ethernet0(S) Ethernet4(S)
 1005  PortChannel1005  LACP(A)(Up)  Ethernet20(S) Ethernet16(S)
 4001  PortChannel4001  LACP(A)(Up)  Ethernet-BP4(S) Ethernet-BP16(S) Ethernet-BP20(S) Ethernet-BP12(S) Ethernet-BP24(S) Ethernet-BP0(S) Ethernet-BP28(S) Ethernet-BP8(S)
 4002  PortChannel4002  LACP(A)(Up)  Ethernet-BP48(S) Ethernet-BP60(S) Ethernet-BP52(S) Ethernet-BP40(S) Ethernet-BP36(S) Ethernet-BP56(S) Ethernet-BP44(S) Ethernet-BP32(S)

- 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 <arlakshm@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Jul 24, 2020

This pull request introduces 1 alert when merging e71321f into aa1b072 - view on LGTM.com

new alerts:

  • 1 for Unused import

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
@jleveque
Copy link
Contributor

jleveque commented Jul 30, 2020

show/main.py Outdated
@@ -1116,10 +1117,15 @@ def rif(interface, period, verbose):

# 'portchannel' subcommand ("show interfaces portchannel")
@interfaces.command()
@multi_asic_click_options
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the config commands I add the namespace option at the command group level ( i.e if you take this example ..it will be like show interfaces -n asic0 portchannel/counters ) instead of specifying the options after the subcommand keyword viz portchannel, counters etc ..

I was looking to see if both the show and config commands follow similar approach .. @arlakshm @jleveque your thoughts ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@judyjoseph. IMO the CLI syntax is cleaner if we have the keywords first then followed by options/arguments.

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Aug 18, 2020

This pull request introduces 2 alerts when merging a942c4b into 8768580 - view on LGTM.com

new alerts:

  • 2 for Unused import

@lguohan
Copy link
Contributor

lguohan commented Aug 21, 2020

please pass the test

@click.option('--verbose', is_flag=True, help="Enable verbose output")
@clicommon.pass_db
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this removed? this can break the unit test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With multi asic support, Teamshow will connect to DBs in each namespace or default namespace. No need to pass the db. Unit test will work with the changes done to support multi asic CLIs

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Aug 21, 2020

This pull request introduces 2 alerts when merging 0eaaa72 into 2c0ff92 - view on LGTM.com

new alerts:

  • 2 for Unused import

@arlakshm
Copy link
Contributor Author

please pass the test

@lguohan, tests are passing now. There was dependency with PR #1006 for Unit tests to work.
Logs

[2020-08-21T16:11:55.162Z] ============================= test session starts ==============================
[2020-08-21T16:11:55.162Z] platform linux2 -- Python 2.7.16, pytest-3.10.1, py-1.7.0, pluggy-0.8.0
[2020-08-21T16:11:55.162Z] rootdir: /sonic/sonic-utilities, inifile: pytest.ini
[2020-08-21T16:11:55.162Z] plugins: cov-2.6.0
[2020-08-21T16:11:56.107Z] collected 138 items
[2020-08-21T16:11:56.107Z] 
[2020-08-21T16:11:56.626Z] tests/acl_loader_test.py ....                                            [  2%]
[2020-08-21T16:11:56.886Z] tests/aclshow_test.py ...........                                        [ 10%]
[2020-08-21T16:11:57.152Z] tests/config_mgmt_test.py ....                                           [ 13%]
[2020-08-21T16:11:57.412Z] tests/config_test.py ..                                                  [ 15%]
[2020-08-21T16:12:01.088Z] tests/drops_group_test.py .......                                        [ 20%]
[2020-08-21T16:12:01.347Z] tests/feature_test.py ..........                                         [ 27%]
[2020-08-21T16:12:01.347Z] tests/filter_fdb_entries_test.py ..........                              [ 34%]
[2020-08-21T16:12:02.482Z] tests/gearbox_test.py ..                                                 [ 36%]
[2020-08-21T16:12:02.998Z] tests/interfaces_test.py .............                                   [ 45%]
[2020-08-21T16:12:14.691Z] tests/intfstat_test.py ........                                          [ 51%]
[2020-08-21T16:12:23.281Z] tests/intfutil_test.py ...............                                   [ 62%]
[2020-08-21T16:12:27.836Z] tests/multi_asic_intfutil_test.py .........                              [ 68%]
[2020-08-21T16:12:27.836Z] tests/port2alias_test.py ....                                            [ 71%]
[2020-08-21T16:12:28.935Z] tests/psu_test.py ...                                                    [ 73%]
[2020-08-21T16:12:29.194Z] tests/sflow_test.py ..                                                   [ 75%]
[2020-08-21T16:12:31.468Z] tests/sfp_test.py ...                                                    [ 77%]
[2020-08-21T16:12:31.468Z] tests/show_breakout_test.py ..                                           [ 78%]
[2020-08-21T16:12:31.468Z] tests/show_platform_test.py .                                            [ 79%]
[2020-08-21T16:12:36.390Z] tests/vlan_test.py ............................                          [100%]

@arlakshm arlakshm requested a review from lguohan August 21, 2020 16:18
Copy link
Contributor

@lguohan lguohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve with caveats. we need to allow to pass db into the commands for unit tests

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.

4 participants