diff options
3 files changed, 17 insertions, 7 deletions
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 0381df05d..8762066d2 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 @@ -139,7 +139,8 @@ public class LocalMappingCustomizer RWUtils.singleItemCollector()); //in case of local mappings,locator_set_index stands for interface index - checkState(locatorSetContext.containsName(details.locatorSetIndex, ctx.getMappingContext())); + checkState(locatorSetContext.containsName(details.locatorSetIndex, ctx.getMappingContext()), + "No Locator Set name found for index %s", details.locatorSetIndex); builder.setLocatorSet(locatorSetContext.getName(details.locatorSetIndex, ctx.getMappingContext())); builder.setKey(new LocalMappingKey(new MappingId(id.firstKeyOf(LocalMapping.class).getId()))); builder.setEid(getArrayAsEidLocal(valueOf(details.eidType), details.eid)); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidConverter.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidConverter.java index 4c8fa691b..39d0fe7f0 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidConverter.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidConverter.java @@ -50,6 +50,14 @@ public final class EidConverter { throw new UnsupportedOperationException("Cannot instantiate utility class " + EidConverter.class.getName()); } + public static byte getPrefixLength(LocalEid address) { + return resolverPrefixLength(address.getAddress()); + } + + public static byte getPrefixLength(RemoteEid address) { + return resolverPrefixLength(address.getAddress()); + } + public static byte getPrefixLength( org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid address) { return resolverPrefixLength(address.getAddress()); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java index d321510be..3eedf295d 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java @@ -20,6 +20,7 @@ package io.fd.honeycomb.lisp.translate.write; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType; +import static io.fd.honeycomb.lisp.translate.util.EidConverter.*; import io.fd.honeycomb.lisp.translate.util.EidConverter; import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; @@ -80,8 +81,8 @@ public class AdjacencyCustomizer extends FutureJVppCustomizer implements ListWri checkState(id.firstKeyOf(VniTable.class) != null, "Unable to find parent VNI for {}", id); final int vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue(); - EidType localEidType = EidConverter.getEidType(data.getLocalEid()); - EidType remoteEidType = EidConverter.getEidType(data.getRemoteEid()); + EidType localEidType = getEidType(data.getLocalEid()); + EidType remoteEidType = getEidType(data.getRemoteEid()); checkArgument(localEidType == remoteEidType, "Local[%s] and Remote[%s] eid types must be the same", localEidType, remoteEidType); @@ -89,10 +90,10 @@ public class AdjacencyCustomizer extends FutureJVppCustomizer implements ListWri LispAddDelAdjacency request = new LispAddDelAdjacency(); request.isAdd = TranslateUtils.booleanToByte(add); - request.seid = EidConverter.getEidAsByteArray(data.getLocalEid()); - request.seidLen = (byte) request.seid.length; - request.deid = EidConverter.getEidAsByteArray(data.getRemoteEid()); - request.seidLen = (byte) request.deid.length; + request.seid = getEidAsByteArray(data.getLocalEid()); + request.seidLen = getPrefixLength(data.getLocalEid()); + request.deid = getEidAsByteArray(data.getRemoteEid()); + request.deidLen = getPrefixLength(data.getRemoteEid()); request.eidType = (byte) localEidType.getValue(); request.vni = vni; |