Skip to content

Commit 2bf48ab

Browse files
neethajohnskbarista
authored andcommitted
Minigraph parser changes for storage backend acl (sonic-net#11221)
Signed-off-by: Neetha John [email protected] Why I did it For storage backend, certain rules will be applied to the DATAACL table to allow only vlan tagged packets and drop untagged packets. How I did it Create DATAACL table if the device is a storage backend device To avoid ACL resource issues, remove EVERFLOW related tables if the device is a storage backend device How to verify it Added the following unit tests - verify that EVERFLOW acl tables is removed and DATAACL table is added for storage backend tor - verify that no DATAACL tables are created and EVERFLOW tables exist for storage backend leaf
1 parent 5a54853 commit 2bf48ab

File tree

4 files changed

+838
-51
lines changed

4 files changed

+838
-51
lines changed

src/sonic-config-engine/minigraph.py

+21-2
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,26 @@ def parse_spine_chassis_fe(results, vni, lo_intfs, phyport_intfs, pc_intfs, pc_m
11721172
#
11731173
###############################################################################
11741174

1175-
def filter_acl_table_bindings(acls, neighbors, port_channels, sub_role):
1175+
def filter_acl_table_for_backend(acls, vlan_members):
1176+
filter_acls = {}
1177+
for acl_name, value in acls.items():
1178+
if 'everflow' not in acl_name.lower():
1179+
filter_acls[acl_name] = value
1180+
1181+
ports = set()
1182+
for vlan, member in vlan_members:
1183+
ports.add(member)
1184+
filter_acls['DATAACL'] = { 'policy_desc': 'DATAACL',
1185+
'stage': 'ingress',
1186+
'type': 'L3',
1187+
'ports': list(ports)
1188+
}
1189+
return filter_acls
1190+
1191+
def filter_acl_table_bindings(acls, neighbors, port_channels, sub_role, device_type, is_storage_device, vlan_members):
1192+
if device_type == 'BackEndToRRouter' and is_storage_device:
1193+
return filter_acl_table_for_backend(acls, vlan_members)
1194+
11761195
filter_acls = {}
11771196

11781197
# If the asic role is BackEnd no ACL Table (Ctrl/Data/Everflow) is binded.
@@ -1741,7 +1760,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
17411760
results['DHCP_RELAY'] = dhcp_relay_table
17421761
results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers)
17431762
results['TACPLUS_SERVER'] = dict((item, {'priority': '1', 'tcp_port': '49'}) for item in tacacs_servers)
1744-
results['ACL_TABLE'] = filter_acl_table_bindings(acls, neighbors, pcs, sub_role)
1763+
results['ACL_TABLE'] = filter_acl_table_bindings(acls, neighbors, pcs, sub_role, current_device['type'], is_storage_device, vlan_members)
17451764
results['FEATURE'] = {
17461765
'telemetry': {
17471766
'state': 'enabled'

0 commit comments

Comments
 (0)