31
31
OFFSET_SWITCH_MUX_DIRECTION = 642
32
32
OFFSET_MUX_DIRECTION = 644
33
33
OFFSET_ACTIVE_TOR_INDICATOR = 645
34
- OFFSET_MANUAL_SWITCH_COUNT = 669
35
34
OFFSET_CONFIGURE_PRBS_TYPE = 768
36
35
OFFSET_ENABLE_PRBS = 769
37
36
OFFSET_INITIATE_BER_MEASUREMENT = 770
92
91
93
92
MAX_NUM_LANES = 4
94
93
95
- # Valid return codes for upgrade_firmware() routine
96
- FIRMWARE_UPGRADE_SUCCESS = 0
97
- FIRMWARE_UPGRADE_FAILURE = 1
94
+ # Valid return codes for upgrade firmware routine steps
95
+ FIRMWARE_DOWNLOAD_SUCCESS = 0
96
+ FIRMWARE_DOWNLOAD_FAILURE = 1
97
+ FIRMWARE_ACTIVATE_SUCCESS = 0
98
+ FIRMWARE_ACTIVATE_FAILURE = 1
99
+ FIRMWARE_ROLLBACK_SUCCESS = 0
100
+ FIRMWARE_ROLLBACK_FAILURE = 1
98
101
99
102
SYSLOG_IDENTIFIER = "sonic_y_cable"
100
103
@@ -995,8 +998,8 @@ def get_part_number(physical_port):
995
998
curr_offset = OFFSET_PART_NUMBER
996
999
997
1000
if platform_chassis is not None :
998
- part_result = platform_chassis .get_sfp (physical_port ).read_eeprom (curr_offset , 15 )
999
- if y_cable_validate_read_data (part_result , 15 , physical_port , "Part number" ) == EEPROM_READ_DATA_INVALID :
1001
+ part_result = platform_chassis .get_sfp (physical_port ).read_eeprom (curr_offset , 16 )
1002
+ if y_cable_validate_read_data (part_result , 16 , physical_port , "Part number" ) == EEPROM_READ_DATA_INVALID :
1000
1003
return EEPROM_ERROR
1001
1004
else :
1002
1005
helper_logger .log_error ("platform_chassis is not loaded, failed to get part number" )
@@ -1021,8 +1024,8 @@ def get_vendor(physical_port):
1021
1024
curr_offset = OFFSET_VENDOR_NAME
1022
1025
1023
1026
if platform_chassis is not None :
1024
- result = platform_chassis .get_sfp (physical_port ).read_eeprom (curr_offset , 15 )
1025
- if y_cable_validate_read_data (result , 15 , physical_port , "Vendor name" ) == EEPROM_READ_DATA_INVALID :
1027
+ result = platform_chassis .get_sfp (physical_port ).read_eeprom (curr_offset , 16 )
1028
+ if y_cable_validate_read_data (result , 16 , physical_port , "Vendor name" ) == EEPROM_READ_DATA_INVALID :
1026
1029
return EEPROM_ERROR
1027
1030
else :
1028
1031
helper_logger .log_error ("platform_chassis is not loaded, failed to get Vendor name" )
@@ -1334,24 +1337,67 @@ def get_nic_voltage(physical_port):
1334
1337
return voltage
1335
1338
1336
1339
1337
- def upgrade_firmware (physical_port , fwfile ):
1338
- """ This routine should facilitate complete firmware
1339
- upgrade of the Y cable on all the three ends of the
1340
- Y cable of the port specified.
1341
- All the components of the Y cable should be upgraded and committed
1342
- in their entirety by this single call subroutine.
1343
- This should return success code if firmware upgrade is successful
1344
- and an error code otherwise.
1340
+ def download_firmware (physical_port , fwfile ):
1341
+ """ This routine should download and store the firmware on all the
1342
+ components of the Y cable of the port specified.
1343
+ This should include any internal transfers, checksum validation etc.
1344
+ from TOR to TOR or TOR to NIC side of the firmware specified by the fwfile.
1345
+ This basically means that the firmware which is being downloaded should be
1346
+ available to be activated (start being utilized by the cable) once this API is
1347
+ successfully executed.
1348
+ Note that this API should ideally not require any rollback even if it fails
1349
+ as this should not interfere with the existing cable functionality because
1350
+ this has not been activated yet.
1345
1351
1346
1352
Args:
1347
1353
physical_port:
1348
1354
an Integer, the actual physical port connected to a Y cable
1349
1355
fwfile:
1350
- a string, a path to the binary file which contains the firmware image
1356
+ a string, a path to the file which contains the firmware image.
1357
+ Note that the firmware file can be in the format of the vendor's
1358
+ choosing (binary, archive, etc.). But note that it should be one file
1359
+ which contains firmware for all components of the Y-cable
1351
1360
Returns:
1352
1361
an Integer:
1353
- a predefined code stating whether the firmware upgrade was successful
1354
- or an error code as to what was the cause of firmware upgrade failure
1362
+ a predefined code stating whether the firmware download was successful
1363
+ or an error code as to what was the cause of firmware download failure
1355
1364
"""
1356
1365
1357
- return FIRMWARE_UPGRADE_SUCCESS
1366
+ return FIRMWARE_DOWNLOAD_SUCCESS
1367
+
1368
+ def activate_firmware (physical_port ):
1369
+ """ This routine should activate the downloaded firmware on all the
1370
+ components of the Y cable of the port specified.
1371
+ This API is meant to be used in conjunction with download_firmware API, and
1372
+ should be called once download_firmware API is succesful.
1373
+ This means that the firmware which has been downloaded should be
1374
+ activated (start being utilized by the cable) once this API is
1375
+ successfully executed.
1376
+
1377
+ Args:
1378
+ physical_port:
1379
+ an Integer, the actual physical port connected to a Y cable
1380
+ Returns:
1381
+ an Integer:
1382
+ a predefined code stating whether the firmware activate was successful
1383
+ or an error code as to what was the cause of firmware activate failure
1384
+ """
1385
+
1386
+ return FIRMWARE_ACTIVATE_SUCCESS
1387
+
1388
+ def rollback_firmware (physical_port ):
1389
+ """ This routine should rollback the firmware to the previous version
1390
+ which was being used by the cable. This API is intended to be called when the
1391
+ user either witnesses an activate_firmware API failure or sees issues with
1392
+ newer firmware in regards to stable cable functioning.
1393
+
1394
+ Args:
1395
+ physical_port:
1396
+ an Integer, the actual physical port connected to a Y cable
1397
+ Returns:
1398
+ an Integer:
1399
+ a predefined code stating whether the firmware rollback was successful
1400
+ or an error code as to what was the cause of firmware rollback failure
1401
+ """
1402
+
1403
+ return FIRMWARE_ROLLBACK_SUCCESS
0 commit comments