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

[Credo][Ycable] Fix for displaying 'N/A' firmware version when NIC endpoint is power off #366

Merged
merged 4 commits into from
Sep 20, 2023

Conversation

xinyulin
Copy link
Contributor

@xinyulin xinyulin commented Apr 25, 2023

Description

This fix resolve the issue of being unable to obtain the firmware version of the self-side when the NIC end is power off.

Motivation and Context

To report the self-side firmware version for maintenance and trouble shooting.

How Has This Been Tested?

Tested on Arista-7050CX3

The original version will show 'N/A' for all endpoints If the NIC endpoint is turned off,
image

After applying the fix, the self-tor version can be displayed correctly.
image

Additional Information (Optional)

…are version of the self-side when the NIC end is power off

Signed-off-by: Xinyu <xinyu0123@gmail.com>
@prgeor
Copy link
Collaborator

prgeor commented Apr 25, 2023

@xinyulin can you paste the CLI output with this fix

prgeor
prgeor previously approved these changes Apr 25, 2023
@prgeor prgeor added the Y-Cable label Apr 25, 2023
@xinyulin
Copy link
Contributor Author

@xinyulin can you paste the CLI output with this fix

Sure!, added in the description.

self.log_error('Get firmware version error (error code:0x%04X)' % (status))
return None
''' should at least return local side fw version if nic is offline'''
if status == 0x1A and ((read_side[0] == 4 and target == 1) or (read_side[0] == 2 and target == 2)):
Copy link
Contributor

Choose a reason for hiding this comment

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

can the read_side byr array be empty ?
if yes we could be causing exception here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'd better to call get_read_side() to handle all the exceptions. I will submit a commit to fix it, thanks!

Signed-off-by: Xinyu <xinyu0123@gmail.com>
@vdahiya12
Copy link
Contributor

LGTM,
I have a generic feedback to have this suggestion for accessing byte_array/dict etc. to be error checked before accessing, on the entire module.
Please let me know if you want more info on this.

self.log_error('Get firmware version error (error code:0x%04X)' % (status))
return None
''' should at least return local side fw version if nic is offline'''
if status == 0x1A and (read_side == target):
Copy link
Collaborator

Choose a reason for hiding this comment

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

@xinyulin 0x1A can you name this status value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I made the correction in the last commit. Please review it.

… for readability

Signed-off-by: Xinyu <xinyu0123@gmail.com>
@prgeor prgeor merged commit 3d3bc1a into sonic-net:master Sep 20, 2023
5 checks passed
StormLiangMS pushed a commit that referenced this pull request Sep 21, 2023
…dpoint is power off (#366)

* [Credo][Ycable] Resolve the issue of being unable to obtain the firmware version of the self-side when the NIC end is power off

Signed-off-by: Xinyu <xinyu0123@gmail.com>

* [Credo][Ycable] call get_read_side() to handle exceptions

Signed-off-by: Xinyu <xinyu0123@gmail.com>

* [Credo][Ycable] Replace the hard-coded value with a constant variable for readability

Signed-off-by: Xinyu <xinyu0123@gmail.com>

---------

Signed-off-by: Xinyu <xinyu0123@gmail.com>
Co-authored-by: Prince George <45705344+prgeor@users.noreply.github.com>
mssonicbld pushed a commit to mssonicbld/sonic-platform-common that referenced this pull request Jan 25, 2024
…dpoint is power off (sonic-net#366)

* [Credo][Ycable] Resolve the issue of being unable to obtain the firmware version of the self-side when the NIC end is power off

Signed-off-by: Xinyu <xinyu0123@gmail.com>

* [Credo][Ycable] call get_read_side() to handle exceptions

Signed-off-by: Xinyu <xinyu0123@gmail.com>

* [Credo][Ycable] Replace the hard-coded value with a constant variable for readability

Signed-off-by: Xinyu <xinyu0123@gmail.com>

---------

Signed-off-by: Xinyu <xinyu0123@gmail.com>
Co-authored-by: Prince George <45705344+prgeor@users.noreply.github.com>
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202205: #430

mssonicbld pushed a commit that referenced this pull request Jan 25, 2024
…dpoint is power off (#366)

* [Credo][Ycable] Resolve the issue of being unable to obtain the firmware version of the self-side when the NIC end is power off

Signed-off-by: Xinyu <xinyu0123@gmail.com>

* [Credo][Ycable] call get_read_side() to handle exceptions

Signed-off-by: Xinyu <xinyu0123@gmail.com>

* [Credo][Ycable] Replace the hard-coded value with a constant variable for readability

Signed-off-by: Xinyu <xinyu0123@gmail.com>

---------

Signed-off-by: Xinyu <xinyu0123@gmail.com>
Co-authored-by: Prince George <45705344+prgeor@users.noreply.github.com>
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.

6 participants