Restore configuration after vxlan module#18714
Merged
StormLiangMS merged 3 commits intosonic-net:masterfrom Jun 5, 2025
Merged
Restore configuration after vxlan module#18714StormLiangMS merged 3 commits intosonic-net:masterfrom
StormLiangMS merged 3 commits intosonic-net:masterfrom
Conversation
Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
11 tasks
Contributor
Author
|
@dypet could you please help review? |
mssonicbld
pushed a commit
to mssonicbld/sonic-mgmt
that referenced
this pull request
Jun 5, 2025
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]\n\n Clear current configuration and import a previous saved config DB dump\n file. <filename> : Names of configuration file(s) to load, separated by\n comma with no spaces in between\n\nOptions:\n -y, --yes\n -l, --load-sysinfo load system default information (mac,\n portmap etc) first.\n -n, --no_service_restart Do not restart docker services\n -f, --force Force config reload without system checks\n -t, --file_format [config_yang|config_db]\n specify the file format [default:\n config_db]\n -b, --bypass-lock Do reload without acquiring lock\n -h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
Collaborator
|
Cherry-pick PR to 202411: #18830 |
11 tasks
mssonicbld
pushed a commit
that referenced
this pull request
Jun 5, 2025
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]\n\n Clear current configuration and import a previous saved config DB dump\n file. <filename> : Names of configuration file(s) to load, separated by\n comma with no spaces in between\n\nOptions:\n -y, --yes\n -l, --load-sysinfo load system default information (mac,\n portmap etc) first.\n -n, --no_service_restart Do not restart docker services\n -f, --force Force config reload without system checks\n -t, --file_format [config_yang|config_db]\n specify the file format [default:\n config_db]\n -b, --bypass-lock Do reload without acquiring lock\n -h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
mssonicbld
pushed a commit
to mssonicbld/sonic-mgmt
that referenced
this pull request
Jun 6, 2025
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]\n\n Clear current configuration and import a previous saved config DB dump\n file. <filename> : Names of configuration file(s) to load, separated by\n comma with no spaces in between\n\nOptions:\n -y, --yes\n -l, --load-sysinfo load system default information (mac,\n portmap etc) first.\n -n, --no_service_restart Do not restart docker services\n -f, --force Force config reload without system checks\n -t, --file_format [config_yang|config_db]\n specify the file format [default:\n config_db]\n -b, --bypass-lock Do reload without acquiring lock\n -h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
Collaborator
|
Cherry-pick PR to 202505: #18839 |
11 tasks
mssonicbld
pushed a commit
that referenced
this pull request
Jun 6, 2025
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]\n\n Clear current configuration and import a previous saved config DB dump\n file. <filename> : Names of configuration file(s) to load, separated by\n comma with no spaces in between\n\nOptions:\n -y, --yes\n -l, --load-sysinfo load system default information (mac,\n portmap etc) first.\n -n, --no_service_restart Do not restart docker services\n -f, --force Force config reload without system checks\n -t, --file_format [config_yang|config_db]\n specify the file format [default:\n config_db]\n -b, --bypass-lock Do reload without acquiring lock\n -h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
sdszhang
pushed a commit
to sdszhang/sonic-mgmt
that referenced
this pull request
Jun 14, 2025
Code sync sonic-net/sonic-mgmt:202411 => 202412 ``` * 1f86dab (HEAD -> code-sync-202412, origin/code-sync-202412) r12f 250610:2314 - Merge remote-tracking branch 'base/202411' into code-sync-202412 |\ | * 2ba104e (base/202411) xwjiang-ms 250610:1604 - [202411] Use ceos 4.32.5M as default ceos image version (sonic-net#18878) | * 5fa5cda Longxiang Lyu 250610:0818 - [202411][dualtor-aa] Add `dualtor_aa` support to `test_nvgre_hash` (sonic-net#18883) | * afecbbf zitingguo-ms 250609:1334 - [Cherry-pick][ACL] Collect all upstream ports and Include service port into upstream neighbors in ACL tests (sonic-net#18847) | * 2e4247b pragnya-arista 250609:0632 - [202411][sonic-mgmt]Fix decap/test_subnet_decap.py::test_vlan_subnet_decap (sonic-net#18778) | * 0bfc7a8 Longxiang Lyu 250606:0943 - [dualtor-io] Fix duplication merge condition (sonic-net#18828) | * 52d3771 Zhaohui Sun 250605:2046 - Restore configuration after vxlan module (sonic-net#18714) | * 3d0922f Yaqiang Zhu 250605:2259 - [202411][pktgen] Skip test_pktgen in m0/mx/m1 (sonic-net#18822) | * 3de20a6 Zhaohui Sun 250516:1325 - Add secondary subnet config for t0 topologies (sonic-net#18399) | * bb3e0f9 Zhaohui Sun 250605:1416 - Xfail test_dir_bcast.py due to known issue on Broadcom platform (sonic-net#18787) | * 158c562 Justin Wong 250604:2058 - Add snmp lldp state check after config_reload (sonic-net#18805) | * e39c891 eyakubch 250605:0415 - bug: added fast reboot into reboot_type check (sonic-net#18551) | * 8c7dd3b Cong Hou 250604:1433 - Remove the skip/xfail for the dualtor_io link failure test (sonic-net#18712) | * 5dbc53d mssonicbld 250604:0952 - [dualtor-io] fix dualtor sniffer start slow issue (sonic-net#18758) (sonic-net#18776) | * 105cdf6 StormLiangMS 250603:0844 - [CRM AVAILABLE] To enhance the crm tests for TD3 and Cisco devices (sonic-net#18733) | * 4251b38 andywongarista 250601:1828 - Add restore_image fixture to test_multi_hop_upgrade_path (sonic-net#18230) (sonic-net#18532) | * 85a55d8 Longxiang Lyu 250528:2313 - [dualtor] Fix `test_orchagent_slb` (sonic-net#18666) | * 95a8764 Vivek Verma 250227:0656 - Fix fixture invocation order in qos_sai_base.py to prevent teardown failure. (sonic-net#17180) | * 9a72265 Justin Wong 250514:1844 - Add PTF parameter for ceos neighbor lacp multiplier (sonic-net#18215) | * cd1375d Longxiang Lyu 250529:1029 - [dualtor-io] Validate and recover active-active setup (sonic-net#18675) | * 763c1b3 Longxiang Lyu 250528:2314 - [dualtor] Fix loganalyzer not exist issue (sonic-net#18674) ```
opcoder0
pushed a commit
to opcoder0/sonic-mgmt
that referenced
this pull request
Dec 8, 2025
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]
Clear current configuration and import a previous saved config DB dump
file. <filename> : Names of configuration file(s) to load, separated by
comma with no spaces in between
Options:
-y, --yes
-l, --load-sysinfo load system default information (mac,
portmap etc) first.
-n, --no_service_restart Do not restart docker services
-f, --force Force config reload without system checks
-t, --file_format [config_yang|config_db]
specify the file format [default:
config_db]
-b, --bypass-lock Do reload without acquiring lock
-h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
AharonMalkin
pushed a commit
to AharonMalkin/sonic-mgmt
that referenced
this pull request
Dec 16, 2025
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]\n\n Clear current configuration and import a previous saved config DB dump\n file. <filename> : Names of configuration file(s) to load, separated by\n comma with no spaces in between\n\nOptions:\n -y, --yes\n -l, --load-sysinfo load system default information (mac,\n portmap etc) first.\n -n, --no_service_restart Do not restart docker services\n -f, --force Force config reload without system checks\n -t, --file_format [config_yang|config_db]\n specify the file format [default:\n config_db]\n -b, --bypass-lock Do reload without acquiring lock\n -h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
Signed-off-by: Aharon Malkin <amalkin@nvidia.com>
gshemesh2
pushed a commit
to gshemesh2/sonic-mgmt
that referenced
this pull request
Dec 21, 2025
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]\n\n Clear current configuration and import a previous saved config DB dump\n file. <filename> : Names of configuration file(s) to load, separated by\n comma with no spaces in between\n\nOptions:\n -y, --yes\n -l, --load-sysinfo load system default information (mac,\n portmap etc) first.\n -n, --no_service_restart Do not restart docker services\n -f, --force Force config reload without system checks\n -t, --file_format [config_yang|config_db]\n specify the file format [default:\n config_db]\n -b, --bypass-lock Do reload without acquiring lock\n -h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
venu-nexthop
pushed a commit
to venu-nexthop/sonic-mgmt
that referenced
this pull request
Jan 13, 2026
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]\n\n Clear current configuration and import a previous saved config DB dump\n file. <filename> : Names of configuration file(s) to load, separated by\n comma with no spaces in between\n\nOptions:\n -y, --yes\n -l, --load-sysinfo load system default information (mac,\n portmap etc) first.\n -n, --no_service_restart Do not restart docker services\n -f, --force Force config reload without system checks\n -t, --file_format [config_yang|config_db]\n specify the file format [default:\n config_db]\n -b, --bypass-lock Do reload without acquiring lock\n -h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
gshemesh2
pushed a commit
to gshemesh2/sonic-mgmt
that referenced
this pull request
Jan 26, 2026
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]\n\n Clear current configuration and import a previous saved config DB dump\n file. <filename> : Names of configuration file(s) to load, separated by\n comma with no spaces in between\n\nOptions:\n -y, --yes\n -l, --load-sysinfo load system default information (mac,\n portmap etc) first.\n -n, --no_service_restart Do not restart docker services\n -f, --force Force config reload without system checks\n -t, --file_format [config_yang|config_db]\n specify the file format [default:\n config_db]\n -b, --bypass-lock Do reload without acquiring lock\n -h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
ytzur1
pushed a commit
to ytzur1/sonic-mgmt
that referenced
this pull request
Feb 2, 2026
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]\n\n Clear current configuration and import a previous saved config DB dump\n file. <filename> : Names of configuration file(s) to load, separated by\n comma with no spaces in between\n\nOptions:\n -y, --yes\n -l, --load-sysinfo load system default information (mac,\n portmap etc) first.\n -n, --no_service_restart Do not restart docker services\n -f, --force Force config reload without system checks\n -t, --file_format [config_yang|config_db]\n specify the file format [default:\n config_db]\n -b, --bypass-lock Do reload without acquiring lock\n -h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
Signed-off-by: Yael Tzur <ytzur@nvidia.com>
venu-nexthop
pushed a commit
to venu-nexthop/sonic-mgmt
that referenced
this pull request
Mar 27, 2026
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common conftest.py which is module level.
It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function backup_and_restore_config_db_on_duts in conftest.py and do config reload after config_db.json restoration.
Make sure if vxlan module run, the configuration will be restored after the test.
How did you verify/test it?
Run test_vxlan_crm on dut and check the log.
Backup config file before running tests
29/05/2025 08:48:01 conftest.restore_config_by_config_reload L0356 INFO | Prepare backup config before running tests
29/05/2025 08:48:01 duthost_utils._backup_and_restore_config L0043 INFO | Backup /etc/sonic/config_db.json to /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 08:48:01 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["cp /etc/sonic/config_db.json /host/config_db.json.before_test_module"], kwargs={}
29/05/2025 08:48:02 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "start": "2025-05-29 08:48:02.236422", "end": "2025-05-29 08:48:02.242861", "delta": "0:00:00.006439", "msg": "", "invocation": {"module_args": {"_raw_params": "cp /etc/sonic/config_db.json /host/config_db.json.before_test_module", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
Restore configuration file, then do config reload after running tests
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29
9/05/2025 09:24:15 __init__._fixture_generator_decorator L0102 INFO | -------------------- fixture fixture_setUp teardown ends --------------------
29/05/2025 09:24:15 duthost_utils._backup_and_restore_config L0049 INFO | Restore /etc/sonic/config_db.json with /host/config_db.json.before_test_module on <bound method DutHosts._Nodes._run_on_nodes of [<MultiAsicSonicHost bjw2-can-8101-2>]>
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["mv /host/config_db.json.before_test_module /etc/sonic/config_db.json"], kwargs={}
29/05/2025 09:24:15 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "", "stderr": "", "rc": 0, "cmd": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "start": "2025-05-29 09:24:15.369677", "end": "2025-05-29 09:24:15.374489", "delta": "0:00:00.004812", "msg": "", "invocation": {"module_args": {"_raw_params": "mv /host/config_db.json.before_test_module /etc/sonic/config_db.json", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "executable": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": [], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:15 conftest.restore_config_by_config_reload L0359 INFO | Restore config after running tests
29/05/2025 09:24:15 config_reload.config_reload L0145 INFO | reloading config_db
29/05/2025 09:24:15 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -h"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:24:17 base._run L0108 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell Result => {"changed": true, "stdout": "Usage: config reload [OPTIONS] [FILENAME]\n\n Clear current configuration and import a previous saved config DB dump\n file. <filename> : Names of configuration file(s) to load, separated by\n comma with no spaces in between\n\nOptions:\n -y, --yes\n -l, --load-sysinfo load system default information (mac,\n portmap etc) first.\n -n, --no_service_restart Do not restart docker services\n -f, --force Force config reload without system checks\n -t, --file_format [config_yang|config_db]\n specify the file format [default:\n config_db]\n -b, --bypass-lock Do reload without acquiring lock\n -h, -?, --help Show this message and exit.", "stderr": "", "rc": 0, "cmd": "config reload -h", "start": "2025-05-29 09:24:15.830852", "end": "2025-05-29 09:24:17.219753", "delta": "0:00:01.388901", "msg": "", "invocation": {"module_args": {"executable": "/bin/bash", "_raw_params": "config reload -h", "_uses_shell": true, "warn": false, "stdin_add_newline": true, "strip_empty_ends": true, "argv": null, "chdir": null, "creates": null, "removes": null, "stdin": null}}, "stdout_lines": ["Usage: config reload [OPTIONS] [FILENAME]", "", " Clear current configuration and import a previous saved config DB dump", " file. <filename> : Names of configuration file(s) to load, separated by", " comma with no spaces in between", "", "Options:", " -y, --yes", " -l, --load-sysinfo load system default information (mac,", " portmap etc) first.", " -n, --no_service_restart Do not restart docker services", " -f, --force Force config reload without system checks", " -t, --file_format [config_yang|config_db]", " specify the file format [default:", " config_db]", " -b, --bypass-lock Do reload without acquiring lock", " -h, -?, --help Show this message and exit."], "stderr_lines": [], "_ansible_no_log": null, "failed": false}
29/05/2025 09:24:47 base._run L0071 DEBUG | /data/sonic-mgmt-int/tests/common/devices/multi_asic.py::_run_on_asics#136: [bjw2-can-8101-2] AnsibleModule::shell, args=["config reload -y -f &>/dev/null"], kwargs={"executable": "/bin/bash"}
29/05/2025 09:25:28 base._run L0
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of PR
Summary:
Fixes # (issue)
#17046 and #17767 all all restore configuration after running tests.
But for
test_vxlan_ecmp.py, it has similar issue. Intest_vxlan_ecmp.py, it will do config save command and after enable bfd session, iptables will add the following iptables rules, and it didn't have any chance to restore the configuration after the test. These iptables rules will be left on the DUT, which will failtest_cacl_applicationwith the following unexpected iptable rulesType of change
Back port request
Approach
What is the motivation for this PR?
Move the configuration restoration from each test case level to the common
conftest.pywhich is module level.It also saves time to do config reload one by one, each config reload may take 5 mins.
Module level configuration restore is more reasonable.
How did you do it?
Call the existing function
backup_and_restore_config_db_on_dutsinconftest.pyand do config reload after config_db.json restoration.Make sure if
vxlanmodule run, the configuration will be restored after the test.How did you verify/test it?
Run
test_vxlan_crmon dut and check the log.Backup config file before running tests
Restore configuration file, then do config reload after running tests
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation