summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-09-07 08:56:04 +0200
committerJan Srnicek <jsrnicek@cisco.com>2016-09-07 08:57:42 +0200
commite9eda93718d02f64ad25299a887efd976edfae4f (patch)
tree4fd01ab1dd7cb1f8a9e3c04c86fa91997836c26d
parent32969dd02d86a78d9fd8847229d929ae17fede34 (diff)
Map resolver filtering fixed
Cherrypicked from https://gerrit.fd.io/r/#/c/2633/ Change-Id:I1849866ca91a321fa5696eb842079ad987cd210d Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
-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());
}