From d3cb0f283648e74c985719f15d5f39bc2b91b2f8 Mon Sep 17 00:00:00 2001 From: Longxiang Lyu Date: Tue, 23 Apr 2024 03:31:22 +0000 Subject: [PATCH 1/2] [decap] Enhance `ipinip.json.j2` template to use new db schema Signed-off-by: Longxiang Lyu --- dockers/docker-orchagent/ipinip.json.j2 | 29 ++++-- .../tests/multi_npu_data/py2/ipinip.json | 53 ++++++++++- .../tests/multi_npu_data/py3/ipinip.json | 53 ++++++++++- .../tests/sample_output/py2/ipinip.json | 89 ++++++++++++++++++- .../tests/sample_output/py3/ipinip.json | 89 ++++++++++++++++++- 5 files changed, 292 insertions(+), 21 deletions(-) diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index 9d40ec68cd12..9042354e3c14 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -49,7 +49,6 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"{% for prefix in ipv4_addresses|sort %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", "dscp_mode":"uniform", {% if "mlnx" in DEVICE_METADATA.localhost.platform %} "ecn_mode":"standard", @@ -59,15 +58,24 @@ "ttl_mode":"pipe" }, "OP": "SET" - } + }{% if ipv4_addresses %}, {% endif %} -{% if ipv4_loopback_addresses and ipv6_loopback_addresses %} , +{% for prefix in ipv4_addresses|sort %} + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:{{ prefix | ip }}" : { + "term_type":"P2MP" + }, + "OP": "SET" + }{% if not loop.last %}, +{% endif %} +{% endfor %} +{% endif %} +{% if ipv4_loopback_addresses and ipv6_loopback_addresses %}, {% endif %} {% if ipv6_loopback_addresses %} { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"{% for prefix in ipv6_addresses|sort %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", "dscp_mode":"uniform", {% if "mlnx" in DEVICE_METADATA.localhost.platform %} "ecn_mode":"standard", @@ -77,8 +85,19 @@ "ttl_mode":"pipe" }, "OP": "SET" - } + }{% if ipv6_addresses %}, {% endif %} +{% for prefix in ipv6_addresses|sort %} + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:{{ prefix | ip }}" : { + "term_type":"P2MP" + }, + "OP": "SET" + }{% if not loop.last %}, +{% endif %} +{% endfor %} +{% endif %} + ] {% endif %} diff --git a/src/sonic-config-engine/tests/multi_npu_data/py2/ipinip.json b/src/sonic-config-engine/tests/multi_npu_data/py2/ipinip.json index 82d583de6078..94196a0a4878 100644 --- a/src/sonic-config-engine/tests/multi_npu_data/py2/ipinip.json +++ b/src/sonic-config-engine/tests/multi_npu_data/py2/ipinip.json @@ -2,22 +2,67 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"10.0.0.0,10.1.0.1,10.1.0.3,10.1.0.32,8.0.0.0", "dscp_mode":"uniform", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" - } - , + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.0" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.1.0.1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.1.0.3" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.1.0.32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:8.0.0.0" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"fc00:1::32,fc00::1,fd00:1::32", "dscp_mode":"uniform", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00:1::32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fd00:1::32" : { + "term_type":"P2MP" + }, + "OP": "SET" } ] diff --git a/src/sonic-config-engine/tests/multi_npu_data/py3/ipinip.json b/src/sonic-config-engine/tests/multi_npu_data/py3/ipinip.json index 82d583de6078..94196a0a4878 100644 --- a/src/sonic-config-engine/tests/multi_npu_data/py3/ipinip.json +++ b/src/sonic-config-engine/tests/multi_npu_data/py3/ipinip.json @@ -2,22 +2,67 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"10.0.0.0,10.1.0.1,10.1.0.3,10.1.0.32,8.0.0.0", "dscp_mode":"uniform", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" - } - , + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.0" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.1.0.1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.1.0.3" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.1.0.32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:8.0.0.0" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"fc00:1::32,fc00::1,fd00:1::32", "dscp_mode":"uniform", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00:1::32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fd00:1::32" : { + "term_type":"P2MP" + }, + "OP": "SET" } ] diff --git a/src/sonic-config-engine/tests/sample_output/py2/ipinip.json b/src/sonic-config-engine/tests/sample_output/py2/ipinip.json index 0a01058463bd..755e954cfb59 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/ipinip.json +++ b/src/sonic-config-engine/tests/sample_output/py2/ipinip.json @@ -2,22 +2,103 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"10.0.0.56,10.0.0.58,10.0.0.60,10.0.0.62,10.1.0.32,10.21.0.64,10.21.64.2,192.168.0.1,192.168.200.1", "dscp_mode":"uniform", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" - } - , + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.56" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.58" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.60" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.62" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.1.0.32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.21.0.64" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.21.64.2" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:192.168.0.1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:192.168.200.1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"fc00:1::32,fc00::71,fc00::75,fc00::79,fc00::7d", "dscp_mode":"uniform", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00:1::32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::71" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::75" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::79" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::7d" : { + "term_type":"P2MP" + }, + "OP": "SET" } ] diff --git a/src/sonic-config-engine/tests/sample_output/py3/ipinip.json b/src/sonic-config-engine/tests/sample_output/py3/ipinip.json index 0a01058463bd..755e954cfb59 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/ipinip.json +++ b/src/sonic-config-engine/tests/sample_output/py3/ipinip.json @@ -2,22 +2,103 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"10.0.0.56,10.0.0.58,10.0.0.60,10.0.0.62,10.1.0.32,10.21.0.64,10.21.64.2,192.168.0.1,192.168.200.1", "dscp_mode":"uniform", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" - } - , + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.56" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.58" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.60" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.62" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.1.0.32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.21.0.64" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.21.64.2" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:192.168.0.1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:192.168.200.1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"fc00:1::32,fc00::71,fc00::75,fc00::79,fc00::7d", "dscp_mode":"uniform", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00:1::32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::71" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::75" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::79" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::7d" : { + "term_type":"P2MP" + }, + "OP": "SET" } ] From bc80a53df7debfad066b50f4c2ef78b07cd7545a Mon Sep 17 00:00:00 2001 From: Longxiang Lyu Date: Tue, 28 May 2024 14:25:18 +0000 Subject: [PATCH 2/2] Add subnet decap tunnels Signed-off-by: Longxiang Lyu --- dockers/docker-orchagent/ipinip.json.j2 | 44 ++++++- .../py2/ipinip_subnet_decap_enable.json | 122 ++++++++++++++++++ .../py3/ipinip_subnet_decap_enable.json | 122 ++++++++++++++++++ src/sonic-config-engine/tests/test_j2files.py | 9 ++ 4 files changed, 295 insertions(+), 2 deletions(-) create mode 100644 src/sonic-config-engine/tests/sample_output/py2/ipinip_subnet_decap_enable.json create mode 100644 src/sonic-config-engine/tests/sample_output/py3/ipinip_subnet_decap_enable.json diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index 9042354e3c14..f25f7d9fb695 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -20,6 +20,12 @@ {%- set ipv6_loopback_addresses = ipv6_loopback_addresses.append(prefix) %} {%- endif %} {% endfor %} +{% set subnet_decap = namespace(enable=false) %} +{% for config in SUBNET_DECAP %} + {%- if SUBNET_DECAP[config].status == 'enable' %} + {%- set subnet_decap.enable = true %} + {%- endif %} +{% endfor %} {% for (name, prefix) in INTERFACE|pfx_filter %} {%- if prefix | ipv4 %} {%- set ipv4_addresses = ipv4_addresses.append(prefix) %} @@ -46,6 +52,21 @@ {% endfor %} [ {% if ipv4_loopback_addresses %} +{% if subnet_decap.enable %} + { + "TUNNEL_DECAP_TABLE:IPINIP_SUBNET" : { + "tunnel_type":"IPINIP", + "dscp_mode":"uniform", +{% if "mlnx" in DEVICE_METADATA.localhost.platform %} + "ecn_mode":"standard", +{% else %} + "ecn_mode":"copy_from_outer", +{% endif %} + "ttl_mode":"pipe" + }, + "OP": "SET" + }, +{% endif %} { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", @@ -58,7 +79,9 @@ "ttl_mode":"pipe" }, "OP": "SET" - }{% if ipv4_addresses %}, + } +{%- if ipv4_addresses -%} +, {% endif %} {% for prefix in ipv4_addresses|sort %} { @@ -73,6 +96,21 @@ {% if ipv4_loopback_addresses and ipv6_loopback_addresses %}, {% endif %} {% if ipv6_loopback_addresses %} +{% if subnet_decap.enable %} + { + "TUNNEL_DECAP_TABLE:IPINIP_SUBNET_V6" : { + "tunnel_type":"IPINIP", + "dscp_mode":"uniform", +{% if "mlnx" in DEVICE_METADATA.localhost.platform %} + "ecn_mode":"standard", +{% else %} + "ecn_mode":"copy_from_outer", +{% endif %} + "ttl_mode":"pipe" + }, + "OP": "SET" + }, +{% endif %} { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", @@ -93,7 +131,9 @@ "term_type":"P2MP" }, "OP": "SET" - }{% if not loop.last %}, + } +{%- if not loop.last -%} +, {% endif %} {% endfor %} {% endif %} diff --git a/src/sonic-config-engine/tests/sample_output/py2/ipinip_subnet_decap_enable.json b/src/sonic-config-engine/tests/sample_output/py2/ipinip_subnet_decap_enable.json new file mode 100644 index 000000000000..ad978b8865a7 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/ipinip_subnet_decap_enable.json @@ -0,0 +1,122 @@ +[ + { + "TUNNEL_DECAP_TABLE:IPINIP_SUBNET" : { + "tunnel_type":"IPINIP", + "dscp_mode":"uniform", + "ecn_mode":"copy_from_outer", + "ttl_mode":"pipe" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { + "tunnel_type":"IPINIP", + "dscp_mode":"uniform", + "ecn_mode":"copy_from_outer", + "ttl_mode":"pipe" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.56" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.58" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.60" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.62" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.1.0.32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.21.0.64" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.21.64.2" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:192.168.0.1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:192.168.200.1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TABLE:IPINIP_SUBNET_V6" : { + "tunnel_type":"IPINIP", + "dscp_mode":"uniform", + "ecn_mode":"copy_from_outer", + "ttl_mode":"pipe" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { + "tunnel_type":"IPINIP", + "dscp_mode":"uniform", + "ecn_mode":"copy_from_outer", + "ttl_mode":"pipe" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00:1::32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::71" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::75" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::79" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::7d" : { + "term_type":"P2MP" + }, + "OP": "SET" + } +] diff --git a/src/sonic-config-engine/tests/sample_output/py3/ipinip_subnet_decap_enable.json b/src/sonic-config-engine/tests/sample_output/py3/ipinip_subnet_decap_enable.json new file mode 100644 index 000000000000..ad978b8865a7 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/ipinip_subnet_decap_enable.json @@ -0,0 +1,122 @@ +[ + { + "TUNNEL_DECAP_TABLE:IPINIP_SUBNET" : { + "tunnel_type":"IPINIP", + "dscp_mode":"uniform", + "ecn_mode":"copy_from_outer", + "ttl_mode":"pipe" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { + "tunnel_type":"IPINIP", + "dscp_mode":"uniform", + "ecn_mode":"copy_from_outer", + "ttl_mode":"pipe" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.56" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.58" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.60" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.0.0.62" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.1.0.32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.21.0.64" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:10.21.64.2" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:192.168.0.1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_TUNNEL:192.168.200.1" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TABLE:IPINIP_SUBNET_V6" : { + "tunnel_type":"IPINIP", + "dscp_mode":"uniform", + "ecn_mode":"copy_from_outer", + "ttl_mode":"pipe" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { + "tunnel_type":"IPINIP", + "dscp_mode":"uniform", + "ecn_mode":"copy_from_outer", + "ttl_mode":"pipe" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00:1::32" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::71" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::75" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::79" : { + "term_type":"P2MP" + }, + "OP": "SET" + }, + { + "TUNNEL_DECAP_TERM_TABLE:IPINIP_V6_TUNNEL:fc00::7d" : { + "term_type":"P2MP" + }, + "OP": "SET" + } +] diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index b83926d4c9e6..cf8907bf1c2b 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -223,6 +223,15 @@ def test_ipinip(self): sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'ipinip.json') assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) + def test_ipinip_subnet_decap_enable(self): + ipinip_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ipinip.json.j2') + extra_data = {"SUBNET_DECAP": {"AZURE": {"status": "enable"}}} + argument = ['-m', self.t0_minigraph, '-p', self.t0_port_config, '-a', json.dumps(extra_data), '-t', ipinip_file] + self.run_script(argument, output_file=self.output_file) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'ipinip_subnet_decap_enable.json') + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) + def test_l2switch_template(self): argument = ['-k', 'Mellanox-SN2700', '--preset', 'l2', '-p', self.t0_port_config] output = self.run_script(argument)