-
Notifications
You must be signed in to change notification settings - Fork 48
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
Add KillProcess gNOI API #213
Add KillProcess gNOI API #213
Conversation
Could you add this PR link into HLD PR description? add a code PR table there. #Closed |
test/utils.py
Outdated
|
||
def gnoi_restart_process(valid): | ||
if not valid: | ||
json_data = '{"name": "snmp", "restart": invalid}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does invalid exist in boolean? or you may want ot use string instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid does not exist in boolean, but this is meant to test a failure scenario with invalid option passed. For example, this is the expected outcome when running gnoi_client with an invalid option passed:
root@str-s6100-acs-1:/# gnoi_client -target 127.0.0.1:50052 -logtostderr -insecure -rpc KillProcess -jsonin '{"name": "snmp", "restart": invalid}'
Kill Process with optional restart
panic: invalid character 'i' looking for beginning of value
goroutine 1 [running]:
main.killProcess(0xb4cbc0, 0xc00027e150, 0xb47980, 0xc00007f240)
/sonic/src/sonic-gnmi/gnoi_client/gnoi_client.go:120 +0x2b4
main.main()
/sonic/src/sonic-gnmi/gnoi_client/gnoi_client.go:61 +0x7dd
test/utils.py
Outdated
@@ -188,6 +188,25 @@ def gnoi_reboot(method, delay, message): | |||
ret, msg = run_cmd(cmd) | |||
return ret, msg | |||
|
|||
def gnoi_kill_process(): | |||
path = os.getcwd() | |||
json_data = '{"name": "snmp"}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you use fixed data for kill process? I think gnoi_kill_process and gnoi_restart_process should be the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, changed to match gnoi_restart_process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
### Type of change - [x] Test case(new/improvement) ### Approach #### What is the motivation for this PR? GNOI KillProcess API introduced in this PR: sonic-net/sonic-gnmi#213 requires thorough E2E tests of supported services, and possible failure scenarios #### How did you do it? Add E2E tests #### How did you verify/test it? Run E2E test on physical DUT ### Documentation Confirmed passing on latest master: ---------------------------------------------------------------------------------- live log teardown ----------------------------------------------------------------------------------- 22:57:39 gu_utils.rollback L0247 INFO | Commands: config rollback test_setup_checkpoint 22:58:06 conftest.core_dump_and_config_check L2165 INFO | Dumping Disk and Memory Space informataion after test on str3-s6100-acs-6 22:58:09 conftest.core_dump_and_config_check L2169 INFO | Collecting core dumps after test on str3-s6100-acs-6 22:58:10 conftest.core_dump_and_config_check L2186 INFO | Collecting running config after test on str3-s6100-acs-6 22:58:13 conftest.core_dump_and_config_check L2317 INFO | Core dump and config check passed for test_gnoi_killprocess.py =================================================================================== warnings summary =================================================================================== ../../../../usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236 /usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated "class": algorithms.Blowfish, -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ------------------------------------------------------------ generated xml file: /var/src/sonic-mgmt-int/tests/logs/tr.xml ------------------------------------------------------------- -------------------------------------------------------------------------------- live log sessionfinish -------------------------------------------------------------------------------- 22:58:13 __init__.pytest_terminal_summary L0067 INFO | Can not get Allure report URL. Please check logs ====================================================================== 16 passed, 1 warning in 375.00s (0:06:14) =======================================================================
…12478) ### Type of change - [x] Test case(new/improvement) ### Approach #### What is the motivation for this PR? GNOI KillProcess API introduced in this PR: sonic-net/sonic-gnmi#213 requires thorough E2E tests of supported services, and possible failure scenarios #### How did you do it? Add E2E tests #### How did you verify/test it? Run E2E test on physical DUT ### Documentation Confirmed passing on latest master: ---------------------------------------------------------------------------------- live log teardown ----------------------------------------------------------------------------------- 22:57:39 gu_utils.rollback L0247 INFO | Commands: config rollback test_setup_checkpoint 22:58:06 conftest.core_dump_and_config_check L2165 INFO | Dumping Disk and Memory Space informataion after test on str3-s6100-acs-6 22:58:09 conftest.core_dump_and_config_check L2169 INFO | Collecting core dumps after test on str3-s6100-acs-6 22:58:10 conftest.core_dump_and_config_check L2186 INFO | Collecting running config after test on str3-s6100-acs-6 22:58:13 conftest.core_dump_and_config_check L2317 INFO | Core dump and config check passed for test_gnoi_killprocess.py =================================================================================== warnings summary =================================================================================== ../../../../usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236 /usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated "class": algorithms.Blowfish, -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ------------------------------------------------------------ generated xml file: /var/src/sonic-mgmt-int/tests/logs/tr.xml ------------------------------------------------------------- -------------------------------------------------------------------------------- live log sessionfinish -------------------------------------------------------------------------------- 22:58:13 __init__.pytest_terminal_summary L0067 INFO | Can not get Allure report URL. Please check logs ====================================================================== 16 passed, 1 warning in 375.00s (0:06:14) =======================================================================
Why I did it
Add gNOI API support for stop and restart process.
With this addition, an external client with write permissions can request a process restart or stop. In this first phase, only a subset of services are supported: ['snmp', 'swss', 'dhcp_relay', 'radv', 'restapi', 'lldp', 'sshd']. sonic-host-services dbus rejects any other service management requests.
How I did it
How to verify it
Unit tests and E2E tests
Which release branch to backport (provide reason below if selected)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)