summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-11-03 09:37:28 +0100
committerMaros Marsalek <mmarsale@cisco.com>2016-11-03 10:51:24 +0000
commit918847c2202e943ca8e3e8c1ff1b8d3617cb502d (patch)
treec9ec38b9522e593ca2a1834b85a609ac0be6d6f1 /lisp/lisp2vpp/src
parente4813a654f93763577e792e4b67353fb27948580 (diff)
HONEYCOMB-259 - CacheKeyFactory
Provides logic for creating scoped keys Change-Id: I126bcb9255b4f8a3f2585f50e6e718948581e7f0 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp/src')
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java13
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java6
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java4
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java10
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java5
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java15
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java45
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java5
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java4
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java4
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java10
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java4
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java5
13 files changed, 63 insertions, 67 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java
index 3c6ace8e7..1d0d8a019 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java
@@ -48,17 +48,18 @@ public class BridgeDomainSubtableCustomizer extends FutureJVppCustomizer impleme
ReaderCustomizer<BridgeDomainSubtable, BridgeDomainSubtableBuilder>, SubtableReader {
private static final Logger LOG = LoggerFactory.getLogger(BridgeDomainSubtableCustomizer.class);
- private static final String CACHE_KEY = BridgeDomainSubtableCustomizer.class.getName();
- private final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager;
+ private final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams>
+ dumpManager;
private final NamingContext bridgeDomainContext;
public BridgeDomainSubtableCustomizer(@Nonnull final FutureJVppCore futureJvppCore,
@Nonnull final NamingContext bridgeDomainContext) {
super(futureJvppCore);
- dumpManager = new DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
- .withExecutor(createExecutor(futureJvppCore))
- .build();
+ dumpManager =
+ new DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
+ .withExecutor(createExecutor(futureJvppCore))
+ .build();
this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
}
@@ -77,7 +78,7 @@ public class BridgeDomainSubtableCustomizer extends FutureJVppCustomizer impleme
LOG.debug("Read attributes for id {}", id);
//dumps only L2(bridge domains)
final Optional<LispEidTableMapDetailsReplyDump> reply =
- readSubtable(dumpManager, CACHE_KEY, ctx.getModificationCache(), id, L2_PARAMS);
+ dumpManager.getDump(id, ctx.getModificationCache(), L2_PARAMS);
if (!reply.isPresent() || reply.get().lispEidTableMapDetails.isEmpty()) {
return;
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 0e1c34483..7291afb03 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
@@ -55,8 +55,6 @@ public class InterfaceCustomizer
extends FutureJVppCustomizer
implements ListReaderCustomizer<Interface, InterfaceKey, InterfaceBuilder>, LocatorReader {
- private static final String KEY_BASE = InterfaceCustomizer.class.getName();
-
private final NamingContext interfaceContext;
private final NamingContext locatorSetContext;
private final DumpCacheManager<LispLocatorDetailsReplyDump, LocatorDumpParams> dumpCacheManager;
@@ -97,7 +95,7 @@ public class InterfaceCustomizer
new LocatorDumpParamsBuilder().setLocatorSetIndex(locatorSetIndexIndex).build();
final Optional<LispLocatorDetailsReplyDump> reply =
- dumpCacheManager.getDump(id, KEY_BASE, ctx.getModificationCache(), params);
+ dumpCacheManager.getDump(id, ctx.getModificationCache(), params);
if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) {
return;
@@ -129,7 +127,7 @@ public class InterfaceCustomizer
.setLocatorSetIndex(locatorSetContext.getIndex(name, context.getMappingContext())).build();
final Optional<LispLocatorDetailsReplyDump> reply =
- dumpCacheManager.getDump(id, KEY_BASE, context.getModificationCache(), params);
+ dumpCacheManager.getDump(id, context.getModificationCache(), params);
if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) {
return Collections.emptyList();
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java
index c9be45cf7..8e8fd5848 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java
@@ -43,8 +43,6 @@ public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer
implements ReaderCustomizer<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder>, ByteDataTranslator,
JvppReplyConsumer {
- private static final String CACHE_KEY = ItrRemoteLocatorSetCustomizer.class.getName();
-
private final DumpCacheManager<LispGetMapRequestItrRlocsReply, Void> dumpCacheManager;
public ItrRemoteLocatorSetCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
@@ -68,7 +66,7 @@ public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer
throws ReadFailedException {
final Optional<LispGetMapRequestItrRlocsReply> reply =
- dumpCacheManager.getDump(id, CACHE_KEY, ctx.getModificationCache(), NO_PARAMS);
+ dumpCacheManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
if (!reply.isPresent() || reply.get().locatorSetName == null) {
return;
}
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 74fbf6f20..e989a393d 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
@@ -65,7 +65,6 @@ public class LocalMappingCustomizer
MappingReader {
private static final Logger LOG = LoggerFactory.getLogger(LocalMappingCustomizer.class);
- private static final String KEY = LocalMappingCustomizer.class.getName();
private final DumpCacheManager<LispEidTableDetailsReplyDump, MappingsDumpParams> dumpManager;
private final NamingContext locatorSetContext;
@@ -113,7 +112,7 @@ public class LocalMappingCustomizer
LOG.debug("Dumping data for LocalMappings(id={})", id);
final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, bindKey("SPECIFIC_" + localMappingId), ctx.getModificationCache(), dumpParams);
+ dumpManager.getDump(id, ctx.getModificationCache(), dumpParams);
if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
return;
@@ -158,7 +157,7 @@ public class LocalMappingCustomizer
LOG.debug("Dumping data for LocalMappings(id={})", id);
final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, bindKey("ALL_LOCAL"), context.getModificationCache(), dumpParams);
+ dumpManager.getDump(id, context.getModificationCache(), dumpParams);
if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
return Collections.emptyList();
@@ -179,9 +178,4 @@ public class LocalMappingCustomizer
public void merge(Builder<? extends DataObject> builder, List<LocalMapping> readData) {
((LocalMappingsBuilder) builder).setLocalMapping(readData);
}
-
- private static String bindKey(String prefix) {
- return prefix + "_" + KEY;
- }
-
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java
index 9a55e5006..ff0855a74 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java
@@ -49,7 +49,6 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
implements ListReaderCustomizer<LocatorSet, LocatorSetKey, LocatorSetBuilder>, ByteDataTranslator,
LocatorSetReader {
- private static final String LOCATOR_SETS_CACHE_ID = LocatorSetCustomizer.class.getName();
private static final Logger LOG = LoggerFactory.getLogger(LocatorSetCustomizer.class);
private final DumpCacheManager<LispLocatorSetDetailsReplyDump, Void> dumpManager;
@@ -75,7 +74,7 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
LOG.debug("Reading attributes for Locator Set {}", id);
final Optional<LispLocatorSetDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, LOCATOR_SETS_CACHE_ID, ctx.getModificationCache(), NO_PARAMS);
+ dumpManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
if (!dumpOptional.isPresent() || dumpOptional.get().lispLocatorSetDetails.isEmpty()) {
return;
@@ -104,7 +103,7 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
LOG.debug("Dumping Locator Set {}", id);
final Optional<LispLocatorSetDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, LOCATOR_SETS_CACHE_ID, context.getModificationCache(), NO_PARAMS);
+ dumpManager.getDump(id, context.getModificationCache(), NO_PARAMS);
if (!dumpOptional.isPresent() || dumpOptional.get().lispLocatorSetDetails.isEmpty()) {
return Collections.emptyList();
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 5c453d5ff..fb44e13e9 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
@@ -51,16 +51,17 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
JvppReplyConsumer {
private static final Logger LOG = LoggerFactory.getLogger(MapResolverCustomizer.class);
- private static final String MAP_RESOLVERS_CACHE_ID = MapResolverCustomizer.class.getName();
private final DumpCacheManager<LispMapResolverDetailsReplyDump, Void> dumpManager;
public MapResolverCustomizer(FutureJVppCore futureJvpp) {
super(futureJvpp);
- this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispMapResolverDetailsReplyDump, Void>()
- .withExecutor((identifier, params) -> getReplyForRead(
- futureJvpp.lispMapResolverDump(new LispMapResolverDump()).toCompletableFuture(), identifier))
- .build();
+ this.dumpManager =
+ new DumpCacheManager.DumpCacheManagerBuilder<LispMapResolverDetailsReplyDump, Void>()
+ .withExecutor((identifier, params) -> getReplyForRead(
+ futureJvpp.lispMapResolverDump(new LispMapResolverDump()).toCompletableFuture(),
+ identifier))
+ .build();
}
@Override
@@ -74,7 +75,7 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
LOG.debug("Reading attributes...");
final Optional<LispMapResolverDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, MAP_RESOLVERS_CACHE_ID, ctx.getModificationCache(), NO_PARAMS);
+ dumpManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
if (!dumpOptional.isPresent() || dumpOptional.get().lispMapResolverDetails.isEmpty()) {
LOG.warn("No data dumped");
@@ -105,7 +106,7 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
LOG.debug("Dumping MapResolver...");
final Optional<LispMapResolverDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, MAP_RESOLVERS_CACHE_ID, context.getModificationCache(), NO_PARAMS);
+ dumpManager.getDump(id, context.getModificationCache(), NO_PARAMS);
if (!dumpOptional.isPresent() || dumpOptional.get().lispMapResolverDetails.isEmpty()) {
return Collections.emptyList();
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 18bafe179..b0e9056fc 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
@@ -24,6 +24,7 @@ import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsD
import static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MapReplyAction.NoAction;
import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableSet;
import io.fd.honeycomb.lisp.context.util.EidMappingContext;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams;
import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams.LocatorDumpParamsBuilder;
@@ -32,15 +33,18 @@ import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpPara
import io.fd.honeycomb.lisp.translate.read.trait.LocatorReader;
import io.fd.honeycomb.lisp.translate.read.trait.MappingReader;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
+import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.ModificationCache;
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.util.RWUtils;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
+import io.fd.honeycomb.translate.util.read.cache.IdentifierCacheKeyFactory;
import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.LispLocatorDetails;
@@ -67,6 +71,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.LocatorBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.rlocs.LocatorKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSets;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSet;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.Interface;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -81,23 +89,29 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
EidTranslator, AddressTranslator, ByteDataTranslator, MappingReader, LocatorReader {
private static final Logger LOG = LoggerFactory.getLogger(RemoteMappingCustomizer.class);
- private static final String KEY = RemoteMappingCustomizer.class.getName();
private final DumpCacheManager<LispEidTableDetailsReplyDump, MappingsDumpParams> dumpManager;
private final DumpCacheManager<LispLocatorDetailsReplyDump, LocatorDumpParams> locatorsDumpManager;
+ private final NamingContext locatorSetContext;
private final EidMappingContext remoteMappingContext;
- public RemoteMappingCustomizer(@Nonnull FutureJVppCore futureJvpp,
- @Nonnull EidMappingContext remoteMappingContext) {
+ public RemoteMappingCustomizer(@Nonnull final FutureJVppCore futureJvpp,
+ @Nonnull final NamingContext locatorSetContext,
+ @Nonnull final EidMappingContext remoteMappingContext) {
super(futureJvpp);
+ this.locatorSetContext = checkNotNull(locatorSetContext, "Locator sets context not present");
this.remoteMappingContext = checkNotNull(remoteMappingContext, "Remote mappings not present");
+ // this one should have default scope == RemoteMapping
this.dumpManager =
new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableDetailsReplyDump, MappingsDumpParams>()
.withExecutor(createMappingDumpExecutor(futureJvpp))
.build();
+
+ // cache key needs to have locator set scope to not mix with cached data
this.locatorsDumpManager =
new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorDetailsReplyDump, LocatorDumpParams>()
.withExecutor(createLocatorDumpExecutor(futureJvpp))
+ .withCacheKeyFactory(new IdentifierCacheKeyFactory(ImmutableSet.of(LocatorSet.class)))
.build();
}
@@ -138,7 +152,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
LOG.debug("Dumping data for LocalMappings(id={})", id);
final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, bindKey("SPECIFIC_" + remoteMappingId), ctx.getModificationCache(), dumpParams);
+ dumpManager.getDump(id, ctx.getModificationCache(), dumpParams);
if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
return;
@@ -158,7 +172,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
builder.setTtl(resolveTtl(details.ttl));
builder.setAuthoritative(
new RemoteMapping.Authoritative(byteToBoolean(details.authoritative)));
- resolverMappings(id, builder, details, ctx.getModificationCache());
+ resolveMappings(id, builder, details, ctx.getModificationCache(), ctx.getMappingContext());
}
//compensate ~0 as default value of ttl
@@ -190,7 +204,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
LOG.debug("Dumping data for LocalMappings(id={})", id);
final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, bindKey("ALL_REMOTE"), context.getModificationCache(), dumpParams);
+ dumpManager.getDump(id, context.getModificationCache(), dumpParams);
if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
return Collections.emptyList();
@@ -213,13 +227,10 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
((RemoteMappingsBuilder) builder).setRemoteMapping(readData);
}
- private String bindKey(String prefix) {
- return prefix + "_" + KEY;
- }
-
- private void resolverMappings(final InstanceIdentifier id, final RemoteMappingBuilder builder,
- final LispEidTableDetails details,
- final ModificationCache cache) throws ReadFailedException {
+ private void resolveMappings(final InstanceIdentifier id, final RemoteMappingBuilder builder,
+ final LispEidTableDetails details,
+ final ModificationCache cache,
+ final MappingContext mappingContext) throws ReadFailedException {
if (details.action != 0) {
// in this case ,negative action was defined
@@ -230,8 +241,14 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
// cache key needs to have locator set scope to not mix with cached data
final Optional<LispLocatorDetailsReplyDump> reply;
+
+ // this will serve to achieve that locators have locator set scope
+ final InstanceIdentifier<Interface> locatorIfaceIdentifier = InstanceIdentifier.create(LocatorSets.class)
+ .child(LocatorSet.class,
+ new LocatorSetKey(locatorSetContext.getName(details.locatorSetIndex, mappingContext)))
+ .child(Interface.class);
try {
- reply = locatorsDumpManager.getDump(id, KEY + "_locator_set_" + details.locatorSetIndex, cache,
+ reply = locatorsDumpManager.getDump(locatorIfaceIdentifier, cache,
new LocatorDumpParamsBuilder().setLocatorSetIndex(details.locatorSetIndex).build());
} catch (ReadFailedException e) {
throw new ReadFailedException(id,
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
index d6f629ee4..49047bcc9 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
@@ -53,7 +53,6 @@ public class VniTableCustomizer extends FutureJVppCustomizer
private static final Logger LOG = LoggerFactory.getLogger(VniTableCustomizer.class);
- private static final String LISP_TABLE_ID_DUMP = VniTableCustomizer.class.getName();
private final DumpCacheManager<LispEidTableVniDetailsReplyDump, Void> dumpManager;
public VniTableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
@@ -88,7 +87,7 @@ public class VniTableCustomizer extends FutureJVppCustomizer
LOG.trace("Reading all IDS...");
final Optional<LispEidTableVniDetailsReplyDump> optionalReply =
- dumpManager.getDump(id, LISP_TABLE_ID_DUMP, context.getModificationCache(), NO_PARAMS);
+ dumpManager.getDump(id, context.getModificationCache(), NO_PARAMS);
if (!optionalReply.isPresent() || optionalReply.get().lispEidTableVniDetails.isEmpty()) {
return Collections.emptyList();
@@ -107,7 +106,7 @@ public class VniTableCustomizer extends FutureJVppCustomizer
VniTableKey key = new VniTableKey(id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier());
final Optional<LispEidTableVniDetailsReplyDump> optionalReply =
- dumpManager.getDump(id, LISP_TABLE_ID_DUMP, ctx.getModificationCache(), NO_PARAMS);
+ dumpManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
if (!optionalReply.isPresent() || optionalReply.get().lispEidTableVniDetails.isEmpty()) {
return;
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java
index 72d25af43..af48a6500 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java
@@ -47,7 +47,6 @@ public class VrfSubtableCustomizer extends FutureJVppCustomizer
implements ReaderCustomizer<VrfSubtable, VrfSubtableBuilder>, SubtableReader {
private static final Logger LOG = LoggerFactory.getLogger(VrfSubtableCustomizer.class);
- private static final String CACHE_KEY = VrfSubtableCustomizer.class.getName();
private final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager;
@@ -72,8 +71,7 @@ public class VrfSubtableCustomizer extends FutureJVppCustomizer
final int vni = checkNotNull(id.firstKeyOf(VniTable.class), "Cannot find parent VNI Table")
.getVirtualNetworkIdentifier().intValue();
- final Optional<LispEidTableMapDetailsReplyDump> reply =
- readSubtable(dumpManager, CACHE_KEY, ctx.getModificationCache(), id, L3_PARAMS);
+ final Optional<LispEidTableMapDetailsReplyDump> reply = dumpManager.getDump(id, ctx.getModificationCache(), L3_PARAMS);
if (!reply.isPresent() || reply.get().lispEidTableMapDetails.isEmpty()) {
return;
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java
index a5805473e..dad04bff5 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java
@@ -149,14 +149,14 @@ final class EidTableReaderFactory extends AbstractLispReaderFactoryBase implemen
remoteMappingSubtreeId.child(Rlocs.class).child(Locator.class),
remoteMappingSubtreeId.child(MapReply.class)),
new GenericListReader<>(vrfTableRemoteMappingsInstanceIdentifier.child(RemoteMapping.class),
- new RemoteMappingCustomizer(vppApi, remoteMappingContext)));
+ new RemoteMappingCustomizer(vppApi, locatorSetContext, remoteMappingContext)));
registry.subtreeAdd(ImmutableSet.of(remoteMappingSubtreeId
.child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid.class),
remoteMappingSubtreeId.child(Rlocs.class),
remoteMappingSubtreeId.child(Rlocs.class).child(Locator.class),
remoteMappingSubtreeId.child(MapReply.class)),
new GenericListReader<>(bridgeDomainRemoteMappingsInstanceIdentifier.child(RemoteMapping.class),
- new RemoteMappingCustomizer(vppApi, remoteMappingContext)));
+ new RemoteMappingCustomizer(vppApi, locatorSetContext, remoteMappingContext)));
registry.addStructuralReader(vrfTableAdjacenciesInstanceIdentifier, AdjacenciesBuilder.class);
registry.addStructuralReader(bridgeDomainAdjacenciesInstanceIdentifier, AdjacenciesBuilder.class);
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java
index 431bf9229..a4a6e21ab 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java
@@ -34,6 +34,7 @@ import io.fd.vpp.jvpp.core.dto.LispEidTableMapDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
import org.opendaylight.yangtools.yang.binding.ChildOf;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -45,15 +46,6 @@ public interface SubtableReader extends JvppReplyConsumer {
SubtableDumpParams L2_PARAMS = new SubtableDumpParamsBuilder().setL2(L2).build();
SubtableDumpParams L3_PARAMS = new SubtableDumpParamsBuilder().setL2(L3).build();
- default Optional<LispEidTableMapDetailsReplyDump> readSubtable(
- @Nonnull final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager,
- @Nonnull final String cacheKey,
- @Nonnull final ModificationCache cache,
- @Nonnull final InstanceIdentifier<? extends ChildOf<VniTable>> id,
- @Nonnull final SubtableDumpParams params) throws ReadFailedException {
- return dumpManager.getDump(id, cacheKey, cache, params);
- }
-
default EntityDumpExecutor<LispEidTableMapDetailsReplyDump, SubtableDumpParams> createExecutor(
@Nonnull final FutureJVppCore vppApi) {
return (identifier, params) -> {
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 701141ebc..749255836 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
@@ -49,15 +49,11 @@ public class LocatorSetCustomizer extends FutureJVppCustomizer
LocatorSetReader {
private final NamingContext locatorSetContext;
- private final DumpCacheManager<LispLocatorSetDetailsReplyDump, Void> dumpManager;
public LocatorSetCustomizer(@Nonnull final FutureJVppCore futureJvpp,
@Nonnull final NamingContext locatorSetContext) {
super(futureJvpp);
this.locatorSetContext = checkNotNull(locatorSetContext, "Locator set context cannot be null");
- this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorSetDetailsReplyDump, Void>()
- .withExecutor(createExecutor(futureJvpp))
- .build();
}
@Override
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java
index cff2dad51..27c243e8b 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java
@@ -27,6 +27,7 @@ import io.fd.honeycomb.lisp.context.util.EidMappingContext;
import io.fd.honeycomb.lisp.translate.util.EidTranslator;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
@@ -83,6 +84,7 @@ public class RemoteMappingCustomizerTest
.child(RemoteMappings.class)
.child(RemoteMapping.class, new RemoteMappingKey(new MappingId("remote-mapping")));
mockMappings();
+ defineMapping(mappingContext,"loc-set",1,"loc-set-context");
}
@@ -163,6 +165,7 @@ public class RemoteMappingCustomizerTest
when(eidMappingContext.containsEid(new MappingId("remote-mapping"), mappingContext)).thenReturn(true);
when(eidMappingContext.getEid(new MappingId("remote-mapping"), mappingContext))
.thenReturn(new EidBuilder().setAddress(EID_ADDRESS).build());
+
}
@Test
@@ -233,6 +236,6 @@ public class RemoteMappingCustomizerTest
@Override
protected ReaderCustomizer<RemoteMapping, RemoteMappingBuilder> initCustomizer() {
- return new RemoteMappingCustomizer(api, eidMappingContext);
+ return new RemoteMappingCustomizer(api, new NamingContext("loc-set", "loc-set-context"), eidMappingContext);
}
} \ No newline at end of file