Skip to content

Commit 4791701

Browse files
Shuotian Chenglguohan
Shuotian Cheng
authored andcommitted
[minigraph]: Mark both ERSPAN and ERSPANv6 as mirror ACL tables (#2732)
- Support ERSPAN and ERSPANv6 two types of ACL tables. - Update the unit test to cover this case. Signed-off-by: Shu0T1an ChenG <[email protected]>
1 parent b56124b commit 4791701

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/sonic-config-engine/minigraph.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def parse_dpg(dpg, hname):
246246
# Give a warning if trying to attach ACL to a LAG member interface, correct way is to attach ACL to the LAG interface
247247
if port_alias_map[member] in intfs_inpc:
248248
print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface"
249-
elif member.lower() == 'erspan':
249+
elif member.lower().startswith('erspan'):
250250
is_mirror = True;
251251
# Erspan session will be attached to all front panel ports,
252252
# if panel ports is a member port of LAG, should add the LAG

src/sonic-config-engine/tests/t0-sample-graph.xml

+10
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@
269269
</IPInterfaces>
270270
<DataAcls/>
271271
<AclInterfaces>
272+
<AclInterface>
273+
<AttachTo>ERSPAN</AttachTo>
274+
<InAcl>everflow</InAcl>
275+
<Type>Everflow</Type>
276+
</AclInterface>
277+
<AclInterface>
278+
<AttachTo>ERSPANv6</AttachTo>
279+
<InAcl>everflowV6</InAcl>
280+
<Type>Everflow</Type>
281+
</AclInterface>
272282
<AclInterface>
273283
<AttachTo>PortChannel01;PortChannel02;PortChannel03;PortChannel04</AttachTo>
274284
<InAcl>DataAcl</InAcl>

src/sonic-config-engine/tests/test_cfggen.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ def test_minigraph_acl(self):
8181
self.assertEqual(output.strip(), "Warning: Ignoring Control Plane ACL NTP_ACL without type\n"
8282
"Warning: ignore interface 'fortyGigE0/2' as it is not in the port_config.ini\n"
8383
"Warning: ignore interface 'fortyGigE0/2' in DEVICE_NEIGHBOR as it is not in the port_config.ini\n"
84-
"{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'},"
85-
" 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'},"
86-
" 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04']},"
87-
" 'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL'},"
88-
" 'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}}")
84+
"{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04']}, "
85+
"'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL'}, "
86+
"'EVERFLOW': {'type': 'MIRROR', 'policy_desc': 'EVERFLOW', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100']}, "
87+
"'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}, "
88+
"'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}, "
89+
"'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}, "
90+
"'EVERFLOWV6': {'type': 'MIRROR', 'policy_desc': 'EVERFLOWV6', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100']}}")
8991

9092
def test_minigraph_everflow(self):
9193
argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION'

0 commit comments

Comments
 (0)