summaryrefslogtreecommitdiffstats
path: root/lisp
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 09:29:25 +0000
commit3dc622d14a76b41f588eccff86b6566d7a145e56 (patch)
tree40ed6338381496a5b914763ce8273c804350d938 /lisp
parentf51020f3e23de8a15a98ab61da2a25c43b19a963 (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')
-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);
}
}