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

Introduce chassisd to monitor status of cards on chassis #97

Merged
merged 12 commits into from
Nov 10, 2020

Conversation

mprabhu-nokia
Copy link
Contributor

@mprabhu-nokia mprabhu-nokia commented Oct 1, 2020

Introducing chassisd to monitor status of cards on a modular chassis

HLD: sonic-net/SONiC#646

-What I did
Introducing a new process to monitor status of control, line and fabric cards.

-How I did it
Support of monitoring of line-cards and fabric-cards. This runs in the main thread periodically.
It updates the STATE_DB with the status information. 'show platform chassis-modules' will read from the STATE_DB

Support of handling configuration of moving the cards toadministratively up/down state. The handling happens as part
of a separate thread that waits on select() for config event from a CHASSIS_MODULE table in CONFIG_DB.

-How I verified it

Support of monitoring of line-cards and fabric-cards. This
runs in the main thread periodically.

Support of handling configuration of moving the cards to
administratively up/down state. The handling happens as part
of a separate thread that waits on select() for config event.
@lgtm-com
Copy link

lgtm-com bot commented Oct 1, 2020

This pull request introduces 3 alerts when merging e855529 into 1aaffcc - view on LGTM.com

new alerts:

  • 2 for Unused import
  • 1 for Unreachable code

Additional changes to config-handling as part of another process.
@lgtm-com
Copy link

lgtm-com bot commented Oct 14, 2020

This pull request introduces 4 alerts when merging d82046b into 8507085 - view on LGTM.com

new alerts:

  • 2 for Unused import
  • 1 for Unused local variable
  • 1 for Unreachable code

@lguohan
Copy link
Contributor

lguohan commented Oct 14, 2020

can we start with python3, also what is the unit test that can be used to test it?

Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add unit tests for chassisd

@lgtm-com
Copy link

lgtm-com bot commented Oct 21, 2020

This pull request introduces 5 alerts when merging 2a1f40b into 61ed24e - view on LGTM.com

new alerts:

  • 2 for Unused local variable
  • 2 for Unused import
  • 1 for Unreachable code

Separated chassisd tasks into ModuleUpdater and ModuleConfigManager
classes. UTs are run using Mock platform, chassis and modules on
the above classes
@mprabhu-nokia
Copy link
Contributor Author

Please also add unit tests for chassisd

Added UT interfacing with Mock classes.

sonic-chassisd/scripts/chassisd Outdated Show resolved Hide resolved
sonic-chassisd/pytest.ini Outdated Show resolved Hide resolved
@mprabhu-nokia
Copy link
Contributor Author

mprabhu-nokia commented Oct 28, 2020

plugins: cov-2.6.0
collected 8 items

tests/test_chassisd.py ........                                                                                                                                                        [100%]

----------- coverage: platform linux, python 3.7.3-final-0 -----------
Name               Stmts   Miss  Cover
--------------------------------------
scripts/chassisd     177     64    64%
Coverage HTML written to dir htmlcov
Coverage XML written to file coverage.xml

The missing coverage is mainly around the area of:

  • init, signal handling of the main loop
  • async subscription handling of the config DB. select() handling etc.

However, the functional area has been separated to classes and fully covered.

@jleveque
Copy link
Contributor

@liat-grozovik: Can someone from your team please review?

@Staphylo: Can you also review, please?

sonic-chassisd/scripts/chassisd Show resolved Hide resolved
sonic-chassisd/scripts/chassisd Show resolved Hide resolved
sonic-chassisd/scripts/chassisd Outdated Show resolved Hide resolved
sonic-chassisd/scripts/chassisd Show resolved Hide resolved
sonic-chassisd/scripts/chassisd Outdated Show resolved Hide resolved
sonic-chassisd/scripts/chassisd Outdated Show resolved Hide resolved
@keboliu
Copy link
Collaborator

keboliu commented Nov 6, 2020

I think this daemon should only for the chassis system, so how to prevent it from running on a 1U system?

@mprabhu-nokia
Copy link
Contributor Author

I think this daemon should only for the chassis system, so how to prevent it from running on a 1U system?

With the current implementation, the process will start but gracefully exit if not running for modular chassis. This is not part of critical processes, so should not affect PMON container.
Going forward, one option would be for vendors to add skip_chassisd in their pmon_daemon_control.json file for 1 RU SKUs.

@jleveque jleveque changed the title Chassisd to monitor status of cards on chassis Introduce chassisd to monitor status of cards on chassis Nov 10, 2020
@jleveque jleveque merged commit a14c2bb into sonic-net:master Nov 10, 2020
vdahiya12 pushed a commit to vdahiya12/sonic-platform-daemons that referenced this pull request Apr 4, 2022
Change the following key names:

- hardwarerev -> hardware_rev
- serialnum -> serial
- manufacturename -> manufacturer
- modelname -> model
- Connector -> connector

Also fix a typo and some return types in docstrings
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.

5 participants