Skip to content

Commit 22dda69

Browse files
dypetgshemesh2
authored andcommitted
Restore config after vxlan_crm from vxlan_ecmp. (sonic-net#17767)
What is the motivation for this PR? test_vxlan_crm.py was recently enabled for smartswitch, which uses the same setup fixture as test_vxlan_ecmp.py. However, the tests in test_vxlan_ecmp.py have additional cleanup code to handle these BFD entries which is missing in test_vxlan_crm.py. How did you do it? Added a config restore fixture, same as in sonic-net#17046, to test_vxlan_ecmp.py which is re-used by test_vxlan_crm.py How did you verify/test it? Ran test_cacl_application.py after running test_vxlan_crm.py and it's now passing with the fix in place. Also checked that iptable is cleaned up after running test_vxlan_crm.py. Signed-off-by: Guy Shemesh <[email protected]>
1 parent 99bc2e9 commit 22dda69

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/vxlan/test_vxlan_ecmp.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060

6161
from tests.common.helpers.assertions import pytest_assert
6262
from tests.common.fixtures.ptfhost_utils import copy_ptftests_directory # noqa F401
63+
from tests.common.fixtures.duthost_utils import backup_and_restore_config_db_on_duts # noqa F401
64+
from tests.common.config_reload import config_reload
6365
from tests.common.utilities import wait_until
6466
from tests.ptf_runner import ptf_runner
6567
from tests.common.vxlan_ecmp_utils import Ecmp_Utils
@@ -140,7 +142,8 @@ def fixture_setUp(duthosts,
140142
rand_one_dut_hostname,
141143
minigraph_facts,
142144
tbinfo,
143-
encap_type):
145+
encap_type,
146+
backup_and_restore_config_db_on_duts): # noqa F811
144147
'''
145148
Setup for the entire script.
146149
The basic steps in VxLAN configs are:
@@ -339,6 +342,14 @@ def fixture_setUp(duthosts,
339342
setup_crm_interval(data['duthost'], int(data['original_crm_interval']))
340343

341344

345+
@pytest.fixture(scope="module", autouse=True)
346+
def restore_config_by_config_reload(duthosts, rand_one_dut_hostname, localhost):
347+
yield
348+
duthost = duthosts[rand_one_dut_hostname]
349+
350+
config_reload(duthost, safe_reload=True)
351+
352+
342353
@pytest.fixture(scope="module")
343354
def default_routes(setUp, encap_type):
344355
vnet = list(setUp[encap_type]['vnet_vni_map'].keys())[0]

0 commit comments

Comments
 (0)