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

Mark sub-port interfaces as invalid ports in xcvrd #412

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

mihirpat1
Copy link
Contributor

@mihirpat1 mihirpat1 commented Dec 14, 2023

Description

Currently, the CmisManagerTask thread crashes with the below traceback when subport interfaces are created.

E               Dec  4 06:47:53.773502 dut-sonic ERR pmon#xcvrd[197]: Exception occured at CmisManagerTask thread due to KeyError(None)
E               
E               Dec  4 06:47:53.777609 dut-sonic ERR pmon#xcvrd[197]: Traceback (most recent call last):
E               
E               Dec  4 06:47:53.777609 dut-sonic ERR pmon#xcvrd[197]:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1717, in run
E               
E               Dec  4 06:47:53.777724 dut-sonic ERR pmon#xcvrd[197]:     self.task_worker()
E               
E               Dec  4 06:47:53.777724 dut-sonic ERR pmon#xcvrd[197]:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1427, in task_worker
E               
E               Dec  4 06:47:53.778242 dut-sonic ERR pmon#xcvrd[197]:     self.port_dict[lport]['host_tx_ready'] = self.get_host_tx_status(lport)
E               
E               Dec  4 06:47:53.778647 dut-sonic ERR pmon#xcvrd[197]:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 1299, in get_host_tx_status
E               
E               Dec  4 06:47:53.778942 dut-sonic ERR pmon#xcvrd[197]:     state_port_tbl = self.xcvr_table_helper.get_state_port_tbl(asic_index)
E               
E               Dec  4 06:47:53.778942 dut-sonic ERR pmon#xcvrd[197]:   File "/usr/local/lib/python3.9/dist-packages/xcvrd/xcvrd.py", line 2631, in get_state_port_tbl
E               
E               Dec  4 06:47:53.779013 dut-sonic ERR pmon#xcvrd[197]:     return self.state_port_tbl[asic_id]
E               
E               Dec  4 06:47:53.779370 dut-sonic ERR pmon#xcvrd[197]: KeyError: None
E               
E               Dec  4 06:47:53.779580 dut-sonic ERR pmon#xcvrd[197]: Xcvrd: exception found at child thread CmisManagerTask due to KeyError(None)
E               
E               Dec  4 06:47:53.779580 dut-sonic ERR pmon#xcvrd[197]: Exiting main loop as child thread raised exception!
E               

The above traceback is also seen while executing the sonic-mgmt sub_port_interfaces/test_show_subinterface.py::test_subinterface_status[port] testcase.

Motivation and Context

As part of dynamic sub-port interfaces creation (sub-port interfaces such as Ethernet1.X, Ethernet2.X are created), the STATE_DB gets a SET event and hence, CmisManagerTask handles the event.
However, since the get_port_mapping function (responsible for updating port relevant data such as asic_id, logical_to_asic etc) is only called during xcvrd boot-up, asic_id remains undefined for the sub-port interfaces ports as they are dynamically created.
Due to this, CmisManagerTask thread crashes since the asic_index is None for the sub-port interfaces ports.

state_port_tbl = self.xcvr_table_helper.get_state_port_tbl(asic_index)

In order to fix this issue, I am planning to mark the sub-port interfaces (port name contains '.') as invalid in port_mapping.py file since xcvrd does not need to handle such ports.

How Has This Been Tested?

Verified that xcvrd remains stable after sub-port interfaces are created dynamically.
Also ensure that the sonic-mgmt sub_port_interfaces/test_show_subinterface.py::test_subinterface_status[port] testcase is passing now.

sub_port_interfaces/test_show_subinterface.py::test_subinterface_status[port] PASSED                                                         [100%]

================================================================= warnings summary =================================================================
../../../../usr/local/lib/python3.8/dist-packages/_yaml/__init__.py:18
  /usr/local/lib/python3.8/dist-packages/_yaml/__init__.py:18: DeprecationWarning: The _yaml extension module is now located at yaml._yaml and its location is subject to change.  To use the LibYAML-based parser and emitter, import from `yaml`: `from yaml import CLoader as Loader, CDumper as Dumper`.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
--------------------------------------------- generated xml file: /var/src/workspace/tests/logs/tr.xml ---------------------------------------------
===================================================== 1 passed, 1 warning in 373.01s (0:06:13) =====================================================
INFO:root:Can not get Allure report URL. Please check logs

Additional Information (Optional)

MSFT ADO - 25745106

@prgeor
Copy link
Collaborator

prgeor commented Dec 15, 2023

@abdosi is there a better way to check for sub interface?

@prgeor
Copy link
Collaborator

prgeor commented Dec 15, 2023

@Junchao-Mellanox @keboliu could you review?

@mlok-nokia
Copy link
Contributor

@snider-nokia Please help to review this PR

@prgeor prgeor merged commit b2b8905 into sonic-net:master Dec 15, 2023
4 checks passed
@mihirpat1
Copy link
Contributor Author

@StormLiangMS, @yxieca - Can you please help in merging this to 202205, 202305 and 202311?
MSFT ADO - 25745106

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #413

mssonicbld pushed a commit that referenced this pull request Dec 18, 2023
mssonicbld pushed a commit to mssonicbld/sonic-platform-daemons that referenced this pull request Jan 25, 2024
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202205: #425

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202311: #426

prgeor pushed a commit to mssonicbld/sonic-platform-daemons that referenced this pull request Feb 15, 2024
@liushilongbuaa
Copy link
Contributor

Cherry-pick PR to 202311: #426

PR is blocked by EasyCLA. @prgeor maybe it is caused by your force push.

mssonicbld pushed a commit to mssonicbld/sonic-platform-daemons that referenced this pull request Mar 4, 2024
mssonicbld pushed a commit that referenced this pull request Mar 4, 2024
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.

7 participants