summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/lisp2vpp/src/main/java/io')
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java23
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java7
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java11
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java13
4 files changed, 43 insertions, 11 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 8762066d2..28c09c95a 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
@@ -154,11 +154,19 @@ public class LocalMappingCustomizer
throws ReadFailedException {
checkState(id.firstKeyOf(VniTable.class) != null, "Parent VNI table not specified");
+ final long vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier();
+
+ if (vni == 0) {
+ // ignoring default vni mapping
+ // its not relevant for us and we also don't store mapping for such eid's
+ // such mapping is used to create helper local mappings to process remote ones
+ return Collections.emptyList();
+ }
//request for all local mappings
final MappingsDumpParams dumpParams = new MappingsDumpParamsBuilder()
- .setVni(Long.valueOf(id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier()).intValue())
.setFilter(FilterType.LOCAL)
+
.setEidSet(QuantityType.ALL)
.build();
@@ -172,11 +180,14 @@ public class LocalMappingCustomizer
if (replyOptional.isPresent()) {
LOG.debug("Valid dump loaded");
- return replyOptional.get().lispEidTableDetails.stream().map(a -> new LocalMappingKey(
- new MappingId(
- localMappingContext.getId(
- getArrayAsEidLocal(valueOf(a.eidType), a.eid),
- context.getMappingContext()))))
+ return replyOptional.get().lispEidTableDetails.stream()
+ //filtering with vni to skip help local mappings that are created in vpp to handle remote mappings(vpp feature)
+ .filter(a -> a.vni == vni)
+ .map(a -> new LocalMappingKey(
+ new MappingId(
+ localMappingContext.getId(
+ getArrayAsEidLocal(valueOf(a.eidType), a.eid),
+ context.getMappingContext()))))
.collect(Collectors.toList());
} else {
LOG.debug("No data dumped");
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
index f03a72937..60ef1f2dc 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
@@ -18,6 +18,7 @@ package io.fd.honeycomb.lisp.translate.read;
import static io.fd.honeycomb.translate.v3po.util.TranslateUtils.arrayToIpAddress;
import static io.fd.honeycomb.translate.v3po.util.TranslateUtils.byteToBoolean;
+import static io.fd.honeycomb.translate.v3po.util.TranslateUtils.reverseAddress;
import static io.fd.honeycomb.translate.v3po.util.cache.EntityDumpExecutor.NO_PARAMS;
import com.google.common.base.Optional;
@@ -85,13 +86,15 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
}
final MapResolverKey key = id.firstKeyOf(MapResolver.class);
- final IpAddress address = key.getIpAddress();
+ //revert searched key to match vpp's reversed order ip's
+ final IpAddress address = reverseAddress(key.getIpAddress());
final LispMapResolverDetailsReplyDump dump = dumpOptional.get();
//cannot use RWUtils.singleItemCollector(),there is some problem with generic params binding
java.util.Optional<LispMapResolverDetails> mapResolverOptional =
dump.lispMapResolverDetails.stream()
- .filter(a -> address.equals(arrayToIpAddress(byteToBoolean(a.isIpv6), a.ipAddress)))
+ .filter(a -> address
+ .equals(arrayToIpAddress(byteToBoolean(a.isIpv6), a.ipAddress)))
.findFirst();
if (mapResolverOptional.isPresent()) {
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
index 81405ecec..b6327c2ba 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
@@ -115,6 +115,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
.setEidType(EidConverter.getEidType(eid))
.setEid(EidConverter.getEidAsByteArray(eid))
.setPrefixLength(EidConverter.getPrefixLength(eid))
+ .setFilter(FilterType.REMOTE)
.build();
LOG.debug("Dumping data for LocalMappings(id={})", id);
@@ -158,10 +159,17 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
throws ReadFailedException {
checkState(id.firstKeyOf(VniTable.class) != null, "Parent VNI table not specified");
+ final int vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue();
+
+ if (vni == 0) {
+ // ignoring default vni mapping
+ // its not relevant for us and we also don't store mapping for such eid's
+ // such mapping is used to create helper local mappings to process remote ones
+ return Collections.emptyList();
+ }
//requesting all remote with specific vni
final MappingsDumpParams dumpParams = new MappingsDumpParamsBuilder()
- .setVni(Long.valueOf(id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier()).intValue())
.setEidSet(QuantityType.ALL)
.setFilter(FilterType.REMOTE)
.build();
@@ -179,6 +187,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
return replyOptional.get()
.lispEidTableDetails
.stream()
+ .filter(a -> a.vni == vni)
.map(detail -> new RemoteMappingKey(
new MappingId(
remoteMappingContext.getId(
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java
index c2db3b845..fdb9cf3ab 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java
@@ -17,6 +17,7 @@
package io.fd.honeycomb.lisp.translate.write;
import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
import static io.fd.honeycomb.translate.v3po.util.TranslateUtils.getReply;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -35,10 +36,12 @@ import io.fd.honeycomb.translate.v3po.util.cache.exceptions.execution.DumpExecut
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import java.io.UnsupportedEncodingException;
+import java.util.List;
import java.util.concurrent.TimeoutException;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.LocatorSet;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.LocatorSetKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.locator.sets.grouping.locator.sets.locator.set.Interface;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.openvpp.jvpp.VppBaseCallException;
import org.openvpp.jvpp.core.dto.LispAddDelLocatorSet;
@@ -76,8 +79,9 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
final String locatorSetName = dataAfter.getName();
checkNotNull(locatorSetName, "LocatorSet name is null");
-
- //TODO check and fill mapping when api returns index of created locator set
+ checkState(isNonEmptyLocatorSet(writeContext.readAfter(id).get()),
+ "Creating empty locator-sets is not allowed");
+ // TODO VPP-323 check and fill mapping when api returns index of created locator set
// checkState(!locatorSetContext.containsIndex(locatorSetName, writeContext.getMappingContext()),
// "Locator set with name %s allready defined", locatorSetName);
@@ -98,6 +102,11 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
}
}
+ private boolean isNonEmptyLocatorSet(final LocatorSet locatorSet) {
+ final List<Interface> locators = locatorSet.getInterface();
+ return locators != null && !locators.isEmpty();
+ }
+
@Override
public void updateCurrentAttributes(@Nonnull InstanceIdentifier<LocatorSet> id,
@Nonnull LocatorSet dataBefore,