17e78715ae
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com> The following changes are done. - Multi asic platform have 2 Loopback interfaces, Loopback0 and Loopback4096. IPinIP decap entries need to be added for both of them. Update the ipinip.json.j2 template to add decap entries for Loopback4096. - Add corressponding unit test
84 lines
3.1 KiB
Django/Jinja
84 lines
3.1 KiB
Django/Jinja
{% set ipv4_addresses = [] %}
|
|
{% set ipv6_addresses = [] %}
|
|
{% set ipv4_loopback_addresses = [] %}
|
|
{% set ipv6_loopback_addresses = [] %}
|
|
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd'%}
|
|
{% set loopback_intf_names = ['Loopback0', 'Loopback4096'] %}
|
|
{% else %}
|
|
{% set loopback_intf_names = ['Loopback0'] %}
|
|
{% endif %}
|
|
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
|
{%- if prefix | ipv4 and name in loopback_intf_names %}
|
|
{%- set ipv4_addresses = ipv4_addresses.append(prefix) %}
|
|
{%- set ipv4_loopback_addresses = ipv4_loopback_addresses.append(prefix) %}
|
|
{%- endif %}
|
|
{%- if prefix | ipv6 and name in loopback_intf_names %}
|
|
{%- set ipv6_addresses = ipv6_addresses.append(prefix) %}
|
|
{%- set ipv6_loopback_addresses = ipv6_loopback_addresses.append(prefix) %}
|
|
{%- endif %}
|
|
{% endfor %}
|
|
{% for (name, prefix) in INTERFACE|pfx_filter %}
|
|
{%- if prefix | ipv4 %}
|
|
{%- set ipv4_addresses = ipv4_addresses.append(prefix) %}
|
|
{%- endif %}
|
|
{%- if prefix | ipv6 %}
|
|
{%- set ipv6_addresses = ipv6_addresses.append(prefix) %}
|
|
{%- endif %}
|
|
{% endfor %}
|
|
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %}
|
|
{%- if prefix | ipv4 %}
|
|
{%- set ipv4_addresses = ipv4_addresses.append(prefix) %}
|
|
{%- endif %}
|
|
{%- if prefix | ipv6 %}
|
|
{%- set ipv6_addresses = ipv6_addresses.append(prefix) %}
|
|
{%- endif %}
|
|
{% endfor %}
|
|
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
|
{%- if prefix | ipv4 %}
|
|
{%- set ipv4_addresses = ipv4_addresses.append(prefix) %}
|
|
{%- endif %}
|
|
{%- if prefix | ipv6 %}
|
|
{%- set ipv6_addresses = ipv6_addresses.append(prefix) %}
|
|
{%- endif %}
|
|
{% endfor %}
|
|
[
|
|
{% if ipv4_loopback_addresses %}
|
|
{
|
|
"TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : {
|
|
"tunnel_type":"IPINIP",
|
|
{% 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 %}
|
|
{% if ipv6_loopback_addresses %}
|
|
{
|
|
"TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : {
|
|
"tunnel_type":"IPINIP",
|
|
{% 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 %}
|
|
"ttl_mode":"pipe"
|
|
},
|
|
"OP": "SET"
|
|
}
|
|
{% endif %}
|
|
]
|