Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMIS: Remote upgrade support #400

Merged
merged 14 commits into from
Oct 7, 2023
Merged

CMIS: Remote upgrade support #400

merged 14 commits into from
Oct 7, 2023

Conversation

AnoopKamath
Copy link
Contributor

@AnoopKamath AnoopKamath commented Sep 28, 2023

Description

Create vendor specific files and classes derived from main class. If vendor is matched when sfputil is run, set the vendor specific byte as target mode

Motivation and Context

Helps with remote upgrade feature

How Has This Been Tested?

Try different target mode, upgrade/downgrade

root@sonic:/home/cisco# sfputil firmware ?
Usage: sfputil firmware [OPTIONS] COMMAND [ARGS]...

  Download/Upgrade firmware on the transceiver

Options:
  --help  Show this message and exit.

Commands:
  commit    Commit the running firmware
  download  Download firmware on the transceiver
  run       Run the firmware with default mode=0
  target    Select target end for firmware download 0-(local) 1-(remote-A)...
  unlock    Unlock the firmware download feature via CDB host password
  upgrade   Upgrade firmware on the transceiver

root@sonic:/home/cisco# sfputil firmware target ?
Usage: sfputil firmware target [OPTIONS] PORT_NAME TARGET
Try "sfputil firmware target --help" for help.

Error: Missing argument "TARGET".
root@sonic:/home/cisco# sfputil firmware target --help
Usage: sfputil firmware target [OPTIONS] PORT_NAME TARGET

  Select target end for firmware download 0-(local)

  1-(remote-A)

  2-(remote-B)

Options:
  --help  Show this message and exit.

oot@sonic:/home/cisco# sfputil firmware target Ethernet180 1
Target Mode set to 1

root@sonic:/home/cisco# sfputil show eeprom-hexdump -n 0 -p Ethernet180
EEPROM hexdump for port Ethernet180 page 0h
        Lower page 0h
        00000000 18 50 00 07 01 00 00 00  00 00 00 00 00 00 18 a8 |.P..............|
        00000010 80 e8 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000020 00 00 00 00 00 01 00 00  03 00 00 00 00 00 00 00 |................|
        00000030 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000040 01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000050 00 00 00 00 00 04 4f 04  44 01 50 04 44 01 ff 00 |......O.D.P.D...|
        00000060 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000070 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|

root@sonic:/home/cisco# sfputil show fwversion Ethernet180
Image A Version: 0.3.5
Image B Version: 0.3.5
Factory Image Version: 0.0.0
Running Image: A
Committed Image: A
Active Firmware: 0.3.5
Inactive Firmware: 0.3.5

root@sonic:/home/cisco# sfputil firmware download Ethernet180 AEC_Camano_YCable_SE_LR_AEC_MS_0.3.6_20230905.bin
CDB: Starting firmware download
Downloading ...  [####################################]  100%
CDB: firmware download complete
Firmware download complete success
Total download Time: 0:01:55.731397

root@sonic:/home/cisco# sfputil show fwversion Ethernet180
Image A Version: 0.3.5
Image B Version: 0.3.6
Factory Image Version: 0.0.0
Running Image: A
Committed Image: A
Active Firmware: 0.3.5
Inactive Firmware: 0.3.6

root@sonic:/home/cisco# sfputil firmware run Ethernet180
Running firmware: Non-hitless Reset to Inactive Image
Firmware run in mode=0 success

root@sonic:/home/cisco# sfputil show fwversion Ethernet180
Image A Version: 0.3.5
Image B Version: 0.3.6
Factory Image Version: 0.0.0
Running Image: B
Committed Image: A
Active Firmware: 0.3.6
Inactive Firmware: 0.3.5

root@sonic:/home/cisco# sfputil firmware commit Ethernet180
Firmware commit successful

root@sonic:/home/cisco# sfputil show fwversion Ethernet180
Image A Version: 0.3.5
Image B Version: 0.3.6
Factory Image Version: 0.0.0
Running Image: B
Committed Image: B
Active Firmware: 0.3.6
Inactive Firmware: 0.3.5

Additional Information (Optional)

@AnoopKamath AnoopKamath changed the title Remote upgrade support CMIS: Remote upgrade support Sep 28, 2023
sonic_platform_base/sonic_xcvr/xcvr_api_factory.py Outdated Show resolved Hide resolved
sonic_platform_base/sonic_xcvr/xcvr_api_factory.py Outdated Show resolved Hide resolved
sonic_platform_base/sonic_xcvr/api/credo/aec_800g.py Outdated Show resolved Hide resolved
sonic_platform_base/sonic_xcvr/api/credo/aec_800g.py Outdated Show resolved Hide resolved
sonic_platform_base/sonic_xcvr/api/credo/aec_800g.py Outdated Show resolved Hide resolved
sonic_platform_base/sonic_xcvr/mem_maps/credo/aec_800g.py Outdated Show resolved Hide resolved
@AnoopKamath
Copy link
Contributor Author

@prgeor : All comments addressed and UT is also taken care. Can you please approve if there are no further comments?

@prgeor prgeor added the CMIS label Oct 7, 2023
@prgeor prgeor merged commit d382ec8 into sonic-net:master Oct 7, 2023
5 checks passed
@mihirpat1
Copy link
Contributor

@StormLiangMS - Can you please help in merging this to 202305?
ADO - 25421938

@keboliu
Copy link
Collaborator

keboliu commented Oct 11, 2023

Hi @AnoopKamath, with this change we see issues on some QSFP cables, would you please take a look

Oct 11 07:06:59.624108 sonic ERR pmon#xcvrd: Exception occured at SfpStateUpdateTask thread due to UnicodeDecodeError('utf-8', b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff', 0, 1, 'invalid start byte')
Oct 11 07:06:59.624505 sonic ERR pmon#xcvrd: Traceback (most recent call last):
Oct 11 07:06:59.624769 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 2231, in run
Oct 11 07:06:59.625036 sonic ERR pmon#xcvrd:     self.task_worker(self.task_stopping_event, self.sfp_error_event)
Oct 11 07:06:59.625291 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 2043, in task_worker
Oct 11 07:06:59.625556 sonic ERR pmon#xcvrd:     self.init()
Oct 11 07:06:59.625859 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1961, in init
Oct 11 07:06:59.626111 sonic ERR pmon#xcvrd:     self.retry_eeprom_set = self._post_port_sfp_info_and_dom_thr_to_db_once(port_mapping_data, self.xcvr_table_helper, self.main_thread_stop_event)
Oct 11 07:06:59.626364 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1916, in _post_port_sfp_info_and_dom_thr_to_db_once
Oct 11 07:06:59.626615 sonic ERR pmon#xcvrd:     rc = post_port_sfp_info_to_db(logical_port_name, port_mapping, xcvr_table_helper.get_intf_tbl(asic_index), transceiver_dict, stop_event)
Oct 11 07:06:59.626861 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 336, in post_port_sfp_info_to_db
Oct 11 07:06:59.627082 sonic ERR pmon#xcvrd:     port_info_dict = _wrapper_get_transceiver_info(physical_port)
Oct 11 07:06:59.627371 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 173, in _wrapper_get_transceiver_info
Oct 11 07:06:59.627615 sonic ERR pmon#xcvrd:     return platform_chassis.get_sfp(physical_port).get_transceiver_info()
Oct 11 07:06:59.627966 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/sfp_optoe_base.py", line 23, in get_transceiver_info
Oct 11 07:06:59.628293 sonic ERR pmon#xcvrd:     api = self.get_xcvr_api()
Oct 11 07:06:59.628607 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform/sfp.py", line 538, in get_xcvr_api
Oct 11 07:06:59.628992 sonic ERR pmon#xcvrd:     self.refresh_xcvr_api()
Oct 11 07:06:59.629307 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sfp_base.py", line 458, in refresh_xcvr_api
Oct 11 07:06:59.629617 sonic ERR pmon#xcvrd:     self._xcvr_api = self._xcvr_api_factory.create_xcvr_api()
Oct 11 07:06:59.629924 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py", line 66, in create_xcvr_api
Oct 11 07:06:59.630253 sonic ERR pmon#xcvrd:     vendor_pn = self._get_vendor_part_num()
Oct 11 07:06:59.630552 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py", line 59, in _get_vendor_part_num
Oct 11 07:06:59.630909 sonic ERR pmon#xcvrd:     vendor_pn = part_num.decode()
Oct 11 07:06:59.631286 sonic ERR pmon#xcvrd: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Oct 11 07:06:59.631286 sonic ERR pmon#xcvrd: Xcvrd: exception found at child thread SfpStateUpdateTask due to UnicodeDecodeError('utf-8', b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff', 0, 1, 'invalid start byte')
Oct 11 07:06:59.631286 sonic ERR pmon#xcvrd: Exiting main loop as child thread raised exception!
Oct 11 06:55:09.429299 sonic ERR pmon#xcvrd: Exception occured at SfpStateUpdateTask thread due to UnicodeDecodeError('utf-8', b'\x00#\x88\x00\x00\x00\x00\x00\x00\x00\x05\xff\x00\x00\x00\x00', 2, 3, 'invalid start byte')
Oct 11 06:55:09.438703 sonic ERR pmon#xcvrd: Traceback (most recent call last):
Oct 11 06:55:09.439319 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 2231, in run
Oct 11 06:55:09.439319 sonic ERR pmon#xcvrd:     self.task_worker(self.task_stopping_event, self.sfp_error_event)
Oct 11 06:55:09.439319 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 2043, in task_worker
Oct 11 06:55:09.439319 sonic ERR pmon#xcvrd:     self.init()
Oct 11 06:55:09.439319 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1961, in init
Oct 11 06:55:09.439354 sonic ERR pmon#xcvrd:     self.retry_eeprom_set = self._post_port_sfp_info_and_dom_thr_to_db_once(port_mapping_data, self.xcvr_table_helper, self.main_thread_stop_event)
Oct 11 06:55:09.439376 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1916, in _post_port_sfp_info_and_dom_thr_to_db_once
Oct 11 06:55:09.439376 sonic ERR pmon#xcvrd:     rc = post_port_sfp_info_to_db(logical_port_name, port_mapping, xcvr_table_helper.get_intf_tbl(asic_index), transceiver_dict, stop_event)
Oct 11 06:55:09.439612 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 336, in post_port_sfp_info_to_db
Oct 11 06:55:09.439612 sonic ERR pmon#xcvrd:     port_info_dict = _wrapper_get_transceiver_info(physical_port)
Oct 11 06:55:09.439612 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 173, in _wrapper_get_transceiver_info
Oct 11 06:55:09.439612 sonic ERR pmon#xcvrd:     return platform_chassis.get_sfp(physical_port).get_transceiver_info()
Oct 11 06:55:09.439648 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/sfp_optoe_base.py", line 23, in get_transceiver_info
Oct 11 06:55:09.439804 sonic ERR pmon#xcvrd:     api = self.get_xcvr_api()
Oct 11 06:55:09.440014 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform/sfp.py", line 538, in get_xcvr_api
Oct 11 06:55:09.440014 sonic ERR pmon#xcvrd:     self.refresh_xcvr_api()
Oct 11 06:55:09.440014 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sfp_base.py", line 458, in refresh_xcvr_api
Oct 11 06:55:09.440014 sonic ERR pmon#xcvrd:     self._xcvr_api = self._xcvr_api_factory.create_xcvr_api()
Oct 11 06:55:09.440049 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py", line 65, in create_xcvr_api
Oct 11 06:55:09.440049 sonic ERR pmon#xcvrd:     vendor_name = self._get_vendor_name()
Oct 11 06:55:09.440181 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py", line 52, in _get_vendor_name
Oct 11 06:55:09.440181 sonic ERR pmon#xcvrd:     vendor_name = name_data.decode()
Oct 11 06:55:09.440181 sonic ERR pmon#xcvrd: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x88 in position 2: invalid start byte
Oct 11 06:55:09.440373 sonic ERR pmon#xcvrd: Xcvrd: exception found at child thread SfpStateUpdateTask due to UnicodeDecodeError('utf-8', b'\x00#\x88\x00\x00\x00\x00\x00\x00\x00\x05\xff\x00\x00\x00\x00', 2, 3, 'invalid start byte')
Oct 11 06:55:09.440373 sonic ERR pmon#xcvrd: Exiting main loop as child thread raised exception!

@keboliu
Copy link
Collaborator

keboliu commented Oct 11, 2023

issue created to trace: sonic-net/sonic-buildimage#16838

@AnoopKamath
Copy link
Contributor Author

Hi @AnoopKamath, with this change we see issues on some QSFP cables, would you please take a look

Oct 11 07:06:59.624108 sonic ERR pmon#xcvrd: Exception occured at SfpStateUpdateTask thread due to UnicodeDecodeError('utf-8', b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff', 0, 1, 'invalid start byte')
Oct 11 07:06:59.624505 sonic ERR pmon#xcvrd: Traceback (most recent call last):
Oct 11 07:06:59.624769 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 2231, in run
Oct 11 07:06:59.625036 sonic ERR pmon#xcvrd:     self.task_worker(self.task_stopping_event, self.sfp_error_event)
Oct 11 07:06:59.625291 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 2043, in task_worker
Oct 11 07:06:59.625556 sonic ERR pmon#xcvrd:     self.init()
Oct 11 07:06:59.625859 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1961, in init
Oct 11 07:06:59.626111 sonic ERR pmon#xcvrd:     self.retry_eeprom_set = self._post_port_sfp_info_and_dom_thr_to_db_once(port_mapping_data, self.xcvr_table_helper, self.main_thread_stop_event)
Oct 11 07:06:59.626364 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1916, in _post_port_sfp_info_and_dom_thr_to_db_once
Oct 11 07:06:59.626615 sonic ERR pmon#xcvrd:     rc = post_port_sfp_info_to_db(logical_port_name, port_mapping, xcvr_table_helper.get_intf_tbl(asic_index), transceiver_dict, stop_event)
Oct 11 07:06:59.626861 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 336, in post_port_sfp_info_to_db
Oct 11 07:06:59.627082 sonic ERR pmon#xcvrd:     port_info_dict = _wrapper_get_transceiver_info(physical_port)
Oct 11 07:06:59.627371 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 173, in _wrapper_get_transceiver_info
Oct 11 07:06:59.627615 sonic ERR pmon#xcvrd:     return platform_chassis.get_sfp(physical_port).get_transceiver_info()
Oct 11 07:06:59.627966 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/sfp_optoe_base.py", line 23, in get_transceiver_info
Oct 11 07:06:59.628293 sonic ERR pmon#xcvrd:     api = self.get_xcvr_api()
Oct 11 07:06:59.628607 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform/sfp.py", line 538, in get_xcvr_api
Oct 11 07:06:59.628992 sonic ERR pmon#xcvrd:     self.refresh_xcvr_api()
Oct 11 07:06:59.629307 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sfp_base.py", line 458, in refresh_xcvr_api
Oct 11 07:06:59.629617 sonic ERR pmon#xcvrd:     self._xcvr_api = self._xcvr_api_factory.create_xcvr_api()
Oct 11 07:06:59.629924 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py", line 66, in create_xcvr_api
Oct 11 07:06:59.630253 sonic ERR pmon#xcvrd:     vendor_pn = self._get_vendor_part_num()
Oct 11 07:06:59.630552 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py", line 59, in _get_vendor_part_num
Oct 11 07:06:59.630909 sonic ERR pmon#xcvrd:     vendor_pn = part_num.decode()
Oct 11 07:06:59.631286 sonic ERR pmon#xcvrd: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Oct 11 07:06:59.631286 sonic ERR pmon#xcvrd: Xcvrd: exception found at child thread SfpStateUpdateTask due to UnicodeDecodeError('utf-8', b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff', 0, 1, 'invalid start byte')
Oct 11 07:06:59.631286 sonic ERR pmon#xcvrd: Exiting main loop as child thread raised exception!
Oct 11 06:55:09.429299 sonic ERR pmon#xcvrd: Exception occured at SfpStateUpdateTask thread due to UnicodeDecodeError('utf-8', b'\x00#\x88\x00\x00\x00\x00\x00\x00\x00\x05\xff\x00\x00\x00\x00', 2, 3, 'invalid start byte')
Oct 11 06:55:09.438703 sonic ERR pmon#xcvrd: Traceback (most recent call last):
Oct 11 06:55:09.439319 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 2231, in run
Oct 11 06:55:09.439319 sonic ERR pmon#xcvrd:     self.task_worker(self.task_stopping_event, self.sfp_error_event)
Oct 11 06:55:09.439319 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 2043, in task_worker
Oct 11 06:55:09.439319 sonic ERR pmon#xcvrd:     self.init()
Oct 11 06:55:09.439319 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1961, in init
Oct 11 06:55:09.439354 sonic ERR pmon#xcvrd:     self.retry_eeprom_set = self._post_port_sfp_info_and_dom_thr_to_db_once(port_mapping_data, self.xcvr_table_helper, self.main_thread_stop_event)
Oct 11 06:55:09.439376 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1916, in _post_port_sfp_info_and_dom_thr_to_db_once
Oct 11 06:55:09.439376 sonic ERR pmon#xcvrd:     rc = post_port_sfp_info_to_db(logical_port_name, port_mapping, xcvr_table_helper.get_intf_tbl(asic_index), transceiver_dict, stop_event)
Oct 11 06:55:09.439612 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 336, in post_port_sfp_info_to_db
Oct 11 06:55:09.439612 sonic ERR pmon#xcvrd:     port_info_dict = _wrapper_get_transceiver_info(physical_port)
Oct 11 06:55:09.439612 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 173, in _wrapper_get_transceiver_info
Oct 11 06:55:09.439612 sonic ERR pmon#xcvrd:     return platform_chassis.get_sfp(physical_port).get_transceiver_info()
Oct 11 06:55:09.439648 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/sfp_optoe_base.py", line 23, in get_transceiver_info
Oct 11 06:55:09.439804 sonic ERR pmon#xcvrd:     api = self.get_xcvr_api()
Oct 11 06:55:09.440014 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform/sfp.py", line 538, in get_xcvr_api
Oct 11 06:55:09.440014 sonic ERR pmon#xcvrd:     self.refresh_xcvr_api()
Oct 11 06:55:09.440014 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sfp_base.py", line 458, in refresh_xcvr_api
Oct 11 06:55:09.440014 sonic ERR pmon#xcvrd:     self._xcvr_api = self._xcvr_api_factory.create_xcvr_api()
Oct 11 06:55:09.440049 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py", line 65, in create_xcvr_api
Oct 11 06:55:09.440049 sonic ERR pmon#xcvrd:     vendor_name = self._get_vendor_name()
Oct 11 06:55:09.440181 sonic ERR pmon#xcvrd:   File "/usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py", line 52, in _get_vendor_name
Oct 11 06:55:09.440181 sonic ERR pmon#xcvrd:     vendor_name = name_data.decode()
Oct 11 06:55:09.440181 sonic ERR pmon#xcvrd: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x88 in position 2: invalid start byte
Oct 11 06:55:09.440373 sonic ERR pmon#xcvrd: Xcvrd: exception found at child thread SfpStateUpdateTask due to UnicodeDecodeError('utf-8', b'\x00#\x88\x00\x00\x00\x00\x00\x00\x00\x05\xff\x00\x00\x00\x00', 2, 3, 'invalid start byte')
Oct 11 06:55:09.440373 sonic ERR pmon#xcvrd: Exiting main loop as child thread raised exception!

Hi @keboliu,

Can you try replacing decode function to str(data, 'UTF-8') and check?

    • vendor_name = str(name_data, 'UTF-8')
    • vendor_name = name_data.decode()
    • vendor_pn = str(part_num, 'UTF-8')
    • vendor_pn = part_num.decode()

@vmittal-msft
Copy link

@AnoopKamath why do we not have this as default ?

@vmittal-msft
Copy link

@AnoopKamath please check this issue - sonic-net/sonic-buildimage#16838

@AnoopKamath
Copy link
Contributor Author

@AnoopKamath why do we not have this as default ?

I have not seen any xcvrd issue on my setup with decode(). Trying to check if I can trigger this.
I had used str(data, 'UTF-8') before, but had some issues writing the mock test for it.
@keboliu can check using either str(data, 'UTF-8') or new_data = data.decode('utf-8') if it helps.

@AnoopKamath
Copy link
Contributor Author

Hi @keboliu, @vmittal-msft,

Please verify the fix #406 for sonic-net/sonic-buildimage#16838

@StormLiangMS
Copy link

@mihirpat1 @prgeor this is more like a feature, why cherry pick to old branch?

@StormLiangMS
Copy link

@AnoopKamath have you tested this PR with 202305 image?

@AnoopKamath
Copy link
Contributor Author

@AnoopKamath have you tested this PR with 202305 image?

@StormLiangMS, Yes tested and verified with 202305 image

root@sonic:/home/cisco# show version

SONiC Software Version: SONiC.azure_cisco_202305.0-dirty-20231022.205906
SONiC OS Version: 11

root@sonic:/home/cisco# sfputil firmware target Ethernet176 2
Target Mode set to 2

root@sonic:/home/cisco# sfputil show fwversion Ethernet176
Image A Version: 0.3.5
Image B Version: 0.3.6
Factory Image Version: 0.0.0
Running Image: A
Committed Image: A
Active Firmware: 0.3.5
Inactive Firmware: 0.3.6

root@sonic:/home/cisco# sfputil show eeprom-hexdump -p Ethernet176
EEPROM hexdump for port Ethernet176 page 0h
        Lower page 0h
        00000000 18 50 00 07 00 00 00 00  00 00 00 00 00 00 18 a8 |.P..............|
        00000010 80 e8 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000020 00 00 00 00 00 01 00 00  03 00 00 00 00 00 00 00 |................|
        00000030 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000040 02 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000050 00 00 00 00 00 04 4f 04  44 01 50 04 44 01 ff 00 |......O.D.P.D...|
        00000060 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        00000070 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|

        Upper page 0h
        00000080 18 43 72 65 64 6f 20 20  20 20 20 20 20 20 20 20 |.Credo          |
        00000090 20 9a ad ca 43 41 43 38  31 58 33 32 31 4d 32 4d | ...CAC81X321M2M|
        000000a0 43 31 4d 53 20 20 42 44  38 44 34 31 58 33 33 30 |C1MS  BD8D41X330|
        000000b0 31 30 30 31 47 20 32 33  30 37 31 39 20 20 20 20 |1001G 230719    |
        000000c0 20 20 20 20 20 20 20 20  40 18 41 23 00 00 00 00 |        @.A#....|
        000000d0 00 00 f0 03 0c 00 00 00  00 00 00 00 00 00 a3 00 |................|
        000000e0 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
        000000f0 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|

root@sonic:/home/cisco# sfputil firmware download Ethernet176 AEC_Camano_YCable_SE_LR_AEC_MS_0.5.0_20230922.bin
CDB: Starting firmware download
Downloading ...  [####################################]  100%
CDB: firmware download complete
Firmware download complete success
Total download Time: 0:01:56.493783
root@sonic:/home/cisco# sfputil firmware run Ethernet176
Running firmware: Non-hitless Reset to Inactive Image
Firmware run in mode=0 success
root@sonic:/home/cisco# sfputil show fwversion Ethernet176
Image A Version: 0.3.5
Image B Version: 0.5.0
Factory Image Version: 0.0.0
Running Image: B
Committed Image: A
Active Firmware: 0.5.0
Inactive Firmware: 0.3.5

StormLiangMS pushed a commit that referenced this pull request Oct 23, 2023
* Add vendor specific consts

* replace vendor classes

* Vendor specific CMIS api file

* Vendor specific codes

* Vendor specific mem_mps file

* Address review comments

1. Cleanup unnecessary imports 
2. update the comments

* Update aec_800g.py

* Address review comments

Add string macros for offset and length to get vendor name and part number

* Add Credo vendor class packages

* Update xcvr_api_factory.py

* Create test_xcvr_api_factory.py

Add pytest for xcvc_api_factory file

* Update test_xcvr_api_factory.py

* Add test for create_xcvr_api

* Update test_xcvr_api_factory.py
jaganbal-a pushed a commit to jaganbal-a/for_PM_stats that referenced this pull request Oct 26, 2023
* Add vendor specific consts

* replace vendor classes

* Vendor specific CMIS api file

* Vendor specific codes

* Vendor specific mem_mps file

* Address review comments

1. Cleanup unnecessary imports 
2. update the comments

* Update aec_800g.py

* Address review comments

Add string macros for offset and length to get vendor name and part number

* Add Credo vendor class packages

* Update xcvr_api_factory.py

* Create test_xcvr_api_factory.py

Add pytest for xcvc_api_factory file

* Update test_xcvr_api_factory.py

* Add test for create_xcvr_api

* Update test_xcvr_api_factory.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants