Skip to content

Commit

Permalink
[swss]: Update the ipinip.j2 template to specify the IPv4 loopback ad…
Browse files Browse the repository at this point in the history
…dress (#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 <shuche@microsoft.com>
  • Loading branch information
Shuotian Cheng authored and taoyl-ms committed Oct 3, 2017
1 parent 4ff0ee5 commit 462b3c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 9 additions & 3 deletions dockers/docker-orchagent/ipinip.json.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{# only IPv4 decapsulation is supported #}
{% set ipv4_loopback_addresses = [] %}
{% for (name, prefix) in LOOPBACK_INTERFACE %}
{%- if prefix | ipv4 %}
{%- set ipv4_loopback_addresses = ipv4_loopback_addresses.append(prefix) %}
{%- endif %}
{% endfor %}
[
{
"TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : {
"tunnel_type":"IPINIP",
"src_ip":"{{ LOOPBACK_INTERFACE.keys()[0][1] | ip }}",
"dst_ip":"{{ LOOPBACK_INTERFACE.keys()[0][1] | ip }}",
"src_ip":"{{ ipv4_loopback_addresses | first | ip }}",
"dst_ip":"{% for prefix in ipv4_loopback_addresses %}{{ prefix | ip }}{% if not loop.last %},{% endif %}{% endfor %}",
{% if onie_switch_asic == "mlnx" %}
"dscp_mode":"uniform",
"ecn_mode":"standard",
Expand All @@ -16,4 +23,3 @@
"OP": "SET"
}
]

1 change: 0 additions & 1 deletion src/sonic-config-engine/tests/sample_output/ipinip.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
"OP": "SET"
}
]

0 comments on commit 462b3c9

Please sign in to comment.