diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2016-10-06 08:54:02 +0200 |
---|---|---|
committer | Jan Srnicek <jsrnicek@cisco.com> | 2016-10-06 08:54:02 +0200 |
commit | 8c9c430823aa19912a55b0a6ccfcbbb6a1bc028d (patch) | |
tree | 1e5aa752236ada01009a353cf34eb6b7706e65fc /nsh | |
parent | 15f481bc86adfd879e0e0d001ef3dd0939aa3649 (diff) |
HONEYCOMB-236 - Unified read/write exceptions
Change-Id: Idde761d0c0c2c4d96555ef94dbdaa87fad889493
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'nsh')
4 files changed, 137 insertions, 170 deletions
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()); } } |