From 23f1d51de3863cea989575bb08173ae59aed3457 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Tue, 29 Dec 2020 06:53:12 +0200 Subject: [PATCH] [ipinip.json.j2] align mellanox configuration dst_ip with other platforms (#6304) Mellanox already supports multiple destination IPs in IPinIP tunnel configuration, thus removing mellanox exception for IPinIP configuration. - How I did it Removed "dst_ip" field generation in mellanox platform condition. Sorted the "dst_ip" list, so that it is easier to test against sample configuration in unit tests. Aligned unit test sample. Signed-off-by: Stepan Blyschak --- dockers/docker-orchagent/ipinip.json.j2 | 8 +++----- .../tests/multi_npu_data/py2/ipinip.json | 6 +++--- .../tests/multi_npu_data/py3/ipinip.json | 6 +++--- .../tests/sample_output/py2/ipinip.json | 6 +++--- .../tests/sample_output/py3/ipinip.json | 4 ++-- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/dockers/docker-orchagent/ipinip.json.j2 b/dockers/docker-orchagent/ipinip.json.j2 index d0eafb2206..cbfeb784b0 100644 --- a/dockers/docker-orchagent/ipinip.json.j2 +++ b/dockers/docker-orchagent/ipinip.json.j2 @@ -46,19 +46,18 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", + "dst_ip":"{% for prefix in ipv4_addresses|sort %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", {% if "mlnx" in DEVICE_METADATA.localhost.platform %} - "dst_ip":"{% for prefix in ipv4_loopback_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", "dscp_mode":"uniform", "ecn_mode":"standard", {% else %} - "dst_ip":"{% for prefix in ipv4_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", {% endif %} "ttl_mode":"pipe" }, "OP": "SET" - } + } {% endif %} {% if ipv4_loopback_addresses and ipv6_loopback_addresses %} , {% endif %} @@ -66,12 +65,11 @@ { "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 %}", {% if "mlnx" in DEVICE_METADATA.localhost.platform %} - "dst_ip":"{% for prefix in ipv6_loopback_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", "dscp_mode":"uniform", "ecn_mode":"standard", {% else %} - "dst_ip":"{% for prefix in ipv6_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", {% 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 d48dcba30b..3e8d4429d7 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,18 +2,18 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"8.0.0.0,10.1.0.32,10.1.0.3,10.0.0.0,10.1.0.1", + "dst_ip":"10.0.0.0,10.1.0.1,10.1.0.3,10.1.0.32,8.0.0.0", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" - } + } , { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"fc00:1::32,fd00:1::32,fc00::1", + "dst_ip":"fc00:1::32,fc00::1,fd00:1::32", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" 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 dd72ec55fe..3e8d4429d7 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,18 +2,18 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"8.0.0.0,10.1.0.32,10.1.0.1,10.1.0.3,10.0.0.0", + "dst_ip":"10.0.0.0,10.1.0.1,10.1.0.3,10.1.0.32,8.0.0.0", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" - } + } , { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"fd00:1::32,fc00:1::32,fc00::1", + "dst_ip":"fc00:1::32,fc00::1,fd00:1::32", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" 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 c93564de77..db70ea4031 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/ipinip.json +++ b/src/sonic-config-engine/tests/sample_output/py2/ipinip.json @@ -2,18 +2,18 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"10.1.0.32,10.0.0.58,10.0.0.60,10.0.0.62,10.0.0.56,192.168.0.1", + "dst_ip":"10.0.0.56,10.0.0.58,10.0.0.60,10.0.0.62,10.1.0.32,192.168.0.1", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" - } + } , { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"fc00:1::32,fc00::7d,fc00::79,fc00::71,fc00::75", + "dst_ip":"fc00:1::32,fc00::71,fc00::75,fc00::79,fc00::7d", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" 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 e4028ea01a..db70ea4031 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/ipinip.json +++ b/src/sonic-config-engine/tests/sample_output/py3/ipinip.json @@ -2,13 +2,13 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"10.1.0.32,10.0.0.56,10.0.0.58,10.0.0.60,10.0.0.62,192.168.0.1", + "dst_ip":"10.0.0.56,10.0.0.58,10.0.0.60,10.0.0.62,10.1.0.32,192.168.0.1", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" }, "OP": "SET" - } + } , { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : {