summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-09-06 13:13:12 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-09-07 06:48:58 +0000
commit6e77db8e850be8ad8a3d91bf43fb8986125ae60f (patch)
tree488440e944652486f9bd6b4ec390f2d69d6fa42b /lisp/lisp2vpp
parentd4219420d9f88498b817dcaf0045a6c3afcebdff (diff)
Map resolver filtering fixed
Change-Id: I8876627d4d5e1cb9bf2024cbaba55335724049d3 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/MapResolverCustomizer.java18
1 files changed, 11 insertions, 7 deletions
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 0b1269648..f03a72937 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
@@ -16,6 +16,8 @@
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.cache.EntityDumpExecutor.NO_PARAMS;
import com.google.common.base.Optional;
@@ -25,12 +27,12 @@ import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.translate.v3po.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.v3po.util.TranslateUtils;
import io.fd.honeycomb.translate.v3po.util.cache.DumpCacheManager;
import io.fd.honeycomb.translate.v3po.util.cache.exceptions.execution.DumpExecutionFailedException;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.MapResolversBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.map.resolvers.MapResolver;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.map.resolvers.grouping.map.resolvers.MapResolverBuilder;
@@ -82,19 +84,22 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
return;
}
- MapResolverKey key = id.firstKeyOf(MapResolver.class);
- LispMapResolverDetailsReplyDump dump = dumpOptional.get();
+ final MapResolverKey key = id.firstKeyOf(MapResolver.class);
+ final IpAddress address = 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(key::equals).findFirst();
+ dump.lispMapResolverDetails.stream()
+ .filter(a -> address.equals(arrayToIpAddress(byteToBoolean(a.isIpv6), a.ipAddress)))
+ .findFirst();
if (mapResolverOptional.isPresent()) {
LispMapResolverDetails details = mapResolverOptional.get();
builder.setKey(key);
builder.setIpAddress(
- TranslateUtils.arrayToIpAddress(TranslateUtils.byteToBoolean(details.isIpv6), details.ipAddress));
+ arrayToIpAddress(byteToBoolean(details.isIpv6), details.ipAddress));
} else {
LOG.warn("No data found with matching key");
}
@@ -120,8 +125,7 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
return dumpOptional.get().lispMapResolverDetails.stream()
.map(resolver -> new MapResolverKey(
- TranslateUtils
- .arrayToIpAddress(TranslateUtils.byteToBoolean(resolver.isIpv6), resolver.ipAddress)))
+ arrayToIpAddress(byteToBoolean(resolver.isIpv6), resolver.ipAddress)))
.collect(Collectors.toList());
}