diff --git a/sonic_y_cable/credo/y_cable_credo.py b/sonic_y_cable/credo/y_cable_credo.py index e93c27866445..7b5535b7d058 100644 --- a/sonic_y_cable/credo/y_cable_credo.py +++ b/sonic_y_cable/credo/y_cable_credo.py @@ -695,6 +695,10 @@ def get_active_linked_tor_side(self): TARGET_TOR_B, if TOR B is actively linked and sending traffic. TARGET_UNKNOWN, if checking which side is linked and sending traffic API fails. """ + + if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS: + return YCableBase.TARGET_UNKNOWN + curr_offset = YCable.OFFSET_ACTIVE_TOR_INDICATOR if self.platform_chassis is not None: @@ -756,6 +760,10 @@ def is_link_active(self, target): a boolean, True if the link is active , False if the link is not active """ + + if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS: + return YCableBase.TARGET_UNKNOWN + curr_offset = YCable.OFFSET_CHECK_LINK_ACTIVE if self.platform_chassis is not None: @@ -825,6 +833,9 @@ def get_eye_heights(self, target): a list, with EYE values of lane 0 lane 1 lane 2 lane 3 with corresponding index """ + if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS: + return None + eye_result = [] if self.platform_chassis is not None: @@ -970,6 +981,9 @@ def get_switch_count_total(self, switch_count_type, clear_on_read=False): an integer, the number of times the Y-cable has been switched """ + if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS: + return 0 + count = 0 if self.platform_chassis is not None: @@ -1785,6 +1799,9 @@ def get_local_temperature(self): an Integer, the temperature of the local MCU """ + if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS: + return 0 + curr_offset = YCable.OFFSET_INTERNAL_TEMPERATURE if self.platform_chassis is not None: with self.rlock.acquire_timeout(RLocker.ACQUIRE_LOCK_TIMEOUT) as lock_status: @@ -1811,6 +1828,9 @@ def get_nic_voltage(self): a float, the voltage of the NIC MCU """ + if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS: + return 0 + if self.platform_chassis is not None: with self.rlock.acquire_timeout(RLocker.ACQUIRE_LOCK_TIMEOUT) as lock_status: if lock_status: @@ -1838,6 +1858,9 @@ def get_local_voltage(self): a float, the voltage of the local MCU """ + if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS: + return 0 + if self.platform_chassis is not None: with self.rlock.acquire_timeout(RLocker.ACQUIRE_LOCK_TIMEOUT) as lock_status: if lock_status: diff --git a/sonic_y_cable/y_cable_base.py b/sonic_y_cable/y_cable_base.py index 774c12db5f3a..69892da36633 100644 --- a/sonic_y_cable/y_cable_base.py +++ b/sonic_y_cable/y_cable_base.py @@ -78,6 +78,15 @@ class YCableBase(): FIRMWARE_DOWNLOAD_STATUS_FAILED = 2 + # Valid status values for mux togge + # The mux_toggle_status variable should be assigned/used + # one of these predefined values inside toggle/telemetry routine + # as to signify what is the current status of toggle in progress + + MUX_TOGGLE_STATUS_NOT_INITIATED_OR_FINISHED = 0 + MUX_TOGGLE_STATUS_INPROGRESS = 1 + + # definitions of PRBS run modes PRBS_DIRECTION_BOTH = 0 PRBS_DIRECTION_GENERATOR = 1 @@ -96,6 +105,7 @@ def __init__(self, port, logger): self.port = port self._logger = logger self.download_firmware_status = self.FIRMWARE_DOWNLOAD_STATUS_NOT_INITIATED_OR_FINISHED + self.mux_toggle_status = self.MUX_TOGGLE_STATUS_NOT_INITIATED_OR_FINISHED def log_warning(self, msg):