Skip to content

Changes to make lldp show command for multi-npu platforms.#914

Merged
abdosi merged 5 commits intosonic-net:masterfrom
abdosi:master_lldp
May 29, 2020
Merged

Changes to make lldp show command for multi-npu platforms.#914
abdosi merged 5 commits intosonic-net:masterfrom
abdosi:master_lldp

Conversation

@abdosi
Copy link
Copy Markdown
Contributor

@abdosi abdosi commented May 13, 2020

- What I did
Enhanced below command to work for multi-npu platforms:-
show lldp table
show lldp neighbours [INTERFACE]

In the O/P we will filter out the LLDP information of Back plane Port/asic

Both this command are now wrapper of script/lldpshow which is now enhanced as below

usage: lldpshow [-h] [-v] [-d] [-p PORT]

Display the LLDP neighbors

optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-d, --detail LLDP neighbors detail information
-p PORT, --port PORT LLDP neighbors detail information for given port

                                  Examples:
                                  lldpshow
                                  lldpshow -d
                                  lldpshow -d -p Ethernet0

- How I did it
Updating script/lldpshow and using it
- How to verify it
Verified on both Single and Multi-NPU platforms
- Previous command output (if the output of a command-line utility has changed)
No change in O/P

We will display only front-panel port information.
@abdosi abdosi marked this pull request as ready for review May 13, 2020 23:41
@abdosi abdosi requested a review from jleveque May 13, 2020 23:41
@abdosi abdosi requested a review from lguohan May 14, 2020 17:54
@abdosi
Copy link
Copy Markdown
Contributor Author

abdosi commented May 15, 2020

retest this please

@abdosi
Copy link
Copy Markdown
Contributor Author

abdosi commented May 20, 2020

@jleveque @lguohan Can you please review this.

@abdosi
Copy link
Copy Markdown
Contributor Author

abdosi commented May 22, 2020

@jleveque can you please review this.

Copy link
Copy Markdown
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

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

As comments. Also I notice this file uses "NPU" and "ASIC" interchangeably. As I have mentioned before, I think we need to unify this terminology. I have created an issue to track this: #922

@abdosi
Copy link
Copy Markdown
Contributor Author

abdosi commented May 22, 2020

As comments. Also I notice this file uses "NPU" and "ASIC" interchangeably. As I have mentioned before, I think we need to unify this terminology. I have created an issue to track this: #922

@jleveque In this file made everything as ASIC

@jleveque
Copy link
Copy Markdown
Contributor

As comments. Also I notice this file uses "NPU" and "ASIC" interchangeably. As I have mentioned before, I think we need to unify this terminology. I have created an issue to track this: #922

@jleveque In this file made everything as ASIC

@abdosi: I believe you mean you changed all references to "NPU", not "ASIC".

scripts/lldpshow Outdated
Copy link
Copy Markdown
Contributor

@jleveque jleveque May 22, 2020

Choose a reason for hiding this comment

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

Why is NPU namespace also an empty string? I thought that was reserved for the host namespace.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jleveque This is just initial/default value to start with. The Interface list will get appended in the loop for asic namespace. We start with '' and then append to it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm confused as to why the host namespace is the "default" in the NPU namespace. Maybe the naming is unclear?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jleveque for LLDP we have instance in both host (for eth0) and per asic (for physical ports) namespace.

For host namespace using macro LLDP_INSTANCE_IN_HOST_NAMESPACE and LLDP_INTERFACE_LIST_IN_HOST_NAMESPACE.

For per asic namespace using macro LLDP_DEFAULT_INTERFACE_LIST_IN_ASIC_NAMESPACE which is just init value and the interface list gets populated in the loop.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jleveque did I clarify your above concern ? let me know

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess I'm still confused. So the empty string here does not denote the namespace, but rather denotes an interface name? Why do we need to populate an empty interface name here?

Copy link
Copy Markdown
Contributor Author

@abdosi abdosi May 26, 2020

Choose a reason for hiding this comment

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

@jleveque Yes, We have empty string for both namespace and interface-list for host.

Empty interface-list is to keep logic generic since for host lldp docker as we do not filter of any interface and the command will be just 'lldpctl' + < Empty string >.
In case user has passed specific interface (-p option) command will be 'lldpctl' + < Interface-Num>.

For asic namespace we filter out Backplane interface (Ethernet-BP) and command will be 'lldpctl' + < Front Interface list >
or in case user has passed interface (-p option) command will be 'lldpctl' + < Interface-Num>.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. Thanks for the explanation. I guess it might just be the similarity of the constant names that is throwing me off here. I'd also like to get Pavel's input here, who is more of a SME on LLDP.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jleveque can you please approve this. pavel has approved it.

@abdosi
Copy link
Copy Markdown
Contributor Author

abdosi commented May 23, 2020

As comments. Also I notice this file uses "NPU" and "ASIC" interchangeably. As I have mentioned before, I think we need to unify this terminology. I have created an issue to track this: #922

@jleveque In this file made everything as ASIC

@abdosi: I believe you mean you changed all references to "NPU", not "ASIC".

@jleveque I think git had some issue with file update . It is "ASIC" since in minigraph we have ASIC already and we can not change that. Going foward as part of Issue #922 we will make NPU as ASIC

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented May 23, 2020

This pull request introduces 1 alert when merging 2dd8bb7 into 221b593 - view on LGTM.com

new alerts:

  • 1 for Syntax error

@jleveque jleveque requested a review from pavel-shirshov May 26, 2020 19:11
Copy link
Copy Markdown
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

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

As comment

scripts/lldpshow Outdated
lldp_port = args.port

if lldp_port and not lldp_detail_info:
parser.error('-d is required when -p is set.')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do we need this? Can we set -d automatically when -p?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@pavel-shirshov yes that is fine too. Updated accordingly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@pavel-shirshov can you please review/approve the PR. Above comment has been addressed.

@abdosi abdosi merged commit 811a4c6 into sonic-net:master May 29, 2020
@abdosi abdosi deleted the master_lldp branch May 29, 2020 20:06
abdosi added a commit that referenced this pull request Jun 3, 2020
* Changes to make lldp show command for multi-npu platforms.
We will display only front-panel port information.

* Address Review Comments.

* Added Comment

* Fix LGTM error

* Address Review Comments
abdosi added a commit to abdosi/sonic-utilities that referenced this pull request Aug 4, 2020
…#914)

* Changes to make lldp show command for multi-npu platforms.
We will display only front-panel port information.

* Address Review Comments.

* Added Comment

* Fix LGTM error

* Address Review Comments
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
Make sure db_migrator is run after all config are loaded during (sonic-net#926)
Vnet alias mapping (sonic-net#924)
Changes to make lldp show command for multi-npu platforms. (sonic-net#914)
[Mellanox] Fix thermal control issue: use natural sort for fan
status and thermal status (sonic-net#836)
[Mellanox] add document for thermal control related cli (sonic-net#832)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants