summaryrefslogtreecommitdiffstats
path: root/ipsec/ipsec-impl/src/test
diff options
context:
space:
mode:
authorTibor Král <tibor.kral@pantheon.tech>2019-01-18 16:54:28 +0100
committerTibor Král <tibor.kral@pantheon.tech>2019-01-18 16:20:32 +0000
commit7645a98e4c92a20d45a8a1417db498db1b075080 (patch)
tree2cb8d5925cbe912b73712370d8b7b6a39ce54d54 /ipsec/ipsec-impl/src/test
parentd10368dffa17254096c99f64d7e1d77644f50a6d (diff)
Update IPSec writers
- Fix data_len fields in api messages - Add enum for authentication types Change-Id: I266bb096488b41d4e97b6fa4c5a557b71925be77 Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
Diffstat (limited to 'ipsec/ipsec-impl/src/test')
-rw-r--r--ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/Ikev2PolicyCustomizerTest.java7
-rw-r--r--ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/Ikev2PolicyIdentityCustomizerTest.java4
-rw-r--r--ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizerTest.java3
3 files changed, 12 insertions, 2 deletions
diff --git a/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/Ikev2PolicyCustomizerTest.java b/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/Ikev2PolicyCustomizerTest.java
index 0c7b65f1b..e2062e56c 100644
--- a/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/Ikev2PolicyCustomizerTest.java
+++ b/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/Ikev2PolicyCustomizerTest.java
@@ -25,6 +25,7 @@ import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
import io.fd.hc2vpp.common.translate.util.Ipv4Translator;
import io.fd.hc2vpp.common.translate.util.Ipv6Translator;
+import io.fd.hc2vpp.ipsec.dto.AuthMethod;
import io.fd.hc2vpp.ipsec.helpers.SchemaContextTestHelper;
import io.fd.honeycomb.test.tools.HoneycombTestRunner;
import io.fd.honeycomb.test.tools.annotations.InjectTestData;
@@ -149,16 +150,18 @@ public class Ikev2PolicyCustomizerTest extends WriterCustomizerTest implements S
if (auth != null) {
request.name = policy.getName().getBytes();
if (auth.isPresharedKey() != null && policy.getPreSharedKey() != null) {
- request.authMethod = ByteDataTranslator.BYTE_FALSE;
+ request.authMethod = AuthMethod.SHARED_KEY_MIC.getValue();
if (policy.getPreSharedKey().getHexString() != null) {
request.isHex = ByteDataTranslator.BYTE_TRUE;
}
request.data = policy.getPreSharedKey().stringValue().getBytes();
+ request.dataLen = request.data.length;
} else if (auth.isRsaSignature() != null) {
IpsecIkev2PolicyAugmentation aug = policy.augmentation(IpsecIkev2PolicyAugmentation.class);
if (aug != null && aug.getCertificate() != null) {
request.data = aug.getCertificate().getBytes();
- request.authMethod = ByteDataTranslator.BYTE_TRUE;
+ request.dataLen = request.data.length;
+ request.authMethod = AuthMethod.RSA_SIG.getValue();
}
}
}
diff --git a/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/Ikev2PolicyIdentityCustomizerTest.java b/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/Ikev2PolicyIdentityCustomizerTest.java
index bb8f0d762..3f57acdbb 100644
--- a/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/Ikev2PolicyIdentityCustomizerTest.java
+++ b/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/Ikev2PolicyIdentityCustomizerTest.java
@@ -69,6 +69,7 @@ public class Ikev2PolicyIdentityCustomizerTest extends WriterCustomizerTest impl
request.idType = (byte) 1;
request.isLocal = BYTE_TRUE;
request.data = ipv4AddressNoZoneToArray(IPV4_TYPE_DATA);
+ request.dataLen = request.data.length;
verify(api).ikev2ProfileSetId(request);
}
@@ -82,6 +83,7 @@ public class Ikev2PolicyIdentityCustomizerTest extends WriterCustomizerTest impl
request.idType = (byte) 2;
request.isLocal = BYTE_FALSE;
request.data = FQDN_TYPE_DATA.getBytes();
+ request.dataLen = request.data.length;
verify(api).ikev2ProfileSetId(request);
}
@@ -95,6 +97,7 @@ public class Ikev2PolicyIdentityCustomizerTest extends WriterCustomizerTest impl
request.idType = (byte) 5;
request.isLocal = BYTE_FALSE;
request.data = ipv6AddressNoZoneToArray(new Ipv6Address(IPV6_TYPE_DATA));
+ request.dataLen = request.data.length;
verify(api).ikev2ProfileSetId(request);
}
@@ -109,6 +112,7 @@ public class Ikev2PolicyIdentityCustomizerTest extends WriterCustomizerTest impl
request.idType = (byte) 3;
request.isLocal = BYTE_TRUE;
request.data = RFC822_TYPE_DATA.getBytes();
+ request.dataLen = request.data.length;
verify(api).ikev2ProfileSetId(request);
}
diff --git a/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizerTest.java b/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizerTest.java
index 912f50f27..e477467db 100644
--- a/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizerTest.java
+++ b/ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizerTest.java
@@ -94,7 +94,9 @@ public class IpsecSadEntryCustomizerTest extends WriterCustomizerTest implements
request.isTunnel = BYTE_TRUE;
request.isTunnelIpv6 = BYTE_FALSE;
request.integrityKey = INTEG_KEY.getBytes();
+ request.integrityKeyLength = (byte) request.integrityKey.length;
request.cryptoKey = CRYPTO_KEY.getBytes();
+ request.cryptoKeyLength = (byte) request.cryptoKey.length;
request.useAntiReplay = 0;
request.tunnelSrcAddress = ipv4AddressNoZoneToArray(TNL_SRC_ADDR);
request.tunnelDstAddress = ipv4AddressNoZoneToArray(TNL_DST_ADDR);
@@ -158,6 +160,7 @@ public class IpsecSadEntryCustomizerTest extends WriterCustomizerTest implements
request.isTunnelIpv6 = BYTE_TRUE;
request.integrityAlgorithm = 1;
request.integrityKey = INTEG_KEY.getBytes();
+ request.integrityKeyLength = (byte) request.integrityKey.length;
request.useAntiReplay = BYTE_TRUE;
request.tunnelSrcAddress = ipv6AddressNoZoneToArray(Ipv6Address.getDefaultInstance("2001::11"));
request.tunnelDstAddress = ipv6AddressNoZoneToArray(Ipv6Address.getDefaultInstance("2001::12"));