diff --git a/src/sonic-config-engine/tests/pc-test-graph.xml b/src/sonic-config-engine/tests/pc-test-graph.xml index 2cb281b879cb..6709d65c4969 100644 --- a/src/sonic-config-engine/tests/pc-test-graph.xml +++ b/src/sonic-config-engine/tests/pc-test-graph.xml @@ -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/> diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index d3bc25272282..4062cd7ae0c8 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -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/> diff --git a/src/sonic-config-engine/tests/t0-sample-acl.json b/src/sonic-config-engine/tests/t0-sample-acl.json index 4157a1701b60..1caf2ff02959 100644 --- a/src/sonic-config-engine/tests/t0-sample-acl.json +++ b/src/sonic-config-engine/tests/t0-sample-acl.json @@ -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" + } } } } diff --git a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml index 18a8baccdae2..f2690985d9f3 100644 --- a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml +++ b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml @@ -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/> diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index fe0b1a1e2500..f3d05cbc22c1 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -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/> diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 2eee6fe331c8..9c9b31abf203 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -73,7 +73,8 @@ def test_render_template(self): 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'