Skip to content

Commit

Permalink
[subnet decap] Fix VLAN prefix decap term (sonic-net#19229)
Browse files Browse the repository at this point in the history
Why I did it
If subnet decap is enabled on T0, the subnet decap term should be created for VLAN prefixes.

Work item tracking
Microsoft ADO (number only): 28316828

How I did it
For VLAN prefixes, if subnet decap is enabled, created MP2MP decap terms with subnet type vlan and under the subnet decap tunnels.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
  • Loading branch information
lolyu authored Sep 12, 2024
1 parent 9080f81 commit 702dd4e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
26 changes: 24 additions & 2 deletions dockers/docker-orchagent/ipinip.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{% else %}
{% set ipv4_addresses = [] %}
{% set ipv6_addresses = [] %}
{% set ipv4_vlan_addresses = [] %}
{% set ipv6_vlan_addresses = [] %}
{% set ipv4_loopback_addresses = [] %}
{% set ipv6_loopback_addresses = [] %}
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd'%}
Expand Down Expand Up @@ -44,12 +46,14 @@
{% endfor %}
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
{%- if prefix | ipv4 %}
{%- set ipv4_addresses = ipv4_addresses.append(prefix) %}
{%- set ipv4_vlan_addresses = ipv4_vlan_addresses.append(prefix) %}
{%- endif %}
{%- if prefix | ipv6 %}
{%- set ipv6_addresses = ipv6_addresses.append(prefix) %}
{%- set ipv6_vlan_addresses = ipv6_vlan_addresses.append(prefix) %}
{%- endif %}
{% endfor %}
{%- set ipv4_addresses = ipv4_addresses + ipv4_vlan_addresses %}
{%- set ipv6_addresses = ipv6_addresses + ipv6_vlan_addresses %}
[
{% if ipv4_loopback_addresses %}
{% if subnet_decap.enable %}
Expand All @@ -66,6 +70,15 @@
},
"OP": "SET"
},
{% for prefix in ipv4_vlan_addresses|sort %}
{
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET:{{ prefix | network }}/{{ prefix | prefixlen }}" : {
"term_type":"MP2MP",
"subnet_type": "vlan"
},
"OP": "SET"
},
{% endfor %}
{% endif %}
{
"TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : {
Expand Down Expand Up @@ -110,6 +123,15 @@
},
"OP": "SET"
},
{% for prefix in ipv6_vlan_addresses|sort %}
{
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET_V6:{{ prefix | network }}/{{ prefix | prefixlen }}" : {
"term_type":"MP2MP",
"subnet_type": "vlan"
},
"OP": "SET"
},
{% endfor %}
{% endif %}
{
"TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@
},
"OP": "SET"
},
{
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET:192.168.0.0/27" : {
"term_type":"MP2MP",
"subnet_type": "vlan"
},
"OP": "SET"
},
{
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET:192.168.200.0/27" : {
"term_type":"MP2MP",
"subnet_type": "vlan"
},
"OP": "SET"
},
{
"TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : {
"tunnel_type":"IPINIP",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@
},
"OP": "SET"
},
{
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET:192.168.0.0/27" : {
"term_type":"MP2MP",
"subnet_type": "vlan"
},
"OP": "SET"
},
{
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET:192.168.200.0/27" : {
"term_type":"MP2MP",
"subnet_type": "vlan"
},
"OP": "SET"
},
{
"TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : {
"tunnel_type":"IPINIP",
Expand Down

0 comments on commit 702dd4e

Please sign in to comment.