Skip to content

Commit aa1938f

Browse files
Issue 20728: Enhance configlet/test_add_rack.py for ipv6-only topos
Currently, the test checks for both ipv4 and ipv6 neighbors unconditionally, and will fail if either is missing. Change that behavior to instead check to see if neighbors exist before running the bgp checks. Add a failure case if no neighbors are found in either AF. This way the test is AF-agnostic. Signed-off-by: Anders Linn <[email protected]>
1 parent 7294362 commit aa1938f

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

tests/common/plugins/conditional_mark/tests_mark_conditions.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -603,10 +603,6 @@ configlet/test_add_rack.py:
603603
reason: "AddRack is not yet supported on multi-ASIC platform"
604604
conditions:
605605
- "is_multi_asic==True"
606-
xfail:
607-
reason: "xfail for IPv6-only topologies, need to add support for IPv6-only - https://github.com/sonic-net/sonic-mgmt/issues/20728"
608-
conditions:
609-
- "https://github.com/sonic-net/sonic-mgmt/issues/20728 and '-v6-' in topo_name"
610606

611607
container_hardening/test_container_hardening.py::test_container_privileged:
612608
skip:

tests/configlet/util/base_test.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,12 @@ def apply_clet(duthost, skip_test=False):
204204
"DB compare failed after apply-clet"
205205

206206
# Ensure BGP session is up
207-
chk_bgp_session(duthost, tor_data["ip"]["remote"], "post-clet test")
208-
chk_bgp_session(duthost, tor_data["ipv6"]["remote"].lower(), "post-clet test")
207+
if len(tor_data.get("ip", []).get("remote", [])):
208+
chk_bgp_session(duthost, tor_data["ip"]["remote"], "post-clet test")
209+
elif len(tor_data.get("ipv6", []).get("remote", [])):
210+
chk_bgp_session(duthost, tor_data["ipv6"]["remote"].lower(), "post-clet test")
211+
else:
212+
report_error("No neighbors detected")
209213

210214
log_info("AddRack by template succeeded")
211215

@@ -265,8 +269,12 @@ def do_test_add_rack(duthost, is_storage_backend=False, skip_load=False,
265269
is_storage_backend=is_storage_backend)
266270

267271
# Ensure BGP session is up before we apply stripped minigraph
268-
chk_bgp_session(duthost, tor_data["ip"]["remote"], "pre-clet test")
269-
chk_bgp_session(duthost, tor_data["ipv6"]["remote"].lower(), "pre-clet test")
272+
if len(tor_data.get("ip", []).get("remote", [])):
273+
chk_bgp_session(duthost, tor_data["ip"]["remote"], "pre-clet test")
274+
elif len(tor_data.get("ipv6", []).get("remote", [])):
275+
chk_bgp_session(duthost, tor_data["ipv6"]["remote"].lower(), "pre-clet test")
276+
else:
277+
report_error("No neighbors detected")
270278

271279
set_log_prefix_msg("test prepare")
272280
prepare_for_test(duthost)

tests/configlet/util/generic_patch.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from tests.common.configlet.utils import orig_db_dir, no_t0_db_dir, patch_add_t0_dir, patch_rm_t0_dir, tor_data,\
1010
RELOAD_WAIT_TIME, PAUSE_INTF_DOWN, PAUSE_INTF_UP, PAUSE_CLET_APPLY, DB_COMP_WAIT_TIME,\
11-
do_pause, db_comp, chk_bgp_session
11+
do_pause, db_comp, chk_bgp_session, report_error
1212

1313
if os.path.exists("/etc/sonic/sonic-environment"):
1414
from mock_for_switch import config_reload, wait_until
@@ -171,8 +171,12 @@ def generic_patch_add_t0(duthost, skip_load=False, hack_apply=False):
171171
"DB compare failed after adding T0 via generic patch updater"
172172

173173
# Ensure BGP session is up
174-
chk_bgp_session(duthost, tor_data["ip"]["remote"], "post-patch-add test")
175-
chk_bgp_session(duthost, tor_data["ipv6"]["remote"].lower(), "post-patch-add test")
174+
if len(tor_data.get("ip", []).get("remote", [])):
175+
chk_bgp_session(duthost, tor_data["ip"]["remote"], "post-patch-add test")
176+
elif len(tor_data.get("ipv6", []).get("remote", [])):
177+
chk_bgp_session(duthost, tor_data["ipv6"]["remote"].lower(), "post-patch-add test")
178+
else:
179+
report_error("No neighbors detected")
176180

177181

178182
def generic_patch_rm_t0(duthost, skip_load=False, hack_apply=False):

0 commit comments

Comments
 (0)