-
Notifications
You must be signed in to change notification settings - Fork 664
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
Fix issue: port_type is referenced before initialized #2323
Fix issue: port_type is referenced before initialized #2323
Conversation
Signed-off-by: Stephen Sun <stephens@nvidia.com>
This may not a right fix. One of the real issue is the function call doesn't handle the internal port correctly. Role such as: Int, Inb and Rec. On a platform with those ports. The following is the output:
|
@mlok-nokia have you taken in both fixes in #2313 & #2323. I see the o/p correct without the "Invalid port" messages |
I did. I used the file from the latest master branch. The print out of "Invalid port" is in the function "logical_port_name_to_physical_port_list()" which is expected to display this line before the exception happened for internal port name. |
I think we should import and add the following line before the "porttype = None": |
ok. thanks. is there any other case that can fail |
Maybe we can use this logic to cover more possible failure scenarios and be scalable for further extension.
|
fix: #2327 |
Here is my suggestion -- As what I understand, "Port-Name" should be all names which are defined in the port_config.ini. It should not contain "vlan", "PortChhannel" --- these type of interfaces. Most of the places use the following logic to check if the port_name is a internal interface or not. I think that using the same logic and convention is easy to be maintained and enhanced. In the future, if there is a new type of internal inter face is created, we can grep these functions and add the new type.
|
Also, there is another issue I am not sure if it is related to this change. When issue the CLI command "show interface status" on a multi-asic platform (2 asics), the following error has been logged twice. If it is expected, it should not be logged as Error. Otherwise, the OC test case will fail on the LogAnalyzer.
|
The logic of identifying the ports are already present here https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_sfp/sfputilhelper.py#L75. I didn't notice that this function "logical_port_name_to_physical_port_list()" was a local function. My thought would be not to duplicate logic, instead just reuse the platform_sfputil.get_logical_to_physical(port_name) call itself in the try block which will fix everything. @mlok-nokia @stephenxs any thoughts
|
Completely agree that we should not duplicate the logic. Let me check a bit more and get back to you. |
It doesn't look relevant to this change.
and exposed to python via
which is called from
it will always check before calling it so it should not run into error if it is called from this func. |
Signed-off-by: Stephen Sun <stephens@nvidia.com>
Signed-off-by: Stephen Sun <stephens@nvidia.com>
Signed-off-by: Stephen Sun stephens@nvidia.com
What I did
Followup fixes : #2312
How I did it
How to verify it
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)