summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/main
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-11-23 10:27:35 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-11-23 10:27:45 +0100
commit51cca1f14d8d6e49263cbf19afe42cebfa3002a6 (patch)
treeaabcc27d53df478bb0aed9f2ffc9587dfe9bfe9c /lisp/lisp2vpp/src/main
parentb1f0c71b032eb17d8cac1c5324745b759c2da87f (diff)
Do not consume ReadFailedException in RemoteMappingCustomizer
Also fixes other issues found by static analysis (unecessary boxing, formatitng). Change-Id: I063ccf4334ebdecf944ca1470e677c95a0fd0bdd Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp/src/main')
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java21
1 files changed, 9 insertions, 12 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java
index 602192cb2..25626b0f6 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java
@@ -83,7 +83,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Customizer for reading {@code RemoteMapping}<br>
+ * Customizer for reading {@code RemoteMapping}.
*/
public class RemoteMappingCustomizer extends FutureJVppCustomizer
implements InitializingListReaderCustomizer<RemoteMapping, RemoteMappingKey, RemoteMappingBuilder>,
@@ -150,7 +150,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
final long vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier();
final Eid eid = copyEid(remoteMappingContext.getEid(mappingId, ctx.getMappingContext()));
final MappingsDumpParams dumpParams = new MappingsDumpParamsBuilder()
- .setVni(Long.valueOf(vni).intValue())
+ .setVni((int) vni)
.setEidSet(QuantityType.SPECIFIC)
.setEidType(getEidType(eid))
.setEid(getEidAsByteArray(eid))
@@ -216,7 +216,8 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
.stream()
.filter(a -> a.vni == vni)
.filter(subtableFilterForRemoteMappings(id))
- .map(detail -> getArrayAsEidRemote(valueOf(detail.eidType), detail.eid, detail.eidPrefixLen, detail.vni))
+ .map(detail ->
+ getArrayAsEidRemote(valueOf(detail.eidType), detail.eid, detail.eidPrefixLen, detail.vni))
.map(remoteEid -> remoteMappingContext.getId(remoteEid, context.getMappingContext()))
.map(MappingId::new)
.map(RemoteMappingKey::new)
@@ -244,14 +245,8 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
.child(LocatorSet.class,
new LocatorSetKey(locatorSetContext.getName(details.locatorSetIndex, mappingContext)))
.child(Interface.class);
- try {
- reply = locatorsDumpManager.getDump(locatorIfaceIdentifier, cache,
- new LocatorDumpParamsBuilder().setLocatorSetIndex(details.locatorSetIndex).build());
- } catch (ReadFailedException e) {
- throw new ReadFailedException(id,
- new IllegalStateException("Unable to resolve Positive/Negative mapping for RemoteMapping",
- e.getCause()));
- }
+ reply = locatorsDumpManager.getDump(locatorIfaceIdentifier, cache,
+ new LocatorDumpParamsBuilder().setLocatorSetIndex(details.locatorSetIndex).build());
bindPositiveMapping(builder, reply.or(new OneLocatorDetailsReplyDump()));
}
@@ -292,7 +287,9 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
@Nonnull
@Override
- public Initialized<? extends DataObject> init(@Nonnull InstanceIdentifier<RemoteMapping> instanceIdentifier, @Nonnull RemoteMapping remoteMapping, @Nonnull ReadContext readContext) {
+ public Initialized<? extends DataObject> init(@Nonnull InstanceIdentifier<RemoteMapping> instanceIdentifier,
+ @Nonnull RemoteMapping remoteMapping,
+ @Nonnull ReadContext readContext) {
return Initialized.create(remoteMappingPath(instanceIdentifier), remoteMapping);
}
}