Skip to content

Enhancement: Missing get_power_override_support interface in SFP Base API #26372

@arista-hpandya

Description

@arista-hpandya

Is it platform specific

generic

Importance or Severity

Medium

Description of the enhancement

Currently, the SONiC SfpBase and SfpOptoeBase classes provide methods to get and set power override values (get_power_override, set_power_override). However, there is no standardized way for the platform layer or upper-layer applications (such as sonic-mgmt tests) to query whether a specific transceiver actually supports the power override feature.

Without this programatic API approach, sonic-mgmt has to rely on hard-coded methods that are very delicate:

 def is_xcvr_support_power_override(self, xcvr_info_dict):
        """Returns True if transceiver supports power override, False if not supported"""
        xcvr_type = xcvr_info_dict["type_abbrv_name"]
        is_valid_xcvr_type = "QSFP" in xcvr_type and xcvr_type != "QSFP-DD"
        return self.is_xcvr_optical(xcvr_info_dict) and is_valid_xcvr_type

Source: https://github.com/sonic-net/sonic-mgmt/blob/a1d1fd8717c4525055a3a4a9e3250232ee3b0d86/tests/platform_tests/api/test_sfp.py#L374-L378

Current Behavior

Using xcvr_type to extrapolate power_override support:

 def is_xcvr_support_power_override(self, xcvr_info_dict):
        """Returns True if transceiver supports power override, False if not supported"""
        xcvr_type = xcvr_info_dict["type_abbrv_name"]
        is_valid_xcvr_type = "QSFP" in xcvr_type and xcvr_type != "QSFP-DD"
        return self.is_xcvr_optical(xcvr_info_dict) and is_valid_xcvr_type

Proposed Behavior

The idea is to support direct API calls like: if sfp.get_power_override_support(platform_api_conn, i) is True:

Metadata

Metadata

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions