Skip to content

Fix issue: should always check return value of a function if the function may return None (#350) Fix unit test failure Conflicts: tests/sonic_xcvr/test_sff8436.py tests/sonic_xcvr/test_sff8636.py#22

Closed
Junchao-Mellanox wants to merge 29 commits intomasterfrom
backport-pr-350-202205
Closed

Fix issue: should always check return value of a function if the function may return None (#350) Fix unit test failure Conflicts: tests/sonic_xcvr/test_sff8436.py tests/sonic_xcvr/test_sff8636.py#22
Junchao-Mellanox wants to merge 29 commits intomasterfrom
backport-pr-350-202205

Conversation

@Junchao-Mellanox
Copy link
Owner

Description

Motivation and Context

How Has This Been Tested?

Additional Information (Optional)

mlok-nokia and others added 29 commits July 5, 2022 16:19
* Support get_port_or_cage_type

The API returns the masks of all types of port or cage that can be supported on the port
All the types are defined in sfp_base.SfpBase

Signed-off-by: Stephen Sun <stephens@nvidia.com>

* Add comments to explain the types

Signed-off-by: Stephen Sun <stephens@nvidia.com>
* catch Exception to avoid CMIS code crash

Signed-off-by: Kebo Liu <kebol@nvidia.com>

* fix review comments, add more UT test

Signed-off-by: Kebo Liu <kebol@nvidia.com>

Signed-off-by: Kebo Liu <kebol@nvidia.com>
…PROM is not ready (sonic-net#305)

* get_transceiver_info should return None when cmis cable eeprom is not ready

Signed-off-by: Kebo Liu <kebol@nvidia.com>

* Add more comments to describe the change

Signed-off-by: Kebo Liu <kebol@nvidia.com>

Signed-off-by: Kebo Liu <kebol@nvidia.com>
…nic-net#311)

this PR removes some of the toggle synchronization logic for SONiC telemetry, since SONiC telemetry table MUX_CABLE_INFO is anyways disabled/enabled using CLI
config muxcable telemetry enable/disable, it is redundant to have this logic embedded in ycabled and port_instance helper objects, which could be unneccessary

Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: maipbui <maibui@microsoft.com>

Signed-off-by: maipbui <maibui@microsoft.com>
* read CMIS data path state duration

* 1. Add code coverage
2. reorder entries in regGroupField
…onic-net#316)

- Description
Catch both TypeError and AttributeError in CmisApi::get_application_advertisement because an AttributeError will be thrown when updating a dict with None.

- Motivation and Context
Fix issue found during automation tests

- How Has This Been Tested?
Manually test
Added new unit test

Signed-off-by: Stephen Sun <stephens@nvidia.com>
…#318)

* Fix issue: copper cable should not display DOM information

* Improve unit test coverage
- Description
For cmis cable, tx power and rx power is not rounding as other eeprom fields

- Motivation and Context
Fix issue: rounding float value for txpower and rxpower

- How Has This Been Tested?
Manual test
Description
The heath metric in ssd_generic for innodisk SSDs is too lazy. Fix to match the entire health number rather than just the first digit.

How Has This Been Tested?
Manual testing on Mellanox MSN2100
…ISAR 10G LR XCVR (sonic-net#319)

* JIRA-SONIC-5341: [eBay_ec202111_214] EEPROM/DOM Info: The Compliance Code will show "unknown" by using FINISAR 10G LR XCVR

correct the code mapping

* Fix others error code mapping and add unit test
Signed-off-by: Mihir Patel <patelmi@microsoft.com>

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

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
…onic-net#324) (sonic-net#329)

- Description
Add media assignment options to Application Advertisement

- Motivation and Context
Add media assignment options to Application Advertisement

- How Has This Been Tested?
Manual test
…d in the eepromTlvInfo decode (sonic-net#333)

Description
The VEMDOR_EXT field parse the data and format each in byte in hex with space as separator. But the logic leaves a space at the end of the value. This PR removes the trailing space in output of the VENDOR_EXT field in the eepromTlvInfo decode

This change is needed by 202205 branch

Motivation and Context
The trailing space at end of the VENDOR_EXT field cause the test of function get_system_eeprom_info() failed. The trailing space of the data filed is invisible char in the show platform syseeprom output while the get_system_eeprom_info() return a dictionary with trailing space in the end. This results in a mis-matched in the test case.

Signed-off-by: mlok <marty.lok@nokia.com>
…onic-net#315)

* Add get_transceiver_status to API interface

* Add test_ccmis support

* Add get_transceiver_pm API interface

* Add debug log and more description for interface

* Remove unnecessary pass
* add SOP ROC in bulk status

* add test item
* Change get_tx_bias return type to list

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
* [Cloudlight] QSFP-DD FW upgrade doesn't work (sonic-net#257)

- Description
cdb1_chkstatus will crash when i2c NACK or timeout.

- Motivation and Context
I2C of transceiver might NACK or stretching when FW upgrade, assuming "None" means "CdbIsBusy" until timeout.

* [Cloudlight] QSFP-DD FW upgrade doesn't work (sonic-net#257)

- Description
Waiting a delay in "run_fw_image" to ensure it is really executed.
Return a special package when get none in "get_module_fw_info".

- Motivation and Context
"run_fw_image" will be executed after a delay which according to run cmd, waiting the delay in "run_fw_image" to avoid aother cmd sent before it really executing.
CDB cmds will maybe cause several seconds NACK or stretching on i2c bus depend on implementation of module vendor, handling this situation for compatible with different implementation.

* [Cloudlight] QSFP-DD FW upgrade doesn't work (sonic-net#257)

- Description
Using real length to replace fixed number in "block_write_epl" function.

- Motivation and Context
To avoid a wrong epl length used in module.

* Update unit tests for cmis.

Test : Creating "get_module_fw_info" test.
Description:
The command is not showing the correct value for ssd health and temperature.

admin@sonic:~$ show platform ssdhealth
Device Model : M.2 (S42) 3IE4
Health       : N/A
Temperature  : N/A

Motivation and Context:
SSD health percentage and temperature not displayed on Nokia-7215 platform.

How Has This Been Tested?
"show platform ssdhealth" cli command on Nokia-7215 and Unittests

Output after fix:
admin@sonic:~$ show platform ssdhealth
Device Model : M.2 (S42) 3IE4
Health       : 100%
Temperature  : 25C
* Fix issue in cmis.get_transceiver_bulk_status

1. In case it fails to read EEPROM, either self.get_rx_power() or self.get_tx_power() can be a list of 'N/A'. Need to test it before calling self.mw_to_dbm
2. It should be a valid case for either self.get_rx_power() or self.get_tx_power() to return None. Handle other fields instead of returning None in this case

Signed-off-by: Stephen Sun <stephens@nvidia.com>

* Address comments: distinguish scenarios between not supporting and reading failure

Signed-off-by: Stephen Sun <stephens@nvidia.com>

* Adjust unit test case

Signed-off-by: Stephen Sun <stephens@nvidia.com>

* Remove redundant code

Signed-off-by: Stephen Sun <stephens@nvidia.com>

---------

Signed-off-by: Stephen Sun <stephens@nvidia.com>
…cation id (sonic-net#352)

* Retrieve channel from CONFIG_DB to enable breakout support

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

* Enhanced test_get_host_lane_assignment_option

* Resolved test case failure

* Addressed review comments

---------

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
…tion may return None (sonic-net#350)

Fix unit test failure
Conflicts:
	tests/sonic_xcvr/test_sff8436.py
	tests/sonic_xcvr/test_sff8636.py
Junchao-Mellanox pushed a commit that referenced this pull request Mar 20, 2025
… 202412 (#22)

```<br>* 9e58462 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-platform-common into 202412 (2025-02-15) [Sonic Automation]
* c735073 - (origin/202411) [202411][cmis] Fix cmis.get_error_description speed for passive module (sonic-net#538) (2025-02-12) [Aryeh Feigin]
* b7e75d8 - Add 800G innolight PNs (sonic-net#540) (2025-02-07) [mssonicbld]<br>```
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.