diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2017-04-21 13:57:39 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-04-24 12:44:32 +0000 |
commit | 82bb8df87d276f98442439893baf7d55c3afdd8c (patch) | |
tree | 9afd723f5bf1a1aaaf21d58f8708854cd271376e /acl/acl-impl/src/test | |
parent | 470588683af86c9ab73538ced85e1d88f55e3b70 (diff) |
HC2VPP-129 - v4 vs v6 detections based on ip-protocol
Change-Id: Id10ec084bbb096df3c40aed6319ce406bb746a21
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'acl/acl-impl/src/test')
-rw-r--r-- | acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/util/ace/extractor/StandardAceDataExtractorTest.java | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/util/ace/extractor/StandardAceDataExtractorTest.java b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/util/ace/extractor/StandardAceDataExtractorTest.java index 35add44a2..4e0f1fd5a 100644 --- a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/util/ace/extractor/StandardAceDataExtractorTest.java +++ b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/util/ace/extractor/StandardAceDataExtractorTest.java @@ -41,6 +41,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl. import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.vpp.ace.vpp.ace.nodes.ace.ip.version.AceIpv4Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.vpp.ace.vpp.ace.nodes.ace.ip.version.AceIpv6; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.vpp.ace.vpp.ace.nodes.ace.ip.version.AceIpv6Builder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.ip.protocol.header.fields.ip.protocol.IcmpBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.ip.protocol.header.fields.ip.protocol.IcmpV6Builder; public class StandardAceDataExtractorTest extends AceDataExtractorTestCase implements StandardAceDataExtractor, @@ -58,17 +60,27 @@ public class StandardAceDataExtractorTest extends AceDataExtractorTestCase imple } @Test - public void testStandardIsIpv6() { - assertFalse(standardIsIpv6(new AceBuilder().build())); - assertFalse(standardIsIpv6(new AceBuilder().setMatches(new MatchesBuilder().build()).build())); - assertFalse(standardIsIpv6( - new AceBuilder().setMatches(new MatchesBuilder().setAceType(new VppAceBuilder().build()).build()) - .build())); - assertFalse(standardIsIpv6(new AceBuilder().setMatches(new MatchesBuilder() - .setAceType(new VppAceBuilder().setVppAceNodes(new VppAceNodesBuilder().build()).build()).build()) - .build())); - assertTrue(standardIsIpv6(new AceBuilder().setMatches(new MatchesBuilder().setAceType(new VppAceBuilder() - .setVppAceNodes(new VppAceNodesBuilder().setAceIpVersion(new AceIpv6Builder().build()).build()).build()) + public void testStandardIsIpv6WithoutMatch() { + assertFalse(standardIsIpv6(new VppAceBuilder().build(), null)); + assertFalse(standardIsIpv6(new VppAceBuilder().setVppAceNodes(new VppAceNodesBuilder().build()).build(), null)); + assertFalse(standardIsIpv6(new VppAceBuilder().setVppAceNodes(new VppAceNodesBuilder() + .setIpProtocol(new IcmpBuilder().build()).build()).build(), null)); + assertTrue(standardIsIpv6(new VppAceBuilder().setVppAceNodes(new VppAceNodesBuilder() + .setIpProtocol(new IcmpV6Builder().build()).build()).build(), null)); + } + + @Test + public void testStandardIsIpv6WithMatch() { + final VppAce ipv6Ace = new VppAceBuilder().setVppAceNodes(new VppAceNodesBuilder() + .setIpProtocol(new IcmpV6Builder().build()).build()).build(); + + assertTrue(standardIsIpv6(ipv6Ace, new MatchesBuilder().build())); + assertTrue(standardIsIpv6(ipv6Ace, new MatchesBuilder().setAceType(new VppAceBuilder().build()).build())); + assertTrue(standardIsIpv6(ipv6Ace, new MatchesBuilder().setAceType(new VppAceBuilder() + .setVppAceNodes(new VppAceNodesBuilder().build()) + .build()).build())); + assertFalse(standardIsIpv6(ipv6Ace, new MatchesBuilder().setAceType(new VppAceBuilder() + .setVppAceNodes(new VppAceNodesBuilder().setAceIpVersion(new AceIpv4Builder().build()).build()) .build()).build())); } |