-
Notifications
You must be signed in to change notification settings - Fork 844
Config/Show commands (newly added) for BMC, leak detection, policy #4417
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
fc52f50
BMC related additional leak config/show commands
judyjoseph 6ced26f
Merge branch 'sonic-net:master' into bmc_impl
judyjoseph f946714
[show/platform, tests]: Fix E501, E402, F401 lint errors
judyjoseph bc06b67
[show/platform, tests]: Merge LIQUID_COOLING_DEVICE into LIQUID_COOLI…
judyjoseph 5e2dbfd
Add new subcommands power-on-delay and shutdown-timeout
judyjoseph df3e2d0
comments update
judyjoseph 25143c3
[config/chassis_modules]: Align with latest HLD - graceful_shutdown_t…
judyjoseph 29b8946
[config/chassis_modules]: Fix int types and rename shutdown timeout f…
judyjoseph 86a5dc7
Remove power_on_delay with -1 dependency and just use admin_status to…
judyjoseph 681e4b1
Fix test failures
judyjoseph 9a878f2
Minor updates to Error logs
judyjoseph f40d07c
Fixes to show commands + support for CHASSIS_MODULE_INFO table
judyjoseph c007fd4
Merge branch 'master' into bmc_impl
judyjoseph 70ad456
Flake8 errors
judyjoseph 223d392
Fix test failures
judyjoseph cda4c87
Change the key in LEAK_CONTROL_POLICY to policy
judyjoseph 4d2a549
The updated pmon doc, we are not having the default -1. Hence updated…
judyjoseph 569a165
flake error fix
judyjoseph e3fac0a
Minor fixes
judyjoseph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import click | ||
| import utilities_common.cli as clicommon | ||
|
|
||
| LEAK_CONTROL_POLICY_TABLE = 'LEAK_CONTROL_POLICY' | ||
| LEAK_CONTROL_POLICY_KEY = 'policy' | ||
|
|
||
| VALID_POLICIES = ('system', 'rack_mgr') | ||
| VALID_SEVERITIES = ('critical', 'minor') | ||
| VALID_ACTIONS = ('syslog_only', 'graceful_shutdown', 'power_off') | ||
|
|
||
| POLICY_FIELD_MAP = { | ||
| 'system': 'system_leak_policy', | ||
| 'rack_mgr': 'rack_mgr_leak_policy', | ||
| } | ||
|
|
||
| ACTION_FIELD_MAP = { | ||
| ('system', 'critical'): 'system_critical_leak_action', | ||
| ('system', 'minor'): 'system_minor_leak_action', | ||
| ('rack_mgr', 'critical'): 'rack_mgr_critical_alert_action', | ||
| ('rack_mgr', 'minor'): 'rack_mgr_minor_alert_action', | ||
| } | ||
|
|
||
|
|
||
| @click.group('liquid-cool') | ||
| def liquid_cool(): | ||
| """Liquid cooling configuration commands""" | ||
| pass | ||
|
|
||
|
|
||
| @liquid_cool.command('leak-control') | ||
| @clicommon.pass_db | ||
| @click.argument('policy_type', metavar='[system|rack_mgr]', type=click.Choice(VALID_POLICIES)) | ||
| @click.argument('state', metavar='[enabled|disabled]', type=click.Choice(['enabled', 'disabled'])) | ||
| def leak_control(db, policy_type, state): | ||
| """Enable or disable system/rack-manager leak policy enforcement""" | ||
| field = POLICY_FIELD_MAP[policy_type] | ||
| db.cfgdb.mod_entry(LEAK_CONTROL_POLICY_TABLE, LEAK_CONTROL_POLICY_KEY, {field: state}) | ||
| click.echo(f"Leak control policy for '{policy_type}' set to '{state}'") | ||
|
|
||
|
|
||
| @liquid_cool.command('leak-action') | ||
| @clicommon.pass_db | ||
| @click.argument('policy_type', metavar='[system|rack_mgr]', type=click.Choice(VALID_POLICIES)) | ||
| @click.argument('severity', metavar='[critical|minor]', type=click.Choice(VALID_SEVERITIES)) | ||
| @click.argument('action', metavar='[syslog_only|graceful_shutdown|power_off]', type=click.Choice(VALID_ACTIONS)) | ||
| def leak_action(db, policy_type, severity, action): | ||
| """Configure the action taken when a critical/minor leak event is detected""" | ||
| field = ACTION_FIELD_MAP[(policy_type, severity)] | ||
| db.cfgdb.mod_entry(LEAK_CONTROL_POLICY_TABLE, LEAK_CONTROL_POLICY_KEY, {field: action}) | ||
| click.echo(f"Leak action for '{policy_type}' '{severity}' events set to '{action}'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.