summaryrefslogtreecommitdiffstats
path: root/lisp
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
parent39c5f0784a01a5747ef9ba8c757db23c55e827d0 (diff)
HONEYCOMB-252 - Reduced scope of dump executors
Change-Id: Ia426f855b13323369bcc7ec2cde0861421950476 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp')
-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
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutorTest.java116
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutorTest.java99
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutorTest.java88
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutorTest.java133
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutorTest.java83
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReaderTest.java (renamed from lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProviderTest.java)2
27 files changed, 123 insertions, 901 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();
}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutorTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutorTest.java
deleted file mode 100644
index c2cd99490..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutorTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams.LocatorDumpParamsBuilder;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.vpp.test.read.JvppDumpExecutorTest;
-import io.fd.vpp.jvpp.VppCallbackException;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDump;
-import java.util.concurrent.TimeoutException;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mockito;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class LocatorDumpExecutorTest extends JvppDumpExecutorTest<LocatorDumpExecutor> {
-
- @Captor
- private ArgumentCaptor<LispLocatorDump> requestCaptor;
-
- private InstanceIdentifier identifier;
- private LispLocatorDetailsReplyDump validDump;
-
- @Before
- public void init() {
- identifier = InstanceIdentifier.create(LocatorSet.class);
- validDump = new LispLocatorDetailsReplyDump();
- LispLocatorDetails detail = new LispLocatorDetails();
-
- detail.swIfIndex = 1;
- detail.priority = 2;
- detail.local = 1;
- detail.weight = 3;
- detail.isIpv6 = 0;
- detail.context = 8;
- detail.ipAddress = new byte[]{-64, -88, 4, 2};
-
- validDump.lispLocatorDetails = ImmutableList.of(detail);
- }
-
- @Test
- public void testExecuteDumpTimeout() throws Exception {
- doThrowTimeoutExceptionWhen().lispLocatorDump(Mockito.any());
- try {
- getExecutor().executeDump(identifier, new LocatorDumpParamsBuilder().build());
- } catch (Exception e) {
- assertTrue(e instanceof ReadFailedException);
- assertTrue(e.getCause() instanceof TimeoutException);
- assertEquals(identifier, ((ReadFailedException) e).getFailedId());
- return;
- }
- fail("Test should have thrown exception");
- }
-
- @Test
- public void testExecuteDumpHalted() throws ReadFailedException {
- doThrowFailExceptionWhen().lispLocatorDump(Mockito.any());
- try {
- getExecutor().executeDump(identifier, new LocatorDumpParamsBuilder().build());
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- assertEquals(identifier, ((ReadFailedException) e).getFailedId());
- return;
- }
- fail("Test should have thrown ReadFailedException");
- }
-
- @Test
- public void testExecuteDump() throws ReadFailedException {
- doReturnResponseWhen(validDump).lispLocatorDump(Mockito.any());
-
- final LocatorDumpParams params = new LocatorDumpParamsBuilder().setLocatorSetIndex(5).build();
-
- final LispLocatorDetailsReplyDump reply = getExecutor().executeDump(identifier, params);
- verify(api, times(1)).lispLocatorDump(requestCaptor.capture());
-
- final LispLocatorDump request = requestCaptor.getValue();
-
- //check passed params
- assertNotNull(request);
- assertEquals(5, request.lsIndex);
-
- //check result
- assertNotNull(reply);
- assertEquals(1, reply.lispLocatorDetails.size());
-
- final LispLocatorDetails details = reply.lispLocatorDetails.get(0);
- assertEquals(1, details.swIfIndex);
- assertEquals(2, details.priority);
- assertEquals(1, details.local);
- assertEquals(3, details.weight);
- assertEquals(0, details.isIpv6);
- assertEquals(8, details.context);
- assertArrayEquals(new byte[]{-64, -88, 4, 2}, details.ipAddress);
- }
-
- @Override
- protected LocatorDumpExecutor initExecutor() {
- return new LocatorDumpExecutor(api);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutorTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutorTest.java
deleted file mode 100644
index 3b47e9b9c..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutorTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.vpp.test.read.JvppDumpExecutorTest;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDump;
-import java.nio.charset.StandardCharsets;
-import java.util.concurrent.TimeoutException;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class LocatorSetsDumpExecutorTest extends JvppDumpExecutorTest<LocatorSetsDumpExecutor> {
-
- public static final byte[] LOCATOR_SET_NAME_BYTES = "loc-set".getBytes(StandardCharsets.UTF_8);
-
- private LispLocatorSetDetailsReplyDump validDump;
-
- @Captor
- private ArgumentCaptor<LispLocatorSetDump> requestCaptor;
-
- private InstanceIdentifier identifier;
-
- @Before
- public void init() {
- identifier = InstanceIdentifier.create(LocatorSet.class);
- validDump = new LispLocatorSetDetailsReplyDump();
- LispLocatorSetDetails detail = new LispLocatorSetDetails();
- detail.lsIndex = 2;
- detail.lsName = LOCATOR_SET_NAME_BYTES;
- detail.context = 4;
-
- validDump.lispLocatorSetDetails = ImmutableList.of(detail);
- }
-
- @Test
- public void testExecuteDumpTimeout() throws Exception {
- doThrowTimeoutExceptionWhen().lispLocatorSetDump(any());
- try {
- getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
- } catch (Exception e) {
- assertTrue(e instanceof ReadFailedException);
- assertTrue(e.getCause() instanceof TimeoutException);
- return;
- }
- fail("Test should have thrown exception");
- }
-
- @Test(expected = ReadFailedException.class)
- public void testExecuteDumpHalted() throws ReadFailedException {
- doThrowFailExceptionWhen().lispLocatorSetDump(any());
- getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
- }
-
- @Test
- public void testExecuteDump() throws ReadFailedException {
- doReturnResponseWhen(validDump).lispLocatorSetDump(any());
-
- final LispLocatorSetDetailsReplyDump replyDump =
- getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
- verify(api, times(1)).lispLocatorSetDump(requestCaptor.capture());
-
- final LispLocatorSetDump request = requestCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(1, request.filter);
-
- assertNotNull(replyDump);
- assertNotNull(replyDump.lispLocatorSetDetails);
- assertEquals(1, replyDump.lispLocatorSetDetails.size());
- final LispLocatorSetDetails detail = replyDump.lispLocatorSetDetails.get(0);
-
- assertNotNull(detail);
- assertEquals(4, detail.context);
- assertEquals(2, detail.lsIndex);
- assertEquals(LOCATOR_SET_NAME_BYTES, detail.lsName);
- }
-
- @Override
- protected LocatorSetsDumpExecutor initExecutor() {
- return new LocatorSetsDumpExecutor(api);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutorTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutorTest.java
deleted file mode 100644
index a3c6cbe45..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutorTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.vpp.test.read.JvppDumpExecutorTest;
-import io.fd.vpp.jvpp.VppCallbackException;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetails;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
-import java.util.concurrent.TimeoutException;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class MapResolversDumpExecutorTest extends JvppDumpExecutorTest<MapResolversDumpExecutor> {
-
- private LispMapResolverDetailsReplyDump validDump;
-
- private InstanceIdentifier identifier;
-
- @Before
- public void init() {
- identifier = InstanceIdentifier.create(MapResolver.class);
- validDump = new LispMapResolverDetailsReplyDump();
- final LispMapResolverDetails details = new LispMapResolverDetails();
- details.isIpv6 = 0;
- details.ipAddress = new byte[]{-64, -88, 5, 4};
- details.context = 7;
-
- validDump.lispMapResolverDetails = ImmutableList.of(details);
- }
-
- @Test
- public void testExecuteDumpTimeout() throws Exception {
- doThrowTimeoutExceptionWhen().lispMapResolverDump(Mockito.any());
- try {
- getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof TimeoutException);
- assertEquals(identifier, ((ReadFailedException) e).getFailedId());
- return;
- }
- fail("Test should have thrown ReadFailedException");
- }
-
- @Test
- public void testExecuteDumpHalted() throws ReadFailedException {
- doThrowFailExceptionWhen().lispMapResolverDump(Mockito.any());
- try {
- getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- assertEquals(identifier, ((ReadFailedException) e).getFailedId());
- return;
- }
- fail("Test should have thrown ReadFailedException");
- }
-
- @Test
- public void testExecuteDump() throws ReadFailedException {
- doReturnResponseWhen(validDump).lispMapResolverDump(Mockito.any());
- final LispMapResolverDetailsReplyDump reply =
- getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
-
- assertNotNull(reply);
- assertEquals(1, reply.lispMapResolverDetails.size());
-
- final LispMapResolverDetails detail = reply.lispMapResolverDetails.get(0);
- assertEquals(7, detail.context);
- assertEquals(0, detail.isIpv6);
- assertArrayEquals(new byte[]{-64, -88, 5, 4}, detail.ipAddress);
- }
-
- @Override
- protected MapResolversDumpExecutor initExecutor() {
- return new MapResolversDumpExecutor(api);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutorTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutorTest.java
deleted file mode 100644
index 6c1ccfac0..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutorTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.FilterType;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.MappingsDumpParamsBuilder;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.QuantityType;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.vpp.test.read.JvppDumpExecutorTest;
-import io.fd.vpp.jvpp.VppCallbackException;
-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 java.util.concurrent.TimeoutException;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class MappingsDumpExecutorTest extends JvppDumpExecutorTest<MappingsDumpExecutor> {
-
- private static final byte[] EID = {-64, -88, 2, 1};
-
- @Captor
- private ArgumentCaptor<LispEidTableDump> requestCaptor;
-
- private InstanceIdentifier identifier;
-
- private LispEidTableDetailsReplyDump validDump;
- private MappingsDumpParams emptyParams;
- private MappingsDumpParams validParams;
-
- @Before
- public void init() {
- identifier = InstanceIdentifier.create(LocalMapping.class);
- validDump = new LispEidTableDetailsReplyDump();
-
- LispEidTableDetails detail = new LispEidTableDetails();
- detail.action = 0;
- detail.authoritative = 1;
- detail.context = 4;
- detail.eid = new byte[]{-64, -88, 2, 1};
- detail.eidPrefixLen = 32;
- detail.isLocal = 1;
- detail.locatorSetIndex = 2;
- detail.ttl = 7;
- detail.vni = 2;
-
- validDump.lispEidTableDetails = ImmutableList.of(detail);
-
- emptyParams = MappingsDumpParamsBuilder.newInstance().build();
- validParams =
- MappingsDumpParamsBuilder.newInstance().setVni(2).setPrefixLength((byte) 32).setEidSet(QuantityType.ALL)
- .setEid(EID)
- .setEidType(EidType.IPV4).setFilter(FilterType.LOCAL).build();
- }
-
- @Test
- public void testExecuteDumpTimeout() throws Exception {
- doThrowTimeoutExceptionWhen().lispEidTableDump(any());
- try {
- getExecutor().executeDump(identifier, emptyParams);
- } catch (Exception e) {
- assertTrue(e instanceof ReadFailedException);
- assertTrue(e.getCause() instanceof TimeoutException);
- assertEquals(identifier, ((ReadFailedException) e).getFailedId());
- return;
- }
- fail("Test should have thrown exception");
- }
-
- @Test
- public void testExecuteDumpHalted() throws Exception {
- doThrowFailExceptionWhen().lispEidTableDump(any());
- try {
- getExecutor().executeDump(identifier, emptyParams);
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- assertEquals(identifier, ((ReadFailedException) e).getFailedId());
- return;
- }
- fail("Test should have thrown ReadFailedException");
- }
-
- @Test
- public void testExecuteDump() throws ReadFailedException {
- doReturnResponseWhen(validDump).lispEidTableDump(any());
- final LispEidTableDetailsReplyDump reply = getExecutor().executeDump(identifier, validParams);
- verify(api, times(1)).lispEidTableDump(requestCaptor.capture());
-
- final LispEidTableDump request = requestCaptor.getValue();
- assertNotNull(request);
- assertEquals(2, request.vni);
- assertEquals(QuantityType.ALL.getValue(), request.eidSet);
- assertArrayEquals(EID, request.eid);
- assertEquals(EidType.IPV4.getValue(), request.eidType);
- assertEquals(FilterType.LOCAL.getValue(), request.filter);
- assertEquals(32, request.prefixLength);
-
- assertNotNull(reply);
- assertEquals(1, reply.lispEidTableDetails.size());
-
- final LispEidTableDetails detail = reply.lispEidTableDetails.get(0);
-
- assertNotNull(detail);
- assertEquals(0, detail.action);
- assertEquals(1, detail.authoritative);
- assertEquals(4, detail.context);
- assertArrayEquals(EID, detail.eid);
- assertEquals(32, detail.eidPrefixLen);
- assertEquals(1, detail.isLocal);
- assertEquals(2, detail.locatorSetIndex);
- assertEquals(7, detail.ttl);
- assertEquals(2, detail.vni);
- }
-
- @Override
- protected MappingsDumpExecutor initExecutor() {
- return new MappingsDumpExecutor(api);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutorTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutorTest.java
deleted file mode 100644
index 305fa9677..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutorTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package io.fd.honeycomb.lisp.translate.read.dump.executor;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.vpp.test.read.JvppDumpExecutorTest;
-import io.fd.vpp.jvpp.VppCallbackException;
-import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump;
-import java.util.concurrent.TimeoutException;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-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.InstanceIdentifier;
-
-
-public class VniTableDumpExecutorTest extends JvppDumpExecutorTest<VniTableDumpExecutor> {
-
- private LispEidTableVniDetailsReplyDump validDump;
- private InstanceIdentifier<VniTable> identifier;
-
- @Before
- public void init() {
- validDump = new LispEidTableVniDetailsReplyDump();
- identifier = InstanceIdentifier.create(VniTable.class);
- LispEidTableVniDetails detail = new LispEidTableVniDetails();
- detail.vni = 2;
- detail.context = 4;
- validDump.lispEidTableVniDetails = ImmutableList.of(detail);
- }
-
- @Test
- public void testExecuteDumpFail() throws Exception {
- doThrowFailExceptionWhen().lispEidTableVniDump(Mockito.any());
- try {
- getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- return;
- }
-
- fail("Test should have thrown ReadFailedException");
- }
-
- @Test
- public void testExecuteDumpTimeout() throws Exception {
- doThrowTimeoutExceptionWhen().lispEidTableVniDump(Mockito.any());
- try {
- getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof TimeoutException);
- return;
- }
- fail("Test should have thrown ReadFailedException");
- }
-
- @Test
- public void testExecuteDump() throws Exception {
-
- doReturnResponseWhen(validDump).lispEidTableVniDump(Mockito.any());
- final LispEidTableVniDetailsReplyDump reply =
- getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS);
-
- assertNotNull(reply);
- assertEquals(1, reply.lispEidTableVniDetails.size());
- final LispEidTableVniDetails detail = reply.lispEidTableVniDetails.get(0);
-
- assertEquals(4, detail.context);
- assertEquals(2, detail.vni);
- }
-
- @Override
- protected VniTableDumpExecutor initExecutor() {
- return new VniTableDumpExecutor(api);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProviderTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReaderTest.java
index 9a4836d63..84d8543ff 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingFilterProviderTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReaderTest.java
@@ -13,7 +13,7 @@ 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.VrfSubtable;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class MappingFilterProviderTest implements MappingFilterProvider {
+public class MappingReaderTest implements MappingReader {
private InstanceIdentifier<LocalMapping> validVrfLocal;
private InstanceIdentifier<LocalMapping> validBdLocal;