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

High power class enabling for SFF-8636 modules #521

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

longhuan-cisco
Copy link
Contributor

@longhuan-cisco longhuan-cisco commented Dec 13, 2024

Description

Add platform common API support for enabling high power class if module's power class is greater or equal to 5 (Refer to SFF-8636 spec 6.2.6 Control Functions (Page 00h, Bytes 86-99) for byte 93 definition)

Motivation and Context

Without enabling high power class for those modules, the module won't operate properly with power output and link won't come up.

How Has This Been Tested?

Verified the module operate with proper power output.

Additional Information (Optional)

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@longhuan-cisco
Copy link
Contributor Author

/azp run

Copy link

Commenter does not have sufficient privileges for PR 521 in repo sonic-net/sonic-platform-common

@longhuan-cisco
Copy link
Contributor Author

/azpw run Azure.sonic-platform-common

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-platform-common

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mihirpat1
Copy link
Contributor

@longhuan-cisco Please help in fixing the built failure

@longhuan-cisco
Copy link
Contributor Author

/azpw run Azure.sonic-platform-common

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-platform-common

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@longhuan-cisco
Copy link
Contributor Author

@longhuan-cisco Please help in fixing the built failure

@mihirpat1 It was due to issue in CICD infra. Issue was gone after rerun.

@prgeor prgeor requested review from Copilot and mihirpat1 February 15, 2025 21:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment on lines +424 to +425
power_class = int(power_class_str[prefix_len:prefix_len + 1])

Copy link
Preview

Copilot AI Feb 15, 2025

Choose a reason for hiding this comment

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

The int conversion in get_power_class method does not handle potential ValueError if the substring is not a valid integer. Add a try-except block to handle the potential ValueError.

Suggested change
power_class = int(power_class_str[prefix_len:prefix_len + 1])
try:
power_class = int(power_class_str[prefix_len:prefix_len + 1])
except ValueError:
power_class = -1

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -12,6 +12,7 @@

class Sff8636Api(XcvrApi):
NUM_CHANNELS = 4
POWER_CLASS_PREFIX = "Power Class "
Copy link
Collaborator

Choose a reason for hiding this comment

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

@longhuan-cisco is the space at the end necessary?

@@ -637,3 +637,14 @@ def get_error_description(self):
"""
raise NotImplementedError

def set_high_power_class(self, enable):
Copy link
Contributor

Choose a reason for hiding this comment

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

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