summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/IpsecModule.java3
-rw-r--r--ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizer.java15
-rw-r--r--ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/write/IpsecWriterFactory.java8
-rw-r--r--ipsec/ipsec-impl/src/test/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizerTest.java14
4 files changed, 9 insertions, 31 deletions
diff --git a/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/IpsecModule.java b/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/IpsecModule.java
index dc96690d9..d3930bb9b 100644
--- a/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/IpsecModule.java
+++ b/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/IpsecModule.java
@@ -21,7 +21,6 @@ import com.google.inject.AbstractModule;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.google.inject.multibindings.Multibinder;
-import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
import io.fd.hc2vpp.ipsec.read.IpsecReaderFactory;
import io.fd.hc2vpp.ipsec.write.IpsecWriterFactory;
import io.fd.honeycomb.translate.read.ReaderFactory;
@@ -36,7 +35,6 @@ import org.slf4j.LoggerFactory;
public class IpsecModule extends AbstractModule {
private static final Logger LOG = LoggerFactory.getLogger(IpsecModule.class);
- private static final String SAD_ENTRIES_MAPPING = "sad-entries-mapping";
private final Class<? extends Provider<FutureJVppIkev2Facade>> jvppIkev2ProviderClass;
public IpsecModule() {
@@ -56,7 +54,6 @@ public class IpsecModule extends AbstractModule {
// binds JVpp Ikev2 future facade
bind(FutureJVppIkev2Facade.class).toProvider(jvppIkev2ProviderClass).in(Singleton.class);
- bind(MultiNamingContext.class).toInstance(new MultiNamingContext(SAD_ENTRIES_MAPPING, 1));
LOG.info("Injecting writers factories");
final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
writerFactoryBinder.addBinding().to(IpsecWriterFactory.class).in(Singleton.class);
diff --git a/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizer.java b/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizer.java
index c1e21ed7a..b4d4957ea 100644
--- a/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizer.java
+++ b/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/write/IpsecSadEntryCustomizer.java
@@ -21,7 +21,6 @@ import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
import io.fd.hc2vpp.common.translate.util.Ipv4Translator;
import io.fd.hc2vpp.common.translate.util.Ipv6Translator;
import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
-import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
@@ -62,11 +61,9 @@ public class IpsecSadEntryCustomizer extends FutureJVppCustomizer
JvppReplyConsumer, ByteDataTranslator, Ipv6Translator, Ipv4Translator {
private static final Logger LOG = LoggerFactory.getLogger(IpsecSadEntryCustomizer.class);
- private MultiNamingContext sadEntryMapping;
- IpsecSadEntryCustomizer(final FutureJVppCore vppApi, final MultiNamingContext sadEntryMapping) {
+ IpsecSadEntryCustomizer(final FutureJVppCore vppApi) {
super(vppApi);
- this.sadEntryMapping = sadEntryMapping;
}
@Override
@@ -136,14 +133,6 @@ public class IpsecSadEntryCustomizer extends FutureJVppCustomizer
final CompletionStage<IpsecSadEntryAddDelReply> ipsecSadEntryAddDellReplyFuture =
getFutureJVpp().ipsecSadEntryAddDel(request);
getReplyForWrite(ipsecSadEntryAddDellReplyFuture.toCompletableFuture(), id);
- if (adding) {
- sadEntryMapping.addChild(dataAfter.key().getDirection().getName(), request.entry.sadId,
- String.valueOf(dataAfter.key().getSpi()), writeContext.getMappingContext());
- } else {
- sadEntryMapping
- .removeChild(dataAfter.key().getDirection().getName(), String.valueOf(dataAfter.key().getSpi()),
- writeContext.getMappingContext());
- }
}
private void fillAhAuthentication(IpsecSadEntryAddDel request, Ah data) {
@@ -170,7 +159,7 @@ public class IpsecSadEntryCustomizer extends FutureJVppCustomizer
request.entry.integrityKey.length = (byte) integKey.getBytes().length;
request.entry.cryptoKey = new Key();
request.entry.cryptoKey.data = null;
- request.entry.cryptoKey.length = 0 ;
+ request.entry.cryptoKey.length = 0;
}
}
diff --git a/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/write/IpsecWriterFactory.java b/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/write/IpsecWriterFactory.java
index 35efe0ab2..51d43046b 100644
--- a/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/write/IpsecWriterFactory.java
+++ b/ipsec/ipsec-impl/src/main/java/io/fd/hc2vpp/ipsec/write/IpsecWriterFactory.java
@@ -18,7 +18,6 @@ package io.fd.hc2vpp.ipsec.write;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
-import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
import io.fd.honeycomb.translate.impl.write.GenericListWriter;
import io.fd.honeycomb.translate.impl.write.GenericWriter;
import io.fd.honeycomb.translate.write.WriterFactory;
@@ -69,15 +68,12 @@ public final class IpsecWriterFactory implements WriterFactory {
private final FutureJVppCore vppApi;
private final FutureJVppIkev2Facade vppIkev2Api;
- private MultiNamingContext sadEntriesMapping;
@Inject
public IpsecWriterFactory(final FutureJVppCore vppApi,
- final FutureJVppIkev2Facade vppIkev2Api,
- final MultiNamingContext sadEntriesMappingContext) {
+ final FutureJVppIkev2Facade vppIkev2Api) {
this.vppApi = vppApi;
this.vppIkev2Api = vppIkev2Api;
- this.sadEntriesMapping = sadEntriesMappingContext;
}
@Override
@@ -101,7 +97,7 @@ public final class IpsecWriterFactory implements WriterFactory {
InstanceIdentifier.create(SadEntries.class).child(Esp.class).child(Encryption.class)
.child(DesCbc.class),
InstanceIdentifier.create(SadEntries.class).augmentation(IpsecSadEntriesAugmentation.class)),
- new GenericListWriter<>(SAD_ENTRIES_ID, new IpsecSadEntryCustomizer(vppApi, sadEntriesMapping)));
+ new GenericListWriter<>(SAD_ENTRIES_ID, new IpsecSadEntryCustomizer(vppApi)));
registry.subtreeAdd(Sets.newHashSet(InstanceIdentifier.create(Spd.class).child(SpdEntries.class),
InstanceIdentifier.create(Spd.class).child(SpdEntries.class)
.augmentation(IpsecSpdEntriesAugmentation.class)),
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 866f962c3..ee5895cad 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
@@ -25,7 +25,6 @@ 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.common.translate.util.MultiNamingContext;
import io.fd.hc2vpp.ipsec.helpers.SchemaContextTestHelper;
import io.fd.honeycomb.test.tools.HoneycombTestRunner;
import io.fd.honeycomb.test.tools.annotations.InjectTestData;
@@ -40,7 +39,6 @@ import io.fd.jvpp.core.types.IpsecSadFlags;
import io.fd.jvpp.core.types.Key;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipsec.rev181214.IkeEncryptionAlgorithmT;
@@ -82,12 +80,10 @@ public class IpsecSadEntryCustomizerTest extends WriterCustomizerTest implements
private static final int SAD_ID = 10;
private IpsecSadEntryCustomizer customizer;
- @Mock
- private MultiNamingContext namingCntext;
@Override
protected void setUpTest() throws Exception {
- customizer = new IpsecSadEntryCustomizer(api, namingCntext);
+ customizer = new IpsecSadEntryCustomizer(api);
when(api.ipsecSadEntryAddDel(any())).thenReturn(future(new IpsecSadEntryAddDelReply()));
}
@@ -115,14 +111,14 @@ public class IpsecSadEntryCustomizerTest extends WriterCustomizerTest implements
assertEquals(false, flags.add(IpsecSadFlags.IpsecSadFlagsOptions.IPSEC_API_SAD_FLAG_NONE));
flags.removeAll(flags2.getOptions());
- assertEquals(0,flags.getOptionsValue());
+ assertEquals(0, flags.getOptionsValue());
assertEquals(true, flags.contains(IpsecSadFlags.IpsecSadFlagsOptions.IPSEC_API_SAD_FLAG_NONE));
- assertEquals(1,flags.getOptions().size());
+ assertEquals(1, flags.getOptions().size());
flags.add(IpsecSadFlags.IpsecSadFlagsOptions.IPSEC_API_SAD_FLAG_IS_TUNNEL);
- assertEquals(1,flags.getOptions().size());
+ assertEquals(1, flags.getOptions().size());
flags2.clear();
- assertEquals(0,flags2.getOptionsValue());
+ assertEquals(0, flags2.getOptionsValue());
assertEquals(true, flags2.contains(IpsecSadFlags.IpsecSadFlagsOptions.IPSEC_API_SAD_FLAG_NONE));
}