From d6d2177bd32b8073aaaf0c384b27d1589d5edbf5 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Tue, 13 Sep 2016 15:17:02 +0200 Subject: HONEYCOMB-211 - Fixed locator set filtering Change-Id: Ia8827040012ea03262727ff5909a68dac9dcb72a Signed-off-by: Jan Srnicek --- .../lisp/translate/read/InterfaceCustomizer.java | 13 +++----- .../read/dump/executor/LocatorDumpExecutor.java | 5 ++- .../dump/executor/params/LocatorDumpParams.java | 37 +--------------------- 3 files changed, 8 insertions(+), 47 deletions(-) (limited to 'lisp/lisp2vpp/src') diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java index cc8bbf5ab..46aebded6 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java @@ -24,6 +24,7 @@ import com.google.common.base.Optional; import io.fd.honeycomb.lisp.translate.read.dump.check.LocatorDumpCheck; import io.fd.honeycomb.lisp.translate.read.dump.executor.LocatorDumpExecutor; import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams; +import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams.LocatorDumpParamsBuilder; import io.fd.honeycomb.translate.read.ReadContext; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer; @@ -100,10 +101,8 @@ public class InterfaceCustomizer final int referencedInterfaceIndex = interfaceContext.getIndex(referencedInterfaceName, ctx.getMappingContext()); - final LocatorDumpParams params = new LocatorDumpParams.LocatorDumpParamsBuilder() - .setFilter(LocatorDumpParams.LocatorDumpFilter.LOCAL) - .setLocatorSetIndex(locatorSetIndexIndex) - .build(); + final LocatorDumpParams params = + new LocatorDumpParamsBuilder().setLocatorSetIndex(locatorSetIndexIndex).build(); Optional reply; try { @@ -136,10 +135,8 @@ public class InterfaceCustomizer final String name = id.firstKeyOf(LocatorSet.class).getName(); checkState(locatorSetContext.containsIndex(name, context.getMappingContext()), "No mapping for %s", name); - final LocatorDumpParams params = new LocatorDumpParams.LocatorDumpParamsBuilder() - .setFilter(LocatorDumpParams.LocatorDumpFilter.LOCAL) - .setLocatorSetIndex(locatorSetContext.getIndex(name, context.getMappingContext())) - .build(); + final LocatorDumpParams params = new LocatorDumpParamsBuilder() + .setLocatorSetIndex(locatorSetContext.getIndex(name, context.getMappingContext())).build(); Optional reply; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java index 8949f44f2..8bdfd3b6c 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/LocatorDumpExecutor.java @@ -49,9 +49,8 @@ public class LocatorDumpExecutor extends AbstractDumpExecutor LispLocatorDump request = new LispLocatorDump(); request.lsIndex = params.getLocatorSetIndex(); - // TODO: HONEYCOMB-211: fix support for locator set filtering - // request.lsName - // request.filter = params.getFilter(); + //flag that lsIndex is set + request.isIndexSet = (byte) 1; try { return TranslateUtils.getReply(vppApi.lispLocatorDump(request).toCompletableFuture()); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/LocatorDumpParams.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/LocatorDumpParams.java index eda1e9771..7528d1d68 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/LocatorDumpParams.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/LocatorDumpParams.java @@ -16,65 +16,30 @@ package io.fd.honeycomb.lisp.translate.read.dump.executor.params; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Params for dumping locators */ public final class LocatorDumpParams { private final int locatorSetIndex; - private final byte filter; private LocatorDumpParams(LocatorDumpParamsBuilder builder) { this.locatorSetIndex = builder.locatorSetIndex; - this.filter = builder.filter; } public int getLocatorSetIndex() { return locatorSetIndex; } - public byte getFilter() { - return filter; - } - - /** - * Enum for filtering which locators to dump - */ - public enum LocatorDumpFilter { - - ALL(0), - LOCAL(1), - REMOTE(2); - - private final int value; - - private LocatorDumpFilter(int value) { - this.value = value; - } - - public final int getValue() { - return value; - } - } - public static final class LocatorDumpParamsBuilder { - public int locatorSetIndex; - public byte filter; - + private int locatorSetIndex; public LocatorDumpParamsBuilder setLocatorSetIndex(final int locatorSetIndex) { this.locatorSetIndex = locatorSetIndex; return this; } - public LocatorDumpParamsBuilder setFilter(final LocatorDumpFilter filter) { - this.filter = Integer.valueOf(checkNotNull(filter, "Cannot set null filter").getValue()).byteValue(); - return this; - } - public LocatorDumpParams build() { return new LocatorDumpParams(this); } -- cgit 1.2.3-korg