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

Fetch firmware versions for Cmis Target FW upgrade supported cables #455

Merged
merged 4 commits into from
Apr 25, 2024

Conversation

mihirpat1
Copy link
Contributor

@mihirpat1 mihirpat1 commented Apr 18, 2024

Description

With onboarding of CMIS target firmware upgrade supported transceivers, we need a mechanism to store the firmware version of E1 and E2 targets (in addition to E0 target) in redis-db. The current change set is for accomplishing this task.
XCVRD will be able to push the target firmware version information to TRANSCEIVER_FIRMWARE_INFO table of STATE_DB.

MSFT ADO - 26565884

Motivation and Context

This change is required to periodically read target firmware versions and store it in TRANSCEIVER_FIRMWARE_INFO table of STATE_DB.

How Has This Been Tested?

Following scenarios were tested

1.1 CLI output on transceiver not supporting Target FW upgrade
1.2 XCVR on target 1 removed
1.3 XCVR on target 2 removed
1.4 All targets having different inactive firmware versions
1.5 CLI output on transceiver not supporting Target FW upgrade
1.6 CLI on port with DOM disabled

Additional Information (Optional)

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
@prgeor
Copy link
Collaborator

prgeor commented Apr 22, 2024

@mihirpat1 type in PR description -> "E1 and E1 targets "

@@ -75,8 +75,8 @@ def get_transceiver_info_firmware_versions(self):
Retrieves active and inactive firmware versions of the xcvr

Returns:
A list with active and inactive firmware versions of the xcvr
[active_firmware, inactive_firmware]
A dictionary containing the active and inactive firmware versions of the transceiver
Copy link
Collaborator

Choose a reason for hiding this comment

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

@AnoopKamath please note this change for your PR...

Copy link
Contributor

Choose a reason for hiding this comment

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

Ack. Thanks @prgeor


TARGET_LIST = [TARGET_E0_VALUE, TARGET_E1_VALUE, TARGET_E2_VALUE]

AEC_E1_FIRMWARE_INFO_MAP = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mihirpat1 rename AEC -> CABLE?

'server_firmware': 'e1_server_firmware'
}

AEC_E2_FIRMWARE_INFO_MAP = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mihirpat1 rename AEC -> CABLE?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@prgeor I have addressed this now.

Returns:
A dictionary of the firmware versions for all targets.
"""
def get_transceiver_info_firmware_versions(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mihirpat1 is this going to be called for cmis optics not supporting remote end fw upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@prgeor No, this implementation will be invoked only for CMIS optics supporting remote end FW upgrade.

Comment on lines 134 to 141
server_fw_version_str = ''
for i in range(0, SERVER_FW_VERSION_SIZE, SERVER_FW_VERSION_NUMBER_SIZE):
server_fw_version_number = bytes(server_fw_version_byte_array[i:i+SERVER_FW_VERSION_NUMBER_SIZE])
# Each number of the server firmware version is 4 bytes and is stored in big endian format.
# Convert the 4 bytes to a number and then convert the number to a string.
server_fw_version_str += str(struct.unpack('>I', server_fw_version_number)[0]) + '.'
server_fw_version_str = server_fw_version_str[:-1]
return_dict['server_firmware'] = server_fw_version_str
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mihirpat1 can we encapsulate this calculation in server version memmap?

Copy link
Collaborator

Choose a reason for hiding this comment

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

For eg. you can check the implementation of DateField field in xcvrd_field.py which return the date in string format.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@prgeor I have addressed this now.

@prgeor prgeor merged commit 4163365 into sonic-net:master Apr 25, 2024
5 checks passed
@mihirpat1
Copy link
Contributor Author

@StormLiangMS @yxieca Can you please help in merging this to 202305 and 202311?
MSFT ADO - 26565884

mssonicbld pushed a commit to mssonicbld/sonic-platform-common that referenced this pull request Apr 26, 2024
…onic-net#455)

* Fetch firmware versions for Cmis Target FW upgrade supported cables

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* Enhanced unit-test for exception handling while reading target firmware version

* Addressed PR comments and moved server firmware version info to xcvr_field

---------

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202311: #459

mssonicbld pushed a commit that referenced this pull request Apr 26, 2024
…455)

* Fetch firmware versions for Cmis Target FW upgrade supported cables

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* Enhanced unit-test for exception handling while reading target firmware version

* Addressed PR comments and moved server firmware version info to xcvr_field

---------

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
mssonicbld pushed a commit to mssonicbld/sonic-platform-common that referenced this pull request May 4, 2024
…onic-net#455)

* Fetch firmware versions for Cmis Target FW upgrade supported cables

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* Enhanced unit-test for exception handling while reading target firmware version

* Addressed PR comments and moved server firmware version info to xcvr_field

---------

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #464

mssonicbld pushed a commit that referenced this pull request May 4, 2024
…455)

* Fetch firmware versions for Cmis Target FW upgrade supported cables

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* Enhanced unit-test for exception handling while reading target firmware version

* Addressed PR comments and moved server firmware version info to xcvr_field

---------

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-platform-common that referenced this pull request Oct 25, 2024
Ignore processing the front panel ports in xcvrd. This include ports with suffixes other than Ethernet and ports that have role field set to any value other than Ext.

Signed-off-by: Vivek Reddy <vkarri@nvidia.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