diff options
Diffstat (limited to 'lisp/lisp2vpp/src')
25 files changed, 229 insertions, 333 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 e2c547821..a765ca024 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 @@ -29,9 +29,11 @@ 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.FutureJVppCustomizer; import io.fd.honeycomb.translate.vpp.util.NamingContext; +import io.fd.vpp.jvpp.core.dto.LispLocatorDetails; +import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump; +import io.fd.vpp.jvpp.core.future.FutureJVppCore; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -44,11 +46,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.LispLocatorDetails; -import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump; -import io.fd.vpp.jvpp.core.future.FutureJVppCore; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** @@ -58,7 +55,6 @@ public class InterfaceCustomizer extends FutureJVppCustomizer implements ListReaderCustomizer<Interface, InterfaceKey, InterfaceBuilder> { - private static final Logger LOG = LoggerFactory.getLogger(InterfaceCustomizer.class); private static final String KEY_BASE = InterfaceCustomizer.class.getName(); private final NamingContext interfaceContext; @@ -102,12 +98,8 @@ public class InterfaceCustomizer final LocatorDumpParams params = new LocatorDumpParamsBuilder().setLocatorSetIndex(locatorSetIndexIndex).build(); - Optional<LispLocatorDetailsReplyDump> reply; - try { - reply = dumpCacheManager.getDump(KEY_BASE, ctx.getModificationCache(), params); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + final Optional<LispLocatorDetailsReplyDump> reply = + dumpCacheManager.getDump(id, KEY_BASE, ctx.getModificationCache(), params); if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) { return; @@ -138,13 +130,8 @@ public class InterfaceCustomizer final LocatorDumpParams params = new LocatorDumpParamsBuilder() .setLocatorSetIndex(locatorSetContext.getIndex(name, context.getMappingContext())).build(); - - Optional<LispLocatorDetailsReplyDump> reply; - try { - reply = dumpCacheManager.getDump(KEY_BASE, context.getModificationCache(), params); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + final Optional<LispLocatorDetailsReplyDump> reply = + dumpCacheManager.getDump(id, KEY_BASE, context.getModificationCache(), params); if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) { return Collections.emptyList(); 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 48e559ddc..979006cbf 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 @@ -26,9 +26,10 @@ 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.util.read.cache.exceptions.execution.DumpExecutionFailedException; import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator; import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer; +import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocsReply; +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.rev160520.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.itr.remote.locator.sets.grouping.ItrRemoteLocatorSetBuilder; @@ -36,8 +37,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.LispGetMapRequestItrRlocsReply; -import io.fd.vpp.jvpp.core.future.FutureJVppCore; public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer implements ReaderCustomizer<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder>, ByteDataTranslator { @@ -63,13 +62,8 @@ public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer @Nonnull final ItrRemoteLocatorSetBuilder builder, @Nonnull final ReadContext ctx) throws ReadFailedException { - Optional<LispGetMapRequestItrRlocsReply> reply; - try { - reply = dumpCacheManager.getDump(CACHE_KEY, ctx.getModificationCache(), NO_PARAMS); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } - + final Optional<LispGetMapRequestItrRlocsReply> reply = + dumpCacheManager.getDump(id, CACHE_KEY, ctx.getModificationCache(), NO_PARAMS); if (!reply.isPresent() || reply.get().locatorSetName == null) { return; } 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 52135def3..9a46a92db 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 @@ -34,7 +34,6 @@ 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.FutureJVppCustomizer; import io.fd.honeycomb.translate.vpp.util.NamingContext; import io.fd.vpp.jvpp.core.dto.LispEidTableDetails; @@ -117,14 +116,8 @@ public class LocalMappingCustomizer .build(); LOG.debug("Dumping data for LocalMappings(id={})", id); - Optional<LispEidTableDetailsReplyDump> replyOptional; - - try { - replyOptional = - dumpManager.getDump(bindKey("SPECIFIC_" + localMappingId), ctx.getModificationCache(), dumpParams); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + final Optional<LispEidTableDetailsReplyDump> replyOptional = + dumpManager.getDump(id, bindKey("SPECIFIC_" + localMappingId), ctx.getModificationCache(), dumpParams); if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) { return; @@ -168,12 +161,8 @@ public class LocalMappingCustomizer .build(); LOG.debug("Dumping data for LocalMappings(id={})", id); - Optional<LispEidTableDetailsReplyDump> replyOptional; - try { - replyOptional = dumpManager.getDump(bindKey("ALL_LOCAL"), context.getModificationCache(), dumpParams); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + final Optional<LispEidTableDetailsReplyDump> replyOptional = + dumpManager.getDump(id, bindKey("ALL_LOCAL"), context.getModificationCache(), dumpParams); if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) { return Collections.emptyList(); 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 6a14586b4..de5b3802f 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 @@ -25,10 +25,12 @@ 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.read.cache.DumpCacheManager; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException; import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator; import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer; import io.fd.honeycomb.translate.vpp.util.NamingContext; +import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetails; +import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump; +import io.fd.vpp.jvpp.core.future.FutureJVppCore; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -40,9 +42,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.LispLocatorSetDetails; -import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump; -import io.fd.vpp.jvpp.core.future.FutureJVppCore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -75,13 +74,9 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer throws ReadFailedException { LOG.debug("Reading attributes for Locator Set {}", id); - Optional<LispLocatorSetDetailsReplyDump> dumpOptional; + final Optional<LispLocatorSetDetailsReplyDump> dumpOptional = + dumpManager.getDump(id, LOCATOR_SETS_CACHE_ID, ctx.getModificationCache(), NO_PARAMS); - try { - dumpOptional = dumpManager.getDump(LOCATOR_SETS_CACHE_ID, ctx.getModificationCache(), NO_PARAMS); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } if (!dumpOptional.isPresent() || dumpOptional.get().lispLocatorSetDetails.isEmpty()) { return; } @@ -108,13 +103,8 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer throws ReadFailedException { LOG.debug("Dumping Locator Set {}", id); - Optional<LispLocatorSetDetailsReplyDump> dumpOptional = null; - try { - dumpOptional = dumpManager.getDump(LOCATOR_SETS_CACHE_ID, context.getModificationCache(), NO_PARAMS); - } catch (DumpExecutionFailedException e) { - LOG.error("Error dumping Locator Set {}", e, id); - return Collections.emptyList(); - } + final Optional<LispLocatorSetDetailsReplyDump> dumpOptional = + dumpManager.getDump(id, LOCATOR_SETS_CACHE_ID, context.getModificationCache(), NO_PARAMS); if (!dumpOptional.isPresent() || dumpOptional.get().lispLocatorSetDetails.isEmpty()) { return Collections.emptyList(); 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 21281c75b..0eb78450f 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 @@ -25,7 +25,6 @@ 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; import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer; import io.fd.vpp.jvpp.core.dto.LispMapResolverDetails; @@ -71,12 +70,8 @@ public class MapResolverCustomizer extends FutureJVppCustomizer throws ReadFailedException { LOG.debug("Reading attributes..."); - Optional<LispMapResolverDetailsReplyDump> dumpOptional = null; - try { - dumpOptional = dumpManager.getDump(MAP_RESOLVERS_CACHE_ID, ctx.getModificationCache(), NO_PARAMS); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + final Optional<LispMapResolverDetailsReplyDump> dumpOptional = + dumpManager.getDump(id, MAP_RESOLVERS_CACHE_ID, ctx.getModificationCache(), NO_PARAMS); if (!dumpOptional.isPresent() || dumpOptional.get().lispMapResolverDetails.isEmpty()) { LOG.warn("No data dumped"); @@ -106,12 +101,8 @@ public class MapResolverCustomizer extends FutureJVppCustomizer throws ReadFailedException { LOG.debug("Dumping MapResolver..."); - Optional<LispMapResolverDetailsReplyDump> dumpOptional; - try { - dumpOptional = dumpManager.getDump(MAP_RESOLVERS_CACHE_ID, context.getModificationCache(), NO_PARAMS); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + final Optional<LispMapResolverDetailsReplyDump> dumpOptional = + dumpManager.getDump(id, MAP_RESOLVERS_CACHE_ID, context.getModificationCache(), NO_PARAMS); 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 5d092f988..53aee15ee 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 @@ -39,7 +39,6 @@ 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; import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator; import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer; @@ -139,13 +138,8 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer .build(); LOG.debug("Dumping data for LocalMappings(id={})", id); - Optional<LispEidTableDetailsReplyDump> replyOptional; - try { - replyOptional = - dumpManager.getDump(bindKey("SPECIFIC_" + remoteMappingId), ctx.getModificationCache(), dumpParams); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + final Optional<LispEidTableDetailsReplyDump> replyOptional = + dumpManager.getDump(id, bindKey("SPECIFIC_" + remoteMappingId), ctx.getModificationCache(), dumpParams); if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) { return; @@ -184,7 +178,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer if (vni == 0) { // ignoring default vni mapping - // its not relevant for us and we also don't store mapping for such eid's + // it's not relevant for us and we also don't store mapping for such eid's // such mapping is used to create helper local mappings to process remote ones return Collections.emptyList(); } @@ -196,12 +190,8 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer .build(); LOG.debug("Dumping data for LocalMappings(id={})", id); - Optional<LispEidTableDetailsReplyDump> replyOptional; - try { - replyOptional = dumpManager.getDump(bindKey("ALL_REMOTE"), context.getModificationCache(), dumpParams); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + final Optional<LispEidTableDetailsReplyDump> replyOptional = + dumpManager.getDump(id, bindKey("ALL_REMOTE"), context.getModificationCache(), dumpParams); if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) { return Collections.emptyList(); @@ -242,11 +232,12 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer // cache key needs to have locator set scope to not mix with cached data final Optional<LispLocatorDetailsReplyDump> reply; try { - reply = locatorsDumpManager.getDump(KEY + "_locator_set_" + details.locatorSetIndex, cache, + reply = locatorsDumpManager.getDump(id, KEY + "_locator_set_" + details.locatorSetIndex, cache, new LocatorDumpParamsBuilder().setLocatorSetIndex(details.locatorSetIndex).build()); - } catch (DumpExecutionFailedException e) { + } catch (ReadFailedException e) { throw new ReadFailedException(id, - new IllegalStateException("Unable to resolve Positive/Negative mapping for RemoteMapping", e)); + new IllegalStateException("Unable to resolve Positive/Negative mapping for RemoteMapping", + e.getCause())); } if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) { 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 e8a28cc1b..755627f12 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 @@ -26,10 +26,7 @@ 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.FutureJVppCustomizer; -import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails; -import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump; import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetails; import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump; import io.fd.vpp.jvpp.core.future.FutureJVppCore; @@ -88,12 +85,8 @@ public class VniTableCustomizer extends FutureJVppCustomizer throws ReadFailedException { LOG.trace("Reading all IDS..."); - Optional<LispEidTableVniDetailsReplyDump> optionalReply; - try { - optionalReply = dumpManager.getDump(LISP_TABLE_ID_DUMP, context.getModificationCache(), NO_PARAMS); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + final Optional<LispEidTableVniDetailsReplyDump> optionalReply = + dumpManager.getDump(id, LISP_TABLE_ID_DUMP, context.getModificationCache(), NO_PARAMS); if (!optionalReply.isPresent() || optionalReply.get().lispEidTableVniDetails.isEmpty()) { return Collections.emptyList(); @@ -111,12 +104,8 @@ public class VniTableCustomizer extends FutureJVppCustomizer checkState(id.firstKeyOf(VniTable.class) != null, "No VNI present"); VniTableKey key = new VniTableKey(id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier()); - Optional<LispEidTableVniDetailsReplyDump> optionalReply; - try { - optionalReply = dumpManager.getDump(LISP_TABLE_ID_DUMP, ctx.getModificationCache(), NO_PARAMS); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + final Optional<LispEidTableVniDetailsReplyDump> optionalReply = + dumpManager.getDump(id, LISP_TABLE_ID_DUMP, ctx.getModificationCache(), NO_PARAMS); if (!optionalReply.isPresent() || optionalReply.get().lispEidTableVniDetails.isEmpty()) { return; 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 index 391fa7668..3b2114af8 100644 --- 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 @@ -16,17 +16,14 @@ 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.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer; -import java.util.concurrent.TimeoutException; -import javax.annotation.Nonnull; -import io.fd.vpp.jvpp.VppBaseCallException; 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 { @@ -36,13 +33,9 @@ public class ItrRemoteLocatorSetDumpExecutor extends AbstractJvppDumpExecutor } @Override - public LispGetMapRequestItrRlocsReply executeDump(final Void params) throws DumpExecutionFailedException { - try { - return getReply(vppApi.lispGetMapRequestItrRlocs(new LispGetMapRequestItrRlocs()).toCompletableFuture()); - } catch (TimeoutException e) { - throw DumpTimeoutException.wrapTimeoutException("Dumping of Itr Remote Locator Sets ended in timeout", e); - } catch (VppBaseCallException e) { - throw DumpCallFailedException.wrapFailedCallException("Dumping of Itr Remote Locator Sets failed", e); - } + 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/LocatorDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java index 86ac1ac63..d200597d6 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/dump/executor/LocatorDumpExecutor.java @@ -19,17 +19,14 @@ 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.LocatorDumpParams; +import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer; -import java.util.concurrent.TimeoutException; -import javax.annotation.Nonnull; -import io.fd.vpp.jvpp.VppBaseCallException; 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; /** @@ -44,7 +41,10 @@ public class LocatorDumpExecutor extends AbstractJvppDumpExecutor } @Override - public LispLocatorDetailsReplyDump executeDump(final LocatorDumpParams params) throws DumpExecutionFailedException { + @Nonnull + public LispLocatorDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, + final LocatorDumpParams params) throws + ReadFailedException { checkNotNull(params, "Params for dump request not present"); LispLocatorDump request = new LispLocatorDump(); @@ -52,14 +52,6 @@ public class LocatorDumpExecutor extends AbstractJvppDumpExecutor //flag that lsIndex is set request.isIndexSet = (byte) 1; - try { - return getReply(vppApi.lispLocatorDump(request).toCompletableFuture()); - } catch (TimeoutException e) { - throw DumpTimeoutException - .wrapTimeoutException("Locator dump ended in timeout with params" + params.toString(), e); - } catch (VppBaseCallException e) { - throw DumpCallFailedException - .wrapFailedCallException("Locator dump failed with params" + params.toString(), e); - } + 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/dump/executor/LocatorSetsDumpExecutor.java index 383cb8e78..c896556bb 100755 --- 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/dump/executor/LocatorSetsDumpExecutor.java @@ -17,17 +17,14 @@ 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.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer; -import java.util.concurrent.TimeoutException; -import javax.annotation.Nonnull; -import io.fd.vpp.jvpp.VppBaseCallException; 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 @@ -38,18 +35,14 @@ public class LocatorSetsDumpExecutor extends AbstractJvppDumpExecutor } @Override - public LispLocatorSetDetailsReplyDump executeDump(final Void params) throws DumpExecutionFailedException { + @Nonnull + public LispLocatorSetDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final Void params) + throws ReadFailedException { LispLocatorSetDump request = new LispLocatorSetDump(); //only local request.filter = 1; - try { - return getReply(vppApi.lispLocatorSetDump(request).toCompletableFuture()); - } catch (TimeoutException e) { - throw DumpTimeoutException.wrapTimeoutException("Locator sets dump ended in timeout", e); - } catch (VppBaseCallException e) { - throw DumpCallFailedException.wrapFailedCallException("Locator sets dump failed", e); - } + return getReplyForRead(vppApi.lispLocatorSetDump(request).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 index 7df537040..8f19e7084 100755 --- 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 @@ -17,17 +17,14 @@ 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.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer; -import java.util.concurrent.TimeoutException; -import javax.annotation.Nonnull; -import io.fd.vpp.jvpp.VppBaseCallException; 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 @@ -38,14 +35,9 @@ public class MapResolversDumpExecutor extends AbstractJvppDumpExecutor } @Override - public LispMapResolverDetailsReplyDump executeDump(final Void params) throws DumpExecutionFailedException { - try { - return getReply(vppApi.lispMapResolverDump(new LispMapResolverDump()).toCompletableFuture()); - } catch (TimeoutException e) { - throw DumpTimeoutException - .wrapTimeoutException("Map resolver dump execution ended in timeout", e); - } catch (VppBaseCallException e) { - throw DumpCallFailedException.wrapFailedCallException("Map resolver dump execution failed", e); - } + @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 index 8e68c143a..778ce5308 100755 --- 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 @@ -20,17 +20,14 @@ 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.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer; -import java.util.concurrent.TimeoutException; -import javax.annotation.Nonnull; -import io.fd.vpp.jvpp.VppBaseCallException; 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; /** @@ -45,8 +42,10 @@ public class MappingsDumpExecutor extends AbstractJvppDumpExecutor @Override - public LispEidTableDetailsReplyDump executeDump(final MappingsDumpParams params) - throws DumpExecutionFailedException { + @Nonnull + public LispEidTableDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, + final MappingsDumpParams params) + throws ReadFailedException { checkNotNull(params, "Params for dump request not present"); LispEidTableDump request = new LispEidTableDump(); @@ -57,14 +56,6 @@ public class MappingsDumpExecutor extends AbstractJvppDumpExecutor request.vni = params.getVni(); request.filter = params.getFilter(); - try { - return getReply(vppApi.lispEidTableDump(request).toCompletableFuture()); - } catch (TimeoutException e) { - throw DumpTimeoutException - .wrapTimeoutException("Mappings dump execution timed out with params " + params.toString(), e); - } catch (VppBaseCallException e) { - throw DumpCallFailedException - .wrapFailedCallException("Mappings dump execution failed with params " + params.toString(), e); - } + 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 index 722cbb182..e83b30327 100644 --- 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 @@ -19,19 +19,16 @@ 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.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer; -import java.util.concurrent.TimeoutException; -import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable; -import io.fd.vpp.jvpp.VppBaseCallException; 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.rev160520.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.vni.table.VrfSubtable; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** * Dump executor for {@link VrfSubtable}/{@link BridgeDomainSubtable} @@ -39,30 +36,18 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore; public final class SubtableDumpExecutor extends AbstractJvppDumpExecutor implements EntityDumpExecutor<LispEidTableMapDetailsReplyDump, SubtableDumpParams>, JvppReplyConsumer { - private SubtableDumpParams params; - private LispEidTableMapDump request; - public SubtableDumpExecutor(@Nonnull final FutureJVppCore vppApi) { super(vppApi); } @Override - public LispEidTableMapDetailsReplyDump executeDump(final SubtableDumpParams params) - throws DumpExecutionFailedException { - this.params = checkNotNull(params, "Cannot bind null params"); - + public LispEidTableMapDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, + final SubtableDumpParams params) + throws ReadFailedException { LispEidTableMapDump request = new LispEidTableMapDump(); - request.isL2 = params.isL2(); + request.isL2 = checkNotNull(params, "Cannot bind null params").isL2(); - try { - return getReply(vppApi.lispEidTableMapDump(request).toCompletableFuture()); - } catch (TimeoutException e) { - throw DumpTimeoutException - .wrapTimeoutException("Dumping subtable with params " + params + " timed out", e); - } catch (VppBaseCallException e) { - throw DumpCallFailedException - .wrapFailedCallException("Dumping subtable with params " + params + " timed out", e); - } + 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 index 6c9a21ef1..200d47c6f 100755 --- 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 @@ -17,17 +17,14 @@ 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.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer; -import io.fd.vpp.jvpp.VppBaseCallException; 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.concurrent.TimeoutException; import javax.annotation.Nonnull; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class VniTableDumpExecutor extends AbstractJvppDumpExecutor @@ -38,13 +35,8 @@ public class VniTableDumpExecutor extends AbstractJvppDumpExecutor } @Override - public LispEidTableVniDetailsReplyDump executeDump(Void params) throws DumpExecutionFailedException { - try { - return getReply(vppApi.lispEidTableVniDump(new LispEidTableVniDump()).toCompletableFuture()); - } catch (TimeoutException e) { - throw DumpTimeoutException.wrapTimeoutException("Eid table map dump ended in timeout", e); - } catch (VppBaseCallException e) { - throw DumpCallFailedException.wrapFailedCallException("Eid table map dump failed", e); - } + 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/trait/SubtableReader.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java index 7af6a7e90..658c4ddf8 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 @@ -26,12 +26,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.exceptions.execution.DumpExecutionFailedException; +import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.eid.table.grouping.eid.table.VniTable; import org.opendaylight.yangtools.yang.binding.ChildOf; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump; /** * Provides common logic for reading Eid subtables @@ -47,10 +46,6 @@ public interface SubtableReader { @Nonnull final ModificationCache cache, @Nonnull final InstanceIdentifier<? extends ChildOf<VniTable>> id, @Nonnull final SubtableDumpParams params) throws ReadFailedException { - try { - return dumpManager.getDump(cacheKey, cache, params); - } catch (DumpExecutionFailedException e) { - throw new ReadFailedException(id, e); - } + return dumpManager.getDump(id, cacheKey, cache, params); } } 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 d996b9aba..fb6126409 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 @@ -23,17 +23,21 @@ 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.translate.ModificationCache; +import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.translate.util.RWUtils; import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager; import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException; 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; +import io.fd.vpp.jvpp.VppBaseCallException; +import io.fd.vpp.jvpp.core.dto.LispAddDelLocatorSet; +import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump; +import io.fd.vpp.jvpp.core.future.FutureJVppCore; import java.io.UnsupportedEncodingException; import java.util.List; import java.util.concurrent.TimeoutException; @@ -42,10 +46,6 @@ 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.rev160520.locator.sets.grouping.locator.sets.LocatorSetKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.locator.set.Interface; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.VppBaseCallException; -import io.fd.vpp.jvpp.core.dto.LispAddDelLocatorSet; -import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump; -import io.fd.vpp.jvpp.core.future.FutureJVppCore; /** @@ -82,7 +82,7 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer "Creating empty locator-sets is not allowed"); // TODO VPP-323 check and fill mapping when api returns index of created locator set // checkState(!locatorSetContext.containsIndex(locatorSetName, writeContext.getMappingContext()), - // "Locator set with name %s allready defined", locatorSetName); + // "Locator set with name %s already defined", locatorSetName); try { addDelLocatorSetAndReply(true, dataAfter.getName()); @@ -93,9 +93,9 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer //TODO - REMOVE FROM MASTER AFTER VPP-323 try { locatorSetContext - .addName(getLocatorSetIndex(locatorSetName, writeContext.getModificationCache()), locatorSetName, - writeContext.getMappingContext()); - } catch (DumpExecutionFailedException e) { + .addName(getLocatorSetIndex(id, locatorSetName, writeContext.getModificationCache()), + locatorSetName, writeContext.getMappingContext()); + } catch (ReadFailedException e) { throw new WriteFailedException(id, new IllegalStateException("Unable to create mapping for locator set " + locatorSetName, e)); } @@ -148,11 +148,13 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer //TODO - REMOVE FROM MASTER AFTER VPP-323 // total hack - public int getLocatorSetIndex(final String name, final ModificationCache cache) - throws DumpExecutionFailedException { + public int getLocatorSetIndex(final InstanceIdentifier<LocatorSet> identifier, final String name, + final ModificationCache cache) + throws ReadFailedException { Optional<LispLocatorSetDetailsReplyDump> reply = dumpManager - .getDump(io.fd.honeycomb.lisp.translate.read.LocatorSetCustomizer.LOCATOR_SETS_CACHE_ID, cache, + .getDump(identifier, io.fd.honeycomb.lisp.translate.read.LocatorSetCustomizer.LOCATOR_SETS_CACHE_ID, + cache, EntityDumpExecutor.NO_PARAMS); if (reply.isPresent()) { diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java index 5902028fe..4334aea31 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.fail; import io.fd.honeycomb.lisp.translate.read.trait.SubtableReaderTestCase; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; import io.fd.honeycomb.translate.vpp.util.NamingContext; import io.fd.vpp.jvpp.VppCallbackException; import org.junit.Test; @@ -76,8 +75,7 @@ public class BridgeDomainSubtableCustomizerTest try { customizer.readCurrentAttributes(validId, builder, ctx); } catch (ReadFailedException e) { - assertTrue(e.getCause() instanceof DumpCallFailedException); - assertTrue(e.getCause().getCause() instanceof VppCallbackException); + assertTrue(e.getCause() instanceof VppCallbackException); assertNull(builder.getBridgeDomainRef()); verifyLispEidTableMapDumpNotCalled(); diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java index a1688ae35..1fd2a3c86 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java @@ -12,7 +12,6 @@ import static org.mockito.Mockito.when; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest; import io.fd.vpp.jvpp.VppCallbackException; import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocs; @@ -85,8 +84,7 @@ public class ItrRemoteLocatorSetCustomizerTest try { getCustomizer().readCurrentAttributes(validId, builder, ctx); } catch (ReadFailedException e) { - assertTrue(e.getCause() instanceof DumpCallFailedException); - assertTrue(e.getCause().getCause() instanceof VppCallbackException); + assertTrue(e.getCause() instanceof VppCallbackException); assertNotNull(builder); assertNull(builder.getRemoteLocatorSetName()); diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java index fe967e486..6ce9ea711 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java @@ -4,22 +4,18 @@ package io.fd.honeycomb.lisp.translate.read; 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.when; -import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.collect.ImmutableList; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest; 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.List; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -61,11 +57,11 @@ public class VniTableCustomizerTest extends ListReaderCustomizerTest<VniTable, V try { getCustomizer().getAllIds(validId, ctx); } catch (ReadFailedException e) { - assertTrue(e instanceof ReadFailedException); - assertTrue(e.getCause() instanceof DumpCallFailedException); - assertTrue(e.getCause().getCause() instanceof VppCallbackException); + assertTrue(e.getCause() instanceof VppCallbackException); + return; } + fail("Test should have thrown ReadFailedException"); } @Test @@ -99,13 +95,7 @@ public class VniTableCustomizerTest extends ListReaderCustomizerTest<VniTable, V private void whenLispEidTableVniDumpThrowException() { when(api.lispEidTableVniDump(Mockito.any())) - .thenReturn(new CompletableFuture<LispEidTableVniDetailsReplyDump>() { - @Override - public LispEidTableVniDetailsReplyDump get(final long l, final TimeUnit timeUnit) - throws InterruptedException, ExecutionException, TimeoutException { - throw new ExecutionException(new VppCallbackException("lispEidTableVniDump", 1, -2)); - } - }); + .thenReturn(failedFuture()); } @Override diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java index f18f349d8..955a5a01a 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.fail; import io.fd.honeycomb.lisp.translate.read.trait.SubtableReaderTestCase; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; import io.fd.vpp.jvpp.VppCallbackException; import org.junit.Before; import org.junit.Test; @@ -70,8 +69,7 @@ public class VrfSubtableCustomizerTest extends SubtableReaderTestCase<VrfSubtabl try { customizer.readCurrentAttributes(validId, builder, ctx); } catch (ReadFailedException e) { - assertTrue(e.getCause() instanceof DumpCallFailedException); - assertTrue(e.getCause().getCause() instanceof VppCallbackException); + assertTrue(e.getCause() instanceof VppCallbackException); assertTrue(builder.getTableId() == null); verifyLispEidTableMapDumpNotCalled(); 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 index 14c7c7002..f21b33353 100644 --- 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 @@ -12,19 +12,20 @@ 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.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; +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 io.fd.vpp.jvpp.core.dto.LispLocatorDetails; -import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump; -import io.fd.vpp.jvpp.core.dto.LispLocatorDump; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.LocatorSet; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class LocatorDumpExecutorTest extends JvppDumpExecutorTest<LocatorDumpExecutor> { @@ -32,10 +33,12 @@ public class LocatorDumpExecutorTest extends JvppDumpExecutorTest<LocatorDumpExe @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(); @@ -54,28 +57,36 @@ public class LocatorDumpExecutorTest extends JvppDumpExecutorTest<LocatorDumpExe public void testExecuteDumpTimeout() throws Exception { doThrowTimeoutExceptionWhen().lispLocatorDump(Mockito.any()); try { - getExecutor().executeDump(new LocatorDumpParamsBuilder().build()); + getExecutor().executeDump(identifier, new LocatorDumpParamsBuilder().build()); } catch (Exception e) { - assertTrue(e instanceof DumpTimeoutException); + assertTrue(e instanceof ReadFailedException); assertTrue(e.getCause() instanceof TimeoutException); + assertEquals(identifier, ((ReadFailedException) e).getFailedId()); return; } fail("Test should have thrown exception"); } - @Test(expected = DumpCallFailedException.class) - public void testExecuteDumpHalted() throws DumpExecutionFailedException { + @Test + public void testExecuteDumpHalted() throws ReadFailedException { doThrowFailExceptionWhen().lispLocatorDump(Mockito.any()); - getExecutor().executeDump(new LocatorDumpParamsBuilder().build()); + 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 DumpExecutionFailedException { + public void testExecuteDump() throws ReadFailedException { doReturnResponseWhen(validDump).lispLocatorDump(Mockito.any()); final LocatorDumpParams params = new LocatorDumpParamsBuilder().setLocatorSetIndex(5).build(); - final LispLocatorDetailsReplyDump reply = getExecutor().executeDump(params); + final LispLocatorDetailsReplyDump reply = getExecutor().executeDump(identifier, params); verify(api, times(1)).lispLocatorDump(requestCaptor.capture()); final LispLocatorDump request = requestCaptor.getValue(); 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 index 0a739b3a8..bb2779ee8 100644 --- 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 @@ -10,20 +10,20 @@ 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.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; 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 io.fd.vpp.jvpp.core.dto.LispLocatorSetDetails; -import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump; -import io.fd.vpp.jvpp.core.dto.LispLocatorSetDump; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.LocatorSet; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class LocatorSetsDumpExecutorTest extends JvppDumpExecutorTest<LocatorSetsDumpExecutor> { @@ -35,8 +35,11 @@ public class LocatorSetsDumpExecutorTest extends JvppDumpExecutorTest<LocatorSet @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; @@ -50,26 +53,27 @@ public class LocatorSetsDumpExecutorTest extends JvppDumpExecutorTest<LocatorSet public void testExecuteDumpTimeout() throws Exception { doThrowTimeoutExceptionWhen().lispLocatorSetDump(any()); try { - getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS); + getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS); } catch (Exception e) { - assertTrue(e instanceof DumpTimeoutException); + assertTrue(e instanceof ReadFailedException); assertTrue(e.getCause() instanceof TimeoutException); return; } fail("Test should have thrown exception"); } - @Test(expected = DumpCallFailedException.class) - public void testExecuteDumpHalted() throws DumpExecutionFailedException { + @Test(expected = ReadFailedException.class) + public void testExecuteDumpHalted() throws ReadFailedException { doThrowFailExceptionWhen().lispLocatorSetDump(any()); - getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS); + getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS); } @Test - public void testExecuteDump() throws DumpExecutionFailedException { + public void testExecuteDump() throws ReadFailedException { doReturnResponseWhen(validDump).lispLocatorSetDump(any()); - final LispLocatorSetDetailsReplyDump replyDump = getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS); + final LispLocatorSetDetailsReplyDump replyDump = + getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS); verify(api, times(1)).lispLocatorSetDump(requestCaptor.capture()); final LispLocatorSetDump request = requestCaptor.getValue(); 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 index 172a89d0a..50aa0391d 100644 --- 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 @@ -8,25 +8,29 @@ 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.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; 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 io.fd.vpp.jvpp.core.dto.LispMapResolverDetails; -import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.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; @@ -40,25 +44,33 @@ public class MapResolversDumpExecutorTest extends JvppDumpExecutorTest<MapResolv public void testExecuteDumpTimeout() throws Exception { doThrowTimeoutExceptionWhen().lispMapResolverDump(Mockito.any()); try { - getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS); - } catch (Exception e) { - assertTrue(e instanceof DumpTimeoutException); + 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 exception"); + fail("Test should have thrown ReadFailedException"); } - @Test(expected = DumpCallFailedException.class) - public void testExecuteDumpHalted() throws DumpExecutionFailedException { + @Test + public void testExecuteDumpHalted() throws ReadFailedException { doThrowFailExceptionWhen().lispMapResolverDump(Mockito.any()); - getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS); + 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 DumpExecutionFailedException { + public void testExecuteDump() throws ReadFailedException { doReturnResponseWhen(validDump).lispMapResolverDump(Mockito.any()); - final LispMapResolverDetailsReplyDump reply = getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS); + final LispMapResolverDetailsReplyDump reply = + getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS); assertNotNull(reply); assertEquals(1, reply.lispMapResolverDetails.size()); 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 index b58c0aebf..f25099baf 100644 --- 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 @@ -15,18 +15,19 @@ 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.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; +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 io.fd.vpp.jvpp.core.dto.LispEidTableDetails; -import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump; -import io.fd.vpp.jvpp.core.dto.LispEidTableDump; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.dp.subtable.grouping.local.mappings.LocalMapping; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class MappingsDumpExecutorTest extends JvppDumpExecutorTest<MappingsDumpExecutor> { @@ -35,12 +36,15 @@ public class MappingsDumpExecutorTest extends JvppDumpExecutorTest<MappingsDumpE @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(); @@ -67,25 +71,33 @@ public class MappingsDumpExecutorTest extends JvppDumpExecutorTest<MappingsDumpE public void testExecuteDumpTimeout() throws Exception { doThrowTimeoutExceptionWhen().lispEidTableDump(any()); try { - getExecutor().executeDump(emptyParams); + getExecutor().executeDump(identifier, emptyParams); } catch (Exception e) { - assertTrue(e instanceof DumpTimeoutException); + assertTrue(e instanceof ReadFailedException); assertTrue(e.getCause() instanceof TimeoutException); + assertEquals(identifier, ((ReadFailedException) e).getFailedId()); return; } fail("Test should have thrown exception"); } - @Test(expected = DumpCallFailedException.class) - public void testExecuteDumpHalted() throws DumpExecutionFailedException { + @Test + public void testExecuteDumpHalted() throws Exception { doThrowFailExceptionWhen().lispEidTableDump(any()); - getExecutor().executeDump(emptyParams); + 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 DumpExecutionFailedException { + public void testExecuteDump() throws ReadFailedException { doReturnResponseWhen(validDump).lispEidTableDump(any()); - final LispEidTableDetailsReplyDump reply = getExecutor().executeDump(validParams); + final LispEidTableDetailsReplyDump reply = getExecutor().executeDump(identifier, validParams); verify(api, times(1)).lispEidTableDump(requestCaptor.capture()); final LispEidTableDump request = requestCaptor.getValue(); 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 index b955609c5..48a327cbe 100644 --- 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 @@ -7,59 +7,66 @@ 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.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpCallFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.i.DumpTimeoutException; 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 io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails; -import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.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(expected = DumpCallFailedException.class) - public void testExecuteDumpFail() throws DumpExecutionFailedException { + @Test + public void testExecuteDumpFail() throws Exception { doThrowFailExceptionWhen().lispEidTableVniDump(Mockito.any()); - getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS); - } + 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(EntityDumpExecutor.NO_PARAMS); - } catch (Exception e) { - assertTrue(e instanceof DumpTimeoutException); + getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS); + } catch (ReadFailedException e) { assertTrue(e.getCause() instanceof TimeoutException); return; } - fail("Test should have thrown exception"); + fail("Test should have thrown ReadFailedException"); } @Test - public void testExecuteDump() throws DumpExecutionFailedException { + public void testExecuteDump() throws Exception { doReturnResponseWhen(validDump).lispEidTableVniDump(Mockito.any()); - final LispEidTableVniDetailsReplyDump reply = getExecutor().executeDump(EntityDumpExecutor.NO_PARAMS); + final LispEidTableVniDetailsReplyDump reply = + getExecutor().executeDump(identifier, EntityDumpExecutor.NO_PARAMS); assertNotNull(reply); assertEquals(1, reply.lispEidTableVniDetails.size()); |