From 8c2a0719764b2c6992e5767ed55ee20daec90ce5 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Wed, 27 Apr 2022 22:20:25 -0400 Subject: [PATCH] Use safe config reload for some tests (#5564) Change some tests to use safe config reload (which is to wait until all docker containers are running before continuing). This is just a portion of the tests that should be doing a safe config reload. Signed-off-by: Saikrishna Arcot --- tests/acl/test_acl_outer_vlan.py | 2 +- tests/arp/conftest.py | 2 +- tests/bgp/conftest.py | 2 +- tests/common/system_utils/docker.py | 2 +- tests/copp/test_copp.py | 4 ++-- tests/ecmp/test_fgnhg.py | 2 +- tests/mvrf/test_mgmtvrf.py | 2 +- tests/nat/conftest.py | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/acl/test_acl_outer_vlan.py b/tests/acl/test_acl_outer_vlan.py index 078906d9ee5..57f136306c8 100644 --- a/tests/acl/test_acl_outer_vlan.py +++ b/tests/acl/test_acl_outer_vlan.py @@ -397,7 +397,7 @@ def teardown(duthosts, rand_one_dut_hostname): """ yield duthost = duthosts[rand_one_dut_hostname] - config_reload(duthost) + config_reload(duthost, safe_reload=True) class AclVlanOuterTest_Base(object): """ diff --git a/tests/arp/conftest.py b/tests/arp/conftest.py index 2902b74d724..1375f2a75ab 100644 --- a/tests/arp/conftest.py +++ b/tests/arp/conftest.py @@ -163,7 +163,7 @@ def common_setup_teardown(duthosts, ptfhost, enum_rand_one_per_hwsku_frontend_ho yield duthost, ptfhost, router_mac finally: #Recover DUT interface IP address - config_reload(duthost, config_source='config_db', wait=120) + config_reload(duthost, config_source='config_db', safe_reload=True) @pytest.fixture def garp_enabled(rand_selected_dut, config_facts): diff --git a/tests/bgp/conftest.py b/tests/bgp/conftest.py index a927f9d1efa..1cfed172afe 100644 --- a/tests/bgp/conftest.py +++ b/tests/bgp/conftest.py @@ -496,7 +496,7 @@ def backup_bgp_config(duthost): try: apply_default_bgp_config(duthost) except Exception: - config_reload(duthost) + config_reload(duthost, safe_reload=True) apply_default_bgp_config(duthost) @pytest.fixture(scope="module") diff --git a/tests/common/system_utils/docker.py b/tests/common/system_utils/docker.py index 2e768d381dc..e61cfb8572f 100644 --- a/tests/common/system_utils/docker.py +++ b/tests/common/system_utils/docker.py @@ -148,7 +148,7 @@ def swap_syncd(duthost, creds): ) logger.info("Reloading config and restarting swss...") - config_reload(duthost) + config_reload(duthost, safe_reload=True) _perform_syncd_liveness_check(duthost) diff --git a/tests/copp/test_copp.py b/tests/copp/test_copp.py index 899e4a6969f..9b2a9d38367 100644 --- a/tests/copp/test_copp.py +++ b/tests/copp/test_copp.py @@ -365,7 +365,7 @@ def _setup_testbed(dut, creds, ptf, test_params, tbinfo): # NOTE: Even if the rpc syncd image is already installed, we need to restart # SWSS for the COPP changes to take effect. logging.info("Reloading config and restarting swss...") - config_reload(dut) + config_reload(dut, safe_reload=True) logging.info("Configure syncd RPC for testing") copp_utils.configure_syncd(dut, test_params.nn_target_port, test_params.nn_target_interface, @@ -387,7 +387,7 @@ def _teardown_testbed(dut, creds, ptf, test_params, tbinfo): else: copp_utils.restore_syncd(dut, test_params.nn_target_namespace) logging.info("Reloading config and restarting swss...") - config_reload(dut) + config_reload(dut, safe_reload=True) def _setup_multi_asic_proxy(dut, creds, test_params, tbinfo): """ diff --git a/tests/ecmp/test_fgnhg.py b/tests/ecmp/test_fgnhg.py index 9b12c898167..b0accec2cf0 100644 --- a/tests/ecmp/test_fgnhg.py +++ b/tests/ecmp/test_fgnhg.py @@ -579,7 +579,7 @@ def fg_ecmp_to_regular_ecmp_transitions(ptfhost, duthost, router_mac, net_ports, def cleanup(duthost, ptfhost): logger.info("Start cleanup") ptfhost.command('rm -f /tmp/fg_ecmp_persist_map.json') - config_reload(duthost) + config_reload(duthost, safe_reload=True) @pytest.fixture(scope="module") diff --git a/tests/mvrf/test_mgmtvrf.py b/tests/mvrf/test_mgmtvrf.py index 72f5830daed..758929b3567 100644 --- a/tests/mvrf/test_mgmtvrf.py +++ b/tests/mvrf/test_mgmtvrf.py @@ -26,7 +26,7 @@ def restore_config_db(duthost): duthost.shell("mv /etc/sonic/config_db.json.bak /etc/sonic/config_db.json") # Reload to restore configuration - config_reload(duthost) + config_reload(duthost, safe_reload=True) @pytest.fixture(scope="module") def check_ntp_sync(duthosts, rand_one_dut_hostname): diff --git a/tests/nat/conftest.py b/tests/nat/conftest.py index d565e07f996..c31925718bc 100644 --- a/tests/nat/conftest.py +++ b/tests/nat/conftest.py @@ -188,7 +188,7 @@ def apply_global_nat_config(duthost, config_nat_feature_enabled): nat_global_config(duthost) yield # reload config on teardown - config_reload(duthost, config_source='minigraph') + config_reload(duthost, config_source='minigraph', safe_reload=True) @pytest.fixture() @@ -204,7 +204,7 @@ def reload_dut_config(request, duthost, setup_test_env): dut_iface = setup_data[interface_type]["vrf_conf"]["red"]["dut_iface"] gw_ip = setup_data[interface_type]["vrf_conf"]["red"]["gw"] mask = setup_data[interface_type]["vrf_conf"]["red"]["mask"] - config_reload(duthost, config_source='minigraph') + config_reload(duthost, config_source='minigraph', safe_reload=True) pch_ip = setup_info["pch_ips"][dut_iface] duthost.shell("sudo config interface ip remove {} {}/31".format(dut_iface, pch_ip)) duthost.shell("sudo config interface ip add {} {}/{}".format(dut_iface, gw_ip, mask))