Skip to content

Commit fed93df

Browse files
authored
[ycable] add definitions of some new API's for Y-Cable infrastructure (sonic-net#301)
Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com This PR adds the following API's useful for muxcable MCU's debug, these are added as base class for muxcable API's and implemented by vendor def queue_info(self): This API should dump all the meaningful data from the eeprom which can help vendor debug the queue info currently relevant to the MCU using this API the vendor could check how many txns are currently in the queue etc for debugging purpose def reset_cause(self): This API should return the reset cause for the NIC MCU. This should help ascertain whether a reset was caused by soft reboot or cable poweroff def operation_time(self): This API should return the time since the cable is powered on from NIC MCU side This should be helpful in debugging purposes as to if/when the cable has been powered on def mem_read(self): This API should return the memory contents/as well as pointers/counters for DMA or hardware FIFO's which could be useful for debugging the state of the MCU
1 parent f6e35fa commit fed93df

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

sonic_y_cable/y_cable_base.py

+130
Original file line numberDiff line numberDiff line change
@@ -1167,3 +1167,133 @@ def debug_dump_registers(self, option=None):
11671167
"""
11681168

11691169
raise NotImplementedError
1170+
1171+
def queue_info(self):
1172+
"""
1173+
This API should dump all the meaningful data from the eeprom which can
1174+
help vendor debug the queue info for the UART stats in particular
1175+
currently relevant to the MCU
1176+
using this API the vendor could check how many txns are currently waiting to be processed,proceessed
1177+
in the queue etc for debugging purposes
1178+
1179+
Args:
1180+
None
1181+
1182+
Returns:
1183+
a Dictionary:
1184+
with all the relevant key-value pairs for all the meaningful fields
1185+
for the queue inside the MCU firmware
1186+
which would help diagnose the cable for proper functioning
1187+
"""
1188+
1189+
raise NotImplementedError
1190+
1191+
def reset_cause(self):
1192+
"""
1193+
This API should return the reset cause for the NIC MCU.
1194+
This should help ascertain whether a reset was caused by soft reboot or
1195+
cable poweroff
1196+
1197+
Args:
1198+
None
1199+
1200+
Returns:
1201+
a string:
1202+
the string should be self explnatory as to what was the cause of reset
1203+
1204+
"""
1205+
raise NotImplementedError
1206+
1207+
def operation_time(self):
1208+
"""
1209+
This API should return the time since the cable is powered on from NIC MCU side
1210+
This should be helpful in debugging purposes as to if/when the cable has been powered on
1211+
1212+
Args:
1213+
None
1214+
1215+
Returns:
1216+
a float:
1217+
the float should represent how much time the mux cable is alive/powered on
1218+
"""
1219+
1220+
raise NotImplementedError
1221+
1222+
def mem_read(self, target, addr, length):
1223+
"""
1224+
This API should return the memory contents of the cable which would be useful in debug for the
1225+
y-cable
1226+
1227+
Args:
1228+
target:
1229+
local (TOR) or remote (NIC) MCU
1230+
addr:
1231+
the starting address of the MCU's memory space
1232+
length:
1233+
length to be read, unit: byte
1234+
1235+
Returns:
1236+
a Bytearray:
1237+
the contents of the memory inside the MCU firmware
1238+
which would help diagnose the cable for proper functioning
1239+
"""
1240+
1241+
raise NotImplementedError
1242+
1243+
def activate_target_firmware(self, target, fwfile=None, hitless=False):
1244+
"""
1245+
This routine should activate the downloaded firmware on all the target
1246+
of the Y cable of the port for which this API is called..
1247+
This API is meant to be used in conjunction with download_firmware API, and
1248+
should be called once download_firmware API is succesful.
1249+
This means that the firmware which has been downloaded should be
1250+
activated (start being utilized by the cable) once this API is
1251+
successfully executed.
1252+
The port on which this API is called for can be referred using self.port.
1253+
1254+
Args:
1255+
target:
1256+
One of the following predefined constants, the actual target to activate the firmware on:
1257+
TARGET_NIC -> NIC,
1258+
TARGET_TOR_A -> TORA,
1259+
TARGET_TOR_B -> TORB
1260+
fwfile (optional):
1261+
a string, a path to the file which contains the firmware image.
1262+
Note that the firmware file can be in the format of the vendor's
1263+
choosing (binary, archive, etc.). But note that it should be one file
1264+
which contains firmware for all components of the Y-cable. In case the
1265+
vendor chooses to pass this file in activate_firmware, the API should
1266+
have the logic to retreive the firmware version from this file
1267+
which has to be activated on the components of the Y-Cable
1268+
this API has been called for.
1269+
If None is passed for fwfile, the cable should activate whatever
1270+
firmware is marked to be activated next.
1271+
If provided, it should retreive the firmware version(s) from this file, ensure
1272+
they are downloaded on the cable, then activate them.
1273+
1274+
hitless (optional):
1275+
a boolean, True, Hitless upgrade: it will backup/restore the current state
1276+
(ex. variables of link status, API attributes...etc.) before
1277+
and after firmware upgrade.
1278+
a boolean, False, Non-hitless upgrade: it will update the firmware regardless
1279+
the current status, a link flip can be observed during the upgrade.
1280+
Returns:
1281+
One of the following predefined constants:
1282+
FIRMWARE_ACTIVATE_SUCCESS
1283+
FIRMWARE_ACTIVATE_FAILURE
1284+
"""
1285+
1286+
raise NotImplementedError
1287+
1288+
def health_check(self):
1289+
"""
1290+
This API checks the health of the cable, where it is healthy/unhealythy for RMA purposes/diagnostics.
1291+
The port on which this API is called for can be referred using self.port.
1292+
1293+
Args:
1294+
1295+
Returns:
1296+
a Boolean, True if the cable is healthy and False if it is not healthy.
1297+
"""
1298+
1299+
raise NotImplementedError

0 commit comments

Comments
 (0)