summaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java46
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java58
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java46
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java32
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java59
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java18
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorDumpCheck.java37
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorSetsDumpCheck.java38
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/MapResolverDumpCheck.java37
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/MappingsDumpCheck.java40
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/VniTableDumpCheck.java37
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java2
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorDumpCheckTest.java25
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorSetsDumpCheckTest.java26
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/MapResolverDumpCheckTest.java26
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/MappingsDumpCheckTest.java26
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/VniTableDumpCheckTest.java26
17 files changed, 112 insertions, 467 deletions
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 8af7a8682..958689df4 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,7 +21,6 @@ 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.check.LocatorDumpCheck;
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;
@@ -29,10 +28,10 @@ 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.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
+import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.vpp.util.NamingContext;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -76,7 +75,6 @@ public class InterfaceCustomizer
this.dumpCacheManager =
new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorDetailsReplyDump, LocatorDumpParams>()
.withExecutor(new LocatorDumpExecutor(futureJvpp))
- .withNonEmptyPredicate(new LocatorDumpCheck())
.build();
}
@@ -111,20 +109,22 @@ public class InterfaceCustomizer
throw new ReadFailedException(id, e);
}
- if (reply.isPresent()) {
- final LispLocatorDetails details = reply.get()
- .lispLocatorDetails
- .stream()
- .filter(a -> a.swIfIndex == referencedInterfaceIndex)
- .collect(RWUtils.singleItemCollector());
+ if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) {
+ return;
+ }
- final String interfaceRef = interfaceContext.getName(details.swIfIndex, ctx.getMappingContext());
+ final LispLocatorDetails details = reply.get()
+ .lispLocatorDetails
+ .stream()
+ .filter(a -> a.swIfIndex == referencedInterfaceIndex)
+ .collect(RWUtils.singleItemCollector());
- builder.setPriority(Byte.valueOf(details.priority).shortValue());
- builder.setWeight(Byte.valueOf(details.weight).shortValue());
- builder.setInterfaceRef(interfaceRef);
- builder.setKey(new InterfaceKey(interfaceRef));
- }
+ final String interfaceRef = interfaceContext.getName(details.swIfIndex, ctx.getMappingContext());
+
+ builder.setPriority(Byte.valueOf(details.priority).shortValue());
+ builder.setWeight(Byte.valueOf(details.weight).shortValue());
+ builder.setInterfaceRef(interfaceRef);
+ builder.setKey(new InterfaceKey(interfaceRef));
}
@Override
@@ -146,15 +146,15 @@ public class InterfaceCustomizer
throw new ReadFailedException(id, e);
}
- if (reply.isPresent()) {
- return reply.get()
- .lispLocatorDetails
- .stream()
- .map(a -> new InterfaceKey(interfaceContext.getName(a.swIfIndex, context.getMappingContext())))
- .collect(Collectors.toList());
- } else {
+ if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) {
return Collections.emptyList();
}
+
+ return reply.get()
+ .lispLocatorDetails
+ .stream()
+ .map(a -> new InterfaceKey(interfaceContext.getName(a.swIfIndex, context.getMappingContext())))
+ .collect(Collectors.toList());
}
@Override
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 015adc954..7524cd3b5 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,7 +25,6 @@ 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.check.MappingsDumpCheck;
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.util.EidTranslator;
@@ -81,7 +80,6 @@ public class LocalMappingCustomizer
this.dumpManager =
new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableDetailsReplyDump, MappingsDumpParams>()
.withExecutor(dumpExecutor)
- .withNonEmptyPredicate(new MappingsDumpCheck())
.build();
}
@@ -125,24 +123,22 @@ public class LocalMappingCustomizer
throw new ReadFailedException(id, e);
}
- if (replyOptional.isPresent()) {
- LOG.debug("Valid dump loaded");
-
- LispEidTableDetails details = replyOptional.get().lispEidTableDetails.stream()
- .filter(a -> compareAddresses(eid.getAddress(),
- getArrayAsEidLocal(valueOf(a.eidType), a.eid).getAddress()))
- .collect(
- RWUtils.singleItemCollector());
-
- //in case of local mappings,locator_set_index stands for interface index
- checkState(locatorSetContext.containsName(details.locatorSetIndex, ctx.getMappingContext()),
- "No Locator Set name found for index %s", details.locatorSetIndex);
- builder.setLocatorSet(locatorSetContext.getName(details.locatorSetIndex, ctx.getMappingContext()));
- builder.setKey(new LocalMappingKey(new MappingId(id.firstKeyOf(LocalMapping.class).getId())));
- builder.setEid(getArrayAsEidLocal(valueOf(details.eidType), details.eid));
- } else {
- LOG.debug("No data dumped");
+ if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
+ return;
}
+
+ LispEidTableDetails details = replyOptional.get().lispEidTableDetails.stream()
+ .filter(a -> compareAddresses(eid.getAddress(),
+ getArrayAsEidLocal(valueOf(a.eidType), a.eid).getAddress()))
+ .collect(
+ RWUtils.singleItemCollector());
+
+ //in case of local mappings,locator_set_index stands for interface index
+ checkState(locatorSetContext.containsName(details.locatorSetIndex, ctx.getMappingContext()),
+ "No Locator Set name found for index %s", details.locatorSetIndex);
+ builder.setLocatorSet(locatorSetContext.getName(details.locatorSetIndex, ctx.getMappingContext()));
+ builder.setKey(new LocalMappingKey(new MappingId(id.firstKeyOf(LocalMapping.class).getId())));
+ builder.setEid(getArrayAsEidLocal(valueOf(details.eidType), details.eid));
}
@Override
@@ -173,21 +169,19 @@ public class LocalMappingCustomizer
throw new ReadFailedException(id, e);
}
- if (replyOptional.isPresent()) {
- LOG.debug("Valid dump loaded");
- return replyOptional.get().lispEidTableDetails.stream()
- //filtering with vni to skip help local mappings that are created in vpp to handle remote mappings(vpp feature)
- .filter(a -> a.vni == vni)
- .map(a -> new LocalMappingKey(
- new MappingId(
- localMappingContext.getId(
- getArrayAsEidLocal(valueOf(a.eidType), a.eid),
- context.getMappingContext()))))
- .collect(Collectors.toList());
- } else {
- LOG.debug("No data dumped");
+ if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
return Collections.emptyList();
}
+
+ return replyOptional.get().lispEidTableDetails.stream()
+ //filtering with vni to skip help local mappings that are created in vpp to handle remote mappings(vpp feature)
+ .filter(a -> a.vni == vni)
+ .map(a -> new LocalMappingKey(
+ new MappingId(
+ localMappingContext.getId(
+ getArrayAsEidLocal(valueOf(a.eidType), a.eid),
+ context.getMappingContext()))))
+ .collect(Collectors.toList());
}
@Override
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 3ce5c2f4e..a1379f49b 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,6 @@ 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.check.LocatorSetsDumpCheck;
import io.fd.honeycomb.lisp.translate.read.dump.executor.LocatorSetsDumpExecutor;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
@@ -63,7 +62,6 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
this.locatorSetContext = checkNotNull(locatorSetContext, "Locator Set mapping context cannot be null");
this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorSetDetailsReplyDump, Void>()
.withExecutor(new LocatorSetsDumpExecutor(futureJvpp))
- .withNonEmptyPredicate(new LocatorSetsDumpCheck())
.build();
}
@@ -84,8 +82,7 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
} catch (DumpExecutionFailedException e) {
throw new ReadFailedException(id, e);
}
- if (!dumpOptional.isPresent()) {
- LOG.warn("No dump present for Locator Set {}", id);
+ if (!dumpOptional.isPresent() || dumpOptional.get().lispLocatorSetDetails.isEmpty()) {
return;
}
@@ -119,29 +116,28 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
return Collections.emptyList();
}
- if (dumpOptional.isPresent()) {
- return dumpOptional.get().lispLocatorSetDetails.stream()
- .map(set -> {
-
- final String locatorSetName = toString(set.lsName);
- //creates mapping for existing locator-set(if it is'nt already existing one)
- if (!locatorSetContext.containsIndex(locatorSetName, context.getMappingContext())) {
- locatorSetContext.addName(set.lsIndex, locatorSetName, context.getMappingContext());
- }
-
- LOG.trace("Locator Set with name: {}, VPP name: {} and index: {} found in VPP",
- locatorSetContext.getName(set.lsIndex, context.getMappingContext()),
- locatorSetName,
- set.lsIndex);
-
- return set;
- })
- .map(set -> new LocatorSetKey(toString(set.lsName)))
- .collect(Collectors.toList());
- } else {
- LOG.warn("No data dumped for Locator Set {}", id);
+ if (!dumpOptional.isPresent() || dumpOptional.get().lispLocatorSetDetails.isEmpty()) {
return Collections.emptyList();
}
+
+ return dumpOptional.get().lispLocatorSetDetails.stream()
+ .map(set -> {
+
+ final String locatorSetName = toString(set.lsName);
+ //creates mapping for existing locator-set(if it is'nt already existing one)
+ if (!locatorSetContext.containsIndex(locatorSetName, context.getMappingContext())) {
+ locatorSetContext.addName(set.lsIndex, locatorSetName, context.getMappingContext());
+ }
+
+ LOG.trace("Locator Set with name: {}, VPP name: {} and index: {} found in VPP",
+ locatorSetContext.getName(set.lsIndex, context.getMappingContext()),
+ locatorSetName,
+ set.lsIndex);
+
+ return set;
+ })
+ .map(set -> new LocatorSetKey(toString(set.lsName)))
+ .collect(Collectors.toList());
}
@Override
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 1458a2d56..faff2e2e1 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,11 +19,11 @@ 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.check.MapResolverDumpCheck;
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;
+import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
@@ -57,7 +57,6 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
super(futureJvpp);
this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispMapResolverDetailsReplyDump, Void>()
.withExecutor(new MapResolversDumpExecutor((futureJvpp)))
- .withNonEmptyPredicate(new MapResolverDumpCheck())
.build();
}
@@ -78,7 +77,7 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
throw new ReadFailedException(id, e);
}
- if (!dumpOptional.isPresent()) {
+ if (!dumpOptional.isPresent() || dumpOptional.get().lispMapResolverDetails.isEmpty()) {
LOG.warn("No data dumped");
return;
}
@@ -86,25 +85,15 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
final MapResolverKey key = id.firstKeyOf(MapResolver.class);
//revert searched key to match vpp's reversed order ip's
final IpAddress address = reverseAddress(key.getIpAddress());
- final LispMapResolverDetailsReplyDump dump = dumpOptional.get();
-
- //cannot use RWUtils.singleItemCollector(),there is some problem with generic params binding
- java.util.Optional<LispMapResolverDetails> mapResolverOptional =
- dump.lispMapResolverDetails.stream()
+ final LispMapResolverDetails mapResolverDetails =
+ dumpOptional.get().lispMapResolverDetails.stream()
.filter(a -> address
.equals(arrayToIpAddress(byteToBoolean(a.isIpv6), a.ipAddress)))
- .findFirst();
-
- if (mapResolverOptional.isPresent()) {
- LispMapResolverDetails details = mapResolverOptional.get();
-
- builder.setKey(key);
- builder.setIpAddress(
- arrayToIpAddress(byteToBoolean(details.isIpv6), details.ipAddress));
- } else {
- LOG.warn("No data found with matching key");
- }
+ .collect(RWUtils.singleItemCollector());
+ builder.setKey(key);
+ builder.setIpAddress(
+ arrayToIpAddress(byteToBoolean(mapResolverDetails.isIpv6), mapResolverDetails.ipAddress));
}
@Override
@@ -112,15 +101,14 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
throws ReadFailedException {
LOG.debug("Dumping MapResolver...");
- Optional<LispMapResolverDetailsReplyDump> dumpOptional = null;
+ Optional<LispMapResolverDetailsReplyDump> dumpOptional;
try {
dumpOptional = dumpManager.getDump(MAP_RESOLVERS_CACHE_ID, context.getModificationCache(), NO_PARAMS);
} catch (DumpExecutionFailedException e) {
throw new ReadFailedException(id, e);
}
- if (!dumpOptional.isPresent()) {
- LOG.warn("No data dumped");
+ if (!dumpOptional.isPresent() || dumpOptional.get().lispMapResolverDetails.isEmpty()) {
return Collections.emptyList();
}
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 72811fddc..50b9d7fa2 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
@@ -24,7 +24,6 @@ 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.check.MappingsDumpCheck;
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.dump.executor.params.MappingsDumpParams.QuantityType;
@@ -77,7 +76,6 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
this.dumpManager =
new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableDetailsReplyDump, MappingsDumpParams>()
.withExecutor(new MappingsDumpExecutor(futureJvpp))
- .withNonEmptyPredicate(new MappingsDumpCheck())
.build();
}
@@ -125,24 +123,23 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
throw new ReadFailedException(id, e);
}
- if (replyOptional.isPresent()) {
- LOG.debug("Valid dump loaded");
+ if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
+ return;
+ }
- LispEidTableDetails details = replyOptional.get().lispEidTableDetails.stream()
- .filter(a -> compareAddresses(eid.getAddress(),
- getArrayAsEidLocal(valueOf(a.eidType), a.eid).getAddress()))
- .collect(
- RWUtils.singleItemCollector());
+ LOG.debug("Valid dump loaded");
- builder.setEid(getArrayAsEidRemote(valueOf(details.eidType), details.eid));
- builder.setKey(new RemoteMappingKey(new MappingId(id.firstKeyOf(RemoteMapping.class).getId())));
- builder.setTtl(resolveTtl(details.ttl));
- builder.setAuthoritative(
- new RemoteMapping.Authoritative(byteToBoolean(details.authoritative)));
+ LispEidTableDetails details = replyOptional.get().lispEidTableDetails.stream()
+ .filter(a -> compareAddresses(eid.getAddress(),
+ getArrayAsEidLocal(valueOf(a.eidType), a.eid).getAddress()))
+ .collect(
+ RWUtils.singleItemCollector());
- } else {
- LOG.debug("No data dumped");
- }
+ builder.setEid(getArrayAsEidRemote(valueOf(details.eidType), details.eid));
+ builder.setKey(new RemoteMappingKey(new MappingId(id.firstKeyOf(RemoteMapping.class).getId())));
+ builder.setTtl(resolveTtl(details.ttl));
+ builder.setAuthoritative(
+ new RemoteMapping.Authoritative(byteToBoolean(details.authoritative)));
}
//compensate ~0 as default value of ttl
@@ -180,23 +177,21 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
throw new ReadFailedException(id, e);
}
- if (replyOptional.isPresent()) {
- LOG.debug("Valid dump loaded");
- return replyOptional.get()
- .lispEidTableDetails
- .stream()
- .filter(a -> a.vni == vni)
- .map(detail -> new RemoteMappingKey(
- new MappingId(
- remoteMappingContext.getId(
- getArrayAsEidRemote(
- valueOf(detail.eidType), detail.eid),
- context.getMappingContext()))))
- .collect(Collectors.toList());
- } else {
- LOG.debug("No data dumped");
+ if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
return Collections.emptyList();
}
+
+ return replyOptional.get()
+ .lispEidTableDetails
+ .stream()
+ .filter(a -> a.vni == vni)
+ .map(detail -> new RemoteMappingKey(
+ new MappingId(
+ remoteMappingContext.getId(
+ getArrayAsEidRemote(
+ valueOf(detail.eidType), detail.eid),
+ context.getMappingContext()))))
+ .collect(Collectors.toList());
}
@Override
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 9acd58bbf..d0f69bf6c 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,14 @@ 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.check.VniTableDumpCheck;
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.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
+import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -61,7 +60,6 @@ public class VniTableCustomizer extends FutureJVppCustomizer
super(futureJvpp);
this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, Void>()
.withExecutor(new VniTableDumpExecutor(futureJvpp))
- .withNonEmptyPredicate(new VniTableDumpCheck())
.build();
}
@@ -95,18 +93,12 @@ public class VniTableCustomizer extends FutureJVppCustomizer
throw new ReadFailedException(id, e);
}
- if (!optionalReply.isPresent()) {
+ if (!optionalReply.isPresent() || optionalReply.get().lispEidTableMapDetails.isEmpty()) {
return Collections.emptyList();
}
- LispEidTableMapDetailsReplyDump reply = optionalReply.get();
- LOG.debug("Dumped ...");
-
- // Just transform received details into a list of keys
- final List<VniTableKey> collect = reply.lispEidTableMapDetails.stream().map(VniTableCustomizer::detailsToKey)
+ return optionalReply.get().lispEidTableMapDetails.stream().map(VniTableCustomizer::detailsToKey)
.collect(Collectors.toList());
- LOG.debug("All IDs found: {} ...", collect);
- return collect;
}
@Override
@@ -124,12 +116,12 @@ public class VniTableCustomizer extends FutureJVppCustomizer
throw new ReadFailedException(id, e);
}
- if (!optionalReply.isPresent()) {
+ if (!optionalReply.isPresent() || optionalReply.get().lispEidTableMapDetails.isEmpty()) {
return;
}
//transforming right away to single detail(specific request should do the magic)
- LispEidTableMapDetails details =
+ final LispEidTableMapDetails details =
optionalReply.get().lispEidTableMapDetails.stream().filter(a -> detailsToKey(a).equals(key))
.collect(RWUtils.singleItemCollector());
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorDumpCheck.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorDumpCheck.java
deleted file mode 100644
index 762aa3830..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorDumpCheck.java
+++ /dev/null
@@ -1,37 +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.check;
-
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpNonEmptyCheck;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.check.DumpCheckFailedException;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.check.i.DumpEmptyException;
-import org.openvpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
-
-public class LocatorDumpCheck implements EntityDumpNonEmptyCheck<LispLocatorDetailsReplyDump> {
-
- @Override
- public void assertNotEmpty(final LispLocatorDetailsReplyDump data) throws DumpCheckFailedException {
-
- if (data == null) {
- throw new DumpEmptyException("Locator dump is null");
- }
-
- if (data.lispLocatorDetails == null) {
- throw new DumpEmptyException("Locator dump is empty");
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorSetsDumpCheck.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorSetsDumpCheck.java
deleted file mode 100755
index a24341460..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorSetsDumpCheck.java
+++ /dev/null
@@ -1,38 +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.check;
-
-
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpNonEmptyCheck;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.check.DumpCheckFailedException;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.check.i.DumpEmptyException;
-import org.openvpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-
-public class LocatorSetsDumpCheck implements EntityDumpNonEmptyCheck<LispLocatorSetDetailsReplyDump> {
-
- @Override
- public void assertNotEmpty(final LispLocatorSetDetailsReplyDump data) throws DumpCheckFailedException {
-
- if (data == null) {
- throw new DumpEmptyException("Locator sets dump is null");
- }
-
- if (data.lispLocatorSetDetails == null) {
- throw new DumpEmptyException("Locator sets dump is empty");
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/MapResolverDumpCheck.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/MapResolverDumpCheck.java
deleted file mode 100755
index 18fc9c882..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/MapResolverDumpCheck.java
+++ /dev/null
@@ -1,37 +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.check;
-
-
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpNonEmptyCheck;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.check.DumpCheckFailedException;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.check.i.DumpEmptyException;
-import org.openvpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
-
-public class MapResolverDumpCheck implements EntityDumpNonEmptyCheck<LispMapResolverDetailsReplyDump> {
-
- @Override
- public void assertNotEmpty(final LispMapResolverDetailsReplyDump data) throws DumpCheckFailedException {
- if (data == null) {
- throw new DumpEmptyException("Map resolvers dump is null");
- }
-
- if (data.lispMapResolverDetails == null) {
- throw new DumpEmptyException("Map resolvers dump is empty");
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/MappingsDumpCheck.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/MappingsDumpCheck.java
deleted file mode 100755
index cf1d0210d..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/MappingsDumpCheck.java
+++ /dev/null
@@ -1,40 +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.check;
-
-
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpNonEmptyCheck;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.check.DumpCheckFailedException;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.check.i.DumpEmptyException;
-import org.openvpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
-
-/**
- * Common dump check for both local and remote mappings
- */
-public class MappingsDumpCheck implements EntityDumpNonEmptyCheck<LispEidTableDetailsReplyDump> {
-
- @Override
- public void assertNotEmpty(final LispEidTableDetailsReplyDump data) throws DumpCheckFailedException {
- if (data == null) {
- throw new DumpEmptyException("Mappings dump is null");
- }
-
- if (data.lispEidTableDetails == null) {
- throw new DumpEmptyException("Mappings dump is empty");
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/VniTableDumpCheck.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/VniTableDumpCheck.java
deleted file mode 100755
index bb5c03321..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/check/VniTableDumpCheck.java
+++ /dev/null
@@ -1,37 +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.check;
-
-
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpNonEmptyCheck;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.check.DumpCheckFailedException;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.check.i.DumpEmptyException;
-import org.openvpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-
-public class VniTableDumpCheck implements EntityDumpNonEmptyCheck<LispEidTableMapDetailsReplyDump> {
-
- @Override
- public void assertNotEmpty(final LispEidTableMapDetailsReplyDump data) throws DumpCheckFailedException {
- if (data == null) {
- throw new DumpEmptyException("Vni table dump is null");
- }
-
- if (data.lispEidTableMapDetails == null) {
- throw new DumpEmptyException("Bni table dump is empty");
- }
- }
-}
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 105294e90..a310e9e46 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,6 @@ 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.check.LocatorSetsDumpCheck;
import io.fd.honeycomb.lisp.translate.read.dump.executor.LocatorSetsDumpExecutor;
import io.fd.honeycomb.translate.ModificationCache;
import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
@@ -67,7 +66,6 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
this.locatorSetContext = checkNotNull(locatorSetContext, "Locator set context cannot be null");
this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorSetDetailsReplyDump, Void>()
.withExecutor(new LocatorSetsDumpExecutor(futureJvpp))
- .withNonEmptyPredicate(new LocatorSetsDumpCheck())
.build();
}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorDumpCheckTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorDumpCheckTest.java
deleted file mode 100644
index 8c52eb930..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorDumpCheckTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.fd.honeycomb.lisp.translate.read.dump.check;
-
-import io.fd.honeycomb.vpp.test.read.DumpCheckTest;
-import org.openvpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
-
-public class LocatorDumpCheckTest extends DumpCheckTest<LocatorDumpCheck, LispLocatorDetailsReplyDump> {
-
- @Override
- protected LocatorDumpCheck initCheck() {
- return new LocatorDumpCheck();
- }
-
- @Override
- protected LispLocatorDetailsReplyDump initEmptyData() {
- final LispLocatorDetailsReplyDump replyDump = new LispLocatorDetailsReplyDump();
- replyDump.lispLocatorDetails = null;
-
- return replyDump;
- }
-
- @Override
- protected LispLocatorDetailsReplyDump initValidData() {
- return new LispLocatorDetailsReplyDump();
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorSetsDumpCheckTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorSetsDumpCheckTest.java
deleted file mode 100644
index f932c22e5..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/LocatorSetsDumpCheckTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.fd.honeycomb.lisp.translate.read.dump.check;
-
-import io.fd.honeycomb.vpp.test.read.DumpCheckTest;
-import org.openvpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-
-
-public class LocatorSetsDumpCheckTest extends DumpCheckTest<LocatorSetsDumpCheck, LispLocatorSetDetailsReplyDump> {
-
- @Override
- protected LocatorSetsDumpCheck initCheck() {
- return new LocatorSetsDumpCheck();
- }
-
- @Override
- protected LispLocatorSetDetailsReplyDump initEmptyData() {
- final LispLocatorSetDetailsReplyDump replyDump = new LispLocatorSetDetailsReplyDump();
- replyDump.lispLocatorSetDetails = null;
-
- return replyDump;
- }
-
- @Override
- protected LispLocatorSetDetailsReplyDump initValidData() {
- return new LispLocatorSetDetailsReplyDump();
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/MapResolverDumpCheckTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/MapResolverDumpCheckTest.java
deleted file mode 100644
index 236f3c494..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/MapResolverDumpCheckTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.fd.honeycomb.lisp.translate.read.dump.check;
-
-import io.fd.honeycomb.vpp.test.read.DumpCheckTest;
-import org.openvpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
-
-
-public class MapResolverDumpCheckTest extends DumpCheckTest<MapResolverDumpCheck, LispMapResolverDetailsReplyDump> {
-
- @Override
- protected MapResolverDumpCheck initCheck() {
- return new MapResolverDumpCheck();
- }
-
- @Override
- protected LispMapResolverDetailsReplyDump initEmptyData() {
- final LispMapResolverDetailsReplyDump replyDump = new LispMapResolverDetailsReplyDump();
- replyDump.lispMapResolverDetails = null;
-
- return replyDump;
- }
-
- @Override
- protected LispMapResolverDetailsReplyDump initValidData() {
- return new LispMapResolverDetailsReplyDump();
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/MappingsDumpCheckTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/MappingsDumpCheckTest.java
deleted file mode 100644
index 6378e5f6b..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/MappingsDumpCheckTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.fd.honeycomb.lisp.translate.read.dump.check;
-
-import io.fd.honeycomb.vpp.test.read.DumpCheckTest;
-import org.openvpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
-
-
-public class MappingsDumpCheckTest extends DumpCheckTest<MappingsDumpCheck, LispEidTableDetailsReplyDump> {
-
- @Override
- protected MappingsDumpCheck initCheck() {
- return new MappingsDumpCheck();
- }
-
- @Override
- protected LispEidTableDetailsReplyDump initEmptyData() {
- final LispEidTableDetailsReplyDump replyDump = new LispEidTableDetailsReplyDump();
- replyDump.lispEidTableDetails = null;
-
- return replyDump;
- }
-
- @Override
- protected LispEidTableDetailsReplyDump initValidData() {
- return new LispEidTableDetailsReplyDump();
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/VniTableDumpCheckTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/VniTableDumpCheckTest.java
deleted file mode 100644
index 5f70e8a1e..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/check/VniTableDumpCheckTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.fd.honeycomb.lisp.translate.read.dump.check;
-
-import io.fd.honeycomb.vpp.test.read.DumpCheckTest;
-import org.openvpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-
-
-public class VniTableDumpCheckTest extends DumpCheckTest<VniTableDumpCheck, LispEidTableMapDetailsReplyDump> {
-
- @Override
- protected VniTableDumpCheck initCheck() {
- return new VniTableDumpCheck();
- }
-
- @Override
- protected LispEidTableMapDetailsReplyDump initEmptyData() {
- final LispEidTableMapDetailsReplyDump replyDump = new LispEidTableMapDetailsReplyDump();
- replyDump.lispEidTableMapDetails = null;
-
- return replyDump;
- }
-
- @Override
- protected LispEidTableMapDetailsReplyDump initValidData() {
- return new LispEidTableMapDetailsReplyDump();
- }
-} \ No newline at end of file