Skip to content

Commit f575a40

Browse files
authored
[Credo][Ycable] changes for synchronizing executing Telemetry API's when mux toggle is inprogress (#280)
In this PR, there is a support for adding a mux_toggle_status variable inside the base class for mux_cable. Using this variable the Derived classes for mux_cable can check this and return in case of a mux_toggle_status is in progress. From the higher layer this allows ycabled to synchronize the calls and not let mux_cable toggle to go in conjunction with some of the Telemetry calls. Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com Description Motivation and Context To get the toggle time to a minimum/ not allow i2c to transactions on the cable to collide with each other How Has This Been Tested? Ran the changes on 7050cx3 arista testbed Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
1 parent b043372 commit f575a40

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

sonic_y_cable/credo/y_cable_credo.py

+23
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,10 @@ def get_active_linked_tor_side(self):
695695
TARGET_TOR_B, if TOR B is actively linked and sending traffic.
696696
TARGET_UNKNOWN, if checking which side is linked and sending traffic API fails.
697697
"""
698+
699+
if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS:
700+
return YCableBase.TARGET_UNKNOWN
701+
698702
curr_offset = YCable.OFFSET_ACTIVE_TOR_INDICATOR
699703

700704
if self.platform_chassis is not None:
@@ -756,6 +760,10 @@ def is_link_active(self, target):
756760
a boolean, True if the link is active
757761
, False if the link is not active
758762
"""
763+
764+
if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS:
765+
return YCableBase.TARGET_UNKNOWN
766+
759767
curr_offset = YCable.OFFSET_CHECK_LINK_ACTIVE
760768

761769
if self.platform_chassis is not None:
@@ -825,6 +833,9 @@ def get_eye_heights(self, target):
825833
a list, with EYE values of lane 0 lane 1 lane 2 lane 3 with corresponding index
826834
"""
827835

836+
if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS:
837+
return None
838+
828839
eye_result = []
829840

830841
if self.platform_chassis is not None:
@@ -970,6 +981,9 @@ def get_switch_count_total(self, switch_count_type, clear_on_read=False):
970981
an integer, the number of times the Y-cable has been switched
971982
"""
972983

984+
if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS:
985+
return 0
986+
973987
count = 0
974988

975989
if self.platform_chassis is not None:
@@ -1785,6 +1799,9 @@ def get_local_temperature(self):
17851799
an Integer, the temperature of the local MCU
17861800
"""
17871801

1802+
if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS:
1803+
return 0
1804+
17881805
curr_offset = YCable.OFFSET_INTERNAL_TEMPERATURE
17891806
if self.platform_chassis is not None:
17901807
with self.rlock.acquire_timeout(RLocker.ACQUIRE_LOCK_TIMEOUT) as lock_status:
@@ -1811,6 +1828,9 @@ def get_nic_voltage(self):
18111828
a float, the voltage of the NIC MCU
18121829
"""
18131830

1831+
if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS:
1832+
return 0
1833+
18141834
if self.platform_chassis is not None:
18151835
with self.rlock.acquire_timeout(RLocker.ACQUIRE_LOCK_TIMEOUT) as lock_status:
18161836
if lock_status:
@@ -1838,6 +1858,9 @@ def get_local_voltage(self):
18381858
a float, the voltage of the local MCU
18391859
"""
18401860

1861+
if self.mux_toggle_status == self.MUX_TOGGLE_STATUS_INPROGRESS:
1862+
return 0
1863+
18411864
if self.platform_chassis is not None:
18421865
with self.rlock.acquire_timeout(RLocker.ACQUIRE_LOCK_TIMEOUT) as lock_status:
18431866
if lock_status:

sonic_y_cable/y_cable_base.py

+10
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ class YCableBase():
7878
FIRMWARE_DOWNLOAD_STATUS_FAILED = 2
7979

8080

81+
# Valid status values for mux togge
82+
# The mux_toggle_status variable should be assigned/used
83+
# one of these predefined values inside toggle/telemetry routine
84+
# as to signify what is the current status of toggle in progress
85+
86+
MUX_TOGGLE_STATUS_NOT_INITIATED_OR_FINISHED = 0
87+
MUX_TOGGLE_STATUS_INPROGRESS = 1
88+
89+
8190
# definitions of PRBS run modes
8291
PRBS_DIRECTION_BOTH = 0
8392
PRBS_DIRECTION_GENERATOR = 1
@@ -96,6 +105,7 @@ def __init__(self, port, logger):
96105
self.port = port
97106
self._logger = logger
98107
self.download_firmware_status = self.FIRMWARE_DOWNLOAD_STATUS_NOT_INITIATED_OR_FINISHED
108+
self.mux_toggle_status = self.MUX_TOGGLE_STATUS_NOT_INITIATED_OR_FINISHED
99109

100110

101111
def log_warning(self, msg):

0 commit comments

Comments
 (0)