summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-10-06 08:54:02 +0200
committerJan Srnicek <jsrnicek@cisco.com>2016-10-06 08:54:02 +0200
commit8c9c430823aa19912a55b0a6ccfcbbb6a1bc028d (patch)
tree1e5aa752236ada01009a353cf34eb6b7706e65fc
parent15f481bc86adfd879e0e0d001ef3dd0939aa3649 (diff)
HONEYCOMB-236 - Unified read/write exceptions
Change-Id: Idde761d0c0c2c4d96555ef94dbdaa87fad889493 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java27
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java14
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java19
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java24
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java17
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java27
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java19
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/ItrRemoteLocatorSetDumpExecutor.java21
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java24
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutor.java21
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutor.java22
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutor.java25
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/SubtableDumpExecutor.java35
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutor.java18
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java9
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java26
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java4
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java4
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java20
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java4
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutorTest.java37
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorSetsDumpExecutorTest.java30
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MapResolversDumpExecutorTest.java40
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/MappingsDumpExecutorTest.java38
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/dump/executor/VniTableDumpExecutorTest.java37
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizer.java39
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java40
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizer.java124
-rwxr-xr-xnsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java104
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizer.java31
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java72
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java33
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizer.java50
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizer.java37
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java29
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java38
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizer.java67
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java58
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizer.java31
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizer.java32
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AbstractAceWriter.java7
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceWriter.java3
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclCustomizer.java27
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclWriter.java4
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAClWriter.java36
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizer.java11
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizer.java35
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizer.java15
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java48
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java30
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Writer.java11
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java43
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizer.java100
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java36
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizer.java132
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslator.java51
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java85
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizer.java83
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizer.java113
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizer.java113
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizer.java119
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizer.java23
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizer.java23
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java27
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java26
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/AddressDumpExecutor.java22
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java33
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java63
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java35
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java30
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReader.java101
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java14
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java24
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java26
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java4
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java29
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java4
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java12
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java26
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java16
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java12
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java26
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java20
-rw-r--r--vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/JvppDumpExecutorTest.java8
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumer.java111
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/cache/DumpCacheManagerTest.java31
86 files changed, 1396 insertions, 1799 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());
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizer.java
index efd1c6a95..795e8b9ad 100755
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizer.java
+++ b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshEntryWriterCustomizer.java
@@ -24,10 +24,12 @@ import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vppnsh.impl.util.FutureJVppNshCustomizer;
+import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntry;
+import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntryReply;
+import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Ethernet;
@@ -38,10 +40,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.entries.NshEntryKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntry;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntryReply;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,16 +63,11 @@ public class NshEntryWriterCustomizer extends FutureJVppNshCustomizer
@Nonnull final NshEntry dataAfter, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
LOG.debug("Creating nsh entry: iid={} dataAfter={}", id, dataAfter);
- try {
- final int newEntryIndex =
- nshAddDelEntry(true, id, dataAfter, ~0 /* value not present */, writeContext.getMappingContext());
-
- // Add nsh entry name <-> vpp index mapping to the naming context:
- nshEntryContext.addName(newEntryIndex, dataAfter.getName(), writeContext.getMappingContext());
- LOG.debug("Successfully created nsh entry(id={]): iid={} dataAfter={}", newEntryIndex, id, dataAfter);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ final int newEntryIndex =
+ nshAddDelEntry(true, id, dataAfter, ~0 /* value not present */, writeContext.getMappingContext());
+ // Add nsh entry name <-> vpp index mapping to the naming context:
+ nshEntryContext.addName(newEntryIndex, dataAfter.getName(), writeContext.getMappingContext());
+ LOG.debug("Successfully created nsh entry(id={]): iid={} dataAfter={}", newEntryIndex, id, dataAfter);
}
@Override
@@ -94,20 +87,16 @@ public class NshEntryWriterCustomizer extends FutureJVppNshCustomizer
"Removing nsh entry {}, but index could not be found in the nsh entry context", entryName);
final int entryIndex = nshEntryContext.getIndex(entryName, writeContext.getMappingContext());
- try {
- nshAddDelEntry(false, id, dataBefore, entryIndex, writeContext.getMappingContext());
-
- // Remove deleted interface from interface context:
- nshEntryContext.removeName(dataBefore.getName(), writeContext.getMappingContext());
- LOG.debug("Successfully removed nsh entry(id={]): iid={} dataAfter={}", entryIndex, id, dataBefore);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ nshAddDelEntry(false, id, dataBefore, entryIndex, writeContext.getMappingContext());
+
+ // Remove deleted interface from interface context:
+ nshEntryContext.removeName(dataBefore.getName(), writeContext.getMappingContext());
+ LOG.debug("Successfully removed nsh entry(id={]): iid={} dataAfter={}", entryIndex, id, dataBefore);
}
private int nshAddDelEntry(final boolean isAdd, @Nonnull final InstanceIdentifier<NshEntry> id,
@Nonnull final NshEntry entry, final int entryId, final MappingContext ctx)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final CompletionStage<NshAddDelEntryReply> createNshEntryReplyCompletionStage =
getFutureJVppNsh().nshAddDelEntry(getNshAddDelEntryRequest(isAdd, entryId, entry, ctx));
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java
index 3f2fb52c1..7ca208110 100755
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java
+++ b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java
@@ -24,20 +24,18 @@ import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vppnsh.impl.util.FutureJVppNshCustomizer;
+import io.fd.vpp.jvpp.nsh.dto.NshAddDelMap;
+import io.fd.vpp.jvpp.nsh.dto.NshAddDelMapReply;
+import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VxlanGpe;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMapKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelMap;
-import io.fd.vpp.jvpp.nsh.dto.NshAddDelMapReply;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,16 +62,12 @@ public class NshMapWriterCustomizer extends FutureJVppNshCustomizer
@Nonnull final NshMap dataAfter, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
LOG.debug("Creating nsh map: iid={} dataAfter={}", id, dataAfter);
- try {
- final int newMapIndex =
- nshAddDelMap(true, id, dataAfter, ~0 /* value not present */, writeContext.getMappingContext());
-
- // Add nsh map name <-> vpp index mapping to the naming context:
- nshMapContext.addName(newMapIndex, dataAfter.getName(), writeContext.getMappingContext());
- LOG.debug("Successfully created nsh map(id={]): iid={} dataAfter={}", newMapIndex, id, dataAfter);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ final int newMapIndex =
+ nshAddDelMap(true, id, dataAfter, ~0 /* value not present */, writeContext.getMappingContext());
+
+ // Add nsh map name <-> vpp index mapping to the naming context:
+ nshMapContext.addName(newMapIndex, dataAfter.getName(), writeContext.getMappingContext());
+ LOG.debug("Successfully created nsh map(id={]): iid={} dataAfter={}", newMapIndex, id, dataAfter);
}
@Override
@@ -93,20 +87,16 @@ public class NshMapWriterCustomizer extends FutureJVppNshCustomizer
"Removing nsh map {}, but index could not be found in the nsh map context", mapName);
final int mapIndex = nshMapContext.getIndex(mapName, writeContext.getMappingContext());
- try {
- nshAddDelMap(false, id, dataBefore, mapIndex, writeContext.getMappingContext());
-
- // Remove deleted interface from interface context:
- nshMapContext.removeName(dataBefore.getName(), writeContext.getMappingContext());
- LOG.debug("Successfully removed nsh map(id={]): iid={} dataAfter={}", mapIndex, id, dataBefore);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ nshAddDelMap(false, id, dataBefore, mapIndex, writeContext.getMappingContext());
+
+ // Remove deleted interface from interface context:
+ nshMapContext.removeName(dataBefore.getName(), writeContext.getMappingContext());
+ LOG.debug("Successfully removed nsh map(id={]): iid={} dataAfter={}", mapIndex, id, dataBefore);
}
private int nshAddDelMap(final boolean isAdd, @Nonnull final InstanceIdentifier<NshMap> id,
@Nonnull final NshMap map, final int mapId, final MappingContext ctx)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final CompletionStage<NshAddDelMapReply> createNshMapReplyCompletionStage =
getFutureJVppNsh().nshAddDelMap(getNshAddDelMapRequest(isAdd, mapId, map, ctx));
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizer.java
index 7f5b77488..186db26ff 100755
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizer.java
+++ b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizer.java
@@ -25,6 +25,10 @@ import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.vppnsh.impl.util.FutureJVppNshCustomizer;
+import io.fd.vpp.jvpp.nsh.dto.NshEntryDetails;
+import io.fd.vpp.jvpp.nsh.dto.NshEntryDetailsReplyDump;
+import io.fd.vpp.jvpp.nsh.dto.NshEntryDump;
+import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -43,11 +47,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.
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.VppBaseCallException;
-import io.fd.vpp.jvpp.nsh.dto.NshEntryDetails;
-import io.fd.vpp.jvpp.nsh.dto.NshEntryDetailsReplyDump;
-import io.fd.vpp.jvpp.nsh.dto.NshEntryDump;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -95,75 +94,70 @@ public class NshEntryReaderCustomizer extends FutureJVppNshCustomizer
@Nonnull final NshEntryBuilder builder, @Nonnull final ReadContext ctx)
throws ReadFailedException {
LOG.debug("Reading attributes for nsh entry: {}", id);
- try {
- final NshEntryKey key = id.firstKeyOf(NshEntry.class);
- checkArgument(key != null, "could not find NshEntry key in {}", id);
- final NshEntryDump request = new NshEntryDump();
+ final NshEntryKey key = id.firstKeyOf(NshEntry.class);
+ checkArgument(key != null, "could not find NshEntry key in {}", id);
+ final NshEntryDump request = new NshEntryDump();
- final String entryName = key.getName();
- if (!nshEntryContext.containsIndex(entryName, ctx.getMappingContext())) {
- LOG.debug("Could not find nsh entry {} in the naming context", entryName);
- return;
- }
- request.entryIndex = nshEntryContext.getIndex(entryName, ctx.getMappingContext());
+ final String entryName = key.getName();
+ if (!nshEntryContext.containsIndex(entryName, ctx.getMappingContext())) {
+ LOG.debug("Could not find nsh entry {} in the naming context", entryName);
+ return;
+ }
+ request.entryIndex = nshEntryContext.getIndex(entryName, ctx.getMappingContext());
- final CompletionStage<NshEntryDetailsReplyDump> nshEntryDetailsReplyDumpCompletionStage =
- getFutureJVppNsh().nshEntryDump(request);
- final NshEntryDetailsReplyDump reply =
- getReplyForRead(nshEntryDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
+ final CompletionStage<NshEntryDetailsReplyDump> nshEntryDetailsReplyDumpCompletionStage =
+ getFutureJVppNsh().nshEntryDump(request);
+ final NshEntryDetailsReplyDump reply =
+ getReplyForRead(nshEntryDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
- if (reply == null || reply.nshEntryDetails == null || reply.nshEntryDetails.isEmpty()) {
- LOG.debug("Has no Nsh Entry {} in VPP. ", key.getName());
+ if (reply == null || reply.nshEntryDetails == null || reply.nshEntryDetails.isEmpty()) {
+ LOG.debug("Has no Nsh Entry {} in VPP. ", key.getName());
+ return;
+ }
+
+ LOG.trace("Nsh Entry : {} attributes returned from VPP: {}", key.getName(), reply);
+
+ final NshEntryDetails nshEntryDetails = reply.nshEntryDetails.get(0);
+ builder.setName(entryName);
+ builder.setKey(key);
+ builder.setVersion((short) nshEntryDetails.verOC);
+ builder.setLength((short) nshEntryDetails.length);
+
+ switch (nshEntryDetails.nextProtocol) {
+ case 1:
+ builder.setNextProtocol(Ipv4.class);
+ break;
+ case 2:
+ builder.setNextProtocol(Ipv6.class);
+ break;
+ case 3:
+ builder.setNextProtocol(Ethernet.class);
+ break;
+ default:
+ LOG.trace("Unsupported next protocol for nsh entry: {}", nshEntryDetails.nextProtocol);
return;
- }
+ }
- LOG.trace("Nsh Entry : {} attributes returned from VPP: {}", key.getName(), reply);
-
- final NshEntryDetails nshEntryDetails = reply.nshEntryDetails.get(0);
- builder.setName(entryName);
- builder.setKey(key);
- builder.setVersion((short) nshEntryDetails.verOC);
- builder.setLength((short) nshEntryDetails.length);
-
- switch (nshEntryDetails.nextProtocol) {
- case 1:
- builder.setNextProtocol(Ipv4.class);
- break;
- case 2:
- builder.setNextProtocol(Ipv6.class);
- break;
- case 3:
- builder.setNextProtocol(Ethernet.class);
- break;
- default:
- LOG.trace("Unsupported next protocol for nsh entry: {}", nshEntryDetails.nextProtocol);
- return;
+ switch (nshEntryDetails.mdType) {
+ case 1: {
+ builder.setMdType(MdType1.class);
+ setNshEntryMdType1Augment(builder, nshEntryDetails);
+ break;
}
-
- switch (nshEntryDetails.mdType) {
- case 1: {
- builder.setMdType(MdType1.class);
- setNshEntryMdType1Augment(builder, nshEntryDetails);
- break;
- }
- case 2: {
- builder.setMdType(MdType1.class);
- break;
- }
- default:
- LOG.trace("Unsupported Mdtype for nsh entry: {}", nshEntryDetails.mdType);
- return;
+ case 2: {
+ builder.setMdType(MdType1.class);
+ break;
}
+ default:
+ LOG.trace("Unsupported Mdtype for nsh entry: {}", nshEntryDetails.mdType);
+ return;
+ }
- builder.setNsp((long) ((nshEntryDetails.nspNsi >> 8) & 0xFFFFFF));
- builder.setNsi((short) (nshEntryDetails.nspNsi & 0xFF));
+ builder.setNsp((long) ((nshEntryDetails.nspNsi >> 8) & 0xFFFFFF));
+ builder.setNsi((short) (nshEntryDetails.nspNsi & 0xFF));
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for nsh entry {} successfully read: {}", id, builder.build());
- }
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to readCurrentAttributes for: {}", id);
- throw new ReadFailedException(id, e);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Attributes for nsh entry {} successfully read: {}", id, builder.build());
}
}
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java
index 4a3d23b38..47c408d2c 100755
--- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java
+++ b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java
@@ -26,6 +26,10 @@ import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.vppnsh.impl.util.FutureJVppNshCustomizer;
+import io.fd.vpp.jvpp.nsh.dto.NshMapDetails;
+import io.fd.vpp.jvpp.nsh.dto.NshMapDetailsReplyDump;
+import io.fd.vpp.jvpp.nsh.dto.NshMapDump;
+import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -39,11 +43,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.
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.VppBaseCallException;
-import io.fd.vpp.jvpp.nsh.dto.NshMapDetails;
-import io.fd.vpp.jvpp.nsh.dto.NshMapDetailsReplyDump;
-import io.fd.vpp.jvpp.nsh.dto.NshMapDump;
-import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,60 +82,55 @@ public class NshMapReaderCustomizer extends FutureJVppNshCustomizer
@Nonnull final NshMapBuilder builder, @Nonnull final ReadContext ctx)
throws ReadFailedException {
LOG.debug("Reading attributes for nsh map: {}", id);
- try {
- final NshMapKey key = id.firstKeyOf(NshMap.class);
- checkArgument(key != null, "could not find NshMap key in {}", id);
- final NshMapDump request = new NshMapDump();
+ final NshMapKey key = id.firstKeyOf(NshMap.class);
+ checkArgument(key != null, "could not find NshMap key in {}", id);
+ final NshMapDump request = new NshMapDump();
- final String mapName = key.getName();
- if (!nshMapContext.containsIndex(mapName, ctx.getMappingContext())) {
- LOG.debug("Could not find nsh map {} in the naming context", mapName);
- return;
- }
- request.mapIndex = nshMapContext.getIndex(mapName, ctx.getMappingContext());
+ final String mapName = key.getName();
+ if (!nshMapContext.containsIndex(mapName, ctx.getMappingContext())) {
+ LOG.debug("Could not find nsh map {} in the naming context", mapName);
+ return;
+ }
+ request.mapIndex = nshMapContext.getIndex(mapName, ctx.getMappingContext());
+
+ final CompletionStage<NshMapDetailsReplyDump> nshMapDetailsReplyDumpCompletionStage =
+ getFutureJVppNsh().nshMapDump(request);
+ final NshMapDetailsReplyDump reply =
+ getReplyForRead(nshMapDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
+
+ if (reply == null || reply.nshMapDetails == null || reply.nshMapDetails.isEmpty()) {
+ LOG.debug("Has no Nsh Map {} in VPP. ", key.getName());
+ return;
+ }
+
+ LOG.trace("Nsh Map : {} attributes returned from VPP: {}", key.getName(), reply);
- final CompletionStage<NshMapDetailsReplyDump> nshMapDetailsReplyDumpCompletionStage =
- getFutureJVppNsh().nshMapDump(request);
- final NshMapDetailsReplyDump reply =
- getReplyForRead(nshMapDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
+ final NshMapDetails nshMapDetails = reply.nshMapDetails.get(0);
+ builder.setName(mapName);
+ builder.setKey(key);
- if (reply == null || reply.nshMapDetails == null || reply.nshMapDetails.isEmpty()) {
- LOG.debug("Has no Nsh Map {} in VPP. ", key.getName());
+ builder.setNsp((long) ((nshMapDetails.nspNsi >> 8) & 0xFFFFFF));
+ builder.setNsi((short) (nshMapDetails.nspNsi & 0xFF));
+
+ builder.setMappedNsp((long) ((nshMapDetails.mappedNspNsi >> 8) & 0xFFFFFF));
+ builder.setMappedNsi((short) (nshMapDetails.mappedNspNsi & 0xFF));
+
+ switch (nshMapDetails.nextNode) {
+ case 2:
+ builder.setEncapType(VxlanGpe.class);
+ break;
+ default:
+ LOG.trace("Unsupported encap type for nsh map: {}", nshMapDetails.nextNode);
return;
- }
-
- LOG.trace("Nsh Map : {} attributes returned from VPP: {}", key.getName(), reply);
-
- final NshMapDetails nshMapDetails = reply.nshMapDetails.get(0);
- builder.setName(mapName);
- builder.setKey(key);
-
- builder.setNsp((long) ((nshMapDetails.nspNsi >> 8) & 0xFFFFFF));
- builder.setNsi((short) (nshMapDetails.nspNsi & 0xFF));
-
- builder.setMappedNsp((long) ((nshMapDetails.mappedNspNsi >> 8) & 0xFFFFFF));
- builder.setMappedNsi((short) (nshMapDetails.mappedNspNsi & 0xFF));
-
- switch (nshMapDetails.nextNode) {
- case 2:
- builder.setEncapType(VxlanGpe.class);
- break;
- default:
- LOG.trace("Unsupported encap type for nsh map: {}", nshMapDetails.nextNode);
- return;
- }
-
- checkState(interfaceContext.containsName(nshMapDetails.swIfIndex, ctx.getMappingContext()),
- "Mapping does not contains mapping for provider interface Index ");
- final String interfaceName = interfaceContext.getName(nshMapDetails.swIfIndex, ctx.getMappingContext());
- builder.setEncapIfName(interfaceName);
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for nsh map {} successfully read: {}", id, builder.build());
- }
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to readCurrentAttributes for: {}", id);
- throw new ReadFailedException(id, e);
+ }
+
+ checkState(interfaceContext.containsName(nshMapDetails.swIfIndex, ctx.getMappingContext()),
+ "Mapping does not contains mapping for provider interface Index ");
+ final String interfaceName = interfaceContext.getName(nshMapDetails.swIfIndex, ctx.getMappingContext());
+ builder.setEncapIfName(interfaceName);
+
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Attributes for nsh map {} successfully read: {}", id, builder.build());
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizer.java
index 82152cecf..8911d1e0c 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizer.java
@@ -22,9 +22,11 @@ import com.google.common.net.InetAddresses;
import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.GreAddDelTunnel;
+import io.fd.vpp.jvpp.core.dto.GreAddDelTunnelReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.net.InetAddress;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
@@ -34,10 +36,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.GreTunnel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Gre;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.GreAddDelTunnel;
-import io.fd.vpp.jvpp.core.dto.GreAddDelTunnelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,12 +70,8 @@ public class GreCustomizer extends AbstractInterfaceTypeCustomizer<Gre> implemen
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
- try {
- createGreTunnel(id, swIfName, dataAfter, writeContext);
- } catch (VppBaseCallException | IllegalInterfaceTypeException e) {
- LOG.warn("Failed to set gre tunnel for interface: {}, gre: {}", swIfName, dataAfter, e);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+
+ createGreTunnel(id, swIfName, dataAfter, writeContext);
}
@Override
@@ -93,16 +87,11 @@ public class GreCustomizer extends AbstractInterfaceTypeCustomizer<Gre> implemen
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
- try {
- deleteGreTunnel(id, swIfName, dataBefore, writeContext);
- } catch (VppBaseCallException e) {
- LOG.debug("Failed to delete gre tunnel for interface: {}, gre: {}", swIfName, dataBefore);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ deleteGreTunnel(id, swIfName, dataBefore, writeContext);
}
private void createGreTunnel(final InstanceIdentifier<Gre> id, final String swIfName, final Gre gre,
- final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext) throws WriteFailedException {
final byte isIpv6 = (byte) (isIpv6(gre)
? 1
: 0);
@@ -117,7 +106,7 @@ public class GreCustomizer extends AbstractInterfaceTypeCustomizer<Gre> implemen
dstAddress.getAddress(), outerFibId, isIpv6));
final GreAddDelTunnelReply reply =
- getReplyForWrite(greAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
+ getReplyForCreate(greAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, gre);
LOG.debug("Gre tunnel set successfully for: {}, gre: {}", swIfName, gre);
if (interfaceContext.containsName(reply.swIfIndex, writeContext.getMappingContext())) {
// VPP keeps gre tunnels present even after they are delete(reserving ID for next tunnel)
@@ -155,7 +144,7 @@ public class GreCustomizer extends AbstractInterfaceTypeCustomizer<Gre> implemen
}
private void deleteGreTunnel(final InstanceIdentifier<Gre> id, final String swIfName, final Gre gre,
- final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext) throws WriteFailedException {
final byte isIpv6 = (byte) (isIpv6(gre)
? 1
: 0);
@@ -169,7 +158,7 @@ public class GreCustomizer extends AbstractInterfaceTypeCustomizer<Gre> implemen
getFutureJVpp().greAddDelTunnel(getGreTunnelRequest((byte) 0 /* is add */, srcAddress.getAddress(),
dstAddress.getAddress(), outerFibId, isIpv6));
- getReplyForWrite(greAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
+ getReplyForDelete(greAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
LOG.debug("Gre tunnel deleted successfully for: {}, gre: {}", swIfName, gre);
// Remove interface from our interface context
interfaceContext.removeName(swIfName, writeContext.getMappingContext());
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java
index 38e8554b1..ac5526861 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java
@@ -21,9 +21,13 @@ import static java.util.Objects.requireNonNull;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2Bridge;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2BridgeReply;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2Xconnect;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2XconnectReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.base.attributes.Interconnection;
@@ -31,12 +35,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.base.attributes.interconnection.XconnectBased;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2Bridge;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2BridgeReply;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2Xconnect;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetL2XconnectReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,51 +60,40 @@ final class InterconnectionWriteUtils implements JvppReplyConsumer {
void setInterconnection(final InstanceIdentifier<? extends DataObject> id, final int swIfIndex,
final String ifcName, final Interconnection ic, final WriteContext writeContext)
throws WriteFailedException {
- try {
- if (ic == null) { // TODO in case of update we should delete interconnection
- LOG.trace("Interconnection is not set. Skipping");
- } else if (ic instanceof XconnectBased) {
- setXconnectBasedL2(id, swIfIndex, ifcName, (XconnectBased) ic, writeContext, (byte) 1 /*enable*/);
- } else if (ic instanceof BridgeBased) {
- setBridgeBasedL2(id, swIfIndex, ifcName, (BridgeBased) ic, writeContext, (byte) 1 /*enable*/);
- } else {
- // Choices&cases are not data objects, so they cannot have a dedicated Reader/Writer
- // This choice is already from augment, so its not possible to augment augmented choice
- LOG.error("Unable to handle Interconnection of type {}", ic.getClass());
- throw new WriteFailedException(id, "Unable to handle Interconnection of type " + ic.getClass());
- }
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to update bridge/xconnect based interconnection flags for: {}, interconnection: {}",
- ifcName, ic);
- throw new WriteFailedException(id, "Unable to handle Interconnection of type " + ic.getClass(), e);
+
+ if (ic == null) { // TODO in case of update we should delete interconnection
+ LOG.trace("Interconnection is not set. Skipping");
+ } else if (ic instanceof XconnectBased) {
+ setXconnectBasedL2(id, swIfIndex, ifcName, (XconnectBased) ic, writeContext, (byte) 1 /*enable*/);
+ } else if (ic instanceof BridgeBased) {
+ setBridgeBasedL2(id, swIfIndex, ifcName, (BridgeBased) ic, writeContext, (byte) 1 /*enable*/);
+ } else {
+ // Choices&cases are not data objects, so they cannot have a dedicated Reader/Writer
+ // This choice is already from augment, so its not possible to augment augmented choice
+ LOG.error("Unable to handle Interconnection of type {}", ic.getClass());
+ throw new WriteFailedException(id, "Unable to handle Interconnection of type " + ic.getClass());
}
}
void deleteInterconnection(final InstanceIdentifier<? extends DataObject> id, final int swIfIndex,
final String ifcName, final Interconnection ic, final WriteContext writeContext)
throws WriteFailedException {
- try {
- if (ic == null) { // TODO in case of update we should delete interconnection
- LOG.trace("Interconnection is not set. Skipping");
- } else if (ic instanceof XconnectBased) {
- setXconnectBasedL2(id, swIfIndex, ifcName, (XconnectBased) ic, writeContext, (byte) 0 /*disable*/);
- } else if (ic instanceof BridgeBased) {
- setBridgeBasedL2(id, swIfIndex, ifcName, (BridgeBased) ic, writeContext, (byte) 0 /*disable*/);
- } else {
- LOG.error("Unable to delete Interconnection of type {}", ic.getClass());
- throw new WriteFailedException(id, "Unable to delete Interconnection of type " + ic.getClass());
- }
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to delete bridge/xconnect based interconnection flags for: {}, interconnection: {}",
- ifcName, ic);
- throw new WriteFailedException(id, "Unable to delete Interconnection of type " + ic.getClass(), e);
+
+ if (ic == null) { // TODO in case of update we should delete interconnection
+ LOG.trace("Interconnection is not set. Skipping");
+ } else if (ic instanceof XconnectBased) {
+ setXconnectBasedL2(id, swIfIndex, ifcName, (XconnectBased) ic, writeContext, (byte) 0 /*disable*/);
+ } else if (ic instanceof BridgeBased) {
+ setBridgeBasedL2(id, swIfIndex, ifcName, (BridgeBased) ic, writeContext, (byte) 0 /*disable*/);
+ } else {
+ LOG.error("Unable to delete Interconnection of type {}", ic.getClass());
+ throw new WriteFailedException(id, "Unable to delete Interconnection of type " + ic.getClass());
}
}
private void setBridgeBasedL2(final InstanceIdentifier<? extends DataObject> id, final int swIfIndex,
final String ifcName, final BridgeBased bb,
- final WriteContext writeContext, final byte enabled)
- throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext, final byte enabled) throws WriteFailedException {
LOG.debug("Setting bridge based interconnection(bridge-domain={}) for interface: {}", bb.getBridgeDomain(),
ifcName);
@@ -144,8 +131,7 @@ final class InterconnectionWriteUtils implements JvppReplyConsumer {
private void setXconnectBasedL2(final InstanceIdentifier<? extends DataObject> id, final int swIfIndex,
final String ifcName, final XconnectBased ic,
- final WriteContext writeContext, final byte enabled)
- throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext, final byte enabled) throws WriteFailedException {
String outSwIfName = ic.getXconnectOutgoingInterface();
LOG.debug("Setting xconnect based interconnection(outgoing ifc={}) for interface: {}", outSwIfName, ifcName);
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java
index 8c4f5080c..17b48f628 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java
@@ -20,18 +20,16 @@ import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
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.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,12 +53,7 @@ public class InterfaceCustomizer extends FutureJVppCustomizer
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
- try {
- setInterface(id, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Update of VppInterfaceAugment failed", e);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ setInterface(id, dataAfter, writeContext);
}
@Override
@@ -69,13 +62,7 @@ public class InterfaceCustomizer extends FutureJVppCustomizer
@Nonnull final Interface dataAfter,
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
-
- try {
- updateInterface(id, dataBefore, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Update of VppInterfaceAugment failed", e);
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
+ updateInterface(id, dataBefore, dataAfter, writeContext);
}
@Override
@@ -86,15 +73,14 @@ public class InterfaceCustomizer extends FutureJVppCustomizer
}
private void setInterface(final InstanceIdentifier<Interface> id, final Interface swIf,
- final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext) throws WriteFailedException {
LOG.debug("Setting interface: {} to: {}", id, swIf);
setInterfaceAttributes(id, swIf, swIf.getName(), writeContext);
}
private void setInterfaceAttributes(final InstanceIdentifier<Interface> id, final Interface swIf,
final String swIfName, final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
setInterfaceFlags(id, swIfName, interfaceContext.getIndex(swIfName, writeContext.getMappingContext()),
swIf.isEnabled()
@@ -105,14 +91,13 @@ public class InterfaceCustomizer extends FutureJVppCustomizer
private void updateInterface(final InstanceIdentifier<Interface> id,
final Interface dataBefore,
final Interface dataAfter, final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
LOG.debug("Updating interface:{} to: {}", id, dataAfter);
setInterfaceAttributes(id, dataAfter, dataAfter.getName(), writeContext);
}
private void setInterfaceFlags(final InstanceIdentifier<Interface> id, final String swIfName, final int swIfIndex,
- final byte enabled)
- throws VppBaseCallException, WriteTimeoutException {
+ final byte enabled) throws WriteFailedException {
final CompletionStage<SwInterfaceSetFlagsReply> swInterfaceSetFlagsReplyFuture =
getFutureJVpp().swInterfaceSetFlags(
getSwInterfaceSetFlagsInput(swIfIndex, enabled, (byte) 0 /* deleted */));
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizer.java
index fd118a9c6..3cd1eb99c 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ProxyArpCustomizer.java
@@ -22,17 +22,16 @@ import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.ProxyArpAddDel;
+import io.fd.vpp.jvpp.core.dto.ProxyArpAddDelReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.net.InetAddress;
-import java.util.concurrent.CompletionStage;
+import java.util.concurrent.Future;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.ProxyArp;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ProxyArpAddDel;
-import io.fd.vpp.jvpp.core.dto.ProxyArpAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,13 +47,7 @@ public class ProxyArpCustomizer extends FutureJVppCustomizer implements WriterCu
public void writeCurrentAttributes(@Nonnull InstanceIdentifier<ProxyArp> id, @Nonnull ProxyArp dataAfter,
@Nonnull WriteContext writeContext) throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
-
- try {
- setProxyArp(id, swIfName, dataAfter, (byte) 1 /* 1 is add */);
- } catch (VppBaseCallException e) {
- LOG.error("Failed to set Proxy ARP settings: {}, for interface: {}", dataAfter, swIfName);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ createProxyArp(getProxyArpRequestFuture(id, swIfName, dataAfter, (byte) 1 /* 1 is add */), id, dataAfter);
}
@Override
@@ -70,27 +63,32 @@ public class ProxyArpCustomizer extends FutureJVppCustomizer implements WriterCu
@Nonnull WriteContext writeContext) throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
- try {
- setProxyArp(id, swIfName, dataBefore, (byte) 0 /* 0 is delete */);
- } catch (VppBaseCallException e) {
- LOG.debug("Failed to delete Proxy ARP settings: {}, for interface: {}", dataBefore, swIfName);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ deleteProxyArp(getProxyArpRequestFuture(id, swIfName, dataBefore, (byte) 0 /* 0 is delete */), id);
}
- private void setProxyArp(InstanceIdentifier<ProxyArp> id, String swIfName, ProxyArp proxyArp, byte operation)
- throws VppBaseCallException, WriteFailedException {
+ private Future<ProxyArpAddDelReply> getProxyArpRequestFuture(InstanceIdentifier<ProxyArp> id, String swIfName,
+ ProxyArp proxyArp, byte operation)
+ throws WriteFailedException {
LOG.debug("Setting Proxy ARP settings for interface: {}", swIfName);
final InetAddress srcAddress = InetAddresses.forString(getv4AddressString(proxyArp.getLowAddr()));
final InetAddress dstAddress = InetAddresses.forString(getv4AddressString(proxyArp.getHighAddr()));
final int vrfId = proxyArp.getVrfId().intValue();
- final CompletionStage<ProxyArpAddDelReply> proxyArpAddDelReplyCompletionStage =
- getFutureJVpp().proxyArpAddDel(getProxyArpConfRequest(operation, srcAddress.getAddress(),
- dstAddress.getAddress(), vrfId));
+ return getFutureJVpp().proxyArpAddDel(
+ getProxyArpConfRequest(operation, srcAddress.getAddress(), dstAddress.getAddress(), vrfId))
+ .toCompletableFuture();
+ }
+
+ private void createProxyArp(final Future<ProxyArpAddDelReply> future, final InstanceIdentifier<ProxyArp> identifier,
+ final ProxyArp data)
+ throws WriteFailedException {
+ final ProxyArpAddDelReply reply = getReplyForCreate(future, identifier, data);
+ LOG.debug("Proxy ARP setting create successful, with reply context:", reply.context);
+ }
- final ProxyArpAddDelReply reply =
- getReplyForWrite(proxyArpAddDelReplyCompletionStage.toCompletableFuture(), id);
- LOG.debug("Proxy ARP setting applied, with reply context:", reply.context);
+ private void deleteProxyArp(final Future<ProxyArpAddDelReply> future, final InstanceIdentifier<ProxyArp> identifier)
+ throws WriteFailedException {
+ final ProxyArpAddDelReply reply = getReplyForDelete(future, identifier);
+ LOG.debug("Proxy ARP setting delete successful, with reply context:", reply.context);
}
private static ProxyArpAddDel getProxyArpConfRequest(final byte isAdd, final byte[] lAddr, final byte[] hAddr,
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizer.java
index 0156129d8..f6d007618 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizer.java
@@ -24,9 +24,11 @@ import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
import io.fd.honeycomb.translate.vpp.util.TagRewriteOperation;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewrite;
+import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewriteReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.List;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
@@ -37,10 +39,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.l2.RewriteBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.tag.rewrite.PushTags;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewrite;
-import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewriteReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,12 +63,7 @@ public class RewriteCustomizer extends FutureJVppCustomizer
final WriteContext writeContext)
throws WriteFailedException {
final String subifName = getSubInterfaceName(id);
- try {
- setTagRewrite(id, subifName, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to write interface {}(id=): {}", subifName, writeContext, dataAfter);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ setTagRewrite(id, subifName, dataAfter, writeContext);
}
private static String getSubInterfaceName(final InstanceIdentifier<Rewrite> id) {
@@ -79,8 +72,7 @@ public class RewriteCustomizer extends FutureJVppCustomizer
}
private void setTagRewrite(final InstanceIdentifier<Rewrite> id, final String ifname, final Rewrite rewrite,
- final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext) throws WriteFailedException {
final int swIfIndex = interfaceContext.getIndex(ifname, writeContext.getMappingContext());
LOG.debug("Setting tag rewrite for interface {}(id=): {}", ifname, swIfIndex, rewrite);
@@ -128,12 +120,7 @@ public class RewriteCustomizer extends FutureJVppCustomizer
@Nonnull final Rewrite dataAfter, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String subifName = getSubInterfaceName(id);
- try {
- setTagRewrite(id, subifName, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to update interface {}(id=): {}", subifName, writeContext, dataAfter);
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
+ setTagRewrite(id, subifName, dataAfter, writeContext);
}
@Override
@@ -141,13 +128,9 @@ public class RewriteCustomizer extends FutureJVppCustomizer
@Nonnull final Rewrite dataBefore, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String subifName = getSubInterfaceName(id);
- try {
- LOG.debug("Disabling tag rewrite for interface {}", subifName);
- final Rewrite rewrite = new RewriteBuilder().build(); // rewrite without push and pops will cause delete
- setTagRewrite(id, subifName, rewrite, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to delete interface {}(id=): {}", subifName, writeContext, dataBefore);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+
+ LOG.debug("Disabling tag rewrite for interface {}", subifName);
+ final Rewrite rewrite = new RewriteBuilder().build(); // rewrite without push and pops will cause delete
+ setTagRewrite(id, subifName, rewrite, writeContext);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java
index 8b93f7551..3eeb8995e 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java
@@ -20,10 +20,8 @@ import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
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.vpp.util.WriteTimeoutException;
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.SwInterfaceSetTable;
import io.fd.vpp.jvpp.core.dto.SwInterfaceSetTableReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
@@ -51,12 +49,7 @@ public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCus
throws WriteFailedException {
final String ifName = id.firstKeyOf(Interface.class).getName();
- try {
- setRouting(id, ifName, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to set routing for interface: {}, {}, vxlan: {}", ifName, writeContext, dataAfter);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ setRouting(id, ifName, dataAfter, writeContext);
}
@Override
@@ -66,12 +59,7 @@ public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCus
throws WriteFailedException {
final String ifName = id.firstKeyOf(Interface.class).getName();
- try {
- setRouting(id, ifName, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to update routing for interface: {}, {}, vxlan: {}", ifName, writeContext, dataAfter);
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
+ setRouting(id, ifName, dataAfter, writeContext);
}
@Override
@@ -79,16 +67,11 @@ public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCus
@Nonnull final Routing dataBefore, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String ifName = id.firstKeyOf(Interface.class).getName();
- try {
- disableRouting(id, ifName, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to disable routing for interface: {}, {}", ifName, writeContext);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ disableRouting(id, ifName, writeContext);
}
private void setRouting(final InstanceIdentifier<Routing> id, final String name, final Routing rt,
- final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext) throws WriteFailedException {
final int swIfc = interfaceContext.getIndex(name, writeContext.getMappingContext());
LOG.debug("Setting routing for interface: {}, {}. Routing: {}", name, swIfc, rt);
@@ -110,11 +93,11 @@ public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCus
* default value 0
*/
private void disableRouting(final InstanceIdentifier<Routing> id, final String name,
- final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext) throws WriteFailedException {
final int swIfc = interfaceContext.getIndex(name, writeContext.getMappingContext());
LOG.debug("Disabling routing for interface: {}, {}.", name, swIfc);
- getReplyForWrite(getFutureJVpp()
+ getReplyForDelete(getFutureJVpp()
.swInterfaceSetTable(getInterfaceSetTableRequest(swIfc, (byte) 0, 0)).toCompletableFuture(), id);
LOG.debug("Routing for interface: {}, {} successfully disabled", name, swIfc);
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java
index dd345e723..c2515621c 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java
@@ -26,9 +26,13 @@ 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.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.CreateSubif;
+import io.fd.vpp.jvpp.core.dto.CreateSubifReply;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -45,12 +49,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.match.attributes.match.type.vlan.tagged.VlanTagged;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.tags.Tag;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.CreateSubif;
-import io.fd.vpp.jvpp.core.dto.CreateSubifReply;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,24 +73,18 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer
@Nonnull final SubInterface dataAfter, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String superIfName = id.firstKeyOf(Interface.class).getName();
- try {
- createSubInterface(id, superIfName, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to create sub interface for: {}, subInterface: {}", superIfName, dataAfter);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ createSubInterface(id, superIfName, dataAfter, writeContext);
}
private void createSubInterface(final InstanceIdentifier<SubInterface> id, @Nonnull final String superIfName,
- @Nonnull final SubInterface subInterface,
- final WriteContext writeContext) throws VppBaseCallException,
- WriteTimeoutException {
+ @Nonnull final SubInterface subInterface, final WriteContext writeContext)
+ throws WriteFailedException {
final int superIfIndex = interfaceContext.getIndex(superIfName, writeContext.getMappingContext());
final CompletionStage<CreateSubifReply> createSubifReplyCompletionStage =
getFutureJVpp().createSubif(getCreateSubifRequest(subInterface, superIfIndex));
final CreateSubifReply reply =
- getReplyForWrite(createSubifReplyCompletionStage.toCompletableFuture(), id);
+ getReplyForCreate(createSubifReplyCompletionStage.toCompletableFuture(), id, subInterface);
setInterfaceState(id, reply.swIfIndex, booleanToByte(subInterface.isEnabled()));
interfaceContext.addName(reply.swIfIndex,
@@ -170,18 +162,12 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer
throws WriteFailedException {
final String subIfaceName = getSubInterfaceName(id.firstKeyOf(Interface.class).getName(),
Math.toIntExact(dataAfter.getIdentifier()));
- try {
- setInterfaceState(id, interfaceContext.getIndex(subIfaceName, writeContext.getMappingContext()),
- booleanToByte(dataAfter.isEnabled()));
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to update interface state for: interface if={}, enabled: {}",
- subIfaceName, booleanToByte(dataAfter.isEnabled()));
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
+ setInterfaceState(id, interfaceContext.getIndex(subIfaceName, writeContext.getMappingContext()),
+ booleanToByte(dataAfter.isEnabled()));
}
private void setInterfaceState(final InstanceIdentifier<SubInterface> id, final int swIfIndex, final byte enabled)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
swInterfaceSetFlags.swIfIndex = swIfIndex;
swInterfaceSetFlags.adminUpDown = enabled;
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizer.java
index 08cdaddc3..09a764136 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/TapCustomizer.java
@@ -20,17 +20,8 @@ import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.MacTranslator;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Tap;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
import io.fd.vpp.jvpp.core.dto.TapConnect;
import io.fd.vpp.jvpp.core.dto.TapConnectReply;
import io.fd.vpp.jvpp.core.dto.TapDelete;
@@ -38,6 +29,13 @@ import io.fd.vpp.jvpp.core.dto.TapDeleteReply;
import io.fd.vpp.jvpp.core.dto.TapModify;
import io.fd.vpp.jvpp.core.dto.TapModifyReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.concurrent.CompletionStage;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Tap;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -61,12 +59,7 @@ public class TapCustomizer extends AbstractInterfaceTypeCustomizer<Tap> implemen
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String ifcName = id.firstKeyOf(Interface.class).getName();
- try {
- createTap(id, ifcName, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to set tap interface: {}, tap: {}", ifcName, dataAfter, e);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ createTap(id, ifcName, dataAfter, writeContext);
}
@Override
@@ -82,12 +75,7 @@ public class TapCustomizer extends AbstractInterfaceTypeCustomizer<Tap> implemen
throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
}
- try {
- modifyTap(id, ifcName, index, dataAfter);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to set tap interface: {}, tap: {}", ifcName, dataAfter, e);
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
+ modifyTap(id, ifcName, index, dataBefore, dataAfter);
}
@Override
@@ -103,45 +91,38 @@ public class TapCustomizer extends AbstractInterfaceTypeCustomizer<Tap> implemen
throw new WriteFailedException.DeleteFailedException(id, e);
}
- try {
- deleteTap(id, ifcName, index, dataBefore, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to delete tap interface: {}, tap: {}", ifcName, dataBefore.getTapName(), e);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ deleteTap(id, ifcName, index, dataBefore, writeContext);
}
private void createTap(final InstanceIdentifier<Tap> id, final String swIfName, final Tap tap,
- final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext) throws WriteFailedException {
LOG.debug("Setting tap interface: {}. Tap: {}", swIfName, tap);
- final CompletionStage<TapConnectReply> tapConnectFuture =
- getFutureJVpp()
- .tapConnect(getTapConnectRequest(tap.getTapName(), tap.getMac(), tap.getDeviceInstance()));
- final TapConnectReply reply =
- getReplyForWrite(tapConnectFuture.toCompletableFuture(), id);
+ final CompletionStage<TapConnectReply> tapConnectFuture = getFutureJVpp()
+ .tapConnect(getTapConnectRequest(tap.getTapName(), tap.getMac(), tap.getDeviceInstance()));
+ final TapConnectReply reply = getReplyForCreate(tapConnectFuture.toCompletableFuture(), id, tap);
LOG.debug("Tap set successfully for: {}, tap: {}", swIfName, tap);
// Add new interface to our interface context
interfaceContext.addName(reply.swIfIndex, swIfName, writeContext.getMappingContext());
}
- private void modifyTap(final InstanceIdentifier<Tap> id, final String swIfName, final int index, final Tap tap)
- throws VppBaseCallException, WriteTimeoutException {
- LOG.debug("Modifying tap interface: {}. Tap: {}", swIfName, tap);
+ private void modifyTap(final InstanceIdentifier<Tap> id, final String swIfName, final int index,
+ final Tap tapBefore, final Tap tapAfter) throws WriteFailedException {
+ LOG.debug("Modifying tap interface: {}. Tap: {}", swIfName, tapAfter);
final CompletionStage<TapModifyReply> vxlanAddDelTunnelReplyCompletionStage =
getFutureJVpp()
- .tapModify(getTapModifyRequest(tap.getTapName(), index, tap.getMac(), tap.getDeviceInstance()));
- getReplyForWrite(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
- LOG.debug("Tap modified successfully for: {}, tap: {}", swIfName, tap);
+ .tapModify(getTapModifyRequest(tapAfter.getTapName(), index, tapAfter.getMac(),
+ tapAfter.getDeviceInstance()));
+ getReplyForUpdate(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, tapBefore, tapAfter);
+ LOG.debug("Tap modified successfully for: {}, tap: {}", swIfName, tapAfter);
}
private void deleteTap(final InstanceIdentifier<Tap> id, final String swIfName, final int index,
- final Tap dataBefore,
- final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ final Tap dataBefore, final WriteContext writeContext)
+ throws WriteFailedException {
LOG.debug("Deleting tap interface: {}. Tap: {}", swIfName, dataBefore);
final CompletionStage<TapDeleteReply> vxlanAddDelTunnelReplyCompletionStage =
getFutureJVpp().tapDelete(getTapDeleteRequest(index));
- getReplyForWrite(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
+ getReplyForDelete(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
LOG.debug("Tap deleted successfully for: {}, tap: {}", swIfName, dataBefore);
// Remove deleted interface from interface context
interfaceContext.removeName(swIfName, writeContext.getMappingContext());
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java
index a906655f1..d0703747a 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java
@@ -21,17 +21,8 @@ import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUserRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.VhostUser;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
import io.fd.vpp.jvpp.core.dto.CreateVhostUserIf;
import io.fd.vpp.jvpp.core.dto.CreateVhostUserIfReply;
import io.fd.vpp.jvpp.core.dto.DeleteVhostUserIf;
@@ -39,6 +30,13 @@ import io.fd.vpp.jvpp.core.dto.DeleteVhostUserIfReply;
import io.fd.vpp.jvpp.core.dto.ModifyVhostUserIf;
import io.fd.vpp.jvpp.core.dto.ModifyVhostUserIfReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import java.util.concurrent.CompletionStage;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUserRole;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.VhostUser;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,23 +64,18 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUs
@Nonnull final VhostUser dataAfter, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
- try {
- createVhostUserIf(id, swIfName, dataAfter, writeContext);
- } catch (VppBaseCallException | IllegalInterfaceTypeException e) {
- LOG.debug("Failed to create vhost user interface: {}, vhostUser: {}", swIfName, dataAfter);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ createVhostUserIf(id, swIfName, dataAfter, writeContext);
}
private void createVhostUserIf(final InstanceIdentifier<VhostUser> id, final String swIfName,
final VhostUser vhostUser, final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
LOG.debug("Creating vhost user interface: name={}, vhostUser={}", swIfName, vhostUser);
final CompletionStage<CreateVhostUserIfReply> createVhostUserIfReplyCompletionStage =
getFutureJVpp().createVhostUserIf(getCreateVhostUserIfRequest(vhostUser));
final CreateVhostUserIfReply reply =
- getReplyForWrite(createVhostUserIfReplyCompletionStage.toCompletableFuture(), id);
+ getReplyForCreate(createVhostUserIfReplyCompletionStage.toCompletableFuture(), id, vhostUser);
LOG.debug("Vhost user interface created successfully for: {}, vhostUser: {}", swIfName, vhostUser);
// Add new interface to our interface context
interfaceContext.addName(reply.swIfIndex, swIfName, writeContext.getMappingContext());
@@ -106,25 +99,21 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUs
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
- try {
- modifyVhostUserIf(id, swIfName, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to update vhost user interface: {}, vhostUser: {}", swIfName, dataAfter);
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
+ modifyVhostUserIf(id, swIfName, dataBefore, dataAfter, writeContext);
}
private void modifyVhostUserIf(final InstanceIdentifier<VhostUser> id, final String swIfName,
- final VhostUser vhostUser, final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
- LOG.debug("Updating vhost user interface: name={}, vhostUser={}", swIfName, vhostUser);
+ final VhostUser vhostUserBefore, final VhostUser vhostUserAfter,
+ final WriteContext writeContext) throws WriteFailedException {
+ LOG.debug("Updating vhost user interface: name={}, vhostUser={}", swIfName, vhostUserAfter);
final CompletionStage<ModifyVhostUserIfReply> modifyVhostUserIfReplyCompletionStage =
getFutureJVpp()
- .modifyVhostUserIf(getModifyVhostUserIfRequest(vhostUser,
+ .modifyVhostUserIf(getModifyVhostUserIfRequest(vhostUserAfter,
interfaceContext.getIndex(swIfName, writeContext.getMappingContext())));
- getReplyForWrite(modifyVhostUserIfReplyCompletionStage.toCompletableFuture(), id);
- LOG.debug("Vhost user interface updated successfully for: {}, vhostUser: {}", swIfName, vhostUser);
+ getReplyForUpdate(modifyVhostUserIfReplyCompletionStage.toCompletableFuture(), id, vhostUserBefore,
+ vhostUserAfter);
+ LOG.debug("Vhost user interface updated successfully for: {}, vhostUser: {}", swIfName, vhostUserAfter);
}
private ModifyVhostUserIf getModifyVhostUserIfRequest(final VhostUser vhostUser, final int swIfIndex) {
@@ -143,23 +132,18 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUs
@Nonnull final VhostUser dataBefore, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
- try {
- deleteVhostUserIf(id, swIfName, dataBefore, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to delete vhost user interface: {}, vhostUser: {}", swIfName, dataBefore);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ deleteVhostUserIf(id, swIfName, dataBefore, writeContext);
}
private void deleteVhostUserIf(final InstanceIdentifier<VhostUser> id, final String swIfName,
final VhostUser vhostUser, final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
LOG.debug("Deleting vhost user interface: name={}, vhostUser={}", swIfName, vhostUser);
final CompletionStage<DeleteVhostUserIfReply> deleteVhostUserIfReplyCompletionStage =
getFutureJVpp().deleteVhostUserIf(getDeleteVhostUserIfRequest(
interfaceContext.getIndex(swIfName, writeContext.getMappingContext())));
- getReplyForWrite(deleteVhostUserIfReplyCompletionStage.toCompletableFuture(), id);
+ getReplyForDelete(deleteVhostUserIfReplyCompletionStage.toCompletableFuture(), id);
LOG.debug("Vhost user interface deleted successfully for: {}, vhostUser: {}", swIfName, vhostUser);
// Remove interface from our interface context
interfaceContext.removeName(swIfName, writeContext.getMappingContext());
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizer.java
index 35500c178..497d25050 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizer.java
@@ -23,9 +23,11 @@ import io.fd.honeycomb.translate.v3po.DisabledInterfacesManager;
import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnel;
+import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnelReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.net.InetAddress;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
@@ -35,10 +37,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanTunnel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Vxlan;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnel;
-import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -67,12 +65,7 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
- try {
- createVxlanTunnel(id, swIfName, dataAfter, writeContext);
- } catch (VppBaseCallException | IllegalInterfaceTypeException e) {
- LOG.debug("Failed to set vxlan tunnel for interface: {}, vxlan: {}", swIfName, dataAfter);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ createVxlanTunnel(id, swIfName, dataAfter, writeContext);
}
@Override
@@ -88,16 +81,12 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
- try {
- deleteVxlanTunnel(id, swIfName, dataBefore, writeContext);
- } catch (VppBaseCallException e) {
- LOG.debug("Failed to delete vxlan tunnel for interface: {}, vxlan: {}", swIfName, dataBefore);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ deleteVxlanTunnel(id, swIfName, dataBefore, writeContext);
}
private void createVxlanTunnel(final InstanceIdentifier<Vxlan> id, final String swIfName, final Vxlan vxlan,
- final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext)
+ throws WriteFailedException {
final byte isIpv6 = (byte) (isIpv6(vxlan)
? 1
: 0);
@@ -113,7 +102,7 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
dstAddress.getAddress(), encapVrfId, -1, vni, isIpv6));
final VxlanAddDelTunnelReply reply =
- getReplyForWrite(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
+ getReplyForCreate(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, vxlan);
LOG.debug("Vxlan tunnel set successfully for: {}, vxlan: {}", swIfName, vxlan);
if (interfaceNamingContext.containsName(reply.swIfIndex, writeContext.getMappingContext())) {
// VPP keeps vxlan tunnels present even after they are delete(reserving ID for next tunnel)
@@ -160,7 +149,7 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
}
private void deleteVxlanTunnel(final InstanceIdentifier<Vxlan> id, final String swIfName, final Vxlan vxlan,
- final WriteContext writeContext) throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext) throws WriteFailedException {
final byte isIpv6 = (byte) (isIpv6(vxlan)
? 1
: 0);
@@ -175,7 +164,7 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
getFutureJVpp().vxlanAddDelTunnel(getVxlanTunnelRequest((byte) 0 /* is add */, srcAddress.getAddress(),
dstAddress.getAddress(), encapVrfId, -1, vni, isIpv6));
- getReplyForWrite(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
+ getReplyForDelete(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
LOG.debug("Vxlan tunnel deleted successfully for: {}, vxlan: {}", swIfName, vxlan);
final int index = interfaceNamingContext.getIndex(swIfName, writeContext.getMappingContext());
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizer.java
index 4a83f9223..744d5f909 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizer.java
@@ -23,9 +23,11 @@ import io.fd.honeycomb.translate.v3po.DisabledInterfacesManager;
import io.fd.honeycomb.translate.vpp.util.AbstractInterfaceTypeCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.VxlanGpeAddDelTunnel;
+import io.fd.vpp.jvpp.core.dto.VxlanGpeAddDelTunnelReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.net.InetAddress;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
@@ -35,10 +37,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanGpeTunnel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.VxlanGpe;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeAddDelTunnel;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeAddDelTunnelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -67,12 +65,7 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
- try {
- createVxlanGpeTunnel(id, swIfName, dataAfter, writeContext);
- } catch (VppBaseCallException | IllegalInterfaceTypeException e) {
- LOG.warn("Failed to set VxlanGpe tunnel for interface: {}, VxlanGpe: {}", swIfName, dataAfter);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ createVxlanGpeTunnel(id, swIfName, dataAfter, writeContext);
}
@Override
@@ -90,17 +83,12 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
final String swIfName = id.firstKeyOf(Interface.class).getName();
- try {
- deleteVxlanGpeTunnel(id, swIfName, dataBefore, writeContext);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to delete VxlanGpe tunnel for interface: {}, VxlanGpe: {}", swIfName, dataBefore);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ deleteVxlanGpeTunnel(id, swIfName, dataBefore, writeContext);
}
private void createVxlanGpeTunnel(final InstanceIdentifier<VxlanGpe> id, final String swIfName,
final VxlanGpe vxlanGpe, final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final byte isIpv6 = (byte) (isIpv6(vxlanGpe)
? 1
: 0);
@@ -118,7 +106,7 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe
Remote.getAddress(), vni, protocol, encapVrfId, decapVrfId, isIpv6));
final VxlanGpeAddDelTunnelReply reply =
- getReplyForWrite(VxlanGpeAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
+ getReplyForCreate(VxlanGpeAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, vxlanGpe);
LOG.debug("VxlanGpe tunnel set successfully for: {}, VxlanGpe: {}", swIfName, vxlanGpe);
if (interfaceNamingContext.containsName(reply.swIfIndex, writeContext.getMappingContext())) {
final String formerName = interfaceNamingContext.getName(reply.swIfIndex, writeContext.getMappingContext());
@@ -160,7 +148,7 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe
private void deleteVxlanGpeTunnel(final InstanceIdentifier<VxlanGpe> id, final String swIfName,
final VxlanGpe vxlanGpe, final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final byte isIpv6 = (byte) (isIpv6(vxlanGpe)
? 1
: 0);
@@ -177,9 +165,7 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe
getFutureJVpp()
.vxlanGpeAddDelTunnel(getVxlanGpeTunnelRequest((byte) 0 /* is delete */, local.getAddress(),
remote.getAddress(), vni, protocol, encapVrfId, decapVrfId, isIpv6));
-
- getReplyForWrite(VxlanGpeAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
-
+ getReplyForDelete(VxlanGpeAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
final int index = interfaceNamingContext.getIndex(swIfName, writeContext.getMappingContext());
// Mark this interface as disabled to not include it in operational reads
// because VPP will keep the interface there
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AbstractAceWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AbstractAceWriter.java
index 882c00a36..eed22a63b 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AbstractAceWriter.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AbstractAceWriter.java
@@ -23,6 +23,7 @@ import com.google.common.annotations.VisibleForTesting;
import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
+import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.VppBaseCallException;
import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
@@ -113,7 +114,7 @@ abstract class AbstractAceWriter<T extends AceType> implements AceWriter, JvppRe
public final void write(@Nonnull final InstanceIdentifier<?> id, @Nonnull final List<Ace> aces,
final InterfaceMode mode, @Nonnull final InputAclSetInterface request,
@Nonnegative final int vlanTags)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final PacketHandling action = aces.stream().map(ace -> ace.getActions().getPacketHandling()).distinct()
.collect(SINGLE_ITEM_COLLECTOR);
@@ -133,7 +134,7 @@ abstract class AbstractAceWriter<T extends AceType> implements AceWriter, JvppRe
private int createClassifyTable(@Nonnull final InstanceIdentifier<?> id,
@Nonnull final ClassifyAddDelTable request)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final CompletionStage<ClassifyAddDelTableReply> cs = futureJVppCore.classifyAddDelTable(request);
final ClassifyAddDelTableReply reply = getReplyForWrite(cs.toCompletableFuture(), id);
@@ -142,7 +143,7 @@ abstract class AbstractAceWriter<T extends AceType> implements AceWriter, JvppRe
private void createClassifySession(@Nonnull final InstanceIdentifier<?> id,
@Nonnull final ClassifyAddDelSession request)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final CompletionStage<ClassifyAddDelSessionReply> cs = futureJVppCore.classifyAddDelSession(request);
getReplyForWrite(cs.toCompletableFuture(), id);
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceWriter.java
index 2be3e09f6..2e22ed1a0 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceWriter.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceWriter.java
@@ -17,6 +17,7 @@
package io.fd.honeycomb.translate.v3po.interfaces.acl.ingress;
import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
+import io.fd.honeycomb.translate.write.WriteFailedException;
import java.util.List;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
@@ -42,5 +43,5 @@ interface AceWriter {
*/
void write(@Nonnull final InstanceIdentifier<?> id, @Nonnull final List<Ace> aces,
final InterfaceMode mode, @Nonnull final InputAclSetInterface request, @Nonnegative final int vlanTags)
- throws VppBaseCallException, WriteTimeoutException;
+ throws WriteFailedException;
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclCustomizer.java
index a423a456f..30b60c6ff 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclCustomizer.java
@@ -22,10 +22,8 @@ import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
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.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
@@ -53,40 +51,33 @@ public class AclCustomizer extends FutureJVppCustomizer implements WriterCustomi
@Override
public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress dataAfter,
@Nonnull final WriteContext writeContext) throws WriteFailedException {
- try {
- setAcl(true, id, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ setAcl(true, id, dataAfter, writeContext);
}
@Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress dataBefore,
+ public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
+ @Nonnull final Ingress dataBefore,
@Nonnull final Ingress dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
+ throws WriteFailedException {
throw new UnsupportedOperationException("Acl update is not supported. Please delete Acl container first.");
}
@Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress dataBefore,
+ public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
+ @Nonnull final Ingress dataBefore,
@Nonnull final WriteContext writeContext) throws WriteFailedException {
- try {
- setAcl(false, id, dataBefore, writeContext);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ setAcl(false, id, dataBefore, writeContext);
}
private void setAcl(final boolean isAdd, @Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress acl,
- @Nonnull final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
final String ifName = id.firstKeyOf(Interface.class).getName();
final int ifIndex = interfaceContext.getIndex(ifName, writeContext.getMappingContext());
LOG.debug("Setting ACL(isAdd={}) on interface={}(id={}): {}", isAdd, ifName, ifIndex, acl);
inputAclSetInterface(getFutureJVpp(), isAdd, id, acl, ifIndex, classifyTableContext,
- writeContext.getMappingContext());
+ writeContext.getMappingContext());
LOG.debug("Successfully set ACL(isAdd={}) on interface={}(id={}): {}", isAdd, ifName, ifIndex, acl);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclWriter.java
index 8c3333476..01ae61d06 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclWriter.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AclWriter.java
@@ -23,6 +23,7 @@ import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
+import io.fd.honeycomb.translate.write.WriteFailedException;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
@@ -42,8 +43,7 @@ interface AclWriter extends ByteDataTranslator, JvppReplyConsumer {
@Nonnull final InstanceIdentifier<?> id, @Nonnull final AclBaseAttributes acl,
@Nonnegative final int ifIndex,
@Nonnull final VppClassifierContextManager classifyTableContext,
- @Nonnull final MappingContext mappingContext)
- throws VppBaseCallException, WriteTimeoutException {
+ @Nonnull final MappingContext mappingContext) throws WriteFailedException {
final InputAclSetInterface request = new InputAclSetInterface();
request.isAdd = booleanToByte(isAdd);
request.swIfIndex = ifIndex;
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAClWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAClWriter.java
index 91c7794d3..1ac9ff2b8 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAClWriter.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAClWriter.java
@@ -22,10 +22,8 @@ import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import io.fd.honeycomb.translate.v3po.interfaces.acl.IetfAclWriter;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
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.ClassifyAddDelTable;
import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterface;
@@ -92,30 +90,26 @@ public final class IetfAClWriter implements JvppReplyConsumer {
}
void deleteAcl(@Nonnull final InstanceIdentifier<?> id, final int swIfIndex)
- throws WriteTimeoutException, WriteFailedException.DeleteFailedException {
+ throws WriteFailedException {
final ClassifyTableByInterface request = new ClassifyTableByInterface();
request.swIfIndex = swIfIndex;
- try {
- final CompletionStage<ClassifyTableByInterfaceReply> cs = jvpp.classifyTableByInterface(request);
- final ClassifyTableByInterfaceReply reply = getReplyForWrite(cs.toCompletableFuture(), id);
+ final CompletionStage<ClassifyTableByInterfaceReply> cs = jvpp.classifyTableByInterface(request);
+ final ClassifyTableByInterfaceReply reply = getReplyForDelete(cs.toCompletableFuture(), id);
- // We unassign and remove all ACL-related classify tables for given interface (we assume we are the only
- // classify table manager)
+ // We unassign and remove all ACL-related classify tables for given interface (we assume we are the only
+ // classify table manager)
- unassignClassifyTables(id, reply);
+ unassignClassifyTables(id, reply);
- removeClassifyTable(id, reply.l2TableId);
- removeClassifyTable(id, reply.ip4TableId);
- removeClassifyTable(id, reply.ip6TableId);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ removeClassifyTable(id, reply.l2TableId);
+ removeClassifyTable(id, reply.ip4TableId);
+ removeClassifyTable(id, reply.ip6TableId);
}
private void unassignClassifyTables(@Nonnull final InstanceIdentifier<?> id,
final ClassifyTableByInterfaceReply currentState)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final InputAclSetInterface request = new InputAclSetInterface();
request.isAdd = 0;
request.swIfIndex = currentState.swIfIndex;
@@ -124,11 +118,11 @@ public final class IetfAClWriter implements JvppReplyConsumer {
request.ip6TableIndex = currentState.ip6TableId;
final CompletionStage<InputAclSetInterfaceReply> inputAclSetInterfaceReplyCompletionStage =
jvpp.inputAclSetInterface(request);
- getReplyForWrite(inputAclSetInterfaceReplyCompletionStage.toCompletableFuture(), id);
+ getReplyForDelete(inputAclSetInterfaceReplyCompletionStage.toCompletableFuture(), id);
}
private void removeClassifyTable(@Nonnull final InstanceIdentifier<?> id, final int tableIndex)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
if (tableIndex == -1) {
return; // classify table id is absent
@@ -136,19 +130,19 @@ public final class IetfAClWriter implements JvppReplyConsumer {
final ClassifyAddDelTable request = new ClassifyAddDelTable();
request.tableIndex = tableIndex;
final CompletionStage<ClassifyAddDelTableReply> cs = jvpp.classifyAddDelTable(request);
- getReplyForWrite(cs.toCompletableFuture(), id);
+ getReplyForDelete(cs.toCompletableFuture(), id);
}
void write(@Nonnull final InstanceIdentifier<?> id, final int swIfIndex, @Nonnull final List<Acl> acls,
@Nullable final InterfaceMode mode, @Nonnull final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
write(id, swIfIndex, mode, acls, writeContext, 0);
}
void write(@Nonnull final InstanceIdentifier<?> id, final int swIfIndex, final InterfaceMode mode,
@Nonnull final List<Acl> acls,
@Nonnull final WriteContext writeContext, @Nonnegative final int numberOfTags)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
// filter ACE entries and group by AceType
final Map<AclType, List<Ace>> acesByType = acls.stream()
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizer.java
index b10dc362b..c9cd66ec2 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclCustomizer.java
@@ -23,7 +23,6 @@ import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
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 javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.ietf.acl.base.attributes.AccessLists;
@@ -60,20 +59,16 @@ public class IetfAclCustomizer implements WriterCustomizer<Ingress> {
final AccessLists accessLists = dataAfter.getAccessLists();
checkArgument(accessLists != null && accessLists.getAcl() != null,
- "ietf-acl container does not define acl list");
+ "ietf-acl container does not define acl list");
- try {
- aclWriter.write(id, ifIndex, accessLists.getAcl(), accessLists.getMode(), writeContext);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ aclWriter.write(id, ifIndex, accessLists.getAcl(), accessLists.getMode(), writeContext);
}
@Override
public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
@Nonnull final Ingress dataBefore, @Nonnull final Ingress dataAfter,
@Nonnull final WriteContext writeContext)
- throws WriteFailedException {
+ throws WriteFailedException {
LOG.debug("ACLs update: removing previously configured ACLs");
deleteCurrentAttributes(id, dataBefore, writeContext);
LOG.debug("ACLs update: adding updated ACLs");
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizer.java
index e71770121..80e43aa29 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizer.java
@@ -23,10 +23,8 @@ import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
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.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
@@ -42,7 +40,7 @@ import org.slf4j.LoggerFactory;
* Customizer for enabling/disabling ingress ACLs on given sub-interface.
*/
public class SubInterfaceAclCustomizer extends FutureJVppCustomizer
- implements WriterCustomizer<Ingress>, AclWriter {
+ implements WriterCustomizer<Ingress>, AclWriter {
private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceAclCustomizer.class);
private final NamingContext interfaceContext;
@@ -59,44 +57,37 @@ public class SubInterfaceAclCustomizer extends FutureJVppCustomizer
@Override
public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress dataAfter,
@Nonnull final WriteContext writeContext) throws WriteFailedException {
- try {
- setAcl(true, id, dataAfter, writeContext);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ setAcl(true, id, dataAfter, writeContext);
}
@Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress dataBefore,
+ public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
+ @Nonnull final Ingress dataBefore,
@Nonnull final Ingress dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
+ throws WriteFailedException {
throw new UnsupportedOperationException("Acl update is not supported. Please delete Acl container first.");
}
@Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress dataBefore,
+ public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
+ @Nonnull final Ingress dataBefore,
@Nonnull final WriteContext writeContext) throws WriteFailedException {
- try {
- setAcl(false, id, dataBefore, writeContext);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ setAcl(false, id, dataBefore, writeContext);
}
private void setAcl(final boolean isAdd, @Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final Ingress acl,
- @Nonnull final WriteContext writeContext)
- throws VppBaseCallException, WriteTimeoutException {
+ @Nonnull final WriteContext writeContext) throws WriteFailedException {
final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class);
final SubInterfaceKey subInterfacekey = id.firstKeyOf(SubInterface.class);
final String subInterfaceName = SubInterfaceUtils
- .getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
+ .getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
LOG.debug("Setting ACL(isAdd={}) on sub-interface={}(id={}): {}",
- isAdd, subInterfaceName, subInterfaceIndex, acl);
+ isAdd, subInterfaceName, subInterfaceIndex, acl);
inputAclSetInterface(getFutureJVpp(), isAdd, id, acl, subInterfaceIndex, classifyTableContext,
- writeContext.getMappingContext());
+ writeContext.getMappingContext());
LOG.debug("Successfully set ACL(isAdd={}) on sub-interface={}(id={}): {}",
- isAdd, subInterfaceName, subInterfaceIndex, acl);
+ isAdd, subInterfaceName, subInterfaceIndex, acl);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizer.java
index c9068d797..ae40714e3 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceIetfAclCustomizer.java
@@ -27,7 +27,6 @@ import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.VppBaseCallException;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
@@ -62,7 +61,7 @@ public class SubInterfaceIetfAclCustomizer implements WriterCustomizer<Ingress>
final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class);
final SubInterfaceKey subInterfacekey = id.firstKeyOf(SubInterface.class);
return SubInterfaceUtils
- .getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
+ .getSubInterfaceName(parentInterfacekey.getName(), subInterfacekey.getIdentifier().intValue());
}
@Override
@@ -74,19 +73,15 @@ public class SubInterfaceIetfAclCustomizer implements WriterCustomizer<Ingress>
final AccessLists accessLists = dataAfter.getAccessLists();
checkArgument(accessLists != null && accessLists.getAcl() != null,
- "ietf-acl container does not define acl list");
+ "ietf-acl container does not define acl list");
final Optional<SubInterface> subInterfaceOptional =
- writeContext.readAfter(id.firstIdentifierOf(SubInterface.class));
+ writeContext.readAfter(id.firstIdentifierOf(SubInterface.class));
checkState(subInterfaceOptional.isPresent(), "Could not read SubInterface data object for %s", id);
final SubInterface subInterface = subInterfaceOptional.get();
- try {
- aclWriter.write(id, subInterfaceIndex, accessLists.getMode(), accessLists.getAcl(), writeContext,
+ aclWriter.write(id, subInterfaceIndex, accessLists.getMode(), accessLists.getAcl(), writeContext,
getNumberOfTags(subInterface.getTags()));
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
}
@Override
@@ -103,7 +98,7 @@ public class SubInterfaceIetfAclCustomizer implements WriterCustomizer<Ingress>
@Override
public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
@Nonnull final Ingress dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
+ throws WriteFailedException {
final String subInterfaceName = getSubInterfaceName(id);
final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext());
LOG.debug("Removing ACLs for sub-interface={}(id={}): {}", subInterfaceName, subInterfaceIndex, dataBefore);
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java
index bd2360317..2cec90695 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java
@@ -27,6 +27,7 @@ import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
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.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
@@ -37,8 +38,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev14061
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.PrefixLength;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DottedQuad;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -125,39 +124,28 @@ public class Ipv4AddressCustomizer extends FutureJVppCustomizer
@Nonnull final String interfaceName, final int interfaceIndex,
@Nonnull final Address address, @Nonnull final Netmask subnet)
throws WriteFailedException {
- try {
- LOG.debug("Setting Subnet(subnet-mask) for interface: {}(id={}). Subnet: {}, address: {}",
- interfaceName, interfaceIndex, subnet, address);
-
- final DottedQuad netmask = subnet.getNetmask();
- checkNotNull(netmask, "netmask value should not be null");
-
- final byte subnetLength = getSubnetMaskLength(netmask.getValue());
- addDelAddress(getFutureJVpp(), add, id, interfaceIndex, address.getIp(), subnetLength);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to set Subnet(subnet-mask) for interface: {}(id={}). Subnet: {}, address: {}",
- interfaceName, interfaceIndex, subnet, address);
- throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass(), e);
- }
+
+ LOG.debug("Setting Subnet(subnet-mask) for interface: {}(id={}). Subnet: {}, address: {}",
+ interfaceName, interfaceIndex, subnet, address);
+
+ final DottedQuad netmask = subnet.getNetmask();
+ checkNotNull(netmask, "netmask value should not be null");
+
+ final byte subnetLength = getSubnetMaskLength(netmask.getValue());
+ addDelAddress(getFutureJVpp(), add, id, interfaceIndex, address.getIp(), subnetLength);
}
private void setPrefixLengthSubnet(final boolean add, @Nonnull final InstanceIdentifier<Address> id,
@Nonnull final String interfaceName, final int interfaceIndex,
@Nonnull final Address address, @Nonnull final PrefixLength subnet)
throws WriteFailedException {
- try {
- LOG.debug("Setting Subnet(prefix-length) for interface: {}(id={}). Subnet: {}, address: {}",
- interfaceName, interfaceIndex, subnet, address);
-
- addDelAddress(getFutureJVpp(), add, id, interfaceIndex, address.getIp(),
- subnet.getPrefixLength().byteValue());
-
- LOG.debug("Subnet(prefix-length) set successfully for interface: {}(id={}). Subnet: {}, address: {}",
- interfaceName, interfaceIndex, subnet, address);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to set Subnet(prefix-length) for interface: {}(id={}). Subnet: {}, address: {}",
- interfaceName, interfaceIndex, subnet, address);
- throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass(), e);
- }
+ LOG.debug("Setting Subnet(prefix-length) for interface: {}(id={}). Subnet: {}, address: {}",
+ interfaceName, interfaceIndex, subnet, address);
+
+ addDelAddress(getFutureJVpp(), add, id, interfaceIndex, address.getIp(),
+ subnet.getPrefixLength().byteValue());
+
+ LOG.debug("Subnet(prefix-length) set successfully for interface: {}(id={}). Subnet: {}, address: {}",
+ interfaceName, interfaceIndex, subnet, address);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java
index 4bcbf126f..be4ef28cf 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java
@@ -27,18 +27,16 @@ 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.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.IpNeighborAddDel;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Neighbor;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.NeighborKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.IpNeighborAddDel;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,13 +73,9 @@ public class Ipv4NeighbourCustomizer extends FutureJVppCustomizer
"Mapping does not contains mapping for provider interface name ".concat(interfaceName));
LOG.debug("Parent interface index found");
- try {
- addDelNeighbourAndReply(id, true,
- interfaceContext.getIndex(interfaceName, mappingContext), dataAfter);
- LOG.info("Neighbour successfully written");
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ addDelNeighbourAndReply(id, true,
+ interfaceContext.getIndex(interfaceName, mappingContext), dataAfter);
+ LOG.info("Neighbour successfully written");
}
@Override
@@ -107,18 +101,14 @@ public class Ipv4NeighbourCustomizer extends FutureJVppCustomizer
"Mapping does not contains mapping for provider interface name %s", interfaceName);
LOG.debug("Parent interface[{}] index found", interfaceName);
- try {
- addDelNeighbourAndReply(id, false,
- interfaceContext.getIndex(interfaceName, mappingContext), dataBefore);
- LOG.info("Neighbour {} successfully deleted", id);
- } catch (VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+
+ addDelNeighbourAndReply(id, false,
+ interfaceContext.getIndex(interfaceName, mappingContext), dataBefore);
+ LOG.info("Neighbour {} successfully deleted", id);
}
private void addDelNeighbourAndReply(InstanceIdentifier<Neighbor> id, boolean add, int parentInterfaceIndex,
- Neighbor data)
- throws VppBaseCallException, WriteTimeoutException {
+ Neighbor data) throws WriteFailedException {
IpNeighborAddDel request = new IpNeighborAddDel();
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Writer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Writer.java
index c823e77b1..788deab3b 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Writer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Writer.java
@@ -22,16 +22,15 @@ import static com.google.common.base.Preconditions.checkNotNull;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddress;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddressReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddress;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddressReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
/**
* Utility class providing Ipv4 CUD support.
@@ -46,7 +45,7 @@ public interface Ipv4Writer extends ByteDataTranslator, Ipv4Translator, JvppRepl
final InstanceIdentifier<?> id,
@Nonnegative final int ifaceId,
@Nonnull final Ipv4AddressNoZone address, @Nonnegative final byte prefixLength)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
checkArgument(prefixLength > 0, "Invalid prefix length");
checkNotNull(address, "address should not be null");
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java
index eb8525949..9b786917d 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java
@@ -24,6 +24,7 @@ import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
@@ -36,8 +37,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.ip4.attributes.ipv4.address.subnet.Netmask;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.ip4.attributes.ipv4.address.subnet.PrefixLength;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -105,40 +104,28 @@ public class SubInterfaceIpv4AddressCustomizer extends FutureJVppCustomizer
@Nonnull final String subInterfaceName, final int subInterfaceIndex,
@Nonnull final Address address, @Nonnull final Netmask subnet)
throws WriteFailedException {
- try {
- LOG.debug("Setting Subnet(subnet-mask) for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
- final DottedQuad netmask = subnet.getNetmask();
- checkNotNull(netmask, "netmask value should not be null");
+ LOG.debug("Setting Subnet(subnet-mask) for sub-interface: {}(id={}). Subnet: {}, address: {}",
+ subInterfaceName, subInterfaceIndex, subnet, address);
- final byte subnetLength = getSubnetMaskLength(netmask.getValue());
- addDelAddress(getFutureJVpp(), add, id, subInterfaceIndex, address.getIp(), subnetLength);
+ final DottedQuad netmask = subnet.getNetmask();
+ checkNotNull(netmask, "netmask value should not be null");
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to set Subnet(subnet-mask) for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
- throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass(), e);
- }
+ final byte subnetLength = getSubnetMaskLength(netmask.getValue());
+ addDelAddress(getFutureJVpp(), add, id, subInterfaceIndex, address.getIp(), subnetLength);
}
private void setPrefixLengthSubnet(final boolean add, @Nonnull final InstanceIdentifier<Address> id,
@Nonnull final String subInterfaceName, final int subInterfaceIndex,
@Nonnull final Address address, @Nonnull final PrefixLength subnet)
throws WriteFailedException {
- try {
- LOG.debug("Setting Subnet(prefix-length) for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
-
- addDelAddress(getFutureJVpp(), add, id, subInterfaceIndex, address.getIp(),
- subnet.getPrefixLength().byteValue());
-
- LOG.debug("Subnet(prefix-length) set successfully for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to set Subnet(prefix-length) for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
- throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass(), e);
- }
+ LOG.debug("Setting Subnet(prefix-length) for sub-interface: {}(id={}). Subnet: {}, address: {}",
+ subInterfaceName, subInterfaceIndex, subnet, address);
+
+ addDelAddress(getFutureJVpp(), add, id, subInterfaceIndex, address.getIp(),
+ subnet.getPrefixLength().byteValue());
+
+ LOG.debug("Subnet(prefix-length) set successfully for sub-interface: {}(id={}). Subnet: {}, address: {}",
+ subInterfaceName, subInterfaceIndex, subnet, address);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizer.java
index d142a8e55..58e0d8bb7 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/GreCustomizer.java
@@ -23,6 +23,10 @@ import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.vpp.jvpp.core.dto.GreTunnelDetails;
+import io.fd.vpp.jvpp.core.dto.GreTunnelDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.GreTunnelDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
@@ -40,11 +44,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.GreTunnelDetails;
-import io.fd.vpp.jvpp.core.dto.GreTunnelDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.GreTunnelDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,60 +74,55 @@ public class GreCustomizer extends FutureJVppCustomizer
public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Gre> id,
@Nonnull final GreBuilder builder,
@Nonnull final ReadContext ctx) throws ReadFailedException {
- try {
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, GreTunnel.class, LOG)) {
- return;
- }
+ final InterfaceKey key = id.firstKeyOf(Interface.class);
+ final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
+ if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, GreTunnel.class, LOG)) {
+ return;
+ }
- LOG.debug("Reading attributes for gre tunnel: {}", key.getName());
- // Dump just a single
- final GreTunnelDump request = new GreTunnelDump();
- request.swIfIndex = index;
+ LOG.debug("Reading attributes for gre tunnel: {}", key.getName());
+ // Dump just a single
+ final GreTunnelDump request = new GreTunnelDump();
+ request.swIfIndex = index;
- final CompletionStage<GreTunnelDetailsReplyDump> swInterfaceGreDetailsReplyDumpCompletionStage =
- getFutureJVpp().greTunnelDump(request);
- final GreTunnelDetailsReplyDump reply =
- getReplyForRead(swInterfaceGreDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
+ final CompletionStage<GreTunnelDetailsReplyDump> swInterfaceGreDetailsReplyDumpCompletionStage =
+ getFutureJVpp().greTunnelDump(request);
+ final GreTunnelDetailsReplyDump reply =
+ getReplyForRead(swInterfaceGreDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
- // VPP keeps gre tunnel interfaces even after they were deleted (optimization)
- // However there ar no longer any gre tunnel specific fields assigned to it and this call
- // returns nothing
- if (reply == null || reply.greTunnelDetails == null || reply.greTunnelDetails.isEmpty()) {
- LOG.debug(
- "Gre tunnel {}, id {} has no attributes assigned in VPP. Probably is a leftover interface placeholder" +
- "after delete", key.getName(), index);
- return;
- }
+ // VPP keeps gre tunnel interfaces even after they were deleted (optimization)
+ // However there ar no longer any gre tunnel specific fields assigned to it and this call
+ // returns nothing
+ if (reply == null || reply.greTunnelDetails == null || reply.greTunnelDetails.isEmpty()) {
+ LOG.debug(
+ "Gre tunnel {}, id {} has no attributes assigned in VPP. Probably is a leftover interface placeholder" +
+ "after delete", key.getName(), index);
+ return;
+ }
- checkState(reply.greTunnelDetails.size() == 1,
- "Unexpected number of returned gre tunnels: {} for tunnel: {}", reply.greTunnelDetails,
- key.getName());
- LOG.trace("Gre tunnel: {} attributes returned from VPP: {}", key.getName(), reply);
+ checkState(reply.greTunnelDetails.size() == 1,
+ "Unexpected number of returned gre tunnels: {} for tunnel: {}", reply.greTunnelDetails,
+ key.getName());
+ LOG.trace("Gre tunnel: {} attributes returned from VPP: {}", key.getName(), reply);
- final GreTunnelDetails swInterfaceGreDetails = reply.greTunnelDetails.get(0);
- if (swInterfaceGreDetails.isIpv6 == 1) {
- final Ipv6Address dstIpv6 =
- new Ipv6Address(parseAddress(swInterfaceGreDetails.dstAddress).getHostAddress());
- builder.setDst(new IpAddress(dstIpv6));
- final Ipv6Address srcIpv6 =
- new Ipv6Address(parseAddress(swInterfaceGreDetails.srcAddress).getHostAddress());
- builder.setSrc(new IpAddress(srcIpv6));
- } else {
- final byte[] dstBytes = Arrays.copyOfRange(swInterfaceGreDetails.dstAddress, 0, 4);
- final Ipv4Address dstIpv4 = new Ipv4Address(parseAddress(dstBytes).getHostAddress());
- builder.setDst(new IpAddress(dstIpv4));
- final byte[] srcBytes = Arrays.copyOfRange(swInterfaceGreDetails.srcAddress, 0, 4);
- final Ipv4Address srcIpv4 = new Ipv4Address(parseAddress(srcBytes).getHostAddress());
- builder.setSrc(new IpAddress(srcIpv4));
- }
- builder.setOuterFibId((long) swInterfaceGreDetails.outerFibId);
- LOG.debug("Gre tunnel: {}, id: {} attributes read as: {}", key.getName(), index, builder);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to readCurrentAttributes for: {}", id, e);
- throw new ReadFailedException(id, e);
+ final GreTunnelDetails swInterfaceGreDetails = reply.greTunnelDetails.get(0);
+ if (swInterfaceGreDetails.isIpv6 == 1) {
+ final Ipv6Address dstIpv6 =
+ new Ipv6Address(parseAddress(swInterfaceGreDetails.dstAddress).getHostAddress());
+ builder.setDst(new IpAddress(dstIpv6));
+ final Ipv6Address srcIpv6 =
+ new Ipv6Address(parseAddress(swInterfaceGreDetails.srcAddress).getHostAddress());
+ builder.setSrc(new IpAddress(srcIpv6));
+ } else {
+ final byte[] dstBytes = Arrays.copyOfRange(swInterfaceGreDetails.dstAddress, 0, 4);
+ final Ipv4Address dstIpv4 = new Ipv4Address(parseAddress(dstBytes).getHostAddress());
+ builder.setDst(new IpAddress(dstIpv4));
+ final byte[] srcBytes = Arrays.copyOfRange(swInterfaceGreDetails.srcAddress, 0, 4);
+ final Ipv4Address srcIpv4 = new Ipv4Address(parseAddress(srcBytes).getHostAddress());
+ builder.setSrc(new IpAddress(srcIpv4));
}
+ builder.setOuterFibId((long) swInterfaceGreDetails.outerFibId);
+ LOG.debug("Gre tunnel: {}, id: {} attributes read as: {}", key.getName(), index, builder);
}
@Nonnull
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java
index 2177c7460..c8e07a82f 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java
@@ -22,6 +22,12 @@ import static java.util.Objects.requireNonNull;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails;
+import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.BridgeDomainDump;
+import io.fd.vpp.jvpp.core.dto.BridgeDomainSwIfDetails;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nonnull;
@@ -29,13 +35,6 @@ import javax.annotation.Nullable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.base.attributes.Interconnection;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.base.attributes.interconnection.BridgeBasedBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDump;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainSwIfDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -112,18 +111,15 @@ final class InterconnectionReadUtils implements InterfaceDataTranslator {
private BridgeDomainDetailsReplyDump getDumpReply(@Nonnull final InstanceIdentifier<?> id)
throws ReadFailedException {
- try {
- // We need to perform full bd dump, because there is no way
- // to ask VPP for BD details given interface id/name (TODO HONEYCOMB-190 add it to vpp.api?)
- // TODO HONEYCOMB-190 cache dump result
- final BridgeDomainDump request = new BridgeDomainDump();
- request.bdId = -1;
-
- final CompletableFuture<BridgeDomainDetailsReplyDump> bdCompletableFuture =
- futureJVppCore.bridgeDomainSwIfDump(request).toCompletableFuture();
- return getReplyForRead(bdCompletableFuture, id);
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
- }
+ // We need to perform full bd dump, because there is no way
+ // to ask VPP for BD details given interface id/name (TODO HONEYCOMB-190 add it to vpp.api?)
+ // TODO HONEYCOMB-190 cache dump result
+ final BridgeDomainDump request = new BridgeDomainDump();
+ request.bdId = -1;
+
+ final CompletableFuture<BridgeDomainDetailsReplyDump> bdCompletableFuture =
+ futureJVppCore.bridgeDomainSwIfDump(request).toCompletableFuture();
+ return getReplyForRead(bdCompletableFuture, id);
+
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizer.java
index 7fcb995db..3093f08a7 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizer.java
@@ -25,6 +25,10 @@ import io.fd.honeycomb.translate.v3po.DisabledInterfacesManager;
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.SwInterfaceDetails;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -42,11 +46,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -136,71 +135,66 @@ public class InterfaceCustomizer extends FutureJVppCustomizer
@Override
public List<InterfaceKey> getAllIds(@Nonnull final InstanceIdentifier<Interface> id,
@Nonnull final ReadContext context) throws ReadFailedException {
- try {
- final List<InterfaceKey> interfacesKeys;
- LOG.trace("Dumping all interfaces to get all IDs");
-
- final SwInterfaceDump request = new SwInterfaceDump();
- request.nameFilter = "".getBytes();
- request.nameFilterValid = 0;
-
- final CompletableFuture<SwInterfaceDetailsReplyDump> swInterfaceDetailsReplyDumpCompletableFuture =
- getFutureJVpp().swInterfaceDump(request).toCompletableFuture();
- final SwInterfaceDetailsReplyDump ifaces =
- getReplyForRead(swInterfaceDetailsReplyDumpCompletableFuture, id);
-
- if (null == ifaces || null == ifaces.swInterfaceDetails) {
- LOG.debug("No interfaces for :{} found in VPP", id);
- return Collections.emptyList();
- }
-
- // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
- context.getModificationCache().put(DUMPED_IFCS_CONTEXT_KEY, ifaces.swInterfaceDetails.stream()
- .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails)));
-
- final MappingContext mappingCtx = context.getMappingContext();
- final Set<Integer> interfacesIdxs = ifaces.swInterfaceDetails.stream()
- .filter(elt -> elt != null)
- // Filter out disabled interfaces, dont read them
- // This also prevents child readers in being invoked such as vxlan (which relies on disabling interfaces)
- .filter(elt -> !interfaceDisableContext
- .isInterfaceDisabled(elt.swIfIndex, mappingCtx))
- .map((elt) -> {
- // Store interface name from VPP in context if not yet present
- if (!interfaceNamingContext.containsName(elt.swIfIndex, mappingCtx)) {
- interfaceNamingContext.addName(elt.swIfIndex, toString(elt.interfaceName),
- mappingCtx);
- }
- LOG.trace("Interface with name: {}, VPP name: {} and index: {} found in VPP",
- interfaceNamingContext.getName(elt.swIfIndex, mappingCtx),
- elt.interfaceName,
- elt.swIfIndex);
-
- return elt;
- })
- // filter out sub-interfaces
- .filter(InterfaceCustomizer::isRegularInterface)
- .map(elt -> elt.swIfIndex)
- .collect(Collectors.toSet());
-
- // Clean disabled interfaces list
- interfaceDisableContext.getDisabledInterfaces(mappingCtx).stream()
- // Find indices not currently in VPP
- .filter(interfacesIdxs::contains)
- // Remove from disabled list ... not disabled if not existing
- .forEach(idx -> interfaceDisableContext.removeDisabledInterface(idx, mappingCtx));
-
- // Transform indices to keys
- interfacesKeys = interfacesIdxs.stream()
- .map(index -> new InterfaceKey(interfaceNamingContext.getName(index, context.getMappingContext())))
- .collect(Collectors.toList());
-
- LOG.debug("Interfaces found in VPP: {}", interfacesKeys);
- return interfacesKeys;
- } catch (VppBaseCallException e) {
- LOG.warn("getAllIds for id :{} failed with exception ", id, e);
- throw new ReadFailedException(id, e);
+ final List<InterfaceKey> interfacesKeys;
+ LOG.trace("Dumping all interfaces to get all IDs");
+
+ final SwInterfaceDump request = new SwInterfaceDump();
+ request.nameFilter = "".getBytes();
+ request.nameFilterValid = 0;
+
+ final CompletableFuture<SwInterfaceDetailsReplyDump> swInterfaceDetailsReplyDumpCompletableFuture =
+ getFutureJVpp().swInterfaceDump(request).toCompletableFuture();
+ final SwInterfaceDetailsReplyDump ifaces =
+ getReplyForRead(swInterfaceDetailsReplyDumpCompletableFuture, id);
+
+ if (null == ifaces || null == ifaces.swInterfaceDetails) {
+ LOG.debug("No interfaces for :{} found in VPP", id);
+ return Collections.emptyList();
}
+
+ // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
+ context.getModificationCache().put(DUMPED_IFCS_CONTEXT_KEY, ifaces.swInterfaceDetails.stream()
+ .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails)));
+
+ final MappingContext mappingCtx = context.getMappingContext();
+ final Set<Integer> interfacesIdxs = ifaces.swInterfaceDetails.stream()
+ .filter(elt -> elt != null)
+ // Filter out disabled interfaces, dont read them
+ // This also prevents child readers in being invoked such as vxlan (which relies on disabling interfaces)
+ .filter(elt -> !interfaceDisableContext
+ .isInterfaceDisabled(elt.swIfIndex, mappingCtx))
+ .map((elt) -> {
+ // Store interface name from VPP in context if not yet present
+ if (!interfaceNamingContext.containsName(elt.swIfIndex, mappingCtx)) {
+ interfaceNamingContext.addName(elt.swIfIndex, toString(elt.interfaceName),
+ mappingCtx);
+ }
+ LOG.trace("Interface with name: {}, VPP name: {} and index: {} found in VPP",
+ interfaceNamingContext.getName(elt.swIfIndex, mappingCtx),
+ elt.interfaceName,
+ elt.swIfIndex);
+
+ return elt;
+ })
+ // filter out sub-interfaces
+ .filter(InterfaceCustomizer::isRegularInterface)
+ .map(elt -> elt.swIfIndex)
+ .collect(Collectors.toSet());
+
+ // Clean disabled interfaces list
+ interfaceDisableContext.getDisabledInterfaces(mappingCtx).stream()
+ // Find indices not currently in VPP
+ .filter(interfacesIdxs::contains)
+ // Remove from disabled list ... not disabled if not existing
+ .forEach(idx -> interfaceDisableContext.removeDisabledInterface(idx, mappingCtx));
+
+ // Transform indices to keys
+ interfacesKeys = interfacesIdxs.stream()
+ .map(index -> new InterfaceKey(interfaceNamingContext.getName(index, context.getMappingContext())))
+ .collect(Collectors.toList());
+
+ LOG.debug("Interfaces found in VPP: {}", interfacesKeys);
+ return interfacesKeys;
}
@Override
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslator.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslator.java
index 81012e21e..2cc8ce250 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslator.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceDataTranslator.java
@@ -24,6 +24,10 @@ import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.math.BigInteger;
import java.util.Map;
import java.util.Objects;
@@ -41,11 +45,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanGpeTunnel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanTunnel;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
public interface InterfaceDataTranslator extends ByteDataTranslator, JvppReplyConsumer {
@@ -195,32 +194,28 @@ public interface InterfaceDataTranslator extends ByteDataTranslator, JvppReplyCo
}
SwInterfaceDetailsReplyDump ifaces;
- try {
- CompletionStage<SwInterfaceDetailsReplyDump> requestFuture = futureJVppCore.swInterfaceDump(request);
- ifaces = getReplyForRead(requestFuture.toCompletableFuture(), id);
- if (null == ifaces || null == ifaces.swInterfaceDetails || ifaces.swInterfaceDetails.isEmpty()) {
- request.nameFilterValid = 0;
- callerLogger.warn("VPP returned null instead of interface by key {} and its not cached", name);
- callerLogger.warn("Iterating through all the interfaces to find interface: {}", name);
+ CompletionStage<SwInterfaceDetailsReplyDump> requestFuture = futureJVppCore.swInterfaceDump(request);
+ ifaces = getReplyForRead(requestFuture.toCompletableFuture(), id);
+ if (null == ifaces || null == ifaces.swInterfaceDetails || ifaces.swInterfaceDetails.isEmpty()) {
+ request.nameFilterValid = 0;
- // Or else just perform full dump and do inefficient filtering
- requestFuture = futureJVppCore.swInterfaceDump(request);
- ifaces = getReplyForRead(requestFuture.toCompletableFuture(), id);
+ callerLogger.warn("VPP returned null instead of interface by key {} and its not cached", name);
+ callerLogger.warn("Iterating through all the interfaces to find interface: {}", name);
+
+ // Or else just perform full dump and do inefficient filtering
+ requestFuture = futureJVppCore.swInterfaceDump(request);
+ ifaces = getReplyForRead(requestFuture.toCompletableFuture(), id);
- // Update the cache
- allInterfaces.clear();
- allInterfaces
- .putAll(ifaces.swInterfaceDetails.stream().collect(Collectors.toMap(d -> d.swIfIndex, d -> d)));
+ // Update the cache
+ allInterfaces.clear();
+ allInterfaces
+ .putAll(ifaces.swInterfaceDetails.stream().collect(Collectors.toMap(d -> d.swIfIndex, d -> d)));
- if (allInterfaces.containsKey(index)) {
- return allInterfaces.get(index);
- }
- throw new IllegalArgumentException("Unable to find interface " + name);
+ if (allInterfaces.containsKey(index)) {
+ return allInterfaces.get(index);
}
- } catch (VppBaseCallException e) {
- callerLogger.warn("getVppInterfaceDetails for id :{} and name :{} failed with exception :", id, name, e);
- throw new ReadFailedException(id, e);
+ throw new IllegalArgumentException("Unable to find interface " + name);
}
// SwInterfaceDump's name filter does prefix match, so we need additional filtering:
@@ -263,8 +258,8 @@ public interface InterfaceDataTranslator extends ByteDataTranslator, JvppReplyCo
/**
* Check interface type. Uses interface details from VPP to determine. Uses {@link
- * #getVppInterfaceDetails(FutureJVppCore, InstanceIdentifier, String, int, ModificationCache, Logger)} internally so
- * tries to utilize cache before asking VPP.
+ * #getVppInterfaceDetails(FutureJVppCore, InstanceIdentifier, String, int, ModificationCache, Logger)} internally
+ * so tries to utilize cache before asking VPP.
*/
default boolean isInterfaceOfType(@Nonnull final FutureJVppCore jvpp,
@Nonnull final ModificationCache cache,
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java
index e618f81e3..a253d0828 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java
@@ -26,6 +26,10 @@ 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.honeycomb.translate.vpp.util.SubInterfaceUtils;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -59,11 +63,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan
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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -110,47 +109,43 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer
@Override
public List<SubInterfaceKey> getAllIds(@Nonnull final InstanceIdentifier<SubInterface> id,
@Nonnull final ReadContext context) throws ReadFailedException {
- try {
- // Relying here that parent InterfaceCustomizer was invoked first (PREORDER)
- // to fill in the context with initial ifc mapping
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final String ifaceName = key.getName();
- final int ifaceId = interfaceContext.getIndex(ifaceName, context.getMappingContext());
-
- // TODO HONEYCOMB-189 if we know that full dump was already performed we could use cache
- // (checking if getCachedInterfaceDump() returns non empty map is not enough, because
- // we could be part of particular iface state read
- final SwInterfaceDump request = new SwInterfaceDump();
- request.nameFilter = "".getBytes();
- request.nameFilterValid = 0;
-
- final CompletableFuture<SwInterfaceDetailsReplyDump> swInterfaceDetailsReplyDumpCompletableFuture =
- getFutureJVpp().swInterfaceDump(request).toCompletableFuture();
- final SwInterfaceDetailsReplyDump ifaces =
- getReplyForRead(swInterfaceDetailsReplyDumpCompletableFuture, id);
-
- if (null == ifaces || null == ifaces.swInterfaceDetails) {
- LOG.warn("Looking for sub-interfaces, but no interfaces found in VPP");
- return Collections.emptyList();
- }
-
- // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
- context.getModificationCache()
- .put(InterfaceCustomizer.DUMPED_IFCS_CONTEXT_KEY, ifaces.swInterfaceDetails.stream()
- .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails)));
-
- final List<SubInterfaceKey> interfacesKeys = ifaces.swInterfaceDetails.stream()
- .filter(elt -> elt != null)
- // accept only sub-interfaces for current iface:
- .filter(elt -> elt.subId != 0 && elt.supSwIfIndex == ifaceId)
- .map(details -> new SubInterfaceKey(new Long(details.subId)))
- .collect(Collectors.toList());
-
- LOG.debug("Sub-interfaces of {} found in VPP: {}", ifaceName, interfacesKeys);
- return interfacesKeys;
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
+ // Relying here that parent InterfaceCustomizer was invoked first (PREORDER)
+ // to fill in the context with initial ifc mapping
+ final InterfaceKey key = id.firstKeyOf(Interface.class);
+ final String ifaceName = key.getName();
+ final int ifaceId = interfaceContext.getIndex(ifaceName, context.getMappingContext());
+
+ // TODO HONEYCOMB-189 if we know that full dump was already performed we could use cache
+ // (checking if getCachedInterfaceDump() returns non empty map is not enough, because
+ // we could be part of particular iface state read
+ final SwInterfaceDump request = new SwInterfaceDump();
+ request.nameFilter = "".getBytes();
+ request.nameFilterValid = 0;
+
+ final CompletableFuture<SwInterfaceDetailsReplyDump> swInterfaceDetailsReplyDumpCompletableFuture =
+ getFutureJVpp().swInterfaceDump(request).toCompletableFuture();
+ final SwInterfaceDetailsReplyDump ifaces =
+ getReplyForRead(swInterfaceDetailsReplyDumpCompletableFuture, id);
+
+ if (null == ifaces || null == ifaces.swInterfaceDetails) {
+ LOG.warn("Looking for sub-interfaces, but no interfaces found in VPP");
+ return Collections.emptyList();
}
+
+ // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
+ context.getModificationCache()
+ .put(InterfaceCustomizer.DUMPED_IFCS_CONTEXT_KEY, ifaces.swInterfaceDetails.stream()
+ .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails)));
+
+ final List<SubInterfaceKey> interfacesKeys = ifaces.swInterfaceDetails.stream()
+ .filter(elt -> elt != null)
+ // accept only sub-interfaces for current iface:
+ .filter(elt -> elt.subId != 0 && elt.supSwIfIndex == ifaceId)
+ .map(details -> new SubInterfaceKey(new Long(details.subId)))
+ .collect(Collectors.toList());
+
+ LOG.debug("Sub-interfaces of {} found in VPP: {}", ifaceName, interfacesKeys);
+ return interfacesKeys;
}
@Override
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizer.java
index c61777423..e2cea64cd 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/TapCustomizer.java
@@ -22,6 +22,10 @@ import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
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.vpp.jvpp.core.dto.SwInterfaceTapDetails;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceTapDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceTapDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -36,11 +40,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceTapDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceTapDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceTapDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,48 +71,44 @@ public class TapCustomizer extends FutureJVppCustomizer
public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Tap> id,
@Nonnull final TapBuilder builder,
@Nonnull final ReadContext ctx) throws ReadFailedException {
- try {
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Tap.class, LOG)) {
- return;
- }
- LOG.debug("Reading attributes for tap interface: {}", key.getName());
-
- @SuppressWarnings("unchecked")
- Map<Integer, SwInterfaceTapDetails> mappedTaps =
- (Map<Integer, SwInterfaceTapDetails>) ctx.getModificationCache().get(DUMPED_TAPS_CONTEXT_KEY);
-
- if (mappedTaps == null) {
- // Full Tap dump has to be performed here, no filter or anything is here to help so at least we cache it
- final SwInterfaceTapDump request = new SwInterfaceTapDump();
- final CompletionStage<SwInterfaceTapDetailsReplyDump> swInterfaceTapDetailsReplyDumpCompletionStage =
- getFutureJVpp().swInterfaceTapDump(request);
- final SwInterfaceTapDetailsReplyDump reply =
- getReplyForRead(swInterfaceTapDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
-
- if (null == reply || null == reply.swInterfaceTapDetails) {
- mappedTaps = Collections.emptyMap();
- } else {
- final List<SwInterfaceTapDetails> swInterfaceTapDetails = reply.swInterfaceTapDetails;
- // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
- mappedTaps = swInterfaceTapDetails.stream()
- .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails));
- }
-
- ctx.getModificationCache().put(DUMPED_TAPS_CONTEXT_KEY, mappedTaps);
- }
+ final InterfaceKey key = id.firstKeyOf(Interface.class);
+ final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
+ if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index,
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Tap.class, LOG)) {
+ return;
+ }
- final SwInterfaceTapDetails swInterfaceTapDetails = mappedTaps.get(index);
- LOG.trace("Tap interface: {} attributes returned from VPP: {}", key.getName(), swInterfaceTapDetails);
+ LOG.debug("Reading attributes for tap interface: {}", key.getName());
+
+ @SuppressWarnings("unchecked")
+ Map<Integer, SwInterfaceTapDetails> mappedTaps =
+ (Map<Integer, SwInterfaceTapDetails>) ctx.getModificationCache().get(DUMPED_TAPS_CONTEXT_KEY);
+
+ if (mappedTaps == null) {
+ // Full Tap dump has to be performed here, no filter or anything is here to help so at least we cache it
+ final SwInterfaceTapDump request = new SwInterfaceTapDump();
+ final CompletionStage<SwInterfaceTapDetailsReplyDump> swInterfaceTapDetailsReplyDumpCompletionStage =
+ getFutureJVpp().swInterfaceTapDump(request);
+ final SwInterfaceTapDetailsReplyDump reply =
+ getReplyForRead(swInterfaceTapDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
+
+ if (null == reply || null == reply.swInterfaceTapDetails) {
+ mappedTaps = Collections.emptyMap();
+ } else {
+ final List<SwInterfaceTapDetails> swInterfaceTapDetails = reply.swInterfaceTapDetails;
+ // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
+ mappedTaps = swInterfaceTapDetails.stream()
+ .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails));
+ }
- builder.setTapName(toString(swInterfaceTapDetails.devName));
- LOG.debug("Tap interface: {}, id: {} attributes read as: {}", key.getName(), index, builder);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to readCurrentAttributes for: {}", id, e);
- throw new ReadFailedException(id, e);
+ ctx.getModificationCache().put(DUMPED_TAPS_CONTEXT_KEY, mappedTaps);
}
+
+ final SwInterfaceTapDetails swInterfaceTapDetails = mappedTaps.get(index);
+ LOG.trace("Tap interface: {} attributes returned from VPP: {}", key.getName(), swInterfaceTapDetails);
+
+ builder.setTapName(toString(swInterfaceTapDetails.devName));
+ LOG.debug("Tap interface: {}, id: {} attributes read as: {}", key.getName(), index, builder);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizer.java
index 0781a3f77..7d575a9b0 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VhostUserCustomizer.java
@@ -22,6 +22,10 @@ import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
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.vpp.jvpp.core.dto.SwInterfaceVhostUserDetails;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
@@ -38,11 +42,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,63 +74,59 @@ public class VhostUserCustomizer extends FutureJVppCustomizer
public void readCurrentAttributes(@Nonnull final InstanceIdentifier<VhostUser> id,
@Nonnull final VhostUserBuilder builder,
@Nonnull final ReadContext ctx) throws ReadFailedException {
- try {
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUser.class,
- LOG)) {
- return;
- }
- LOG.debug("Reading attributes for vhpost user interface: {}", key.getName());
-
- @SuppressWarnings("unchecked")
- Map<Integer, SwInterfaceVhostUserDetails> mappedVhostUsers =
- (Map<Integer, SwInterfaceVhostUserDetails>) ctx.getModificationCache()
- .get(DUMPED_VHOST_USERS_CONTEXT_KEY);
-
- if (mappedVhostUsers == null) {
- // Full VhostUser dump has to be performed here, no filter or anything is here to help so at least we cache it
- final SwInterfaceVhostUserDump request = new SwInterfaceVhostUserDump();
- final CompletionStage<SwInterfaceVhostUserDetailsReplyDump>
- swInterfaceVhostUserDetailsReplyDumpCompletionStage =
- getFutureJVpp().swInterfaceVhostUserDump(request);
- final SwInterfaceVhostUserDetailsReplyDump reply =
- getReplyForRead(swInterfaceVhostUserDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
-
- if (null == reply || null == reply.swInterfaceVhostUserDetails) {
- mappedVhostUsers = Collections.emptyMap();
- } else {
- final List<SwInterfaceVhostUserDetails> swInterfaceVhostUserDetails =
- reply.swInterfaceVhostUserDetails;
- // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
- mappedVhostUsers = swInterfaceVhostUserDetails.stream()
- .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails));
- }
-
- ctx.getModificationCache().put(DUMPED_VHOST_USERS_CONTEXT_KEY, mappedVhostUsers);
+ final InterfaceKey key = id.firstKeyOf(Interface.class);
+ final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
+ if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index,
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUser.class,
+ LOG)) {
+ return;
+ }
+
+ LOG.debug("Reading attributes for vhpost user interface: {}", key.getName());
+
+ @SuppressWarnings("unchecked")
+ Map<Integer, SwInterfaceVhostUserDetails> mappedVhostUsers =
+ (Map<Integer, SwInterfaceVhostUserDetails>) ctx.getModificationCache()
+ .get(DUMPED_VHOST_USERS_CONTEXT_KEY);
+
+ if (mappedVhostUsers == null) {
+ // Full VhostUser dump has to be performed here, no filter or anything is here to help so at least we cache it
+ final SwInterfaceVhostUserDump request = new SwInterfaceVhostUserDump();
+ final CompletionStage<SwInterfaceVhostUserDetailsReplyDump>
+ swInterfaceVhostUserDetailsReplyDumpCompletionStage =
+ getFutureJVpp().swInterfaceVhostUserDump(request);
+ final SwInterfaceVhostUserDetailsReplyDump reply =
+ getReplyForRead(swInterfaceVhostUserDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
+
+ if (null == reply || null == reply.swInterfaceVhostUserDetails) {
+ mappedVhostUsers = Collections.emptyMap();
+ } else {
+ final List<SwInterfaceVhostUserDetails> swInterfaceVhostUserDetails =
+ reply.swInterfaceVhostUserDetails;
+ // Cache interfaces dump in per-tx context to later be used in readCurrentAttributes
+ mappedVhostUsers = swInterfaceVhostUserDetails.stream()
+ .collect(Collectors.toMap(t -> t.swIfIndex, swInterfaceDetails -> swInterfaceDetails));
}
- // Relying here that parent InterfaceCustomizer was invoked first to fill in the context with initial ifc mapping
- final SwInterfaceVhostUserDetails swInterfaceVhostUserDetails = mappedVhostUsers.get(index);
- LOG.trace("Vhost user interface: {} attributes returned from VPP: {}", key.getName(),
- swInterfaceVhostUserDetails);
-
- builder.setRole(swInterfaceVhostUserDetails.isServer == 1
- ? VhostUserRole.Server
- : VhostUserRole.Client);
- builder.setFeatures(BigInteger.valueOf(swInterfaceVhostUserDetails.features));
- builder.setNumMemoryRegions((long) swInterfaceVhostUserDetails.numRegions);
- builder.setSocket(toString(swInterfaceVhostUserDetails.sockFilename));
- builder.setVirtioNetHdrSize((long) swInterfaceVhostUserDetails.virtioNetHdrSz);
- // TODO: map error code to meaningful message after VPP-436 is done
- builder.setConnectError(Integer.toString(swInterfaceVhostUserDetails.sockErrno));
-
- LOG.debug("Vhost user interface: {}, id: {} attributes read as: {}", key.getName(), index, builder);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to readCurrentAttributes for: {}", id, e);
- throw new ReadFailedException(id, e);
+ ctx.getModificationCache().put(DUMPED_VHOST_USERS_CONTEXT_KEY, mappedVhostUsers);
}
+
+ // Relying here that parent InterfaceCustomizer was invoked first to fill in the context with initial ifc mapping
+ final SwInterfaceVhostUserDetails swInterfaceVhostUserDetails = mappedVhostUsers.get(index);
+ LOG.trace("Vhost user interface: {} attributes returned from VPP: {}", key.getName(),
+ swInterfaceVhostUserDetails);
+
+ builder.setRole(swInterfaceVhostUserDetails.isServer == 1
+ ? VhostUserRole.Server
+ : VhostUserRole.Client);
+ builder.setFeatures(BigInteger.valueOf(swInterfaceVhostUserDetails.features));
+ builder.setNumMemoryRegions((long) swInterfaceVhostUserDetails.numRegions);
+ builder.setSocket(toString(swInterfaceVhostUserDetails.sockFilename));
+ builder.setVirtioNetHdrSize((long) swInterfaceVhostUserDetails.virtioNetHdrSz);
+ // TODO: map error code to meaningful message after VPP-436 is done
+ builder.setConnectError(Integer.toString(swInterfaceVhostUserDetails.sockErrno));
+
+ LOG.debug("Vhost user interface: {}, id: {} attributes read as: {}", key.getName(), index, builder);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizer.java
index 579136085..555d48c81 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanCustomizer.java
@@ -24,6 +24,10 @@ import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
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.vpp.jvpp.core.dto.VxlanTunnelDetails;
+import io.fd.vpp.jvpp.core.dto.VxlanTunnelDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.VxlanTunnelDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
@@ -42,11 +46,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.VxlanTunnelDetails;
-import io.fd.vpp.jvpp.core.dto.VxlanTunnelDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.VxlanTunnelDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -77,61 +76,57 @@ public class VxlanCustomizer extends FutureJVppCustomizer
public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Vxlan> id,
@Nonnull final VxlanBuilder builder,
@Nonnull final ReadContext ctx) throws ReadFailedException {
- try {
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, VxlanTunnel.class, LOG)) {
- return;
- }
-
- LOG.debug("Reading attributes for vxlan tunnel: {}", key.getName());
- // Dump just a single
- final VxlanTunnelDump request = new VxlanTunnelDump();
- request.swIfIndex = index;
-
- final CompletionStage<VxlanTunnelDetailsReplyDump> swInterfaceVxlanDetailsReplyDumpCompletionStage =
- getFutureJVpp().vxlanTunnelDump(request);
- final VxlanTunnelDetailsReplyDump reply =
- getReplyForRead(swInterfaceVxlanDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
-
- // VPP keeps vxlan tunnel interfaces even after they were deleted (optimization)
- // However there ar no longer any vxlan tunnel specific fields assigned to it and this call
- // returns nothing
- if (reply == null || reply.vxlanTunnelDetails == null || reply.vxlanTunnelDetails.isEmpty()) {
- LOG.debug(
- "Vxlan tunnel {}, id {} has no attributes assigned in VPP. Probably is a leftover interface placeholder" +
- "after delete", key.getName(), index);
- return;
- }
-
- checkState(reply.vxlanTunnelDetails.size() == 1,
- "Unexpected number of returned vxlan tunnels: {} for tunnel: {}", reply.vxlanTunnelDetails,
- key.getName());
- LOG.trace("Vxlan tunnel: {} attributes returned from VPP: {}", key.getName(), reply);
-
- final VxlanTunnelDetails swInterfaceVxlanDetails = reply.vxlanTunnelDetails.get(0);
- if (swInterfaceVxlanDetails.isIpv6 == 1) {
- final Ipv6Address dstIpv6 =
- new Ipv6Address(parseAddress(swInterfaceVxlanDetails.dstAddress).getHostAddress());
- builder.setDst(new IpAddress(dstIpv6));
- final Ipv6Address srcIpv6 =
- new Ipv6Address(parseAddress(swInterfaceVxlanDetails.srcAddress).getHostAddress());
- builder.setSrc(new IpAddress(srcIpv6));
- } else {
- final byte[] dstBytes = Arrays.copyOfRange(swInterfaceVxlanDetails.dstAddress, 0, 4);
- final Ipv4Address dstIpv4 = new Ipv4Address(parseAddress(dstBytes).getHostAddress());
- builder.setDst(new IpAddress(dstIpv4));
- final byte[] srcBytes = Arrays.copyOfRange(swInterfaceVxlanDetails.srcAddress, 0, 4);
- final Ipv4Address srcIpv4 = new Ipv4Address(parseAddress(srcBytes).getHostAddress());
- builder.setSrc(new IpAddress(srcIpv4));
- }
- builder.setEncapVrfId((long) swInterfaceVxlanDetails.encapVrfId);
- builder.setVni(new VxlanVni((long) swInterfaceVxlanDetails.vni));
- LOG.debug("Vxlan tunnel: {}, id: {} attributes read as: {}", key.getName(), index, builder);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to readCurrentAttributes for: {}", id);
- throw new ReadFailedException(id, e);
+
+ final InterfaceKey key = id.firstKeyOf(Interface.class);
+ final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
+ if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, VxlanTunnel.class, LOG)) {
+ return;
+ }
+
+ LOG.debug("Reading attributes for vxlan tunnel: {}", key.getName());
+ // Dump just a single
+ final VxlanTunnelDump request = new VxlanTunnelDump();
+ request.swIfIndex = index;
+
+ final CompletionStage<VxlanTunnelDetailsReplyDump> swInterfaceVxlanDetailsReplyDumpCompletionStage =
+ getFutureJVpp().vxlanTunnelDump(request);
+ final VxlanTunnelDetailsReplyDump reply =
+ getReplyForRead(swInterfaceVxlanDetailsReplyDumpCompletionStage.toCompletableFuture(), id);
+
+ // VPP keeps vxlan tunnel interfaces even after they were deleted (optimization)
+ // However there ar no longer any vxlan tunnel specific fields assigned to it and this call
+ // returns nothing
+ if (reply == null || reply.vxlanTunnelDetails == null || reply.vxlanTunnelDetails.isEmpty()) {
+ LOG.debug(
+ "Vxlan tunnel {}, id {} has no attributes assigned in VPP. Probably is a leftover interface placeholder" +
+ "after delete", key.getName(), index);
+ return;
+ }
+
+ checkState(reply.vxlanTunnelDetails.size() == 1,
+ "Unexpected number of returned vxlan tunnels: {} for tunnel: {}", reply.vxlanTunnelDetails,
+ key.getName());
+ LOG.trace("Vxlan tunnel: {} attributes returned from VPP: {}", key.getName(), reply);
+
+ final VxlanTunnelDetails swInterfaceVxlanDetails = reply.vxlanTunnelDetails.get(0);
+ if (swInterfaceVxlanDetails.isIpv6 == 1) {
+ final Ipv6Address dstIpv6 =
+ new Ipv6Address(parseAddress(swInterfaceVxlanDetails.dstAddress).getHostAddress());
+ builder.setDst(new IpAddress(dstIpv6));
+ final Ipv6Address srcIpv6 =
+ new Ipv6Address(parseAddress(swInterfaceVxlanDetails.srcAddress).getHostAddress());
+ builder.setSrc(new IpAddress(srcIpv6));
+ } else {
+ final byte[] dstBytes = Arrays.copyOfRange(swInterfaceVxlanDetails.dstAddress, 0, 4);
+ final Ipv4Address dstIpv4 = new Ipv4Address(parseAddress(dstBytes).getHostAddress());
+ builder.setDst(new IpAddress(dstIpv4));
+ final byte[] srcBytes = Arrays.copyOfRange(swInterfaceVxlanDetails.srcAddress, 0, 4);
+ final Ipv4Address srcIpv4 = new Ipv4Address(parseAddress(srcBytes).getHostAddress());
+ builder.setSrc(new IpAddress(srcIpv4));
}
+ builder.setEncapVrfId((long) swInterfaceVxlanDetails.encapVrfId);
+ builder.setVni(new VxlanVni((long) swInterfaceVxlanDetails.vni));
+ LOG.debug("Vxlan tunnel: {}, id: {} attributes read as: {}", key.getName(), index, builder);
}
@Nonnull
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizer.java
index 8ea95c190..764054d55 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/VxlanGpeCustomizer.java
@@ -24,6 +24,10 @@ import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
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.vpp.jvpp.core.dto.VxlanGpeTunnelDetails;
+import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
@@ -43,11 +47,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDetails;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,64 +77,60 @@ public class VxlanGpeCustomizer extends FutureJVppCustomizer
public void readCurrentAttributes(@Nonnull final InstanceIdentifier<VxlanGpe> id,
@Nonnull final VxlanGpeBuilder builder,
@Nonnull final ReadContext ctx) throws ReadFailedException {
- try {
- final InterfaceKey key = id.firstKeyOf(Interface.class);
- final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
- if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, VxlanGpeTunnel.class, LOG)) {
- return;
- }
-
- LOG.debug("Reading attributes for VxlanGpe tunnel: {}", key.getName());
- // Dump just a single
- final VxlanGpeTunnelDump request = new VxlanGpeTunnelDump();
- request.swIfIndex = index;
-
- final CompletionStage<VxlanGpeTunnelDetailsReplyDump> swInterfaceVxlanGpeDetailsReplyDumpCompletionStage =
- getFutureJVpp().vxlanGpeTunnelDump(request);
- final VxlanGpeTunnelDetailsReplyDump reply =
- getReplyForRead(swInterfaceVxlanGpeDetailsReplyDumpCompletionStage.toCompletableFuture(),
- id);
-
- // VPP keeps VxlanGpe tunnel interfaces even after they were deleted (optimization)
- // However there are no longer any VxlanGpe tunnel specific fields assigned to it and this call
- // returns nothing
- if (reply == null || reply.vxlanGpeTunnelDetails == null || reply.vxlanGpeTunnelDetails.isEmpty()) {
- LOG.debug(
- "VxlanGpe tunnel {}, id {} has no attributes assigned in VPP. Probably is a leftover interface placeholder" +
- "after delete", key.getName(), index);
- return;
- }
-
- checkState(reply.vxlanGpeTunnelDetails.size() == 1,
- "Unexpected number of returned VxlanGpe tunnels: {} for tunnel: {}", reply.vxlanGpeTunnelDetails,
- key.getName());
- LOG.trace("VxlanGpe tunnel: {} attributes returned from VPP: {}", key.getName(), reply);
-
- final VxlanGpeTunnelDetails swInterfaceVxlanGpeDetails = reply.vxlanGpeTunnelDetails.get(0);
- if (swInterfaceVxlanGpeDetails.isIpv6 == 1) {
- final Ipv6Address remote6 =
- new Ipv6Address(parseAddress(swInterfaceVxlanGpeDetails.remote).getHostAddress());
- builder.setRemote(new IpAddress(remote6));
- final Ipv6Address local6 =
- new Ipv6Address(parseAddress(swInterfaceVxlanGpeDetails.local).getHostAddress());
- builder.setLocal(new IpAddress(local6));
- } else {
- final byte[] dstBytes = Arrays.copyOfRange(swInterfaceVxlanGpeDetails.remote, 0, 4);
- final Ipv4Address remote4 = new Ipv4Address(parseAddress(dstBytes).getHostAddress());
- builder.setRemote(new IpAddress(remote4));
- final byte[] srcBytes = Arrays.copyOfRange(swInterfaceVxlanGpeDetails.local, 0, 4);
- final Ipv4Address local4 = new Ipv4Address(parseAddress(srcBytes).getHostAddress());
- builder.setLocal(new IpAddress(local4));
- }
- builder.setVni(new VxlanGpeVni((long) swInterfaceVxlanGpeDetails.vni));
- builder.setNextProtocol(VxlanGpeNextProtocol.forValue(swInterfaceVxlanGpeDetails.protocol));
- builder.setEncapVrfId((long) swInterfaceVxlanGpeDetails.encapVrfId);
- builder.setDecapVrfId((long) swInterfaceVxlanGpeDetails.decapVrfId);
- LOG.debug("VxlanGpe tunnel: {}, id: {} attributes read as: {}", key.getName(), index, builder);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to readCurrentAttributes for: {}", id);
- throw new ReadFailedException(id, e);
+
+ final InterfaceKey key = id.firstKeyOf(Interface.class);
+ final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext());
+ if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, VxlanGpeTunnel.class, LOG)) {
+ return;
+ }
+
+ LOG.debug("Reading attributes for VxlanGpe tunnel: {}", key.getName());
+ // Dump just a single
+ final VxlanGpeTunnelDump request = new VxlanGpeTunnelDump();
+ request.swIfIndex = index;
+
+ final CompletionStage<VxlanGpeTunnelDetailsReplyDump> swInterfaceVxlanGpeDetailsReplyDumpCompletionStage =
+ getFutureJVpp().vxlanGpeTunnelDump(request);
+ final VxlanGpeTunnelDetailsReplyDump reply =
+ getReplyForRead(swInterfaceVxlanGpeDetailsReplyDumpCompletionStage.toCompletableFuture(),
+ id);
+
+ // VPP keeps VxlanGpe tunnel interfaces even after they were deleted (optimization)
+ // However there are no longer any VxlanGpe tunnel specific fields assigned to it and this call
+ // returns nothing
+ if (reply == null || reply.vxlanGpeTunnelDetails == null || reply.vxlanGpeTunnelDetails.isEmpty()) {
+ LOG.debug(
+ "VxlanGpe tunnel {}, id {} has no attributes assigned in VPP. Probably is a leftover interface placeholder" +
+ "after delete", key.getName(), index);
+ return;
+ }
+
+ checkState(reply.vxlanGpeTunnelDetails.size() == 1,
+ "Unexpected number of returned VxlanGpe tunnels: {} for tunnel: {}", reply.vxlanGpeTunnelDetails,
+ key.getName());
+ LOG.trace("VxlanGpe tunnel: {} attributes returned from VPP: {}", key.getName(), reply);
+
+ final VxlanGpeTunnelDetails swInterfaceVxlanGpeDetails = reply.vxlanGpeTunnelDetails.get(0);
+ if (swInterfaceVxlanGpeDetails.isIpv6 == 1) {
+ final Ipv6Address remote6 =
+ new Ipv6Address(parseAddress(swInterfaceVxlanGpeDetails.remote).getHostAddress());
+ builder.setRemote(new IpAddress(remote6));
+ final Ipv6Address local6 =
+ new Ipv6Address(parseAddress(swInterfaceVxlanGpeDetails.local).getHostAddress());
+ builder.setLocal(new IpAddress(local6));
+ } else {
+ final byte[] dstBytes = Arrays.copyOfRange(swInterfaceVxlanGpeDetails.remote, 0, 4);
+ final Ipv4Address remote4 = new Ipv4Address(parseAddress(dstBytes).getHostAddress());
+ builder.setRemote(new IpAddress(remote4));
+ final byte[] srcBytes = Arrays.copyOfRange(swInterfaceVxlanGpeDetails.local, 0, 4);
+ final Ipv4Address local4 = new Ipv4Address(parseAddress(srcBytes).getHostAddress());
+ builder.setLocal(new IpAddress(local4));
}
+ builder.setVni(new VxlanGpeVni((long) swInterfaceVxlanGpeDetails.vni));
+ builder.setNextProtocol(VxlanGpeNextProtocol.forValue(swInterfaceVxlanGpeDetails.protocol));
+ builder.setEncapVrfId((long) swInterfaceVxlanGpeDetails.encapVrfId);
+ builder.setDecapVrfId((long) swInterfaceVxlanGpeDetails.decapVrfId);
+ LOG.debug("VxlanGpe tunnel: {}, id: {} attributes read as: {}", key.getName(), index, builder);
}
@Nonnull
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizer.java
index c248575ca..091244eea 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/AclCustomizer.java
@@ -26,7 +26,6 @@ import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
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.vpp.jvpp.VppBaseCallException;
import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterface;
import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterfaceReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
@@ -71,7 +70,8 @@ public class AclCustomizer extends FutureJVppCustomizer
}
@Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final IngressBuilder builder,
+ public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
+ @Nonnull final IngressBuilder builder,
@Nonnull final ReadContext ctx) throws ReadFailedException {
LOG.debug("Reading attributes for interface ACL: {}", id);
final InterfaceKey interfaceKey = id.firstKeyOf(Interface.class);
@@ -79,19 +79,16 @@ public class AclCustomizer extends FutureJVppCustomizer
final ClassifyTableByInterface request = new ClassifyTableByInterface();
request.swIfIndex = interfaceContext.getIndex(interfaceKey.getName(), ctx.getMappingContext());
- try {
- final ClassifyTableByInterfaceReply reply =
- getReplyForRead(getFutureJVpp().classifyTableByInterface(request).toCompletableFuture(), id);
- builder.setL2Acl(readL2Acl(reply.l2TableId, classifyTableContext, ctx.getMappingContext()));
- builder.setIp4Acl(readIp4Acl(reply.ip4TableId, classifyTableContext, ctx.getMappingContext()));
- builder.setIp6Acl(readIp6Acl(reply.ip6TableId, classifyTableContext, ctx.getMappingContext()));
+ final ClassifyTableByInterfaceReply reply =
+ getReplyForRead(getFutureJVpp().classifyTableByInterface(request).toCompletableFuture(), id);
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for ACL {} successfully read: {}", id, builder.build());
- }
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
+ builder.setL2Acl(readL2Acl(reply.l2TableId, classifyTableContext, ctx.getMappingContext()));
+ builder.setIp4Acl(readIp4Acl(reply.ip4TableId, classifyTableContext, ctx.getMappingContext()));
+ builder.setIp6Acl(readIp6Acl(reply.ip6TableId, classifyTableContext, ctx.getMappingContext()));
+
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Attributes for ACL {} successfully read: {}", id, builder.build());
}
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizer.java
index ad80f6ee2..de287cf67 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/acl/ingress/SubInterfaceAclCustomizer.java
@@ -27,7 +27,6 @@ import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager;
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.vpp.jvpp.VppBaseCallException;
import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterface;
import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterfaceReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
@@ -74,7 +73,8 @@ public class SubInterfaceAclCustomizer extends FutureJVppCustomizer
}
@Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id, @Nonnull final IngressBuilder builder,
+ public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ingress> id,
+ @Nonnull final IngressBuilder builder,
@Nonnull final ReadContext ctx) throws ReadFailedException {
LOG.debug("Reading attributes for sub-interface ACL: {}", id);
final InterfaceKey parentInterfacekey = id.firstKeyOf(Interface.class);
@@ -86,19 +86,16 @@ public class SubInterfaceAclCustomizer extends FutureJVppCustomizer
final ClassifyTableByInterface request = new ClassifyTableByInterface();
request.swIfIndex = interfaceContext.getIndex(subInterfaceName, ctx.getMappingContext());
- try {
- final ClassifyTableByInterfaceReply reply =
- getReplyForRead(getFutureJVpp().classifyTableByInterface(request).toCompletableFuture(), id);
- builder.setL2Acl(readL2Acl(reply.l2TableId, classifyTableContext, ctx.getMappingContext()));
- builder.setIp4Acl(readIp4Acl(reply.ip4TableId, classifyTableContext, ctx.getMappingContext()));
- builder.setIp6Acl(readIp6Acl(reply.ip6TableId, classifyTableContext, ctx.getMappingContext()));
+ final ClassifyTableByInterfaceReply reply =
+ getReplyForRead(getFutureJVpp().classifyTableByInterface(request).toCompletableFuture(), id);
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for ACL {} successfully read: {}", id, builder.build());
- }
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
+ builder.setL2Acl(readL2Acl(reply.l2TableId, classifyTableContext, ctx.getMappingContext()));
+ builder.setIp4Acl(readIp4Acl(reply.ip4TableId, classifyTableContext, ctx.getMappingContext()));
+ builder.setIp6Acl(readIp6Acl(reply.ip6TableId, classifyTableContext, ctx.getMappingContext()));
+
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Attributes for ACL {} successfully read: {}", id, builder.build());
}
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java
index bba2cf590..f07ef3d57 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java
@@ -23,11 +23,13 @@ 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.v3po.interfacesstate.ip.dump.AddressDumpExecutor;
import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.params.AddressDumpParams;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
+import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.List;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
@@ -39,9 +41,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev14061
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.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,14 +79,8 @@ public class Ipv4AddressCustomizer extends FutureJVppCustomizer
final String interfaceName = id.firstKeyOf(Interface.class).getName();
final int interfaceIndex = interfaceContext.getIndex(interfaceName, ctx.getMappingContext());
- final Optional<IpAddressDetailsReplyDump> dumpOptional;
- try {
- dumpOptional =
- dumpManager.getDump(CACHE_KEY, ctx.getModificationCache(),
- new AddressDumpParams(interfaceIndex, false));
- } catch (DumpExecutionFailedException e) {
- throw new ReadFailedException(id, e);
- }
+ final Optional<IpAddressDetailsReplyDump> dumpOptional = dumpManager
+ .getDump(id, CACHE_KEY, ctx.getModificationCache(), new AddressDumpParams(interfaceIndex, false));
if (!dumpOptional.isPresent() || dumpOptional.get().ipAddressDetails.isEmpty()) {
return;
@@ -115,14 +108,8 @@ public class Ipv4AddressCustomizer extends FutureJVppCustomizer
final String interfaceName = id.firstKeyOf(Interface.class).getName();
final int interfaceIndex = interfaceContext.getIndex(interfaceName, ctx.getMappingContext());
- final Optional<IpAddressDetailsReplyDump> dumpOptional;
- try {
- dumpOptional =
- dumpManager.getDump(CACHE_KEY, ctx.getModificationCache(),
- new AddressDumpParams(interfaceIndex, false));
- } catch (DumpExecutionFailedException e) {
- throw new ReadFailedException(id, e);
- }
+ final Optional<IpAddressDetailsReplyDump> dumpOptional = dumpManager
+ .getDump(id, CACHE_KEY, ctx.getModificationCache(), new AddressDumpParams(interfaceIndex, false));
return getAllIpv4AddressIds(dumpOptional, AddressKey::new);
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java
index 06682b641..234270883 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java
@@ -23,12 +23,14 @@ 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.v3po.interfacesstate.ip.dump.AddressDumpExecutor;
import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.params.AddressDumpParams;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
+import io.fd.vpp.jvpp.core.dto.IpAddressDetails;
+import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.List;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
@@ -41,9 +43,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan
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.IpAddressDetails;
-import io.fd.vpp.jvpp.core.dto.IpAddressDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -82,14 +81,8 @@ public class SubInterfaceIpv4AddressCustomizer extends FutureJVppCustomizer
final String subInterfaceName = getSubInterfaceName(id);
final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, ctx.getMappingContext());
- final Optional<IpAddressDetailsReplyDump> dumpOptional;
- try {
- dumpOptional = dumpManager
- .getDump(CACHE_KEY, ctx.getModificationCache(), new AddressDumpParams(subInterfaceIndex, false));
- } catch (DumpExecutionFailedException e) {
- throw new ReadFailedException(id, e);
- }
-
+ final Optional<IpAddressDetailsReplyDump> dumpOptional = dumpManager
+ .getDump(id, CACHE_KEY, ctx.getModificationCache(), new AddressDumpParams(subInterfaceIndex, false));
final Optional<IpAddressDetails> ipAddressDetails =
findIpAddressDetailsByIp(dumpOptional, id.firstKeyOf(Address.class).getIp());
@@ -113,13 +106,8 @@ public class SubInterfaceIpv4AddressCustomizer extends FutureJVppCustomizer
final String subInterfaceName = getSubInterfaceName(id);
final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, ctx.getMappingContext());
- final Optional<IpAddressDetailsReplyDump> dumpOptional;
- try {
- dumpOptional = dumpManager
- .getDump(CACHE_KEY, ctx.getModificationCache(), new AddressDumpParams(subInterfaceIndex, false));
- } catch (DumpExecutionFailedException e) {
- throw new ReadFailedException(id, e);
- }
+ final Optional<IpAddressDetailsReplyDump> dumpOptional = dumpManager
+ .getDump(id, CACHE_KEY, ctx.getModificationCache(), new AddressDumpParams(subInterfaceIndex, false));
return getAllIpv4AddressIds(dumpOptional, AddressKey::new);
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/AddressDumpExecutor.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/AddressDumpExecutor.java
index 20fda0405..764717db4 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/AddressDumpExecutor.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/AddressDumpExecutor.java
@@ -3,19 +3,16 @@ package io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump;
import static com.google.common.base.Preconditions.checkNotNull;
+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.v3po.interfacesstate.ip.dump.params.AddressDumpParams;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
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.IpAddressDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.IpAddressDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class AddressDumpExecutor
implements EntityDumpExecutor<IpAddressDetailsReplyDump, AddressDumpParams>, ByteDataTranslator,
@@ -28,20 +25,15 @@ public class AddressDumpExecutor
}
@Override
- public IpAddressDetailsReplyDump executeDump(final AddressDumpParams params) throws DumpExecutionFailedException {
+ @Nonnull
+ public IpAddressDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final AddressDumpParams params)
+ throws ReadFailedException {
checkNotNull(params, "Address dump params cannot be null");
IpAddressDump dumpRequest = new IpAddressDump();
dumpRequest.isIpv6 = booleanToByte(params.isIpv6());
dumpRequest.swIfIndex = params.getInterfaceIndex();
- try {
- return getReply(vppApi.ipAddressDump(dumpRequest).toCompletableFuture());
- } catch (TimeoutException e) {
- throw DumpTimeoutException
- .wrapTimeoutException("Dumping or addresses ended in timeout[params : ]" + params, e);
- } catch (VppBaseCallException e) {
- throw DumpCallFailedException.wrapFailedCallException("Dumping of addresses failed[params : ]" + params, e);
- }
+ return getReplyForRead(vppApi.ipAddressDump(dumpRequest).toCompletableFuture(), identifier);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java
index c6c92aa35..58c3549fc 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java
@@ -23,9 +23,11 @@ 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.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.BdIpMacAddDel;
+import io.fd.vpp.jvpp.core.dto.BdIpMacAddDelReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
@@ -34,10 +36,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.BdIpMacAddDel;
-import io.fd.vpp.jvpp.core.dto.BdIpMacAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,14 +62,9 @@ public class ArpTerminationTableEntryCustomizer extends FutureJVppCustomizer
@Nonnull final ArpTerminationTableEntry dataAfter,
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
- try {
- LOG.debug("Creating ARP termination table entry: {} {}", id, dataAfter);
- bdIpMacAddDel(id, dataAfter, writeContext, true);
- LOG.debug("L2 ARP termination table entry created successfully: {} {}", id, dataAfter);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to create ARP termination table entry: {} {}", id, dataAfter);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ LOG.debug("Creating ARP termination table entry: {} {}", id, dataAfter);
+ bdIpMacAddDel(id, dataAfter, writeContext, true);
+ LOG.debug("L2 ARP termination table entry created successfully: {} {}", id, dataAfter);
}
@Override
@@ -88,20 +81,14 @@ public class ArpTerminationTableEntryCustomizer extends FutureJVppCustomizer
@Nonnull final ArpTerminationTableEntry dataBefore,
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
- try {
- LOG.debug("Deleting ARP termination table entry entry: {} {}", id, dataBefore);
- bdIpMacAddDel(id, dataBefore, writeContext, false);
- LOG.debug("ARP termination table entry deleted successfully: {} {}", id, dataBefore);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to delete ARP termination table entry: {} {}", id, dataBefore);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ LOG.debug("Deleting ARP termination table entry entry: {} {}", id, dataBefore);
+ bdIpMacAddDel(id, dataBefore, writeContext, false);
+ LOG.debug("ARP termination table entry deleted successfully: {} {}", id, dataBefore);
}
private void bdIpMacAddDel(@Nonnull final InstanceIdentifier<ArpTerminationTableEntry> id,
@Nonnull final ArpTerminationTableEntry entry,
- final WriteContext writeContext, boolean isAdd)
- throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext, boolean isAdd) throws WriteFailedException {
final String bdName = id.firstKeyOf(BridgeDomain.class).getName();
final int bdId = bdContext.getIndex(bdName, writeContext.getMappingContext());
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java
index 1f704e727..327247b41 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java
@@ -25,18 +25,16 @@ 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.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDel;
+import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDelReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.GuardedBy;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDel;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,7 +57,7 @@ public class BridgeDomainCustomizer
private BridgeDomainAddDelReply addOrUpdateBridgeDomain(@Nonnull final InstanceIdentifier<BridgeDomain> id,
final int bdId, @Nonnull final BridgeDomain bd)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final BridgeDomainAddDelReply reply;
final BridgeDomainAddDel request = new BridgeDomainAddDel();
request.bdId = bdId;
@@ -86,27 +84,22 @@ public class BridgeDomainCustomizer
// Invoke 1. check index, 2. increase index 3. create ND 4. store mapping in a synchronized block to prevent
// race conditions in case of concurrent invocation
synchronized (this) {
- try {
- int index;
- if (bdContext.containsIndex(bdName, ctx.getMappingContext())) {
- index = bdContext.getIndex(bdName, ctx.getMappingContext());
- } else {
- // Critical section due to bridgeDomainIndexCounter read and write access
- // TODO HONEYCOMB-199 move this "get next available index" into naming context or an adapter
- // or a dedicated object
-
- // Use counter to assign bridge domain index, but still check naming context if it's not taken there
- while (bdContext.containsName(bridgeDomainIndexCounter, ctx.getMappingContext())) {
- bridgeDomainIndexCounter++;
- }
- index = bridgeDomainIndexCounter;
+ int index;
+ if (bdContext.containsIndex(bdName, ctx.getMappingContext())) {
+ index = bdContext.getIndex(bdName, ctx.getMappingContext());
+ } else {
+ // Critical section due to bridgeDomainIndexCounter read and write access
+ // TODO HONEYCOMB-199 move this "get next available index" into naming context or an adapter
+ // or a dedicated object
+
+ // Use counter to assign bridge domain index, but still check naming context if it's not taken there
+ while (bdContext.containsName(bridgeDomainIndexCounter, ctx.getMappingContext())) {
+ bridgeDomainIndexCounter++;
}
- addOrUpdateBridgeDomain(id, index, dataBefore);
- bdContext.addName(index, bdName, ctx.getMappingContext());
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to create bridge domain", e);
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
+ index = bridgeDomainIndexCounter;
}
+ addOrUpdateBridgeDomain(id, index, dataBefore);
+ bdContext.addName(index, bdName, ctx.getMappingContext());
}
}
@@ -118,17 +111,12 @@ public class BridgeDomainCustomizer
LOG.debug("deleteCurrentAttributes: id={}, dataBefore={}, ctx={}", id, dataBefore, ctx);
final String bdName = id.firstKeyOf(BridgeDomain.class).getName();
int bdId = bdContext.getIndex(bdName, ctx.getMappingContext());
- try {
- final BridgeDomainAddDel request = new BridgeDomainAddDel();
- request.bdId = bdId;
+ final BridgeDomainAddDel request = new BridgeDomainAddDel();
+ request.bdId = bdId;
- getReplyForWrite(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture(), id);
- LOG.debug("Bridge domain {} (id={}) deleted successfully", bdName, bdId);
- } catch (VppBaseCallException e) {
- LOG.warn("Bridge domain {} (id={}) delete failed", bdName, bdId);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ getReplyForWrite(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture(), id);
+ LOG.debug("Bridge domain {} (id={}) deleted successfully", bdName, bdId);
}
@Override
@@ -143,12 +131,7 @@ public class BridgeDomainCustomizer
checkArgument(bdName.equals(dataBefore.getName()),
"BridgeDomain name changed. It should be deleted and then created.");
- try {
- addOrUpdateBridgeDomain(id, bdContext.getIndex(bdName, ctx.getMappingContext()), dataAfter);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to create bridge domain", e);
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
+ addOrUpdateBridgeDomain(id, bdContext.getIndex(bdName, ctx.getMappingContext()), dataAfter);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java
index eb7247b1c..59198b58a 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java
@@ -24,9 +24,11 @@ import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.MacTranslator;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.L2FibAddDel;
+import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.L2FibFilter;
@@ -34,10 +36,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.L2FibAddDel;
-import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,14 +63,10 @@ public class L2FibEntryCustomizer extends FutureJVppCustomizer
public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id,
@Nonnull final L2FibEntry dataAfter, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
- try {
- LOG.debug("Creating L2 FIB entry: {} {}", id, dataAfter);
- l2FibAddDel(id, dataAfter, writeContext, true);
- LOG.debug("L2 FIB entry created successfully: {} {}", id, dataAfter);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to create L2 FIB entry: {} {}", id, dataAfter);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+
+ LOG.debug("Creating L2 FIB entry: {} {}", id, dataAfter);
+ l2FibAddDel(id, dataAfter, writeContext, true);
+ LOG.debug("L2 FIB entry created successfully: {} {}", id, dataAfter);
}
@Override
@@ -87,19 +81,14 @@ public class L2FibEntryCustomizer extends FutureJVppCustomizer
public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id,
@Nonnull final L2FibEntry dataBefore, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
- try {
- LOG.debug("Deleting L2 FIB entry: {} {}", id, dataBefore);
- l2FibAddDel(id, dataBefore, writeContext, false);
- LOG.debug("L2 FIB entry deleted successfully: {} {}", id, dataBefore);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to delete L2 FIB entry: {} {}", id, dataBefore);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+
+ LOG.debug("Deleting L2 FIB entry: {} {}", id, dataBefore);
+ l2FibAddDel(id, dataBefore, writeContext, false);
+ LOG.debug("L2 FIB entry deleted successfully: {} {}", id, dataBefore);
}
private void l2FibAddDel(@Nonnull final InstanceIdentifier<L2FibEntry> id, @Nonnull final L2FibEntry entry,
- final WriteContext writeContext, boolean isAdd)
- throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext, boolean isAdd) throws WriteFailedException {
final String bdName = id.firstKeyOf(BridgeDomain.class).getName();
final int bdId = bdContext.getIndex(bdName, writeContext.getMappingContext());
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java
index 2b7c62f6b..be9d0d953 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java
@@ -29,6 +29,10 @@ import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceDataTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
+import io.fd.vpp.jvpp.core.dto.ClassifySessionDetails;
+import io.fd.vpp.jvpp.core.dto.ClassifySessionDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.ClassifySessionDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -48,11 +52,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.clas
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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDetails;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -155,21 +154,18 @@ public class ClassifySessionReader extends FutureJVppCustomizer
final int tableId = classifyTableContext.getTableIndex(tableName, ctx.getMappingContext());
LOG.debug("Dumping classify sessions for classify table id={}", tableId);
- try {
- final ClassifySessionDump dumpRequest = new ClassifySessionDump();
- dumpRequest.tableId = tableId;
- classifySessionDump =
- getReplyForRead(getFutureJVpp().classifySessionDump(dumpRequest).toCompletableFuture(), id);
- if (classifySessionDump != null) {
- // update the cache:
- ctx.getModificationCache().put(cacheKey, classifySessionDump);
- }
+ final ClassifySessionDump dumpRequest = new ClassifySessionDump();
+ dumpRequest.tableId = tableId;
+ classifySessionDump =
+ getReplyForRead(getFutureJVpp().classifySessionDump(dumpRequest).toCompletableFuture(), id);
- return classifySessionDump;
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
+ if (classifySessionDump != null) {
+ // update the cache:
+ ctx.getModificationCache().put(cacheKey, classifySessionDump);
}
+
+ return classifySessionDump;
}
private static Optional<ClassifySessionDetails> findClassifySessionDetailsByMatch(
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReader.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReader.java
index c544d9c2d..96a174d8e 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReader.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableReader.java
@@ -28,6 +28,11 @@ import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceDataTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.MacTranslator;
+import io.fd.vpp.jvpp.core.dto.ClassifyTableIds;
+import io.fd.vpp.jvpp.core.dto.ClassifyTableIdsReply;
+import io.fd.vpp.jvpp.core.dto.ClassifyTableInfo;
+import io.fd.vpp.jvpp.core.dto.ClassifyTableInfoReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -42,12 +47,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.clas
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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableIds;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableIdsReply;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableInfo;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableInfoReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -99,39 +98,36 @@ public class ClassifyTableReader extends FutureJVppCustomizer
}
request.tableId = classifyTableContext.getTableIndex(tableName, ctx.getMappingContext());
- try {
- final ClassifyTableInfoReply reply =
- getReplyForRead(getFutureJVpp().classifyTableInfo(request).toCompletableFuture(), id);
-
- // mandatory values:
- builder.setName(tableName);
- builder.setKey(key);
- builder.setNbuckets(UnsignedInts.toLong(reply.nbuckets));
- builder.setSkipNVectors(UnsignedInts.toLong(reply.skipNVectors));
-
- // optional value read from context
- final Optional<String> tableBaseNode =
- classifyTableContext.getTableBaseNode(tableName, ctx.getMappingContext());
- if (tableBaseNode.isPresent()) {
- builder.setClassifierNode(new VppNodeName(tableBaseNode.get()));
- }
-
- builder.setMissNext(
- readVppNode(reply.tableId, reply.missNextIndex, classifyTableContext, ctx.getMappingContext(), LOG)
- .get());
- builder.setMask(new HexString(printHexBinary(reply.mask)));
- builder.setActiveSessions(UnsignedInts.toLong(reply.activeSessions));
-
- if (reply.nextTableIndex != ~0) {
- // next table index is present:
- builder.setNextTable(classifyTableContext.getTableName(reply.nextTableIndex, ctx.getMappingContext()));
- }
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("Attributes for classify table {} successfully read: {}", id, builder.build());
- }
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
+
+ final ClassifyTableInfoReply reply =
+ getReplyForRead(getFutureJVpp().classifyTableInfo(request).toCompletableFuture(), id);
+
+ // mandatory values:
+ builder.setName(tableName);
+ builder.setKey(key);
+ builder.setNbuckets(UnsignedInts.toLong(reply.nbuckets));
+ builder.setSkipNVectors(UnsignedInts.toLong(reply.skipNVectors));
+
+ // optional value read from context
+ final Optional<String> tableBaseNode =
+ classifyTableContext.getTableBaseNode(tableName, ctx.getMappingContext());
+ if (tableBaseNode.isPresent()) {
+ builder.setClassifierNode(new VppNodeName(tableBaseNode.get()));
+ }
+
+ builder.setMissNext(
+ readVppNode(reply.tableId, reply.missNextIndex, classifyTableContext, ctx.getMappingContext(), LOG)
+ .get());
+ builder.setMask(new HexString(printHexBinary(reply.mask)));
+ builder.setActiveSessions(UnsignedInts.toLong(reply.activeSessions));
+
+ if (reply.nextTableIndex != ~0) {
+ // next table index is present:
+ builder.setNextTable(classifyTableContext.getTableName(reply.nextTableIndex, ctx.getMappingContext()));
+ }
+
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Attributes for classify table {} successfully read: {}", id, builder.build());
}
}
@@ -140,21 +136,18 @@ public class ClassifyTableReader extends FutureJVppCustomizer
public List<ClassifyTableKey> getAllIds(@Nonnull final InstanceIdentifier<ClassifyTable> id,
@Nonnull final ReadContext context) throws ReadFailedException {
LOG.debug("Reading list of keys for classify tables: {}", id);
- try {
- final ClassifyTableIdsReply classifyTableIdsReply =
- getReplyForRead(getFutureJVpp().classifyTableIds(new ClassifyTableIds()).toCompletableFuture(),
- id);
- if (classifyTableIdsReply.ids != null) {
- return Arrays.stream(classifyTableIdsReply.ids).mapToObj(i -> {
- final String tableName = classifyTableContext.getTableName(i, context.getMappingContext());
- LOG.trace("Classify table with name: {} and index: {} found in VPP", tableName, i);
- return new ClassifyTableKey(tableName);
- }).collect(Collectors.toList());
- } else {
- return Collections.emptyList();
- }
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
+
+ final ClassifyTableIdsReply classifyTableIdsReply =
+ getReplyForRead(getFutureJVpp().classifyTableIds(new ClassifyTableIds()).toCompletableFuture(),
+ id);
+ if (classifyTableIdsReply.ids != null) {
+ return Arrays.stream(classifyTableIdsReply.ids).mapToObj(i -> {
+ final String tableName = classifyTableContext.getTableName(i, context.getMappingContext());
+ LOG.trace("Classify table with name: {} and index: {} found in VPP", tableName, i);
+ return new ClassifyTableKey(tableName);
+ }).collect(Collectors.toList());
+ } else {
+ return Collections.emptyList();
}
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java
index 2640d3e9e..a9cc7b1c9 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java
@@ -19,19 +19,19 @@ package io.fd.honeycomb.translate.v3po.vppclassifier;
import static com.google.common.base.Preconditions.checkArgument;
import io.fd.honeycomb.translate.MappingContext;
+import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.ReadTimeoutException;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.GetNextIndex;
+import io.fd.vpp.jvpp.core.dto.GetNextIndexReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.VppNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTable;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.GetNextIndex;
-import io.fd.vpp.jvpp.core.dto.GetNextIndexReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
abstract class VppNodeWriter extends FutureJVppCustomizer implements JvppReplyConsumer {
@@ -54,7 +54,7 @@ abstract class VppNodeWriter extends FutureJVppCustomizer implements JvppReplyCo
private int nodeNameToIndex(@Nonnull final ClassifyTable classifyTable, @Nonnull final String nextNodeName,
@Nonnull final VppClassifierContextManager vppClassifierContextManager,
@Nonnull final MappingContext ctx, @Nonnull final InstanceIdentifier<?> id)
- throws VppBaseCallException, WriteFailedException {
+ throws WriteFailedException {
checkArgument(classifyTable != null && classifyTable.getClassifierNode() != null,
"to use relative node names, table classifier node needs to be provided");
final GetNextIndex request = new GetNextIndex();
@@ -70,7 +70,7 @@ abstract class VppNodeWriter extends FutureJVppCustomizer implements JvppReplyCo
// vpp does not provide relative node index to node name conversion (https://jira.fd.io/browse/VPP-219)
// as a workaround we need to add mapping to vpp-classfier-context
vppClassifierContextManager.addNodeName(classifyTable.getName(), reply.nextIndex, nextNodeName, ctx);
- } catch (ReadTimeoutException e) {
+ } catch (ReadFailedException e) {
throw new WriteFailedException(id, String.format("Failed to get node index for %s relative to %s",
nextNodeName, classifyTable.getClassifierNode()), e);
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java
index f83bc9b89..f6db9bc84 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java
@@ -26,7 +26,10 @@ import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceDataTranslator;
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.honeycomb.translate.vpp.util.ReadTimeoutException;
+import io.fd.vpp.jvpp.core.dto.L2FibTableDump;
+import io.fd.vpp.jvpp.core.dto.L2FibTableEntry;
+import io.fd.vpp.jvpp.core.dto.L2FibTableEntryReplyDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -45,11 +48,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.L2FibTableDump;
-import io.fd.vpp.jvpp.core.dto.L2FibTableEntry;
-import io.fd.vpp.jvpp.core.dto.L2FibTableEntryReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -106,7 +104,7 @@ public final class L2FibEntryCustomizer extends FutureJVppCustomizer
@Nonnull
private List<L2FibTableEntry> dumpL2Fibs(final InstanceIdentifier<L2FibEntry> id, final int bdId)
- throws VppBaseCallException, ReadTimeoutException {
+ throws ReadFailedException {
final L2FibTableDump l2FibRequest = new L2FibTableDump();
l2FibRequest.bdId = bdId;
@@ -130,14 +128,10 @@ public final class L2FibEntryCustomizer extends FutureJVppCustomizer
final int bdId = bdContext.getIndex(bridgeDomainKey.getName(), ctx.getMappingContext());
LOG.debug("Reading L2 FIB for bridge domain {} (bdId={})", bridgeDomainKey, bdId);
- try {
- return dumpL2Fibs(id, bdId).stream()
- .map(entry -> new L2FibEntryKey(
- new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(entry.mac), 2))))
- .collect(Collectors.toList());
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
- }
+ return dumpL2Fibs(id, bdId).stream()
+ .map(entry -> new L2FibEntryKey(
+ new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(entry.mac), 2))))
+ .collect(Collectors.toList());
}
@Override
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java
index 86ab994b3..e4dec37fa 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java
@@ -22,6 +22,9 @@ import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
+import io.fd.vpp.jvpp.core.dto.ShowVersion;
+import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppStateBuilder;
@@ -30,10 +33,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.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.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ShowVersion;
-import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
public final class VersionCustomizer
extends FutureJVppCustomizer
@@ -57,18 +56,15 @@ public final class VersionCustomizer
@Override
public void readCurrentAttributes(@Nonnull InstanceIdentifier<Version> id, @Nonnull final VersionBuilder builder,
@Nonnull final ReadContext context) throws ReadFailedException {
- try {
- // Execute with timeout
- final CompletionStage<ShowVersionReply> showVersionFuture = getFutureJVpp().showVersion(new ShowVersion());
- final ShowVersionReply reply = getReplyForRead(showVersionFuture.toCompletableFuture(), id);
- builder.setBranch(toString(reply.version));
- builder.setName(toString(reply.program));
- builder.setBuildDate(toString(reply.buildDate));
- builder.setBuildDirectory(toString(reply.buildDirectory));
- } catch (VppBaseCallException e) {
- throw new ReadFailedException(id, e);
- }
+ // Execute with timeout
+ final CompletionStage<ShowVersionReply> showVersionFuture = getFutureJVpp().showVersion(new ShowVersion());
+ final ShowVersionReply reply = getReplyForRead(showVersionFuture.toCompletableFuture(), id);
+
+ builder.setBranch(toString(reply.version));
+ builder.setName(toString(reply.program));
+ builder.setBuildDate(toString(reply.buildDate));
+ builder.setBuildDirectory(toString(reply.buildDirectory));
}
}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java
index 4b7489f8e..ac0a003d8 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java
@@ -117,7 +117,7 @@ public class AclCustomizerTest extends WriterCustomizerTest {
try {
customizer.writeCurrentAttributes(id, acl, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verify(api).inputAclSetInterface(generateInputAclSetInterface((byte) 1, IF_INDEX, ACL_TABLE_INDEX));
return;
@@ -146,7 +146,7 @@ public class AclCustomizerTest extends WriterCustomizerTest {
try {
customizer.deleteCurrentAttributes(id, acl, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verify(api).inputAclSetInterface(generateInputAclSetInterface((byte) 0, IF_INDEX, ACL_TABLE_INDEX));
return;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java
index 7effc876e..3cedc4f71 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RewriteCustomizerTest.java
@@ -26,6 +26,10 @@ import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.vpp.util.TagRewriteOperation;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.VppInvocationException;
+import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewrite;
+import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewriteReply;
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
@@ -40,10 +44,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.l2.RewriteBuilder;
import org.opendaylight.yangtools.yang.binding.ChildOf;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewrite;
-import io.fd.vpp.jvpp.core.dto.L2InterfaceVlanTagRewriteReply;
public class RewriteCustomizerTest extends WriterCustomizerTest {
@@ -68,10 +68,10 @@ public class RewriteCustomizerTest extends WriterCustomizerTest {
private static InstanceIdentifier<Rewrite> getVlanTagRewriteId(final String name, final long index) {
final Class<ChildOf<? super SubInterface>> child = (Class) Rewrite.class;
final InstanceIdentifier id =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(name)).augmentation(
- SubinterfaceAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(index))
- .child(child);
+ InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(name)).augmentation(
+ SubinterfaceAugmentation.class).child(SubInterfaces.class)
+ .child(SubInterface.class, new SubInterfaceKey(index))
+ .child(child);
return id;
}
@@ -96,7 +96,7 @@ public class RewriteCustomizerTest extends WriterCustomizerTest {
*/
private void whenL2InterfaceVlanTagRewriteThenSuccess() {
doReturn(future(new L2InterfaceVlanTagRewriteReply())).when(api)
- .l2InterfaceVlanTagRewrite(any(L2InterfaceVlanTagRewrite.class));
+ .l2InterfaceVlanTagRewrite(any(L2InterfaceVlanTagRewrite.class));
}
/**
@@ -133,7 +133,7 @@ public class RewriteCustomizerTest extends WriterCustomizerTest {
try {
customizer.writeCurrentAttributes(VLAN_IID, vlanTagRewrite, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verify(api).l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, op));
return;
@@ -151,7 +151,7 @@ public class RewriteCustomizerTest extends WriterCustomizerTest {
customizer.updateCurrentAttributes(VLAN_IID, before, after, writeContext);
verify(api)
- .l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, TagRewriteOperation.pop_1));
+ .l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, TagRewriteOperation.pop_1));
}
@Test
@@ -163,10 +163,11 @@ public class RewriteCustomizerTest extends WriterCustomizerTest {
try {
customizer.updateCurrentAttributes(VLAN_IID, before, after, writeContext);
- } catch (WriteFailedException.UpdateFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verify(api)
- .l2InterfaceVlanTagRewrite(generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, TagRewriteOperation.pop_1));
+ .l2InterfaceVlanTagRewrite(
+ generateL2InterfaceVlanTagRewrite(VLAN_IF_INDEX, TagRewriteOperation.pop_1));
return;
}
fail("WriteFailedException.UpdateFailedException was expected");
@@ -187,7 +188,7 @@ public class RewriteCustomizerTest extends WriterCustomizerTest {
try {
customizer.deleteCurrentAttributes(VLAN_IID, null, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
+ } catch (WriteFailedException e) {
Assert.assertTrue(e.getCause() instanceof VppBaseCallException);
verifyL2InterfaceVlanTagRewriteDeleteWasInvoked();
return;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java
index 930e3d14f..6c7d05823 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java
@@ -59,7 +59,7 @@ public class RoutingCustomizerTest extends WriterCustomizerTest {
verify(api).swInterfaceSetTable(expectedRequest(vrfId));
}
- @Test(expected = WriteFailedException.CreateFailedException.class)
+ @Test(expected = WriteFailedException.class)
public void testWriteFailed() throws WriteFailedException {
when(api.swInterfaceSetTable(any())).thenReturn(failedFuture());
customizer.writeCurrentAttributes(IID, routing(213), writeContext);
@@ -72,7 +72,7 @@ public class RoutingCustomizerTest extends WriterCustomizerTest {
verifyZeroInteractions(api);
}
- @Test(expected = WriteFailedException.UpdateFailedException.class)
+ @Test(expected = WriteFailedException.class)
public void testUpdateFailed() throws WriteFailedException {
when(api.swInterfaceSetTable(any())).thenReturn(failedFuture());
customizer.updateCurrentAttributes(IID, routing(123L), routing(321L), writeContext);
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java
index f5ec496ef..e754ec9c1 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/SubInterfaceAclCustomizerTest.java
@@ -55,9 +55,9 @@ public class SubInterfaceAclCustomizerTest extends WriterCustomizerTest {
private static final int TABLE_INDEX = 123;
private static final InstanceIdentifier<Ingress> IID =
- InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)).augmentation(
- SubinterfaceAugmentation.class).child(SubInterfaces.class)
- .child(SubInterface.class, new SubInterfaceKey(SUBIF_ID)).child(Acl.class).child(Ingress.class);
+ InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)).augmentation(
+ SubinterfaceAugmentation.class).child(SubInterfaces.class)
+ .child(SubInterface.class, new SubInterfaceKey(SUBIF_ID)).child(Acl.class).child(Ingress.class);
@Mock
private VppClassifierContextManager classifyTableContext;
@@ -67,7 +67,7 @@ public class SubInterfaceAclCustomizerTest extends WriterCustomizerTest {
@Override
protected void setUp() throws Exception {
customizer = new SubInterfaceAclCustomizer(api, new NamingContext("prefix", IFC_TEST_INSTANCE),
- classifyTableContext);
+ classifyTableContext);
defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE);
defineMapping(mappingContext, SUBIF_NAME, SUBIF_INDEX, IFC_TEST_INSTANCE);
when(classifyTableContext.getTableIndex(TABLE_NAME, mappingContext)).thenReturn(TABLE_INDEX);
@@ -80,7 +80,7 @@ public class SubInterfaceAclCustomizerTest extends WriterCustomizerTest {
verify(api).inputAclSetInterface(expectedIp4AclRequest());
}
- @Test(expected = WriteFailedException.CreateFailedException.class)
+ @Test(expected = WriteFailedException.class)
public void testCreateFailed() throws WriteFailedException {
when(api.inputAclSetInterface(any())).thenReturn(failedFuture());
customizer.writeCurrentAttributes(IID, ip4Acl(), writeContext);
@@ -98,7 +98,7 @@ public class SubInterfaceAclCustomizerTest extends WriterCustomizerTest {
verify(api).inputAclSetInterface(expectedIp6AclRequest());
}
- @Test(expected = WriteFailedException.DeleteFailedException.class)
+ @Test(expected = WriteFailedException.class)
public void testDeleteFailed() throws WriteFailedException {
when(api.inputAclSetInterface(any())).thenReturn(failedFuture());
customizer.deleteCurrentAttributes(IID, ip4Acl(), writeContext);
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java
index dece4bfe8..4ece9228b 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java
@@ -28,6 +28,10 @@ import static org.mockito.Mockito.verify;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.VppInvocationException;
+import io.fd.vpp.jvpp.core.dto.BdIpMacAddDel;
+import io.fd.vpp.jvpp.core.dto.BdIpMacAddDelReply;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
@@ -41,10 +45,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.BdIpMacAddDel;
-import io.fd.vpp.jvpp.core.dto.BdIpMacAddDelReply;
public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest {
private static final String BD_CTX_NAME = "bd-test-instance";
@@ -66,8 +66,8 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest
public void setUp() throws Exception {
customizer = new ArpTerminationTableEntryCustomizer(api, new NamingContext("generatedBdName", BD_CTX_NAME));
- ipAddressRaw = new byte[] {1, 2, 3, 4};
- physAddressRaw = new byte[] {1, 2, 3, 4, 5, 6};
+ ipAddressRaw = new byte[]{1, 2, 3, 4};
+ physAddressRaw = new byte[]{1, 2, 3, 4, 5, 6};
physAddress = new PhysAddress("01:02:03:04:05:06");
ipAddress = new IpAddress(Ipv4AddressNoZone.getDefaultInstance("1.2.3.4"));
@@ -81,8 +81,8 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest
private static InstanceIdentifier<ArpTerminationTableEntry> getArpEntryId(final IpAddress ipAddress,
final PhysAddress physAddress) {
return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(BD_NAME))
- .child(ArpTerminationTable.class)
- .child(ArpTerminationTableEntry.class, new ArpTerminationTableEntryKey(ipAddress, physAddress));
+ .child(ArpTerminationTable.class)
+ .child(ArpTerminationTableEntry.class, new ArpTerminationTableEntryKey(ipAddress, physAddress));
}
private void whenBdIpMacAddDelThenSuccess() {
@@ -112,7 +112,7 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest
}
private void verifyBdIpMacAddDelWasInvoked(final BdIpMacAddDel expected) throws
- VppInvocationException {
+ VppInvocationException {
ArgumentCaptor<BdIpMacAddDel> argumentCaptor = ArgumentCaptor.forClass(BdIpMacAddDel.class);
verify(api).bdIpMacAddDel(argumentCaptor.capture());
final BdIpMacAddDel actual = argumentCaptor.getValue();
@@ -134,7 +134,7 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest
whenBdIpMacAddDelThenFailure();
try {
customizer.writeCurrentAttributes(id, entry, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verifyBdIpMacAddDelWasInvoked(generateBdIpMacAddDelRequest(ipAddressRaw, physAddressRaw, (byte) 1));
return;
@@ -145,8 +145,8 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest
@Test(expected = UnsupportedOperationException.class)
public void testUpdate() throws Exception {
customizer.updateCurrentAttributes(InstanceIdentifier.create(ArpTerminationTableEntry.class),
- mock(ArpTerminationTableEntry.class),
- mock(ArpTerminationTableEntry.class), writeContext);
+ mock(ArpTerminationTableEntry.class),
+ mock(ArpTerminationTableEntry.class), writeContext);
}
@Test
@@ -161,7 +161,7 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest
whenBdIpMacAddDelThenFailure();
try {
customizer.deleteCurrentAttributes(id, entry, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verifyBdIpMacAddDelWasInvoked(generateBdIpMacAddDelRequest(ipAddressRaw, physAddressRaw, (byte) 0));
return;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java
index 2ab921c90..b18273350 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java
@@ -27,6 +27,9 @@ import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.VppInvocationException;
+import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDel;
+import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDelReply;
import javax.annotation.Nullable;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.BridgeDomains;
@@ -35,9 +38,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDel;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDelReply;
public class BridgeDomainCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
@@ -155,7 +155,7 @@ public class BridgeDomainCustomizerTest extends WriterCustomizerTest implements
try {
customizer.writeCurrentAttributes(bdIdentifierForName(bdName), bd, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
+ } catch (WriteFailedException e) {
verifyBridgeDomainAddOrUpdateWasInvoked(bd, bdId);
return;
}
@@ -202,7 +202,7 @@ public class BridgeDomainCustomizerTest extends WriterCustomizerTest implements
try {
customizer.deleteCurrentAttributes(bdIdentifierForName(bdName), bd, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
+ } catch (WriteFailedException e) {
verifyBridgeDomainDeleteWasInvoked(bdId);
return;
}
@@ -265,10 +265,8 @@ public class BridgeDomainCustomizerTest extends WriterCustomizerTest implements
whenBridgeDomainAddDelThenFailure();
try {
- customizer
- .updateCurrentAttributes(bdIdentifierForName(bdName), bdBefore, bdAfter,
- writeContext);
- } catch (WriteFailedException.UpdateFailedException e) {
+ customizer.updateCurrentAttributes(bdIdentifierForName(bdName), bdBefore, bdAfter, writeContext);
+ } catch (WriteFailedException e) {
verifyBridgeDomainAddOrUpdateWasInvoked(bdAfter, bdId);
return;
}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java
index 4704ef084..d2ea4c32d 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizerTest.java
@@ -27,6 +27,10 @@ import static org.mockito.Mockito.verify;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.VppInvocationException;
+import io.fd.vpp.jvpp.core.dto.L2FibAddDel;
+import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
@@ -39,10 +43,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.dto.L2FibAddDel;
-import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply;
public class L2FibEntryCustomizerTest extends WriterCustomizerTest {
private static final String BD_CTX_NAME = "bd-test-instance";
@@ -141,7 +141,7 @@ public class L2FibEntryCustomizerTest extends WriterCustomizerTest {
try {
customizer.writeCurrentAttributes(id, entry, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verifyL2FibAddDelWasInvoked(generateL2FibAddDelRequest(address_vpp, (byte) 1));
return;
@@ -180,7 +180,7 @@ public class L2FibEntryCustomizerTest extends WriterCustomizerTest {
try {
customizer.deleteCurrentAttributes(id, entry, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verifyL2FibAddDelWasInvoked(generateL2FibAddDelRequest(address_vpp, (byte) 0));
return;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java
index b70ccf0f3..cb507b104 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionWriterTest.java
@@ -27,6 +27,9 @@ import static org.mockito.Mockito.when;
import com.google.common.base.Optional;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
+import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
@@ -41,9 +44,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.clas
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
public class ClassifySessionWriterTest extends WriterCustomizerTest {
@@ -81,13 +81,13 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest {
private static InstanceIdentifier<ClassifySession> getClassifySessionId(final String tableName,
final String match) {
return InstanceIdentifier.create(VppClassifier.class)
- .child(ClassifyTable.class, new ClassifyTableKey(tableName))
- .child(ClassifySession.class, new ClassifySessionKey(new HexString(match)));
+ .child(ClassifyTable.class, new ClassifyTableKey(tableName))
+ .child(ClassifySession.class, new ClassifySessionKey(new HexString(match)));
}
private void whenClassifyAddDelSessionThenSuccess() {
doReturn(future(new ClassifyAddDelSessionReply())).when(api)
- .classifyAddDelSession(any(ClassifyAddDelSession.class));
+ .classifyAddDelSession(any(ClassifyAddDelSession.class));
}
private void whenClassifyAddDelSessionThenFailure() {
@@ -103,8 +103,8 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest {
request.hitNextIndex = 0;
request.advance = 123;
request.match =
- new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
+ new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+ (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
return request;
}
@@ -131,7 +131,7 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest {
try {
customizer.writeCurrentAttributes(id, classifySession, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 1, TABLE_INDEX, SESSION_INDEX));
return;
@@ -154,8 +154,7 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest {
customizer.deleteCurrentAttributes(id, classifySession, writeContext);
- verify(api).classifyAddDelSession(
- generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX));
+ verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX));
}
@Test
@@ -168,10 +167,9 @@ public class ClassifySessionWriterTest extends WriterCustomizerTest {
try {
customizer.deleteCurrentAttributes(id, classifySession, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
- verify(api).classifyAddDelSession(
- generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX));
+ verify(api).classifyAddDelSession(generateClassifyAddDelSession((byte) 0, TABLE_INDEX, SESSION_INDEX));
return;
}
fail("WriteFailedException.DeleteFailedException was expected");
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java
index c8844e5cc..3c62c2d40 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifyTableWriterTest.java
@@ -26,6 +26,9 @@ import static org.mockito.Mockito.when;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
+import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
@@ -37,9 +40,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.clas
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
public class ClassifyTableWriterTest extends WriterCustomizerTest {
@@ -71,7 +71,7 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest {
private static InstanceIdentifier<ClassifyTable> getClassifyTableId(final String name) {
return InstanceIdentifier.create(VppClassifier.class)
- .child(ClassifyTable.class, new ClassifyTableKey(name));
+ .child(ClassifyTable.class, new ClassifyTableKey(name));
}
private void whenClassifyAddDelTableThenSuccess() {
@@ -99,8 +99,8 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest {
request.nextTableIndex = ~0;
request.missNextIndex = ~0;
request.mask =
- new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
+ new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+ (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
return request;
}
@@ -115,7 +115,7 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest {
verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 1));
verify(classifierContext)
- .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext);
+ .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext);
}
@Test
@@ -127,11 +127,11 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest {
try {
customizer.writeCurrentAttributes(id, classifyTable, writeContext);
- } catch (WriteFailedException.CreateFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 1));
verify(classifierContext, times(0))
- .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext);
+ .addTable(TABLE_INDEX, classifyTable.getName(), classifyTable.getClassifierNode(), mappingContext);
return;
}
fail("WriteFailedException.CreateFailedException was expected");
@@ -162,7 +162,7 @@ public class ClassifyTableWriterTest extends WriterCustomizerTest {
try {
customizer.deleteCurrentAttributes(id, classifyTable, writeContext);
- } catch (WriteFailedException.DeleteFailedException e) {
+ } catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof VppBaseCallException);
verify(api).classifyAddDelTable(generateClassifyAddDelTable((byte) 0, TABLE_INDEX));
return;
diff --git a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/JvppDumpExecutorTest.java b/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/JvppDumpExecutorTest.java
index da1600f2f..500c31387 100644
--- a/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/JvppDumpExecutorTest.java
+++ b/vpp-common/vpp-translate-test/src/main/java/io/fd/honeycomb/vpp/test/read/JvppDumpExecutorTest.java
@@ -24,6 +24,8 @@ import static org.mockito.Mockito.when;
import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
import io.fd.honeycomb.vpp.test.util.FutureProducer;
+import io.fd.vpp.jvpp.VppInvocationException;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
@@ -31,8 +33,6 @@ import java.util.concurrent.TimeoutException;
import org.junit.Before;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import io.fd.vpp.jvpp.VppInvocationException;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
/**
* Generic test for implementation of {@link EntityDumpExecutor}
@@ -78,9 +78,7 @@ public abstract class JvppDumpExecutorTest<T extends EntityDumpExecutor<?, ?>> i
* while performing desired method
*/
protected FutureJVppCore doThrowFailExceptionWhen() {
- return doReturn(failedFuture(
- new VppInvocationException("Exception invoked by " + JvppDumpExecutorTest.class.getName(), -1)))
- .when(api);
+ return doReturn(failedFuture()).when(api);
}
/**
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumer.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumer.java
index 9fb04c618..9e85c5d8b 100644
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumer.java
+++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/JvppReplyConsumer.java
@@ -18,15 +18,18 @@ package io.fd.honeycomb.translate.vpp.util;
import static com.google.common.base.Preconditions.checkArgument;
+import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.VppBaseCallException;
+import io.fd.vpp.jvpp.dto.JVppReply;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.dto.JVppReply;
/**
* Trait providing logic for consuming reply's to jvpp api calls
@@ -35,18 +38,112 @@ public interface JvppReplyConsumer {
int DEFAULT_TIMEOUT_IN_SECONDS = 5;
+ /**
+ * Consumes reply for jvpp call representing any write operation
+ * Should be used in case of calls where it's not clear which write crud operation respective
+ * call represents, for ex. setRouting
+ */
default <REP extends JVppReply<?>> REP getReplyForWrite(@Nonnull Future<REP> future,
@Nonnull final InstanceIdentifier<?> replyType)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
return getReplyForWrite(future, replyType, DEFAULT_TIMEOUT_IN_SECONDS);
}
+ /**
+ * Consumes reply for jvpp call representing any write operation
+ * Should be used in case of calls where it's not clear which write crud operation respective
+ * call represents, for ex. setRouting
+ */
default <REP extends JVppReply<?>> REP getReplyForWrite(@Nonnull Future<REP> future,
@Nonnull final InstanceIdentifier<?> replyType,
@Nonnegative final int timeoutInSeconds)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
+ try {
+ return getReply(future, timeoutInSeconds);
+ } catch (TimeoutException e) {
+ throw new WriteTimeoutException(replyType, e);
+ } catch (VppBaseCallException e) {
+ throw new WriteFailedException(replyType, e);
+ }
+
+ }
+
+ /**
+ * Consumes reply for jvpp call representing create operation
+ */
+ default <REP extends JVppReply<?>> REP getReplyForCreate(@Nonnull Future<REP> future,
+ @Nonnull final InstanceIdentifier<?> replyType,
+ @Nonnull final DataObject data)
+ throws WriteFailedException {
+ return getReplyForCreate(future, replyType, data, DEFAULT_TIMEOUT_IN_SECONDS);
+ }
+
+ /**
+ * Consumes reply for jvpp call representing create operation
+ */
+ default <REP extends JVppReply<?>> REP getReplyForCreate(@Nonnull Future<REP> future,
+ @Nonnull final InstanceIdentifier<?> replyType,
+ @Nonnull final DataObject data,
+ @Nonnegative final int timeoutInSeconds)
+ throws WriteFailedException {
+ try {
+ return getReply(future, timeoutInSeconds);
+ } catch (VppBaseCallException e) {
+ throw new WriteFailedException.CreateFailedException(replyType, data, e);
+ } catch (TimeoutException e) {
+ throw new WriteTimeoutException(replyType, e);
+ }
+ }
+
+ /**
+ * Consumes reply for jvpp call representing update operation
+ */
+ default <REP extends JVppReply<?>> REP getReplyForUpdate(@Nonnull Future<REP> future,
+ @Nonnull final InstanceIdentifier<?> replyType,
+ @Nonnull final DataObject dataBefore,
+ @Nonnull final DataObject dataAfter)
+ throws WriteFailedException {
+ return getReplyForUpdate(future, replyType, dataBefore, dataAfter, DEFAULT_TIMEOUT_IN_SECONDS);
+ }
+
+ /**
+ * Consumes reply for jvpp call representing update operation
+ */
+ default <REP extends JVppReply<?>> REP getReplyForUpdate(@Nonnull Future<REP> future,
+ @Nonnull final InstanceIdentifier<?> replyType,
+ @Nonnull final DataObject dataBefore,
+ @Nonnull final DataObject dataAfter,
+ @Nonnegative final int timeoutInSeconds)
+ throws WriteFailedException {
+ try {
+ return getReply(future, timeoutInSeconds);
+ } catch (VppBaseCallException e) {
+ throw new WriteFailedException.UpdateFailedException(replyType, dataBefore, dataAfter, e);
+ } catch (TimeoutException e) {
+ throw new WriteTimeoutException(replyType, e);
+ }
+ }
+
+ /**
+ * Consumes reply for jvpp call representing delete operation
+ */
+ default <REP extends JVppReply<?>> REP getReplyForDelete(@Nonnull Future<REP> future,
+ @Nonnull final InstanceIdentifier<?> replyType)
+ throws WriteFailedException {
+ return getReplyForDelete(future, replyType, DEFAULT_TIMEOUT_IN_SECONDS);
+ }
+
+ /**
+ * Consumes reply for jvpp call representing delete operation
+ */
+ default <REP extends JVppReply<?>> REP getReplyForDelete(@Nonnull Future<REP> future,
+ @Nonnull final InstanceIdentifier<?> replyType,
+ @Nonnegative final int timeoutInSeconds)
+ throws WriteFailedException {
try {
return getReply(future, timeoutInSeconds);
+ } catch (VppBaseCallException e) {
+ throw new WriteFailedException.DeleteFailedException(replyType, e);
} catch (TimeoutException e) {
throw new WriteTimeoutException(replyType, e);
}
@@ -54,18 +151,20 @@ public interface JvppReplyConsumer {
default <REP extends JVppReply<?>> REP getReplyForRead(@Nonnull Future<REP> future,
@Nonnull final InstanceIdentifier<?> replyType)
- throws VppBaseCallException, ReadTimeoutException {
+ throws ReadFailedException {
return getReplyForRead(future, replyType, DEFAULT_TIMEOUT_IN_SECONDS);
}
default <REP extends JVppReply<?>> REP getReplyForRead(@Nonnull Future<REP> future,
@Nonnull final InstanceIdentifier<?> replyType,
@Nonnegative final int timeoutInSeconds)
- throws VppBaseCallException, ReadTimeoutException {
+ throws ReadFailedException {
try {
return getReply(future, timeoutInSeconds);
} catch (TimeoutException e) {
throw new ReadTimeoutException(replyType, e);
+ } catch (VppBaseCallException e) {
+ throw new ReadFailedException(replyType, e);
}
}
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/cache/DumpCacheManagerTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/cache/DumpCacheManagerTest.java
index 0d7702bc0..ac7dcece0 100644
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/cache/DumpCacheManagerTest.java
+++ b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/vpp/util/cache/DumpCacheManagerTest.java
@@ -22,16 +22,17 @@ import static org.mockito.Mockito.when;
import com.google.common.base.Optional;
import io.fd.honeycomb.translate.ModificationCache;
+import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
import io.fd.honeycomb.translate.util.read.cache.EntityDumpPostProcessingFunction;
-import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException;
+import io.fd.vpp.jvpp.core.dto.IpDetails;
+import io.fd.vpp.jvpp.core.dto.IpDetailsReplyDump;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import io.fd.vpp.jvpp.core.dto.IpDetails;
-import io.fd.vpp.jvpp.core.dto.IpDetailsReplyDump;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class DumpCacheManagerTest {
@@ -40,6 +41,9 @@ public class DumpCacheManagerTest {
@Mock
private EntityDumpExecutor<IpDetailsReplyDump, Void> executor;
+ @Mock
+ private InstanceIdentifier identifier;
+
private DumpCacheManager<IpDetailsReplyDump, Void> managerPositive;
private DumpCacheManager<IpDetailsReplyDump, Void> managerPositiveWithPostProcessing;
private DumpCacheManager<IpDetailsReplyDump, Void> managerNegative;
@@ -70,13 +74,13 @@ public class DumpCacheManagerTest {
* This test verify full dump-caching cycle
*/
@Test
- public void testCaching() throws DumpExecutionFailedException {
+ public void testCaching() throws ReadFailedException {
final IpDetailsReplyDump stage1Data = new IpDetailsReplyDump();
// executor cant return null data
- when(executor.executeDump(NO_PARAMS)).thenReturn(new IpDetailsReplyDump());
+ when(executor.executeDump(identifier, NO_PARAMS)).thenReturn(new IpDetailsReplyDump());
- final Optional<IpDetailsReplyDump> stage1Optional = managerNegative.getDump(KEY, cache, NO_PARAMS);
+ final Optional<IpDetailsReplyDump> stage1Optional = managerNegative.getDump(identifier, KEY, cache, NO_PARAMS);
// this is first call so instance should be from executor
// and it should be cached after calling executor
@@ -87,33 +91,34 @@ public class DumpCacheManagerTest {
//rebind executor with other data
IpDetailsReplyDump stage2LoadedDump = new IpDetailsReplyDump();
- when(executor.executeDump(NO_PARAMS)).thenReturn(stage2LoadedDump);
+ when(executor.executeDump(identifier, NO_PARAMS)).thenReturn(stage2LoadedDump);
- final Optional<IpDetailsReplyDump> stage2Optional = managerPositive.getDump(KEY, cache, NO_PARAMS);
+ final Optional<IpDetailsReplyDump> stage2Optional = managerPositive.getDump(identifier, KEY, cache, NO_PARAMS);
assertEquals(true, stage2Optional.isPresent());
assertEquals(stage2LoadedDump, stage2Optional.get());
//rebind executor with other data
IpDetailsReplyDump stage3LoadedDump = new IpDetailsReplyDump();
- when(executor.executeDump(NO_PARAMS)).thenReturn(stage3LoadedDump);
+ when(executor.executeDump(identifier, NO_PARAMS)).thenReturn(stage3LoadedDump);
- final Optional<IpDetailsReplyDump> stage3Optional = managerPositive.getDump(KEY, cache, NO_PARAMS);
+ final Optional<IpDetailsReplyDump> stage3Optional = managerPositive.getDump(identifier, KEY, cache, NO_PARAMS);
assertEquals(true, stage3Optional.isPresent());
//check if it returns instance cached from previous stage
assertEquals(stage2LoadedDump, stage3Optional.get());
}
@Test
- public void testPostprocessing() throws DumpExecutionFailedException {
+ public void testPostprocessing() throws ReadFailedException {
IpDetailsReplyDump dump = new IpDetailsReplyDump();
IpDetails details = new IpDetails();
details.swIfIndex = 2;
dump.ipDetails.add(details);
- when(executor.executeDump(null)).thenReturn(dump);
+ when(executor.executeDump(identifier, null)).thenReturn(dump);
- Optional<IpDetailsReplyDump> optionalDump = managerPositiveWithPostProcessing.getDump(KEY, cache, NO_PARAMS);
+ Optional<IpDetailsReplyDump> optionalDump =
+ managerPositiveWithPostProcessing.getDump(identifier, KEY, cache, NO_PARAMS);
assertEquals(true, optionalDump.isPresent());
assertEquals(1, optionalDump.get().ipDetails.size());