Skip to content

[autorestart] Move disable_container_autorestart fixtures to pre_test and post_test#2371

Merged
bingwang-ms merged 3 commits intosonic-net:masterfrom
bingwang-ms:move_disable_autorestart_to_pretest
Oct 21, 2020
Merged

[autorestart] Move disable_container_autorestart fixtures to pre_test and post_test#2371
bingwang-ms merged 3 commits intosonic-net:masterfrom
bingwang-ms:move_disable_autorestart_to_pretest

Conversation

@bingwang-ms
Copy link
Copy Markdown
Collaborator

Description of PR

Summary:
The update of autorestart feature will reload snmp container. To save unnecessary reload, the disable_container_autorestart fixture is moved to pre_test as a test case, and states are saved in /tmp path in sonic-mgnt container. All autorestart features are restored in post_test.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

This PR is to improve the autouse fixture disable_container_autorestart.

How did you do it?

  1. The autouse fixture disable_container_autorestart is removed;
  2. Add a new test case in pretest.py to disable autorestart for all containers, and save original states in /tmp path in sonic-mgnt container;
  3. Add a new test case in posttest.py to restore autorestart feature for all containers;
  4. config_db.json is updated after disable and restore autorestart features, so that the state will keep even after config reload or reboot.

How did you verify/test it?

Verified on Arista-7260cx3-2.
Default states:

admin@str-7260cx3-acs-2:~$ show feature autorestart 
Feature     AutoRestart
----------  -------------
acms        enabled
bgp         enabled
database    disabled
dhcp_relay  enabled
lldp        enabled
pmon        enabled
radv        enabled
snmp        enabled
swss        enabled
syncd       enabled
teamd       enabled
telemetry   enabled

Autorestart features are disabled for all containers after running test_disable_container_autorestart and states are backed up.

admin@str-7260cx3-acs-2:~$ show feature autorestart 
Feature     AutoRestart
----------  -------------
acms        disabled
bgp         disabled
database    disabled
dhcp_relay  disabled
lldp        disabled
pmon        disabled
radv        disabled
snmp        disabled
swss        disabled
syncd       disabled
teamd       disabled
telemetry   disabled

bingwang@df9bc4cdf9b3:/data/Networking-acs-sonic-mgmt$ cat /tmp/autorestart_state_str-7260cx3-acs-2.json 
{"lldp": "enabled", "bgp": "enabled", "pmon": "enabled", "database": "disabled", "radv": "enabled", "telemetry": "enabled", "snmp": "enabled", "acms": "enabled", "dhcp_relay": "enabled", "teamd": "enabled", "syncd": "enabled", "swss": "enabled"}

Autorestart features are disabled for all containers after running test_restore_container_autorestart

admin@str-7260cx3-acs-2:~$ show feature autorestart 
Feature     AutoRestart
----------  -------------
acms        enabled
bgp         enabled
database    disabled
dhcp_relay  enabled
lldp        enabled
pmon        enabled
radv        enabled
snmp        enabled
swss        enabled
syncd       enabled
teamd       enabled
telemetry   enabled

Any platform specific information?

No.

Supported testbed topology if it's a new test case?

No.

Documentation

No.

restore in post_test

The update of autorestart feature will reload snmp container. To save
unnecessary reload, the disable_autorestart_feature is moved to
pre_test, and states are saved in /tmp path in sonic-mgnt container. All
autorestart features are restored in post_test.

Signed-off-by: bingwang <[email protected]>
@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 20, 2020

This pull request fixes 1 alert when merging 265981f into 7d140d5 - view on LGTM.com

fixed alerts:

  • 1 for Unused import


assert True

def test_restore_container_autorestart(duthost, request):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The request fixture is not required.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. I forget to cleanup.

if ptfhost:
ptfhost.shell("if [[ -f /etc/rsyslog.conf ]]; then mv /etc/rsyslog.conf /etc/rsyslog.conf.orig; uniq /etc/rsyslog.conf.orig > /etc/rsyslog.conf; fi", executable="/bin/bash")

def test_disable_container_autorestart(duthost, request):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The request fixture is not required.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

Signed-off-by: bingwang <[email protected]>
@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 20, 2020

This pull request fixes 1 alert when merging d2d75a0 into f2922bf - view on LGTM.com

fixed alerts:

  • 1 for Unused import

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Oct 21, 2020

This pull request fixes 1 alert when merging 5fab76b into 18a1540 - view on LGTM.com

fixed alerts:

  • 1 for Unused import

@bingwang-ms bingwang-ms merged commit de5df94 into sonic-net:master Oct 21, 2020
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…aemon] advance submodule head (sonic-net#11652)

linkmgrd:
* 17240f1 2022-08-02 | [active-active] Update unhealthy label definition (sonic-net#102) (HEAD -> 202205, github/202205) [Jing Zhang]
* 99a7b4b 2022-07-28 | Update the definition of healthy label (sonic-net#99) [Jing Zhang]
* 551144b 2022-08-08 | [Active-Standby]Remove unnecessary `handleMuxWaitTimeout` logs (sonic-net#100) [Jing Zhang]

utilities:
* 8cbbe4f 2022-08-08 | [crm] add checking for CRM interval range (sonic-net#2293) (HEAD -> 202205, github/202205) [Andriy Yurkiv]
* 7dac7a7 2022-08-03 | Fix version in db_migrator  for `PORT_QOS_MAP|global` (#2289) [bingwang-ms]
* e14f0c9 2022-08-03 | Add override testcase to verify removal (#2288) [jingwenxie]
* 61ea21d 2022-07-29 | [watermarkstat] Fix CLI script for unconfigured PG counters (sonic-net#2239) [Nazarii Hnydyn]
* e206e2d 2022-05-19 | [portconfig] Allow to configure interface mtu for physical ports only [Sudharsan Dhamal Gopalarathnam]
* 9751479 2022-08-01 | Transfer organization from Azure to sonic-net (sonic-net#2285) [Liu Shilong]
* 218b175 2022-07-29 | [202205][counters] Keep counters cache in a single directory (sonic-net#2280) [Stepan Blyshchak]

swss:
* d772a70 2022-08-09 | [muxorch] return true if the nbr IP is in the skip_neighbors list (sonic-net#2407) (HEAD -> 202205) [Nikola Dancejic]
* a3ac275 2022-08-08 | [EVPN]Modified tunnel creation logic when creating tunnel in VRF-VNI map creation flow (sonic-net#2404) (HEAD -> 202205) [Sudharsan Dhamal Gopalarathnam]
* 67c1376 2022-08-09 | [QoS] Fix issue: the WRED profile can not be set if current min > new max or current max < new min (sonic-net#2379) [Stephen Sun]
* 0295a35 2022-07-21 | [Buffer Orch] Support removing buffer port profile list (sonic-net#2371) [Stephen Sun]
* 450e9ec 2022-07-07 | Fix: missing sonic-db-cli in docker-sonic-vs image (sonic-net#2357) [Qi Luo]
* c1c1147 2022-06-02 | Purge package sonic-db-cli which depends on libswsscommon (sonic-net#2308) [Qi Luo]

swss-common:
* 749cd6f 2022-07-21 | Fix PING database command not backward compatible with python version issue. (sonic-net#650) (HEAD -> 202205) [Hua Liu]
* 4fa7484 2022-06-27 | Fix: missing sonic-db-cli in docker-sonic-vs image (sonic-net#640) [Qi Luo]
* 4d0dc7a 2022-06-23 | [sonic-cli] Fix sonic-db-cli output format not backward compatible with python version issue. (sonic-net#631) [Hua Liu]
* c5573fe 2022-06-03 | Purge package sonic-db-cli which depends on libswsscommon (sonic-net#628) [Qi Luo]
* 0ade483 2022-08-02 | Add docker-mux related table names  (sonic-net#627) [Jing Zhang]
* 675d793 2022-05-26 | Re-write sonic-db-cli with c++ for sonic startup performance issue (sonic-net#607) [Hua Liu]
* 1155773 2022-08-01 | Transfer organization from Azure to sonic-net (sonic-net#661) (github/202205) [Liu Shilong]

sairedis:
* c62a453 2022-06-03 | Purge package sonic-db-cli which depends on libswsscommon (sonic-net#1057) (HEAD -> 202205) [Qi Luo]
* 8be9292 2022-07-20 | [syncd] Remove error message when tryTranslateVidToRid fails (sonic-net#1048) [Kamil Cudnik]
* eb552ee 2022-08-01 | Transfer organization from Azure to sonic-net (sonic-net#1099) (github/202205) [Liu Shilong]

platform-daemon:
* d150229 2022-08-11 | Correct the peer forwarding state table (sonic-net#281) (HEAD -> 202205) [Longxiang Lyu]
* 9507e6c 2022-08-10 | [ycabled] remove some spurious logs (sonic-net#282) (HEAD -> 202205) [vdahiya12]

Signed-off-by: Ying Xie <[email protected]>
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
Update sonic-utilities submodule pointer to include the following:
[202205][subinterface]Added additional checks in portchannel and subinterface commands (sonic-net#2371)
[202205] Use warm-boot infrastructure for fast-boot (sonic-net#2365)
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
Update sonic-utilities submodule pointer to include the following:
* b739efc [subinterface]Added additional checks in portchannel and subinterface commands (sonic-net#2345) ([sonic-net#2371](sonic-net/sonic-utilities#2371))
* d01153a Use warm-boot infrastructure for fast-boot ([sonic-net#2365](sonic-net/sonic-utilities#2365))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants