From cdbadea1559e2fccaa512149c35d91ff763118fc Mon Sep 17 00:00:00 2001 From: Aakash Tiwari Date: Thu, 20 Aug 2026 00:49:38 -0700 Subject: [PATCH] [tests/vxlan]: Set VXLAN tunnel ttl_mode=pipe for cisco-8000 platforms Signed-off-by: Aakash Tiwari --- tests/acl/test_src_mac_rewrite.py | 14 +++++++++++--- tests/vxlan/test_scale_ecmp.py | 13 +++++++++---- tests/vxlan/test_vnet_decap.py | 3 ++- tests/vxlan/test_vxlan_bfd_tsa.py | 3 ++- tests/vxlan/test_vxlan_decap.py | 13 +++++++++---- tests/vxlan/test_vxlan_ecmp.py | 3 ++- tests/vxlan/test_vxlan_ecmp_switchover.py | 3 ++- tests/vxlan/test_vxlan_route_advertisement.py | 3 ++- tests/vxlan/test_vxlan_tunnel_route_scale.py | 7 ++++++- tests/vxlan/test_vxlan_vnet_bgp_subintf.py | 11 +++++++---- 10 files changed, 52 insertions(+), 21 deletions(-) diff --git a/tests/acl/test_src_mac_rewrite.py b/tests/acl/test_src_mac_rewrite.py index c1ea8a7e18..508cb16f3e 100644 --- a/tests/acl/test_src_mac_rewrite.py +++ b/tests/acl/test_src_mac_rewrite.py @@ -182,7 +182,8 @@ def fixture_setUp(rand_selected_dut, tbinfo, ptfadapter): tunnel_name=data['vxlan_tunnel_name'], src_ip=data['loopback_src_ip'], portchannel_name=selected_pc, - router_mac=rand_selected_dut.facts['router_mac'] + router_mac=rand_selected_dut.facts['router_mac'], + asic_type=rand_selected_dut.facts.get('asic_type') ) def _check_vnet_route(duthost): @@ -525,7 +526,8 @@ def _check_acl_rule_absent(duthost, table_name, rule_name): pytest_assert(exists_output.strip() == "0", f"ACL rule {state_db_key} still exists in STATE_DB") -def create_vxlan_vnet_config(duthost, tunnel_name, src_ip, portchannel_name="PortChannel101", router_mac=None): +def create_vxlan_vnet_config(duthost, tunnel_name, src_ip, portchannel_name="PortChannel101", router_mac=None, + asic_type=None): # --- VXLAN parameters --- vnet_base = VXLAN_VNI ptf_vtep = PTF_VTEP_IP @@ -534,10 +536,16 @@ def create_vxlan_vnet_config(duthost, tunnel_name, src_ip, portchannel_name="Por ecmp_utils.Constants['KEEP_TEMP_FILES'] = True ecmp_utils.Constants['DEBUG'] = False + vxlan_tunnel_entry = {"src_ip": dut_vtep} + # On cisco-8000, base topology IP-in-IP decap tunnels may already use pipe TTL mode. + # Set VXLAN decap ttl_mode to pipe so orchagent passes DECAP_TTL_MODE consistently. + if asic_type == "cisco-8000": + vxlan_tunnel_entry["ttl_mode"] = "pipe" + # --- Build overlay config JSON --- dut_json = { "VXLAN_TUNNEL": { - tunnel_name: {"src_ip": dut_vtep} + tunnel_name: vxlan_tunnel_entry }, "VNET": { "Vnet1": { diff --git a/tests/vxlan/test_scale_ecmp.py b/tests/vxlan/test_scale_ecmp.py index 39783d5fd6..6d5f86cc17 100644 --- a/tests/vxlan/test_scale_ecmp.py +++ b/tests/vxlan/test_scale_ecmp.py @@ -120,7 +120,12 @@ def vxlan_setup_one_vnet(duthost, ptfhost, tbinfo, cfg_facts, dut_vtep = get_loopback_ip(cfg_facts) logger.info(f"Creating VXLAN tunnel {TUNNEL_NAME} with source {dut_vtep}") - apply_chunk(duthost, {"VXLAN_TUNNEL": {TUNNEL_NAME: {"src_ip": dut_vtep}}}, "vxlan_tunnel") + vxlan_tunnel_entry = {"src_ip": dut_vtep} + # On cisco-8000, base topology IP-in-IP decap tunnels may already use pipe TTL mode. + # Set VXLAN decap ttl_mode to pipe so orchagent passes DECAP_TTL_MODE consistently. + if duthost.facts.get("asic_type") == "cisco-8000": + vxlan_tunnel_entry["ttl_mode"] = "pipe" + apply_chunk(duthost, {"VXLAN_TUNNEL": {TUNNEL_NAME: vxlan_tunnel_entry}}, "vxlan_tunnel") apply_chunk(duthost, {"VNET": {VNET_NAME: {"vni": str(VNI), "vxlan_tunnel": TUNNEL_NAME}}}, "vnet") ptf_port_index = port_indexes[ingress_if] @@ -288,7 +293,7 @@ def test_vxlan_mac_vni(ptfhost, one_vnet_setup_teardown): # --- Build deterministic MAC list --- # 52:54:00:00:xx:yy (unique per endpoint) - mac_list = [f"52:54:00:{i//256:02x}:{i%256:02x}:aa" for i in range(num_endpoints)] + mac_list = [f"52:54:00:{i//256:02x}:{i % 256:02x}:aa" for i in range(num_endpoints)] mac_list_str = ",".join(mac_list) updated_vni = 5001 @@ -442,7 +447,7 @@ def test_ecmp_scale_modify_mac(ptfhost, one_vnet_setup_teardown): time.sleep(5) # Step 2 — Initial MAC list - mac_list = [f"52:54:00:{i//256:02x}:{i%256:02x}:aa" for i in range(num)] + mac_list = [f"52:54:00:{i//256:02x}:{i % 256:02x}:aa" for i in range(num)] mac_string = ",".join(mac_list) # Push initial MAC list @@ -451,7 +456,7 @@ def test_ecmp_scale_modify_mac(ptfhost, one_vnet_setup_teardown): # Step 3 — Random index to modify mod_idx = random.randint(0, num - 1) - new_mac = f"52:54:99:{mod_idx//256:02x}:{mod_idx%256:02x}:cc" + new_mac = f"52:54:99:{mod_idx//256:02x}:{mod_idx % 256:02x}:cc" logger.info(f"Modifying MAC for endpoint index {mod_idx}: new MAC = {new_mac}") # Update the list diff --git a/tests/vxlan/test_vnet_decap.py b/tests/vxlan/test_vnet_decap.py index 0f8859c0fd..00f205089a 100644 --- a/tests/vxlan/test_vnet_decap.py +++ b/tests/vxlan/test_vnet_decap.py @@ -106,7 +106,8 @@ def setup(request, duthosts, rand_one_dut_hostname, tbinfo, inner_ip_version, ou topo = tbinfo["topo"]["type"].upper() vnet_interface = ecmp_utils.select_required_interfaces(duthost, 1, minigraph_facts, outer_ip_version_str, topo=topo)[0] - vxlan_tunnel = ecmp_utils.create_vxlan_tunnel(duthost, minigraph_facts, outer_ip_version_str) + vxlan_tunnel = ecmp_utils.create_vxlan_tunnel(duthost, minigraph_facts, outer_ip_version_str, + ttl_mode="pipe" if asic_type == "cisco-8000" else None) inner_ip_version_str = f"v{inner_ip_version}" encap_type = f"{inner_ip_version_str}_in_{outer_ip_version_str}" vnet = next(iter(ecmp_utils.create_vnets(duthost, vxlan_tunnel, diff --git a/tests/vxlan/test_vxlan_bfd_tsa.py b/tests/vxlan/test_vxlan_bfd_tsa.py index 9ead8ea9f2..a4163141a5 100644 --- a/tests/vxlan/test_vxlan_bfd_tsa.py +++ b/tests/vxlan/test_vxlan_bfd_tsa.py @@ -165,7 +165,8 @@ def fixture_setUp(duthosts, tunnel_names[outer_layer_version] = ecmp_utils.create_vxlan_tunnel( data['duthost'], minigraph_data=minigraph_facts, - af=outer_layer_version) + af=outer_layer_version, + ttl_mode="pipe" if data['duthost'].facts.get("asic_type") == "cisco-8000" else None) payload_version = ecmp_utils.get_payload_version(encap_type) encap_type = "{}_in_{}".format(payload_version, outer_layer_version) diff --git a/tests/vxlan/test_vxlan_decap.py b/tests/vxlan/test_vxlan_decap.py index 5377222fd0..30f1b8f9ac 100644 --- a/tests/vxlan/test_vxlan_decap.py +++ b/tests/vxlan/test_vxlan_decap.py @@ -84,12 +84,17 @@ def generate_vxlan_config_files(duthost, mg_facts): pytest.fail("ipv4 lo interface not found") # Generate vxlan tunnel config json file on DUT + vxlan_tunnel_entry = { + "src_ip": loopback_ip, + "dst_ip": VTEP2_IP + } + # On cisco-8000, base topology IP-in-IP decap tunnels may already use pipe TTL mode. + # Set VXLAN decap ttl_mode to pipe so orchagent passes DECAP_TTL_MODE consistently. + if duthost.facts.get("asic_type") == "cisco-8000": + vxlan_tunnel_entry["ttl_mode"] = "pipe" vxlan_tunnel_cfg = { "VXLAN_TUNNEL": { - "tlVxlan": { - "src_ip": loopback_ip, - "dst_ip": VTEP2_IP - } + "tlVxlan": vxlan_tunnel_entry } } duthost.copy(content=json.dumps(vxlan_tunnel_cfg, indent=2), diff --git a/tests/vxlan/test_vxlan_ecmp.py b/tests/vxlan/test_vxlan_ecmp.py index 24c125f6e8..daea172abb 100644 --- a/tests/vxlan/test_vxlan_ecmp.py +++ b/tests/vxlan/test_vxlan_ecmp.py @@ -252,7 +252,8 @@ def fixture_setUp(duthosts, tunnel_names[outer_layer_version] = ecmp_utils.create_vxlan_tunnel( data['duthost'], minigraph_data=minigraph_facts, - af=outer_layer_version) + af=outer_layer_version, + ttl_mode="pipe" if data['duthost'].facts.get("asic_type") == "cisco-8000" else None) payload_version = ecmp_utils.get_payload_version(encap_type) encap_type = "{}_in_{}".format(payload_version, outer_layer_version) diff --git a/tests/vxlan/test_vxlan_ecmp_switchover.py b/tests/vxlan/test_vxlan_ecmp_switchover.py index 94f7134875..f0fed5f96f 100644 --- a/tests/vxlan/test_vxlan_ecmp_switchover.py +++ b/tests/vxlan/test_vxlan_ecmp_switchover.py @@ -134,7 +134,8 @@ def fixture_setUp(duthosts, tunnel_names[outer_layer_version] = ecmp_utils.create_vxlan_tunnel( data['duthost'], minigraph_data=minigraph_facts, - af=outer_layer_version) + af=outer_layer_version, + ttl_mode="pipe" if data['duthost'].facts.get("asic_type") == "cisco-8000" else None) payload_version = ecmp_utils.get_payload_version(encap_type) encap_type = "{}_in_{}".format(payload_version, outer_layer_version) diff --git a/tests/vxlan/test_vxlan_route_advertisement.py b/tests/vxlan/test_vxlan_route_advertisement.py index 1c48e73af9..d1f7a75dd7 100644 --- a/tests/vxlan/test_vxlan_route_advertisement.py +++ b/tests/vxlan/test_vxlan_route_advertisement.py @@ -131,7 +131,8 @@ def fixture_setUp(duthosts, tunnel_names[outer_layer_version] = ecmp_utils.create_vxlan_tunnel( data['duthost'], minigraph_data=minigraph_facts, - af=outer_layer_version) + af=outer_layer_version, + ttl_mode="pipe" if data['duthost'].facts.get("asic_type") == "cisco-8000" else None) payload_version = ecmp_utils.get_payload_version(encap_type) encap_type = "{}_in_{}".format(payload_version, outer_layer_version) diff --git a/tests/vxlan/test_vxlan_tunnel_route_scale.py b/tests/vxlan/test_vxlan_tunnel_route_scale.py index 527cc3b888..0c8c4504d7 100644 --- a/tests/vxlan/test_vxlan_tunnel_route_scale.py +++ b/tests/vxlan/test_vxlan_tunnel_route_scale.py @@ -201,7 +201,12 @@ def vxlan_setup_config(config_facts, cfg_facts, duthost, dut_indx, ptfhost, dut_vtep = get_loopback_ip(cfg_facts) ptf_vtep = PTF_VTEP vxlan_tun = TUNNEL_NAME - apply_chunk(duthost, {"VXLAN_TUNNEL": {vxlan_tun: {"src_ip": dut_vtep}}}, "vxlan_tunnel") + vxlan_tunnel_entry = {"src_ip": dut_vtep} + # On cisco-8000, base topology IP-in-IP decap tunnels may already use pipe TTL mode. + # Set VXLAN decap ttl_mode to pipe so orchagent passes DECAP_TTL_MODE consistently. + if duthost.facts.get("asic_type") == "cisco-8000": + vxlan_tunnel_entry["ttl_mode"] = "pipe" + apply_chunk(duthost, {"VXLAN_TUNNEL": {vxlan_tun: vxlan_tunnel_entry}}, "vxlan_tunnel") res = duthost.shell("redis-cli -n 0 hget 'SWITCH_TABLE:switch' vxlan_router_mac") vxlan_router_mac = res["stdout"].strip() diff --git a/tests/vxlan/test_vxlan_vnet_bgp_subintf.py b/tests/vxlan/test_vxlan_vnet_bgp_subintf.py index 4ed2f70fd6..f82522906b 100644 --- a/tests/vxlan/test_vxlan_vnet_bgp_subintf.py +++ b/tests/vxlan/test_vxlan_vnet_bgp_subintf.py @@ -532,7 +532,7 @@ def setup_portchannel_subintfs(duthost, ptfhost, portchannel_info, vnet_vnis, ba gnmi_set_update_config_db_json( duthost, ptfhost, - f"{GNMI_PATH_PREFIX}/VLAN_SUB_INTERFACE/{subintf_name}|{dut_ips[j][i].replace('/','~1')}", + f"{GNMI_PATH_PREFIX}/VLAN_SUB_INTERFACE/{subintf_name}|{dut_ips[j][i].replace('/', '~1')}", {}, f"{subintf_name}_ip") @@ -619,10 +619,13 @@ def setup_vnets(duthost, ptfhost, num_vnets, tunnel, base_vni): def setup_vxlan_tunnel(duthost, ptfhost, name, src_ip): + tunnel_entry = {"src_ip": src_ip} + # On cisco-8000, base topology IP-in-IP decap tunnels may already use pipe TTL mode. + # Set VXLAN decap ttl_mode to pipe so orchagent passes DECAP_TTL_MODE consistently. + if duthost.facts.get("asic_type") == "cisco-8000": + tunnel_entry["ttl_mode"] = "pipe" gnmi_set_update_config_db_json(duthost, ptfhost, f"{GNMI_PATH_PREFIX}/VXLAN_TUNNEL", { - name: { - "src_ip": src_ip - } + name: tunnel_entry }, "vxlan")