forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add backend acl template (sonic-net#11220)
Why I did it Storage backend has all vlan members tagged. If untagged packets are received on those links, they are accounted as RX_DROPS which can lead to false alarms in monitoring tools. Using this acl to hide these drops. How I did it Created a acl template which will be loaded during minigraph load for backend. This template will allow tagged vlan packets and dropped untagged How to verify it Unit tests Signed-off-by: Neetha John <[email protected]>
- Loading branch information
1 parent
be532c0
commit 5a54853
Showing
7 changed files
with
314 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{%- set vlan2ports = {} %} | ||
{%- for vlan in VLAN %} | ||
{% set portlist = [] %} | ||
{%- for vlan_name, port in VLAN_MEMBER %} | ||
{%- if vlan_name == vlan %} | ||
{%- if portlist.append(port) %}{%- endif %} | ||
{%- endif %} | ||
{%- endfor %} | ||
{%- set _ = vlan2ports.update({vlan: portlist| sort | join(',')}) %} | ||
{%- endfor %} | ||
|
||
|
||
{ | ||
"acl": { | ||
"acl-sets": { | ||
"acl-set": { | ||
"DATAACL": { | ||
"acl-entries": { | ||
"acl-entry": { | ||
{% for vlan, vlan_entries in VLAN.items() %} | ||
"{{ loop.index }}": { | ||
"config": { | ||
"sequence-id": {{ loop.index }} | ||
}, | ||
"actions": { | ||
"config": { | ||
"forwarding-action": "ACCEPT" | ||
} | ||
}, | ||
"l2": { | ||
"config": { | ||
"vlan_id": "{{ vlan_entries['vlanid'] }}" | ||
} | ||
}, | ||
"input_interface": { | ||
"interface_ref": { | ||
"config": { | ||
"interface": "{{ vlan2ports[vlan] }}" | ||
} | ||
} | ||
} | ||
|
||
}{% if not loop.last %},{% endif %} | ||
{% endfor -%} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/sonic-config-engine/tests/data/backend_acl/acl_multi_vlan.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
{ | ||
"acl": { | ||
"acl-sets": { | ||
"acl-set": { | ||
"DATAACL": { | ||
"acl-entries": { | ||
"acl-entry": { | ||
"1": { | ||
"config": { | ||
"sequence-id": 1 | ||
}, | ||
"actions": { | ||
"config": { | ||
"forwarding-action": "ACCEPT" | ||
} | ||
}, | ||
"l2": { | ||
"config": { | ||
"vlan_id": "1000" | ||
} | ||
}, | ||
"input_interface": { | ||
"interface_ref": { | ||
"config": { | ||
"interface": "Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76" | ||
} | ||
} | ||
} | ||
|
||
}, "2": { | ||
"config": { | ||
"sequence-id": 2 | ||
}, | ||
"actions": { | ||
"config": { | ||
"forwarding-action": "ACCEPT" | ||
} | ||
}, | ||
"l2": { | ||
"config": { | ||
"vlan_id": "2000" | ||
} | ||
}, | ||
"input_interface": { | ||
"interface_ref": { | ||
"config": { | ||
"interface": "Ethernet4,Ethernet8" | ||
} | ||
} | ||
} | ||
|
||
} } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/sonic-config-engine/tests/data/backend_acl/acl_single_vlan.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
{ | ||
"acl": { | ||
"acl-sets": { | ||
"acl-set": { | ||
"DATAACL": { | ||
"acl-entries": { | ||
"acl-entry": { | ||
"1": { | ||
"config": { | ||
"sequence-id": 1 | ||
}, | ||
"actions": { | ||
"config": { | ||
"forwarding-action": "ACCEPT" | ||
} | ||
}, | ||
"l2": { | ||
"config": { | ||
"vlan_id": "1000" | ||
} | ||
}, | ||
"input_interface": { | ||
"interface_ref": { | ||
"config": { | ||
"interface": "Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet4,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet8" | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
src/sonic-config-engine/tests/data/backend_acl/multi_vlan.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"VLAN": { | ||
"Vlan1000": { | ||
"vlanid": "1000" | ||
}, | ||
"Vlan2000": { | ||
"vlanid": "2000" | ||
} | ||
}, | ||
"VLAN_MEMBER": { | ||
"Vlan1000|Ethernet12": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet16": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet20": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet24": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet28": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet32": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet36": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet40": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet44": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet48": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet52": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet56": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet60": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet64": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet68": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet72": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet76": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan2000|Ethernet4": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan2000|Ethernet8": { | ||
"tagging_mode": "tagged" | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
src/sonic-config-engine/tests/data/backend_acl/single_vlan.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"VLAN": { | ||
"Vlan1000": { | ||
"vlanid": "1000" | ||
} | ||
}, | ||
"VLAN_MEMBER": { | ||
"Vlan1000|Ethernet4": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet8": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet12": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet16": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet20": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet24": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet28": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet32": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet36": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet40": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet44": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet48": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet52": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet56": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet60": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet64": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet68": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet72": { | ||
"tagging_mode": "tagged" | ||
}, | ||
"Vlan1000|Ethernet76": { | ||
"tagging_mode": "tagged" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters