summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/main/java/io
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-10-10 09:14:09 +0200
committerJan Srnicek <jsrnicek@cisco.com>2016-10-10 09:14:09 +0200
commit267528178217b0d49b1ec57b1e1713ac65169498 (patch)
treef2f2d1f2d478ab00ca1787647be1f9aeb902710b /lisp/lisp2vpp/src/main/java/io
parent39c5f0784a01a5747ef9ba8c757db23c55e827d0 (diff)
HONEYCOMB-252 - Reduced scope of dump executors
Change-Id: Ia426f855b13323369bcc7ec2cde0861421950476 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp/src/main/java/io')
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java11
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java12
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java11
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java10
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java7
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java9
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java11
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java8
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java17
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/AbstractJvppDumpExecutor.java35
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/ItrRemoteLocatorSetDumpExecutor.java41
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutor.java43
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutor.java61
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/SubtableDumpExecutor.java53
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutor.java42
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java3
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java (renamed from lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java)41
-rw-r--r--[-rwxr-xr-x]lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java (renamed from lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutor.java)37
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReader.java (renamed from lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProvider.java)28
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java16
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java7
21 files changed, 122 insertions, 381 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java
index a758ab667..aa94a3071 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java
@@ -19,13 +19,13 @@ package io.fd.honeycomb.lisp.translate.read;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.SubtableDumpExecutor;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
import io.fd.honeycomb.lisp.translate.read.trait.SubtableReader;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
+import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
@@ -51,17 +51,14 @@ public class BridgeDomainSubtableCustomizer extends FutureJVppCustomizer impleme
private static final String CACHE_KEY = BridgeDomainSubtableCustomizer.class.getName();
private final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager;
- private final SubtableDumpExecutor dumpExecutor;
private final NamingContext bridgeDomainContext;
public BridgeDomainSubtableCustomizer(@Nonnull final FutureJVppCore futureJvppCore,
@Nonnull final NamingContext bridgeDomainContext) {
super(futureJvppCore);
- dumpExecutor = new SubtableDumpExecutor(futureJvppCore);
- dumpManager =
- new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
- .withExecutor(dumpExecutor)
- .build();
+ dumpManager = new DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
+ .withExecutor(createExecutor(futureJvppCore))
+ .build();
this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java
index 9387937e0..0e1c34483 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java
@@ -21,9 +21,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.LocatorDumpExecutor;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams.LocatorDumpParamsBuilder;
+import io.fd.honeycomb.lisp.translate.read.trait.LocatorReader;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
@@ -53,7 +53,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
*/
public class InterfaceCustomizer
extends FutureJVppCustomizer
- implements ListReaderCustomizer<Interface, InterfaceKey, InterfaceBuilder> {
+ implements ListReaderCustomizer<Interface, InterfaceKey, InterfaceBuilder>, LocatorReader {
private static final String KEY_BASE = InterfaceCustomizer.class.getName();
@@ -61,16 +61,14 @@ public class InterfaceCustomizer
private final NamingContext locatorSetContext;
private final DumpCacheManager<LispLocatorDetailsReplyDump, LocatorDumpParams> dumpCacheManager;
- public InterfaceCustomizer(
- @Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext) {
+ public InterfaceCustomizer(@Nonnull final FutureJVppCore futureJvpp, @Nonnull final NamingContext interfaceContext,
+ @Nonnull final NamingContext locatorSetContext) {
super(futureJvpp);
this.interfaceContext = checkNotNull(interfaceContext, "Interface context cannot be null");
this.locatorSetContext = checkNotNull(locatorSetContext, "Locator set context cannot be null");
this.dumpCacheManager =
new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorDetailsReplyDump, LocatorDumpParams>()
- .withExecutor(new LocatorDumpExecutor(futureJvpp))
+ .withExecutor(createLocatorDumpExecutor(futureJvpp))
.build();
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java
index f95d6c70d..9defc3c5f 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java
@@ -20,7 +20,6 @@ package io.fd.honeycomb.lisp.translate.read;
import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.ItrRemoteLocatorSetDumpExecutor;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
@@ -28,6 +27,8 @@ import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
+import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocs;
import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocsReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
@@ -39,7 +40,8 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer
- implements ReaderCustomizer<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder>, ByteDataTranslator {
+ implements ReaderCustomizer<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder>, ByteDataTranslator,
+ JvppReplyConsumer {
private static final String CACHE_KEY = ItrRemoteLocatorSetCustomizer.class.getName();
@@ -48,7 +50,10 @@ public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer
public ItrRemoteLocatorSetCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
super(futureJVppCore);
dumpCacheManager = new DumpCacheManagerBuilder<LispGetMapRequestItrRlocsReply, Void>()
- .withExecutor(new ItrRemoteLocatorSetDumpExecutor(futureJVppCore)).build();
+ .withExecutor(((identifier, params) -> getReplyForRead(
+ futureJVppCore.lispGetMapRequestItrRlocs(new LispGetMapRequestItrRlocs()).toCompletableFuture(),
+ identifier)))
+ .build();
}
@Nonnull
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java
index 4efe57e2c..74fbf6f20 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java
@@ -25,9 +25,8 @@ import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsD
import com.google.common.base.Optional;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.MappingsDumpExecutor;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
-import io.fd.honeycomb.lisp.translate.read.trait.MappingFilterProvider;
+import io.fd.honeycomb.lisp.translate.read.trait.MappingReader;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
@@ -63,14 +62,12 @@ import org.slf4j.LoggerFactory;
public class LocalMappingCustomizer
extends FutureJVppCustomizer
implements ListReaderCustomizer<LocalMapping, LocalMappingKey, LocalMappingBuilder>, EidTranslator,
- MappingFilterProvider {
+ MappingReader {
private static final Logger LOG = LoggerFactory.getLogger(LocalMappingCustomizer.class);
private static final String KEY = LocalMappingCustomizer.class.getName();
-
private final DumpCacheManager<LispEidTableDetailsReplyDump, MappingsDumpParams> dumpManager;
- private final MappingsDumpExecutor dumpExecutor;
private final NamingContext locatorSetContext;
private final EidMappingContext localMappingContext;
@@ -79,10 +76,9 @@ public class LocalMappingCustomizer
super(futureJvpp);
this.locatorSetContext = checkNotNull(locatorSetContext, "Locator Set Mapping Context cannot be null");
this.localMappingContext = checkNotNull(localMappingsContext, "Local mappings context cannot be null");
- this.dumpExecutor = new MappingsDumpExecutor(futureJvpp);
this.dumpManager =
new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableDetailsReplyDump, MappingsDumpParams>()
- .withExecutor(dumpExecutor)
+ .withExecutor(createMappingDumpExecutor(futureJvpp))
.build();
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java
index 5c02097d1..bacdd55bf 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java
@@ -20,7 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.LocatorSetsDumpExecutor;
+import io.fd.honeycomb.lisp.translate.read.trait.LocatorSetReader;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
@@ -46,7 +46,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LocatorSetCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<LocatorSet, LocatorSetKey, LocatorSetBuilder>, ByteDataTranslator {
+ implements ListReaderCustomizer<LocatorSet, LocatorSetKey, LocatorSetBuilder>, ByteDataTranslator,
+ LocatorSetReader {
//TODO - temporary as public because of hack in write customizer in *.write.LocatorSetCustomizer
public static final String LOCATOR_SETS_CACHE_ID = LocatorSetCustomizer.class.getName();
@@ -60,7 +61,7 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
super(futureJvpp);
this.locatorSetContext = checkNotNull(locatorSetContext, "Locator Set mapping context cannot be null");
this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorSetDetailsReplyDump, Void>()
- .withExecutor(new LocatorSetsDumpExecutor(futureJvpp))
+ .withExecutor(createExecutor(futureJvpp))
.build();
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
index b9a83e214..5c453d5ff 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
@@ -19,7 +19,6 @@ package io.fd.honeycomb.lisp.translate.read;
import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.MapResolversDumpExecutor;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
@@ -27,8 +26,10 @@ import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.vpp.jvpp.core.dto.LispMapResolverDetails;
import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.LispMapResolverDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Arrays;
import java.util.Collections;
@@ -46,7 +47,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MapResolverCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<MapResolver, MapResolverKey, MapResolverBuilder>, AddressTranslator {
+ implements ListReaderCustomizer<MapResolver, MapResolverKey, MapResolverBuilder>, AddressTranslator,
+ JvppReplyConsumer {
private static final Logger LOG = LoggerFactory.getLogger(MapResolverCustomizer.class);
private static final String MAP_RESOLVERS_CACHE_ID = MapResolverCustomizer.class.getName();
@@ -56,7 +58,8 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
public MapResolverCustomizer(FutureJVppCore futureJvpp) {
super(futureJvpp);
this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispMapResolverDetailsReplyDump, Void>()
- .withExecutor(new MapResolversDumpExecutor((futureJvpp)))
+ .withExecutor((identifier, params) -> getReplyForRead(
+ futureJvpp.lispMapResolverDump(new LispMapResolverDump()).toCompletableFuture(), identifier))
.build();
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
index 78da66c63..18bafe179 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
@@ -25,13 +25,12 @@ import static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.l
import com.google.common.base.Optional;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.LocatorDumpExecutor;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.MappingsDumpExecutor;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams.LocatorDumpParamsBuilder;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.QuantityType;
-import io.fd.honeycomb.lisp.translate.read.trait.MappingFilterProvider;
+import io.fd.honeycomb.lisp.translate.read.trait.LocatorReader;
+import io.fd.honeycomb.lisp.translate.read.trait.MappingReader;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
import io.fd.honeycomb.translate.ModificationCache;
import io.fd.honeycomb.translate.read.ReadContext;
@@ -79,7 +78,7 @@ import org.slf4j.LoggerFactory;
*/
public class RemoteMappingCustomizer extends FutureJVppCustomizer
implements ListReaderCustomizer<RemoteMapping, RemoteMappingKey, RemoteMappingBuilder>,
- EidTranslator, AddressTranslator, ByteDataTranslator, MappingFilterProvider {
+ EidTranslator, AddressTranslator, ByteDataTranslator, MappingReader, LocatorReader {
private static final Logger LOG = LoggerFactory.getLogger(RemoteMappingCustomizer.class);
private static final String KEY = RemoteMappingCustomizer.class.getName();
@@ -94,11 +93,11 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
this.remoteMappingContext = checkNotNull(remoteMappingContext, "Remote mappings not present");
this.dumpManager =
new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableDetailsReplyDump, MappingsDumpParams>()
- .withExecutor(new MappingsDumpExecutor(futureJvpp))
+ .withExecutor(createMappingDumpExecutor(futureJvpp))
.build();
this.locatorsDumpManager =
new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorDetailsReplyDump, LocatorDumpParams>()
- .withExecutor(new LocatorDumpExecutor(futureJvpp))
+ .withExecutor(createLocatorDumpExecutor(futureJvpp))
.build();
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
index 8779103d0..d3e50f012 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
@@ -20,15 +20,16 @@ import static com.google.common.base.Preconditions.checkState;
import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.VniTableDumpExecutor;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetails;
import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.LispEidTableVniDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Collections;
import java.util.List;
@@ -48,7 +49,7 @@ import org.slf4j.LoggerFactory;
* Handles the reads of {@link VniTable} nodes
*/
public class VniTableCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<VniTable, VniTableKey, VniTableBuilder> {
+ implements ListReaderCustomizer<VniTable, VniTableKey, VniTableBuilder>, JvppReplyConsumer {
private static final Logger LOG = LoggerFactory.getLogger(VniTableCustomizer.class);
@@ -58,7 +59,8 @@ public class VniTableCustomizer extends FutureJVppCustomizer
public VniTableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
super(futureJvpp);
this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableVniDetailsReplyDump, Void>()
- .withExecutor(new VniTableDumpExecutor(futureJvpp))
+ .withExecutor(((identifier, params) -> getReplyForRead(
+ futureJvpp.lispEidTableVniDump(new LispEidTableVniDump()).toCompletableFuture(), identifier)))
.build();
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java
index c0d5ae5aa..324ae9c9a 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java
@@ -19,14 +19,17 @@ package io.fd.honeycomb.lisp.translate.read;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.SubtableDumpExecutor;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
import io.fd.honeycomb.lisp.translate.read.trait.SubtableReader;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
+import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
@@ -37,9 +40,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,15 +50,12 @@ public class VrfSubtableCustomizer extends FutureJVppCustomizer
private static final String CACHE_KEY = VrfSubtableCustomizer.class.getName();
private final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager;
- private final SubtableDumpExecutor dumpExecutor;
public VrfSubtableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
super(futureJvpp);
- dumpExecutor = new SubtableDumpExecutor(futureJvpp);
- dumpManager =
- new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
- .withExecutor(dumpExecutor)
- .build();
+ dumpManager = new DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
+ .withExecutor(createExecutor(futureJvpp))
+ .build();
}
@Nonnull
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/AbstractJvppDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/AbstractJvppDumpExecutor.java
deleted file mode 100644
index 65f41443c..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/AbstractJvppDumpExecutor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.annotation.Nonnull;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Abstract holder for jvpp reference
- */
-public abstract class AbstractJvppDumpExecutor {
-
- protected final FutureJVppCore vppApi;
-
- public AbstractJvppDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
- this.vppApi = checkNotNull(vppApi, "VPP Api reference cannot be null");
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/ItrRemoteLocatorSetDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/ItrRemoteLocatorSetDumpExecutor.java
deleted file mode 100644
index 3b2114af8..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/ItrRemoteLocatorSetDumpExecutor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocs;
-import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocsReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class ItrRemoteLocatorSetDumpExecutor extends AbstractJvppDumpExecutor
- implements EntityDumpExecutor<LispGetMapRequestItrRlocsReply, Void>, JvppReplyConsumer {
-
- public ItrRemoteLocatorSetDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- public LispGetMapRequestItrRlocsReply executeDump(final InstanceIdentifier<?> identifier, final Void params) throws
- ReadFailedException {
- return getReplyForRead(vppApi.lispGetMapRequestItrRlocs(new LispGetMapRequestItrRlocs()).toCompletableFuture(),
- identifier);
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutor.java
deleted file mode 100755
index 8f19e7084..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class MapResolversDumpExecutor extends AbstractJvppDumpExecutor
- implements EntityDumpExecutor<LispMapResolverDetailsReplyDump, Void>, JvppReplyConsumer {
-
- public MapResolversDumpExecutor(@Nonnull FutureJVppCore api) {
- super(api);
- }
-
- @Override
- @Nonnull
- public LispMapResolverDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final Void params) throws
- ReadFailedException {
- return getReplyForRead(vppApi.lispMapResolverDump(new LispMapResolverDump()).toCompletableFuture(), identifier);
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutor.java
deleted file mode 100755
index 778ce5308..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * Common dump executor for both local and remote mappings
- */
-public class MappingsDumpExecutor extends AbstractJvppDumpExecutor
- implements EntityDumpExecutor<LispEidTableDetailsReplyDump, MappingsDumpParams>, JvppReplyConsumer {
-
- public MappingsDumpExecutor(@Nonnull FutureJVppCore vppApi) {
- super(vppApi);
- }
-
-
- @Override
- @Nonnull
- public LispEidTableDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier,
- final MappingsDumpParams params)
- throws ReadFailedException {
- checkNotNull(params, "Params for dump request not present");
-
- LispEidTableDump request = new LispEidTableDump();
- request.eid = params.getEid();
- request.eidSet = params.getEidSet();
- request.eidType = params.getEidType();
- request.prefixLength = params.getPrefixLength();
- request.vni = params.getVni();
- request.filter = params.getFilter();
-
- return getReplyForRead(vppApi.lispEidTableDump(request).toCompletableFuture(), identifier);
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/SubtableDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/SubtableDumpExecutor.java
deleted file mode 100644
index bf5451294..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/SubtableDumpExecutor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Dump executor for {@link VrfSubtable}/{@link BridgeDomainSubtable}
- */
-public final class SubtableDumpExecutor extends AbstractJvppDumpExecutor
- implements EntityDumpExecutor<LispEidTableMapDetailsReplyDump, SubtableDumpParams>, JvppReplyConsumer {
-
- public SubtableDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- public LispEidTableMapDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier,
- final SubtableDumpParams params)
- throws ReadFailedException {
- LispEidTableMapDump request = new LispEidTableMapDump();
- request.isL2 = checkNotNull(params, "Cannot bind null params").isL2();
-
- return getReplyForRead(vppApi.lispEidTableMapDump(request).toCompletableFuture(), identifier);
- }
-
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutor.java
deleted file mode 100755
index 200d47c6f..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispEidTableVniDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class VniTableDumpExecutor extends AbstractJvppDumpExecutor
- implements EntityDumpExecutor<LispEidTableVniDetailsReplyDump, Void>, JvppReplyConsumer {
-
- public VniTableDumpExecutor(@Nonnull FutureJVppCore api) {
- super(api);
- }
-
- @Override
- public LispEidTableVniDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, Void params)
- throws ReadFailedException {
- return getReplyForRead(vppApi.lispEidTableVniDump(new LispEidTableVniDump()).toCompletableFuture(), identifier);
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java
index 1f7990c9b..d1af212b8 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java
@@ -16,11 +16,10 @@
package io.fd.honeycomb.lisp.translate.read.dump.executor.params;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.MappingsDumpExecutor;
import java.util.Arrays;
/**
- * Parameters for executing {@link MappingsDumpExecutor}
+ * Parameters for executing dump of mappings
*/
public final class MappingsDumpParams {
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java
index d200597d6..54fef659e 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java
@@ -14,44 +14,33 @@
* limitations under the License.
*/
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
+package io.fd.honeycomb.lisp.translate.read.trait;
import static com.google.common.base.Preconditions.checkNotNull;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams;
-import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.LispLocatorDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
/**
- * Executor for dumping of locators
+ * Provides common logic for reading of locators
*/
-public class LocatorDumpExecutor extends AbstractJvppDumpExecutor
- implements EntityDumpExecutor<LispLocatorDetailsReplyDump, LocatorDumpParams>, JvppReplyConsumer {
-
-
- public LocatorDumpExecutor(@Nonnull final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- @Nonnull
- public LispLocatorDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier,
- final LocatorDumpParams params) throws
- ReadFailedException {
- checkNotNull(params, "Params for dump request not present");
-
- LispLocatorDump request = new LispLocatorDump();
- request.lsIndex = params.getLocatorSetIndex();
- //flag that lsIndex is set
- request.isIndexSet = (byte) 1;
-
- return getReplyForRead(vppApi.lispLocatorDump(request).toCompletableFuture(), identifier);
+public interface LocatorReader extends JvppReplyConsumer {
+
+ default EntityDumpExecutor<LispLocatorDetailsReplyDump, LocatorDumpParams> createLocatorDumpExecutor(
+ @Nonnull final FutureJVppCore vppApi) {
+ return (identifier, params) -> {
+ checkNotNull(params, "Params for dump request not present");
+ final LispLocatorDump request = new LispLocatorDump();
+ request.lsIndex = params.getLocatorSetIndex();
+ //flag that lsIndex is set
+ request.isIndexSet = (byte) 1;
+
+ return getReplyForRead(vppApi.lispLocatorDump(request).toCompletableFuture(), identifier);
+ };
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java
index c896556bb..7085b047d 100755..100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutor.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java
@@ -14,35 +14,28 @@
* limitations under the License.
*/
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
+package io.fd.honeycomb.lisp.translate.read.trait;
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.LispLocatorSetDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class LocatorSetsDumpExecutor extends AbstractJvppDumpExecutor
- implements EntityDumpExecutor<LispLocatorSetDetailsReplyDump, Void>, JvppReplyConsumer {
-
- public LocatorSetsDumpExecutor(@Nonnull FutureJVppCore api) {
- super(api);
- }
-
- @Override
- @Nonnull
- public LispLocatorSetDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final Void params)
- throws ReadFailedException {
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
- LispLocatorSetDump request = new LispLocatorSetDump();
- //only local
- request.filter = 1;
-
- return getReplyForRead(vppApi.lispLocatorSetDump(request).toCompletableFuture(), identifier);
+/**
+ * Provides common logic for reading {@link LocatorSet}
+ */
+public interface LocatorSetReader extends JvppReplyConsumer {
+
+ default EntityDumpExecutor<LispLocatorSetDetailsReplyDump, Void> createExecutor(
+ @Nonnull final FutureJVppCore vppApi) {
+ return (identifier, params) -> {
+ final LispLocatorSetDump request = new LispLocatorSetDump();
+ //only local
+ request.filter = 1;
+ return getReplyForRead(vppApi.lispLocatorSetDump(request).toCompletableFuture(), identifier);
+ };
}
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProvider.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReader.java
index cc7af4d44..2a28d822b 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProvider.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReader.java
@@ -1,9 +1,17 @@
package io.fd.honeycomb.lisp.translate.read.trait;
+import static com.google.common.base.Preconditions.checkNotNull;
import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4;
import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6;
import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.MAC;
+import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
+import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
+import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
+import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
+import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.LispEidTableDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.function.Predicate;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
@@ -11,12 +19,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
/**
* Trait providing predicates to filter mappings to respective subtables
*/
-public interface MappingFilterProvider {
+public interface MappingReader extends JvppReplyConsumer {
Predicate<LispEidTableDetails> BRIDGE_DOMAIN_MAPPINGS_ONLY =
(LispEidTableDetails detail) -> detail.eidType == MAC.getValue();
@@ -47,4 +54,21 @@ public interface MappingFilterProvider {
throw new IllegalArgumentException("Cannot determine mappings predicate for " + identifier);
}
}
+
+ default EntityDumpExecutor<LispEidTableDetailsReplyDump, MappingsDumpParams> createMappingDumpExecutor(
+ @Nonnull final FutureJVppCore vppApi) {
+ return (identifier, params) -> {
+ checkNotNull(params, "Params for dump request not present");
+
+ LispEidTableDump request = new LispEidTableDump();
+ request.eid = params.getEid();
+ request.eidSet = params.getEidSet();
+ request.eidType = params.getEidType();
+ request.prefixLength = params.getPrefixLength();
+ request.vni = params.getVni();
+ request.filter = params.getFilter();
+
+ return getReplyForRead(vppApi.lispEidTableDump(request).toCompletableFuture(), identifier);
+ };
+ }
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java
index a30e489ea..343e0e813 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java
@@ -17,6 +17,7 @@
package io.fd.honeycomb.lisp.translate.read.trait;
+import static com.google.common.base.Preconditions.checkNotNull;
import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L2;
import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L3;
import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.SubtableDumpParamsBuilder;
@@ -26,7 +27,11 @@ import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpPara
import io.fd.honeycomb.translate.ModificationCache;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
+import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
+import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.LispEidTableMapDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
import org.opendaylight.yangtools.yang.binding.ChildOf;
@@ -35,7 +40,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
* Provides common logic for reading Eid subtables
*/
-public interface SubtableReader {
+public interface SubtableReader extends JvppReplyConsumer {
SubtableDumpParams L2_PARAMS = new SubtableDumpParamsBuilder().setL2(L2).build();
SubtableDumpParams L3_PARAMS = new SubtableDumpParamsBuilder().setL2(L3).build();
@@ -48,4 +53,13 @@ public interface SubtableReader {
@Nonnull final SubtableDumpParams params) throws ReadFailedException {
return dumpManager.getDump(id, cacheKey, cache, params);
}
+
+ default EntityDumpExecutor<LispEidTableMapDetailsReplyDump, SubtableDumpParams> createExecutor(
+ @Nonnull final FutureJVppCore vppApi) {
+ return (identifier, params) -> {
+ final LispEidTableMapDump request = new LispEidTableMapDump();
+ request.isL2 = checkNotNull(params, "Cannot bind null params").isL2();
+ return getReplyForRead(vppApi.lispEidTableMapDump(request).toCompletableFuture(), identifier);
+ };
+ }
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java
index f64eda849..6e15315b9 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java
@@ -21,7 +21,7 @@ import static com.google.common.base.Preconditions.checkState;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.LocatorSetsDumpExecutor;
+import io.fd.honeycomb.lisp.translate.read.trait.LocatorSetReader;
import io.fd.honeycomb.translate.ModificationCache;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
@@ -30,7 +30,6 @@ import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
@@ -55,7 +54,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
*/
public class LocatorSetCustomizer extends FutureJVppCustomizer
implements ListWriterCustomizer<LocatorSet, LocatorSetKey>, ByteDataTranslator,
- JvppReplyConsumer {
+ LocatorSetReader {
private final NamingContext locatorSetContext;
private final DumpCacheManager<LispLocatorSetDetailsReplyDump, Void> dumpManager;
@@ -65,7 +64,7 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
super(futureJvpp);
this.locatorSetContext = checkNotNull(locatorSetContext, "Locator set context cannot be null");
this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorSetDetailsReplyDump, Void>()
- .withExecutor(new LocatorSetsDumpExecutor(futureJvpp))
+ .withExecutor(createExecutor(futureJvpp))
.build();
}