diff options
author | Tibor Král <tibor.kral@pantheon.tech> | 2019-04-02 11:39:54 +0200 |
---|---|---|
committer | Tibor Král <tibor.kral@pantheon.tech> | 2019-04-02 11:39:54 +0200 |
commit | 89eeb336aebc92cd34c27b3fa325803c6478a461 (patch) | |
tree | f5ed058eb6776990e3d1139ae57a88995e487d54 /ipsec/ipsec-impl/src/main/java/io/fd | |
parent | 25296ac131f1ad42f826911210db6041a50b4dd0 (diff) |
Remove naming context from Ipsec writer
Change-Id: I0c0f032c1b2b1aa273514453f044c52dae66c1ab
Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
Diffstat (limited to 'ipsec/ipsec-impl/src/main/java/io/fd')
3 files changed, 4 insertions, 22 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)), |