summaryrefslogtreecommitdiffstats
path: root/acl/acl-impl/src/test/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'acl/acl-impl/src/test/java/io')
-rw-r--r--acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/write/VppAclCustomizerTest.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/write/VppAclCustomizerTest.java b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/write/VppAclCustomizerTest.java
index bfdd17682..b4b4ef9ba 100644
--- a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/write/VppAclCustomizerTest.java
+++ b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/write/VppAclCustomizerTest.java
@@ -168,7 +168,7 @@ public class VppAclCustomizerTest extends WriterCustomizerTest implements AclTes
@Test
public void updateCurrentAttributesTcp(@InjectTestData(resourcePath = "/acl/standard/standard-acl-tcp.json")
- AccessLists standardAcls) throws Exception {
+ AccessLists standardAcls) throws Exception {
final int aclIndex = 4;
when(standardAclContext.getAclIndex("standard-acl", mappingContext)).thenReturn(aclIndex);
final Acl data = standardAcls.getAcl().get(0);
@@ -178,6 +178,23 @@ public class VppAclCustomizerTest extends WriterCustomizerTest implements AclTes
verifyTcpRequest(aclIndex);
}
+ @Test
+ public void updateCurrentAttributesTcpSrcOnly(@InjectTestData(resourcePath = "/acl/standard/standard-acl-tcp-src-only.json")
+ AccessLists standardAcls) throws Exception {
+ final int aclIndex = 4;
+ when(standardAclContext.getAclIndex("standard-acl", mappingContext)).thenReturn(aclIndex);
+ final Acl data = standardAcls.getAcl().get(0);
+ aclCustomizer.updateCurrentAttributes(validId, data, data, writeContext);
+
+ verify(aclApi, times(1)).aclAddReplace(aclAddReplaceRequestCaptor.capture());
+ final AclAddReplace request = aclAddReplaceRequestCaptor.getValue();
+ final AclRule tcpRule = request.r[0];
+ assertTrue(Arrays.equals(new byte[]{-64, -88, 2, 2}, tcpRule.srcIpAddr));
+ assertEquals(32, tcpRule.srcIpPrefixLen);
+ assertTrue(Arrays.equals(new byte[]{0, 0, 0, 0}, tcpRule.dstIpAddr));
+ assertEquals(0, tcpRule.dstIpPrefixLen);
+ }
+
@Test
public void writeCurrentAttributesUdp(@InjectTestData(resourcePath = "/acl/standard/standard-acl-udp.json")