Skip to content

Fix is_xcvr_optical check failure for Moby backplane port SFP type#20489

Merged
prgeor merged 1 commit intosonic-net:masterfrom
sdszhang:moby_bp_sfp
Sep 3, 2025
Merged

Fix is_xcvr_optical check failure for Moby backplane port SFP type#20489
prgeor merged 1 commit intosonic-net:masterfrom
sdszhang:moby_bp_sfp

Conversation

@sdszhang
Copy link
Contributor

@sdszhang sdszhang commented Sep 3, 2025

Description of PR

Summary:
Fix the following issue:

platform_tests/api/test_sfp.py::TestSfpApi::test_get_rx_los[xxxx]   FAILED     43%

01/09/2025 09:42:17 sfp.sfp_api                              L0018 INFO   | Executing sfp API: "get_rx_los", index: 16, arguments: "[]", result: "[False, False, False, False, False, False, False, False]"
01/09/2025 09:42:17 sfp.sfp_api                              L0018 INFO   | Executing sfp API: "get_transceiver_info", index: 17, arguments: "[]", result: "{'type': 'Backplane Cartridge', 'type_abbrv_name': 'BP', 'hardware_rev': '0.0', 'serial': 'APH1725600050   ', 'cable_length': 1.0, 'manufacturer': 'Amphenol        ', 'model': 'HS33006-001     ', 'vendor_date': '2025-04-30   ', 'vendor_oui': '41-50-48', 'vendor_rev': '03', 'application_advertisement': "{1: {'host_electrical_interface_id': '800G-ETC-CR8', 'module_media_interface_id': 'Undefined', 'media_lane_count': 8, 'host_lane_count': 8, 'host_lane_assignment_options': 1}, 2: {'host_electrical_interface_id': '400GBASE-CR4 (Clause 162)', 'module_media_interface_id': 'Copper cable', 'media_lane_count': 4, 'host_lane_count': 4, 'host_lane_assignment_options': 17}}", 'host_electrical_interface': 'N/A', 'host_lane_count': 8, 'cable_type': 'Length Cable Assembly(m)', 'cmis_rev': '5.1', 'specification_compliance': 'passive_copper_media_interface', 'slot_id': '1', 'host_lane_assignment_option': 1, 'vdm_supported': False}"
01/09/2025 09:42:17 __init__.pytest_runtest_call             L0040 ERROR  | Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 1788, in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
  File "/usr/local/lib/python3.8/dist-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/usr/local/lib/python3.8/dist-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/usr/local/lib/python3.8/dist-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.8/dist-packages/_pytest/python.py", line 194, in pytest_pyfunc_call
    result = testfunction(**testargs)
  File "/var/src/sonic-mgmt_vms92-t0-7060x6-moby-512-2/tests/platform_tests/api/test_sfp.py", line 595, in test_get_rx_los
    if not self.is_xcvr_optical(info_dict):
  File "/var/src/sonic-mgmt_vms92-t0-7060x6-moby-512-2/tests/platform_tests/api/test_sfp.py", line 296, in is_xcvr_optical
    spec_compliance_dict = ast.literal_eval(xcvr_info_dict["specification_compliance"])
  File "/usr/lib/python3.8/ast.py", line 99, in literal_eval
    return _convert(node_or_string)
  File "/usr/lib/python3.8/ast.py", line 98, in _convert
    return _convert_signed_num(node)
  File "/usr/lib/python3.8/ast.py", line 75, in _convert_signed_num
    return _convert_num(node)
  File "/usr/lib/python3.8/ast.py", line 66, in _convert_num
    _raise_malformed_node(node)
  File "/usr/lib/python3.8/ast.py", line 63, in _raise_malformed_node
    raise ValueError(f'malformed node or string: {node!r}')
ValueError: malformed node or string: <_ast.Name object at 0x7fdab9497ee0>

Moby's backplane port has the following attribute:
'type': 'Backplane Cartridge',
'type_abbrv_name': 'BP',

However, 'BP' is not in the non-optical check list, this PR adds it into the list.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Approach

What is the motivation for this PR?

Fix optical checking API to include the new backplane port used in Moby.

How did you do it?

Add Moby BP port type into the list.

How did you verify/test it?

Local testbed.

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@sdszhang sdszhang requested a review from prgeor as a code owner September 3, 2025 13:27
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sdszhang
Copy link
Contributor Author

sdszhang commented Sep 3, 2025

Test result:

platform_tests/api/test_sfp.py::TestSfpApi::test_get_reset_status[str5-7060x6-moby-512-3] PASSED [ 39%]
platform_tests/api/test_sfp.py::TestSfpApi::test_get_rx_los[str5-7060x6-moby-512-3] PASSED [ 43%]
platform_tests/api/test_sfp.py::TestSfpApi::test_get_tx_fault[str5-7060x6-moby-512-3] PASSED [ 47%]
platform_tests/api/test_sfp.py::TestSfpApi::test_get_temperature[str5-7060x6-moby-512-3] PASSED [ 52%]
platform_tests/api/test_sfp.py::TestSfpApi::test_get_voltage[str5-7060x6-moby-512-3] PASSED [ 56%]

There are still some keyError failures with this fix, which will be addressed as a separate issue.

@sdszhang
Copy link
Contributor Author

sdszhang commented Sep 3, 2025

@prgeor can you help to review this one?

@sdszhang sdszhang changed the title Fix Moby backplane port SFP type. Fix is_xcvr_optical check failure for Moby backplane port SFP type Sep 3, 2025
@prgeor prgeor merged commit 61410ea into sonic-net:master Sep 3, 2025
17 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Sep 4, 2025
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202505: #20518

mssonicbld pushed a commit that referenced this pull request Sep 4, 2025
@sdszhang sdszhang deleted the moby_bp_sfp branch September 13, 2025 10:22
xixuej pushed a commit to xixuej/sonic-mgmt that referenced this pull request Sep 17, 2025
vidyac86 pushed a commit to vidyac86/sonic-mgmt that referenced this pull request Oct 23, 2025
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
Signed-off-by: Aharon Malkin <amalkin@nvidia.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
lakshmi-nexthop pushed a commit to lakshmi-nexthop/sonic-mgmt that referenced this pull request Jan 28, 2026
Signed-off-by: Lakshmi Yarramaneni <lakshmi@nexthop.ai>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
Signed-off-by: Yael Tzur <ytzur@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.

4 participants