Skip to content

Commit 486dfef

Browse files
Shuotian Chenglguohan
Shuotian Cheng
authored andcommitted
[swss]: Update the ipinip.j2 template to specify the IPv4 loopback address (#998)
Use ipv4_loopback_addresses variable to store all IPv4 loopback addresses. The source IP for encapsulation is chosen from one of the addresses. The destination IPs for decapsulation is the list of the addresses. Signed-off-by: Shu0T1an ChenG <[email protected]>
1 parent 002aabe commit 486dfef

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

dockers/docker-orchagent/ipinip.json.j2

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
{# only IPv4 decapsulation is supported #}
2+
{% set ipv4_loopback_addresses = [] %}
3+
{% for (name, prefix) in LOOPBACK_INTERFACE %}
4+
{%- if prefix | ipv4 %}
5+
{%- set ipv4_loopback_addresses = ipv4_loopback_addresses.append(prefix) %}
6+
{%- endif %}
7+
{% endfor %}
18
[
29
{
310
"TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : {
411
"tunnel_type":"IPINIP",
5-
"src_ip":"{{ LOOPBACK_INTERFACE.keys()[0][1] | ip }}",
6-
"dst_ip":"{{ LOOPBACK_INTERFACE.keys()[0][1] | ip }}",
12+
"src_ip":"{{ ipv4_loopback_addresses | first | ip }}",
13+
"dst_ip":"{% for prefix in ipv4_loopback_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}",
714
{% if onie_switch_asic == "mlnx" %}
815
"dscp_mode":"uniform",
916
"ecn_mode":"standard",
@@ -16,4 +23,3 @@
1623
"OP": "SET"
1724
}
1825
]
19-

src/sonic-config-engine/tests/sample_output/ipinip.json

-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@
1111
"OP": "SET"
1212
}
1313
]
14-

0 commit comments

Comments
 (0)