Skip to content

Commit 0b745ed

Browse files
Shuotian Chenglguohan
Shuotian Cheng
authored andcommitted
[minigraph]: Add mirror type v6 condition (#2836)
Signed-off-by: Shu0T1an ChenG <[email protected]>
1 parent 386c041 commit 0b745ed

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/sonic-config-engine/minigraph.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ def parse_dpg(dpg, hname):
228228
aclattach = aclintf.find(str(QName(ns, "AttachTo"))).text.split(';')
229229
acl_intfs = []
230230
is_mirror = False
231+
is_mirror_v6 = False
231232

232233
# TODO: Ensure that acl_intfs will only ever contain front-panel interfaces (e.g.,
233234
# maybe we should explicity ignore management and loopback interfaces?) because we
@@ -247,7 +248,10 @@ def parse_dpg(dpg, hname):
247248
if port_alias_map[member] in intfs_inpc:
248249
print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface"
249250
elif member.lower().startswith('erspan'):
250-
is_mirror = True;
251+
if member.lower().startswith('erspanv6'):
252+
is_mirror_v6 = True
253+
else:
254+
is_mirror = True;
251255
# Erspan session will be attached to all front panel ports,
252256
# if panel ports is a member port of LAG, should add the LAG
253257
# to acl table instead of the panel ports
@@ -258,10 +262,13 @@ def parse_dpg(dpg, hname):
258262
break;
259263
if acl_intfs:
260264
acls[aclname] = {'policy_desc': aclname,
261-
'ports': acl_intfs,
262-
'type': 'MIRROR' if is_mirror else 'L3'}
263-
elif is_mirror:
264-
acls[aclname] = {'policy_desc': aclname, 'type': 'MIRROR'}
265+
'ports': acl_intfs}
266+
if is_mirror:
267+
acls[aclname]['type'] = 'MIRROR'
268+
elif is_mirror_v6:
269+
acls[aclname]['type'] = 'MIRRORV6'
270+
else:
271+
acls[aclname]['type'] = 'L3'
265272
else:
266273
# This ACL has no interfaces to attach to -- consider this a control plane ACL
267274
try:

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_minigraph_acl(self):
8787
"'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}, "
8888
"'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}, "
8989
"'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']}}")
90+
"'EVERFLOWV6': {'type': 'MIRRORV6', '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']}}")
9191

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

0 commit comments

Comments
 (0)