[minigraph.py] Only add 'service' field to control plane ACLs, not dataplane ACLs (#1341)

* [minigraph.py] Only add 'service' field to control plane ACLs, not dataplane ACLs

* Modify unit test accordingly
This commit is contained in:
Joe LeVeque 2018-01-26 20:29:20 -08:00 committed by lguohan
parent 2b91c9681d
commit da10ff5aa9
2 changed files with 3 additions and 4 deletions

View File

@ -202,15 +202,14 @@ def parse_dpg(dpg, hname):
if acl_intfs:
acls[aclname] = {'policy_desc': aclname,
'ports': acl_intfs,
'type': 'MIRROR' if is_mirror else 'L3',
'service': 'N/A'}
'type': 'MIRROR' if is_mirror else 'L3'}
else:
# This ACL has no interfaces to attach to -- consider this a control plane ACL
aclservice = aclintf.find(str(QName(ns, "Type"))).text
acls[aclname] = {'policy_desc': aclname,
'ports': acl_intfs,
'type': 'CTRLPLANE',
'service': aclservice if aclservice is not None else ''}
'service': aclservice if aclservice is not None else 'UNKNOWN'}
return intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, acls
return None, None, None, None, None, None, None

View File

@ -73,7 +73,7 @@ class TestCfgGen(TestCase):
def test_minigraph_acl(self):
argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE'
output = self.run_script(argument)
self.assertEqual(output.strip(), "{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'service': 'N/A', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}")
self.assertEqual(output.strip(), "{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}")
def test_minigraph_everflow(self):
argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION'