[sonic-cfggen] Enhance ACL unit test to also test control plane (service) ACLs (#1349)

This commit is contained in:
Joe LeVeque 2018-01-30 11:19:03 -08:00 committed by GitHub
parent 91effa249c
commit 8cf03b0b28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 87 additions and 13 deletions

View File

@ -134,10 +134,14 @@
<DataAcls/>
<AclInterfaces>
<AclInterface>
<AttachTo>
PortChannel01;PortChannel02;PortChannel03;PortChannel04
</AttachTo>
<AttachTo>PortChannel01;PortChannel02;PortChannel03;PortChannel04</AttachTo>
<InAcl>DataAcl</InAcl>
<Type>DataPlane</Type>
</AclInterface>
<AclInterface>
<AttachTo>SNMP</AttachTo>
<InAcl>SNMP_ACL</InAcl>
<Type>SNMP</Type>
</AclInterface>
</AclInterfaces>
<DownstreamSummaries/>

View File

@ -166,10 +166,14 @@
<DataAcls/>
<AclInterfaces>
<AclInterface>
<AttachTo>
PortChannel01
</AttachTo>
<AttachTo>PortChannel01</AttachTo>
<InAcl>DataAcl</InAcl>
<Type>DataPlane</Type>
</AclInterface>
<AclInterface>
<AttachTo>SNMP</AttachTo>
<InAcl>SNMP_ACL</InAcl>
<Type>SNMP</Type>
</AclInterface>
</AclInterfaces>
<DownstreamSummaries/>

View File

@ -112,6 +112,63 @@
"config": {
"name": "everflow"
}
},
"SNMP-ACL": {
"acl-entries": {
"acl-entry": {
"1": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 1
},
"ip": {
"config": {
"protocol": "IP_UDP",
"source-ip-address": "10.0.0.0/8"
}
}
},
"2": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 2
},
"ip": {
"config": {
"protocol": "IP_UDP",
"source-ip-address": "100.64.0.0/10"
}
}
},
"3": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 3
},
"ip": {
"config": {
"protocol": "IP_UDP",
"source-ip-address": "25.0.0.0/8"
}
}
}
}
},
"config": {
"name": "SNMP-ACL"
}
}
}
}

View File

@ -259,10 +259,14 @@
<DataAcls/>
<AclInterfaces>
<AclInterface>
<AttachTo>
PortChannel01;PortChannel02;PortChannel03;PortChannel04
</AttachTo>
<AttachTo>PortChannel01;PortChannel02;PortChannel03;PortChannel04</AttachTo>
<InAcl>DataAcl</InAcl>
<Type>DataPlane</Type>
</AclInterface>
<AclInterface>
<AttachTo>SNMP</AttachTo>
<InAcl>SNMP_ACL</InAcl>
<Type>SNMP</Type>
</AclInterface>
</AclInterfaces>
<DownstreamSummaries/>

View File

@ -262,10 +262,14 @@
<DataAcls/>
<AclInterfaces>
<AclInterface>
<AttachTo>
PortChannel01;PortChannel02;PortChannel03;PortChannel04
</AttachTo>
<AttachTo>PortChannel01;PortChannel02;PortChannel03;PortChannel04</AttachTo>
<InAcl>DataAcl</InAcl>
<Type>DataPlane</Type>
</AclInterface>
<AclInterface>
<AttachTo>SNMP</AttachTo>
<InAcl>SNMP_ACL</InAcl>
<Type>SNMP</Type>
</AclInterface>
</AclInterfaces>
<DownstreamSummaries/>

View File

@ -73,7 +73,8 @@ 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', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}")
self.assertEqual(output.strip(), "{'SNMP_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL', 'service': 'SNMP', 'ports': []},"
" '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'