Skip to content

Commit 702dd4e

Browse files
authored
[subnet decap] Fix VLAN prefix decap term (sonic-net#19229)
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 <[email protected]>
1 parent 9080f81 commit 702dd4e

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

dockers/docker-orchagent/ipinip.json.j2

+24-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
{% else %}
44
{% set ipv4_addresses = [] %}
55
{% set ipv6_addresses = [] %}
6+
{% set ipv4_vlan_addresses = [] %}
7+
{% set ipv6_vlan_addresses = [] %}
68
{% set ipv4_loopback_addresses = [] %}
79
{% set ipv6_loopback_addresses = [] %}
810
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd'%}
@@ -44,12 +46,14 @@
4446
{% endfor %}
4547
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
4648
{%- if prefix | ipv4 %}
47-
{%- set ipv4_addresses = ipv4_addresses.append(prefix) %}
49+
{%- set ipv4_vlan_addresses = ipv4_vlan_addresses.append(prefix) %}
4850
{%- endif %}
4951
{%- if prefix | ipv6 %}
50-
{%- set ipv6_addresses = ipv6_addresses.append(prefix) %}
52+
{%- set ipv6_vlan_addresses = ipv6_vlan_addresses.append(prefix) %}
5153
{%- endif %}
5254
{% endfor %}
55+
{%- set ipv4_addresses = ipv4_addresses + ipv4_vlan_addresses %}
56+
{%- set ipv6_addresses = ipv6_addresses + ipv6_vlan_addresses %}
5357
[
5458
{% if ipv4_loopback_addresses %}
5559
{% if subnet_decap.enable %}
@@ -66,6 +70,15 @@
6670
},
6771
"OP": "SET"
6872
},
73+
{% for prefix in ipv4_vlan_addresses|sort %}
74+
{
75+
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET:{{ prefix | network }}/{{ prefix | prefixlen }}" : {
76+
"term_type":"MP2MP",
77+
"subnet_type": "vlan"
78+
},
79+
"OP": "SET"
80+
},
81+
{% endfor %}
6982
{% endif %}
7083
{
7184
"TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : {
@@ -110,6 +123,15 @@
110123
},
111124
"OP": "SET"
112125
},
126+
{% for prefix in ipv6_vlan_addresses|sort %}
127+
{
128+
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET_V6:{{ prefix | network }}/{{ prefix | prefixlen }}" : {
129+
"term_type":"MP2MP",
130+
"subnet_type": "vlan"
131+
},
132+
"OP": "SET"
133+
},
134+
{% endfor %}
113135
{% endif %}
114136
{
115137
"TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : {

src/sonic-config-engine/tests/sample_output/py2/ipinip_subnet_decap_enable.json

+14
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@
88
},
99
"OP": "SET"
1010
},
11+
{
12+
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET:192.168.0.0/27" : {
13+
"term_type":"MP2MP",
14+
"subnet_type": "vlan"
15+
},
16+
"OP": "SET"
17+
},
18+
{
19+
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET:192.168.200.0/27" : {
20+
"term_type":"MP2MP",
21+
"subnet_type": "vlan"
22+
},
23+
"OP": "SET"
24+
},
1125
{
1226
"TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : {
1327
"tunnel_type":"IPINIP",

src/sonic-config-engine/tests/sample_output/py3/ipinip_subnet_decap_enable.json

+14
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@
88
},
99
"OP": "SET"
1010
},
11+
{
12+
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET:192.168.0.0/27" : {
13+
"term_type":"MP2MP",
14+
"subnet_type": "vlan"
15+
},
16+
"OP": "SET"
17+
},
18+
{
19+
"TUNNEL_DECAP_TERM_TABLE:IPINIP_SUBNET:192.168.200.0/27" : {
20+
"term_type":"MP2MP",
21+
"subnet_type": "vlan"
22+
},
23+
"OP": "SET"
24+
},
1125
{
1226
"TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : {
1327
"tunnel_type":"IPINIP",

0 commit comments

Comments
 (0)