Skip to content

Commit cc162d6

Browse files
[sonic_y_cable]: Decorate all method for mux simulator (#181)
Testbeds using the mux simulator will see lots of error messages in the syslog since many y_cable methods are not mocked for the mux simulator. This PR prepares `y_cable.py` to use mocked methods that will be introduced in a future sonic-mgmt PR. Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
1 parent fa02416 commit cc162d6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

sonic_y_cable/y_cable.py

+24
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ def check_if_link_is_active_for_torB(physical_port):
602602
return False
603603

604604

605+
@hook_y_cable_simulator
605606
def enable_prbs_mode(physical_port, target, mode_value, lane_map):
606607
"""
607608
This API specifically configures and enables the PRBS mode/type depending upon the mode_value the user provides.
@@ -674,6 +675,7 @@ def enable_prbs_mode(physical_port, target, mode_value, lane_map):
674675
return result
675676

676677

678+
@hook_y_cable_simulator
677679
def disable_prbs_mode(physical_port, target):
678680
"""
679681
This API specifically disables the PRBS mode on the physcial port.
@@ -724,6 +726,7 @@ def disable_prbs_mode(physical_port, target):
724726
return result
725727

726728

729+
@hook_y_cable_simulator
727730
def enable_loopback_mode(physical_port, target, lane_map):
728731
"""
729732
This API specifically configures and enables the Loopback mode on the port user provides.
@@ -781,6 +784,7 @@ def enable_loopback_mode(physical_port, target, lane_map):
781784
return result
782785

783786

787+
@hook_y_cable_simulator
784788
def disable_loopback_mode(physical_port, target):
785789
"""
786790
This API specifically disables the Loopback mode on the port user provides.
@@ -834,6 +838,7 @@ def disable_loopback_mode(physical_port, target):
834838
return result
835839

836840

841+
@hook_y_cable_simulator
837842
def get_ber_info(physical_port, target):
838843
"""
839844
This API specifically returns the BER (Bit error rate) value for a specfic port.
@@ -912,6 +917,7 @@ def get_ber_info(physical_port, target):
912917
return ber_result
913918

914919

920+
@hook_y_cable_simulator
915921
def get_eye_info(physical_port, target):
916922
"""
917923
This API specifically returns the EYE height value for a specfic port.
@@ -989,6 +995,7 @@ def get_eye_info(physical_port, target):
989995
return eye_result
990996

991997

998+
@hook_y_cable_simulator
992999
def get_part_number(physical_port):
9931000
"""
9941001
This API specifically returns the part number of the Y cable for a specfic port.
@@ -1015,6 +1022,7 @@ def get_part_number(physical_port):
10151022
return part_number
10161023

10171024

1025+
@hook_y_cable_simulator
10181026
def get_vendor(physical_port):
10191027
"""
10201028
This API specifically returns the vendor name of the Y cable for a specfic port.
@@ -1041,6 +1049,7 @@ def get_vendor(physical_port):
10411049
return vendor_name
10421050

10431051

1052+
@hook_y_cable_simulator
10441053
def get_switch_count(physical_port, count_type):
10451054
"""
10461055
This API specifically returns the switch count to change the Active TOR which has
@@ -1089,6 +1098,7 @@ def get_switch_count(physical_port, count_type):
10891098
return count
10901099

10911100

1101+
@hook_y_cable_simulator
10921102
def get_target_cursor_values(physical_port, lane, target):
10931103
"""
10941104
This API specifically returns the cursor equalization parameters for a target(NIC, TOR1, TOR2).
@@ -1145,6 +1155,7 @@ def get_target_cursor_values(physical_port, lane, target):
11451155
return result
11461156

11471157

1158+
@hook_y_cable_simulator
11481159
def check_if_nic_lanes_active(physical_port):
11491160
"""
11501161
This API specifically returns the byte value which denotes which nic lanes
@@ -1175,6 +1186,7 @@ def check_if_nic_lanes_active(physical_port):
11751186
return result
11761187

11771188

1189+
@hook_y_cable_simulator
11781190
def get_firmware_version(physical_port, target):
11791191

11801192
data = bytearray(FIRMWARE_INFO_PAYLOAD_SIZE)
@@ -1226,6 +1238,7 @@ def get_firmware_version(physical_port, target):
12261238
return result
12271239

12281240

1241+
@hook_y_cable_simulator
12291242
def get_internal_voltage_temp(physical_port):
12301243

12311244
curr_offset = OFFSET_INTERNAL_TEMPERATURE
@@ -1250,6 +1263,7 @@ def get_internal_voltage_temp(physical_port):
12501263
return temp, voltage
12511264

12521265

1266+
@hook_y_cable_simulator
12531267
def get_nic_voltage_temp(physical_port):
12541268

12551269
curr_offset = OFFSET_NIC_TEMPERATURE
@@ -1274,6 +1288,7 @@ def get_nic_voltage_temp(physical_port):
12741288
return temp, voltage
12751289

12761290

1291+
@hook_y_cable_simulator
12771292
def get_local_temperature(physical_port):
12781293

12791294
curr_offset = OFFSET_INTERNAL_TEMPERATURE
@@ -1289,6 +1304,7 @@ def get_local_temperature(physical_port):
12891304
return temp
12901305

12911306

1307+
@hook_y_cable_simulator
12921308
def get_local_voltage(physical_port):
12931309

12941310
if platform_chassis is not None:
@@ -1308,6 +1324,7 @@ def get_local_voltage(physical_port):
13081324
return voltage
13091325

13101326

1327+
@hook_y_cable_simulator
13111328
def get_nic_temperature(physical_port):
13121329

13131330
curr_offset = OFFSET_NIC_TEMPERATURE
@@ -1323,6 +1340,7 @@ def get_nic_temperature(physical_port):
13231340
return temp
13241341

13251342

1343+
@hook_y_cable_simulator
13261344
def get_nic_voltage(physical_port):
13271345

13281346
curr_offset = OFFSET_NIC_VOLTAGE
@@ -1342,6 +1360,7 @@ def get_nic_voltage(physical_port):
13421360
return voltage
13431361

13441362

1363+
@hook_y_cable_simulator
13451364
def download_firmware(physical_port, fwfile):
13461365
""" This routine should download and store the firmware on all the
13471366
components of the Y cable of the port specified.
@@ -1371,6 +1390,7 @@ def download_firmware(physical_port, fwfile):
13711390
return FIRMWARE_DOWNLOAD_SUCCESS
13721391

13731392

1393+
@hook_y_cable_simulator
13741394
def activate_firmware(physical_port):
13751395
""" This routine should activate the downloaded firmware on all the
13761396
components of the Y cable of the port specified.
@@ -1392,6 +1412,7 @@ def activate_firmware(physical_port):
13921412
return FIRMWARE_ACTIVATE_SUCCESS
13931413

13941414

1415+
@hook_y_cable_simulator
13951416
def rollback_firmware(physical_port):
13961417
""" This routine should rollback the firmware to the previous version
13971418
which was being used by the cable. This API is intended to be called when the
@@ -1410,6 +1431,7 @@ def rollback_firmware(physical_port):
14101431
return FIRMWARE_ROLLBACK_SUCCESS
14111432

14121433

1434+
@hook_y_cable_simulator
14131435
def set_switching_mode(physical_port, mode):
14141436
"""
14151437
This API specifically enables the auto switching or manual switching feature on the muxcable,
@@ -1456,6 +1478,8 @@ def set_switching_mode(physical_port, mode):
14561478

14571479
return result
14581480

1481+
1482+
@hook_y_cable_simulator
14591483
def get_switching_mode(physical_port):
14601484
"""
14611485
This API specifically returns which type of switching mode the cable is set to auto/manual

0 commit comments

Comments
 (0)