diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2016-10-06 08:54:02 +0200 |
---|---|---|
committer | Jan Srnicek <jsrnicek@cisco.com> | 2016-10-06 08:54:02 +0200 |
commit | fb6666efe7b6009528e98702efc66e9118011174 (patch) | |
tree | e7dd2b205552c1a756f7f8410fc11536162db9aa /lisp/lisp2vpp/src/main | |
parent | cf15cfe3593ec4c02cdb1121649bf95d19814e0c (diff) |
HONEYCOMB-236 - Unified read/write exceptions
Change-Id: Idde761d0c0c2c4d96555ef94dbdaa87fad889493
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp/src/main')
16 files changed, 107 insertions, 241 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()) { |