summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-09-02 13:40:53 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-09-05 11:38:47 +0000
commit3fd4162137ecfc8b7efc722d2171e9c62f9d4230 (patch)
tree03783a344271b72918d01ae5ea55552ed99ec4ad /lisp/lisp2vpp
parentfa78239a1060643ce3e1914f741e0a41928f525c (diff)
HONEYCOMB-146 : Unable to create adjacencies in Lisp
Fixed setting of prefix lenghts for Eid's Change-Id: I78dd4672f8b3227cc09c4d01abce537a67b8913a Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp')
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java3
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidConverter.java8
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java13
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;