[minigraph]: Add mirror type v6 condition (#2836)
Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
This commit is contained in:
parent
16bfd7200f
commit
66245e29a3
@ -228,6 +228,7 @@ def parse_dpg(dpg, hname):
|
|||||||
aclattach = aclintf.find(str(QName(ns, "AttachTo"))).text.split(';')
|
aclattach = aclintf.find(str(QName(ns, "AttachTo"))).text.split(';')
|
||||||
acl_intfs = []
|
acl_intfs = []
|
||||||
is_mirror = False
|
is_mirror = False
|
||||||
|
is_mirror_v6 = False
|
||||||
|
|
||||||
# TODO: Ensure that acl_intfs will only ever contain front-panel interfaces (e.g.,
|
# TODO: Ensure that acl_intfs will only ever contain front-panel interfaces (e.g.,
|
||||||
# maybe we should explicity ignore management and loopback interfaces?) because we
|
# maybe we should explicity ignore management and loopback interfaces?) because we
|
||||||
@ -247,7 +248,10 @@ def parse_dpg(dpg, hname):
|
|||||||
if port_alias_map[member] in intfs_inpc:
|
if port_alias_map[member] in intfs_inpc:
|
||||||
print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface"
|
print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface"
|
||||||
elif member.lower().startswith('erspan'):
|
elif member.lower().startswith('erspan'):
|
||||||
is_mirror = True;
|
if member.lower().startswith('erspanv6'):
|
||||||
|
is_mirror_v6 = True
|
||||||
|
else:
|
||||||
|
is_mirror = True;
|
||||||
# Erspan session will be attached to all front panel ports,
|
# Erspan session will be attached to all front panel ports,
|
||||||
# if panel ports is a member port of LAG, should add the LAG
|
# if panel ports is a member port of LAG, should add the LAG
|
||||||
# to acl table instead of the panel ports
|
# to acl table instead of the panel ports
|
||||||
@ -258,10 +262,13 @@ def parse_dpg(dpg, hname):
|
|||||||
break;
|
break;
|
||||||
if acl_intfs:
|
if acl_intfs:
|
||||||
acls[aclname] = {'policy_desc': aclname,
|
acls[aclname] = {'policy_desc': aclname,
|
||||||
'ports': acl_intfs,
|
'ports': acl_intfs}
|
||||||
'type': 'MIRROR' if is_mirror else 'L3'}
|
if is_mirror:
|
||||||
elif is_mirror:
|
acls[aclname]['type'] = 'MIRROR'
|
||||||
acls[aclname] = {'policy_desc': aclname, 'type': 'MIRROR'}
|
elif is_mirror_v6:
|
||||||
|
acls[aclname]['type'] = 'MIRRORV6'
|
||||||
|
else:
|
||||||
|
acls[aclname]['type'] = 'L3'
|
||||||
else:
|
else:
|
||||||
# This ACL has no interfaces to attach to -- consider this a control plane ACL
|
# This ACL has no interfaces to attach to -- consider this a control plane ACL
|
||||||
try:
|
try:
|
||||||
|
@ -87,7 +87,7 @@ class TestCfgGen(TestCase):
|
|||||||
"'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}, "
|
"'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}, "
|
||||||
"'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}, "
|
"'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}, "
|
||||||
"'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}, "
|
"'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}, "
|
||||||
"'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']}}")
|
"'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']}}")
|
||||||
|
|
||||||
def test_minigraph_everflow(self):
|
def test_minigraph_everflow(self):
|
||||||
argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION'
|
argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION'
|
||||||
|
Reference in New Issue
Block a user