summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-11-10 12:22:28 +0100
committerMaros Marsalek <mmarsale@cisco.com>2016-11-10 12:47:24 +0100
commit8e0c7007906730fe4547b0265a895ad8a322a7dc (patch)
treedbc3310da5c7b7083cc6b9ecffee633d2cf5cd7f /lisp/lisp2vpp
parentaa7e652e6105a6972d6c41ff0738cd9e31ce0188 (diff)
Remove hc2vpp codebase
Moved to a dedicated hc2vpp project in fd.io Change-Id: I03dc3b3029f21b127a00c69a86bcd8e467896241 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp')
-rw-r--r--lisp/lisp2vpp/asciidoc/Readme.adoc3
-rwxr-xr-xlisp/lisp2vpp/pom.xml118
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java87
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java59
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContext.java174
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactory.java46
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactoryProvider.java36
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/EidMappingContext.java227
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java192
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java104
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java147
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java82
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizer.java100
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java181
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java136
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java125
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java83
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java301
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java125
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java98
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/LocatorDumpParams.java47
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java191
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/SubtableDumpParams.java75
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/AbstractLispReaderFactoryBase.java101
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java183
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java83
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java71
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java58
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java46
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java41
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducer.java72
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReader.java90
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java57
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidMetadataProvider.java68
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java343
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java183
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainSubtableCustomizer.java97
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizer.java122
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java82
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LispCustomizer.java97
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java141
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java107
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizer.java99
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java104
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java236
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java83
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizer.java82
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/AbstractLispWriterFactoryBase.java94
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java82
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java64
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java55
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java158
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriter.java82
-rw-r--r--lisp/lisp2vpp/src/main/resources/honeycomb-minimal-resources/config/lisp.json2
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java101
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContextTest.java184
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java108
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/AdjacencyData.java59
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java145
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java118
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizerTest.java118
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java164
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizerTest.java68
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java144
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizerTest.java96
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java102
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java77
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java241
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java121
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java121
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java186
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReaderTest.java95
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java97
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java60
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java243
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainCustomizerTest.java108
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java160
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java146
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LispCustomizerTest.java111
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java163
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java148
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizerTest.java103
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizerTest.java117
-rwxr-xr-xlisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java155
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java103
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizerTest.java105
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriterTestCase.java59
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/AdjacencyMappingContextTestHelper.java126
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java116
-rw-r--r--lisp/lisp2vpp/src/test/resources/adjacencies-identification-context.json29
90 files changed, 0 insertions, 10317 deletions
diff --git a/lisp/lisp2vpp/asciidoc/Readme.adoc b/lisp/lisp2vpp/asciidoc/Readme.adoc
deleted file mode 100644
index 88c43fd4b..000000000
--- a/lisp/lisp2vpp/asciidoc/Readme.adoc
+++ /dev/null
@@ -1,3 +0,0 @@
-= lisp2vpp
-
-Overview of lisp2vpp \ No newline at end of file
diff --git a/lisp/lisp2vpp/pom.xml b/lisp/lisp2vpp/pom.xml
deleted file mode 100755
index b612acc32..000000000
--- a/lisp/lisp2vpp/pom.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright (c) 2016 Cisco and/or its affiliates.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at:
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-impl-parent</artifactId>
- <version>1.16.12-SNAPSHOT</version>
- <relativePath>../../vpp-common/vpp-impl-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.lisp</groupId>
- <artifactId>lisp2vpp</artifactId>
- <name>${project.artifactId}</name>
- <version>1.16.12-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <properties>
- <project.vpp.groupId>io.fd.honeycomb.vpp</project.vpp.groupId>
- <project.honeycomb.groupId>io.fd.honeycomb</project.honeycomb.groupId>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>${project.honeycomb.groupId}</groupId>
- <artifactId>translate-spi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.vpp.groupId}</groupId>
- <artifactId>vpp-translate-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>lisp-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.honeycomb.groupId}</groupId>
- <artifactId>translate-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.honeycomb.groupId}</groupId>
- <artifactId>cfg-init</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.vpp</groupId>
- <artifactId>jvpp-core</artifactId>
- </dependency>
-
- <!-- DI -->
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
- <dependency>
- <groupId>net.jmob</groupId>
- <artifactId>guice.conf</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- </dependency>
-
- <!-- Testing Dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-testlib</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.vpp</groupId>
- <artifactId>vpp-translate-test</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.infra</groupId>
- <artifactId>test-tools</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-</project>
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java
deleted file mode 100644
index db5557f0d..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/LispModule.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp;
-
-
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCAL_MAPPING_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCATOR_SET_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCATOR_SET_CONTEXT_PREFIX;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.REMOTE_MAPPING_CONTEXT;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Names;
-import io.fd.honeycomb.lisp.cfgattrs.LispConfiguration;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.ContextsReaderFactoryProvider;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.factory.LispStateReaderFactory;
-import io.fd.honeycomb.lisp.translate.write.factory.LispWriterFactory;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import net.jmob.guice.conf.core.ConfigurationModule;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LispModule extends AbstractModule {
-
- private static final Logger LOG = LoggerFactory.getLogger(LispModule.class);
-
- @Override
- protected void configure() {
- LOG.info("Configuring module Lisp");
- install(ConfigurationModule.create());
- requestInjection(LispConfiguration.class);
-
- LOG.info("Binding Naming context[{}]", LOCATOR_SET_CONTEXT);
- bind(NamingContext.class)
- .annotatedWith(Names.named(LOCATOR_SET_CONTEXT))
- .toInstance(new NamingContext(LOCATOR_SET_CONTEXT_PREFIX, LOCATOR_SET_CONTEXT));
-
- LOG.info("Binding Eid context[{}]", LOCAL_MAPPING_CONTEXT);
- bind(EidMappingContext.class)
- .annotatedWith(Names.named(LOCAL_MAPPING_CONTEXT))
- .toInstance(new EidMappingContext(LOCAL_MAPPING_CONTEXT));
-
- LOG.info("Binding Eid context[{}]", REMOTE_MAPPING_CONTEXT);
- bind(EidMappingContext.class)
- .annotatedWith(Names.named(REMOTE_MAPPING_CONTEXT))
- .toInstance(new EidMappingContext(REMOTE_MAPPING_CONTEXT));
-
- LOG.info("Binding Adjacencies context");
- bind(AdjacenciesMappingContext.class)
- .annotatedWith(Names.named(LispConfiguration.ADJACENCIES_IDENTIFICATION_CONTEXT))
- .toInstance(new AdjacenciesMappingContext(LispConfiguration.ADJACENCIES_IDENTIFICATION_CONTEXT));
-
- LOG.info("Binding reader factories");
- final Multibinder<ReaderFactory> readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
- readerFactoryBinder.addBinding().to(LispStateReaderFactory.class);
- LOG.info("Reader factories binded");
-
- LOG.info("Binding writer factories");
- final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
- writerFactoryBinder.addBinding().to(LispWriterFactory.class);
- LOG.info("Writer factories binded");
-
- final Multibinder<ReaderFactory> readerBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
- readerBinder.addBinding().toProvider(ContextsReaderFactoryProvider.class).in(Singleton.class);
-
- LOG.info("Module Lisp successfully configured");
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java
deleted file mode 100644
index 177f650c9..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/cfgattrs/LispConfiguration.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.cfgattrs;
-
-import net.jmob.guice.conf.core.BindConfig;
-import net.jmob.guice.conf.core.Syntax;
-
-/**
- * Class containing static configuration for Lisp module,<br>
- * either loaded from property file or statically typed.
- */
-@BindConfig(value = "lisp", syntax = Syntax.JSON)
-public class LispConfiguration {
-
- //TODO HONEYCOMB-176 - this constant should be part of V3po plugin
- /**
- * Interface index to name mapping.
- */
- public static final String INTERFACE_CONTEXT = "interface-context";
-
- /**
- * Locator set index to name mapping.
- */
- public static final String LOCATOR_SET_CONTEXT = "locator-set-context";
-
- /**
- * Local mappings's eid to name mapping.
- */
- public static final String LOCAL_MAPPING_CONTEXT = "local-mapping-context";
-
- /**
- * Remote mappings's eid to name mapping.
- */
- public static final String REMOTE_MAPPING_CONTEXT = "remote-mapping-context";
-
- /**
- * Unique prefix for naming context of locator sets.
- **/
- public static final String LOCATOR_SET_CONTEXT_PREFIX = "locator-set-";
-
- /**
- * Adjacency id to eid pair mapping
- * */
- public static final String ADJACENCIES_IDENTIFICATION_CONTEXT = "adjacencies-identification-context";
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContext.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContext.java
deleted file mode 100644
index 557dc2771..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContext.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.context.util;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.util.RWUtils;
-import java.util.stream.Collector;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.AdjacenciesIdentificationContexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentification;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentificationKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.MappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.MappingKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPair;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPairBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-public class AdjacenciesMappingContext {
-
- private static final Collector<Mapping, ?, Mapping> SINGLE_ITEM_COLLECTOR = RWUtils.singleItemCollector();
-
- private final KeyedInstanceIdentifier<AdjacenciesIdentification, AdjacenciesIdentificationKey>
- namingContextIid;
-
- /**
- * Create new naming context
- *
- * @param instanceName name of this context instance. Will be used as list item identifier within context data tree
- */
- public AdjacenciesMappingContext(@Nonnull final String instanceName) {
- namingContextIid = InstanceIdentifier.create(AdjacenciesIdentificationContexts.class).child(
- AdjacenciesIdentification.class, new AdjacenciesIdentificationKey(instanceName));
- }
-
- /**
- * Retrieve name for mapping stored provided mappingContext instance.
- *
- * @param localEidId {@code MappingId} for local eid
- * @param remoteEidId {@code MappingId} for remote eid
- * @param mappingContext mapping context providing context data for current transaction
- * @return name mapped to provided index
- */
- @Nonnull
- public synchronized String getAdjacencyId(
- @Nonnull final String localEidId,
- @Nonnull final String remoteEidId,
- @Nonnull final MappingContext mappingContext) {
-
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
- checkState(read.isPresent(), "No adjacencies mappings stored");
-
- return read.get().getMapping().stream()
- .filter(mapping -> isSame(pairForCombination(localEidId, remoteEidId), mapping))
- .collect(SINGLE_ITEM_COLLECTOR).getId();
- }
-
- private boolean isSame(final EidIdentificatorPair currentPair, final Mapping mapping) {
- // EidIdentificatorPair is container so it needs to be compared like this
- final EidIdentificatorPair mappingPair = mapping.getEidIdentificatorPair();
- return currentPair.getLocalEidId().equals(mappingPair.getLocalEidId())
- && currentPair.getRemoteEidId().equals(mappingPair.getRemoteEidId());
- }
-
- private EidIdentificatorPair pairForCombination(final @Nonnull String localEidId,
- final @Nonnull String remoteEidId) {
- return new EidIdentificatorPairBuilder()
- .setLocalEidId(new MappingId(localEidId))
- .setRemoteEidId(new MappingId(remoteEidId))
- .build();
- }
-
- /**
- * Check whether mapping is present for index.
- *
- * @param localEidId {@code MappingId} for local eid
- * @param remoteEidId {@code MappingId} for remote eid
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsId(
- @Nonnull final String localEidId,
- @Nonnull final String remoteEidId,
- @Nonnull final MappingContext mappingContext) {
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
-
- return read.isPresent() &&
- read.get().getMapping()
- .stream()
- .anyMatch(mapping -> isSame(pairForCombination(localEidId, remoteEidId), mapping));
- }
-
- /**
- * Add mapping to current context
- *
- * @param index index of a mapped item
- * @param localEidId {@code MappingId} for local eid
- * @param remoteEidId {@code MappingId} for remote eid
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void addEidPair(
- @Nonnull final String index,
- @Nonnull final String localEidId,
- @Nonnull final String remoteEidId,
- final MappingContext mappingContext) {
-
- final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = getMappingIid(index);
- mappingContext.put(mappingIid, new MappingBuilder().setId(index).setEidIdentificatorPair(
- pairForCombination(localEidId, remoteEidId)).build());
- }
-
- private KeyedInstanceIdentifier<Mapping, MappingKey> getMappingIid(final String index) {
- return namingContextIid.child(Mappings.class).child(Mapping.class, new MappingKey(index));
- }
-
-
- /**
- * Remove mapping from current context
- *
- * @param index identificator of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void removeForIndex(@Nonnull final String index, final MappingContext mappingContext) {
- mappingContext.delete(getMappingIid(index));
- }
-
- /**
- * Returns index value associated with the given name.
- *
- * @param index index whitch should value sits on
- * @param mappingContext mapping context providing context data for current transaction
- * @return integer index value matching supplied name
- * @throws IllegalArgumentException if name was not found
- */
- public synchronized EidIdentificatorPair getEidPair(@Nonnull final String index,
- final MappingContext mappingContext) {
- final Optional<Mapping> read = mappingContext.read(getMappingIid(index));
- checkArgument(read.isPresent(), "No mapping stored for index: %s", index);
- return read.get().getEidIdentificatorPair();
- }
-
- /**
- * Check whether mapping is present for name.
- *
- * @param index index of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsEidPairForIndex(@Nonnull final String index,
- @Nonnull final MappingContext mappingContext) {
- return mappingContext.read(getMappingIid(index)).isPresent();
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactory.java
deleted file mode 100644
index 29a5e3fd4..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.context.util;
-
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.read.BindingBrokerReader;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.Contexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.ContextsBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * {@link ReaderFactory} initiating reader providing data from context data store for eid's.
- * Making them available over RESTCONF/NETCONF.
- */
-public class ContextsReaderFactory implements ReaderFactory {
-
- private final DataBroker contextBindingBrokerDependency;
-
- public ContextsReaderFactory(final DataBroker contextBindingBrokerDependency) {
- this.contextBindingBrokerDependency = contextBindingBrokerDependency;
- }
-
- @Override
- public void init(final ModifiableReaderRegistryBuilder registry) {
- registry.add(new BindingBrokerReader<>(InstanceIdentifier.create(Contexts.class),
- contextBindingBrokerDependency,
- LogicalDatastoreType.OPERATIONAL, ContextsBuilder.class));
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactoryProvider.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactoryProvider.java
deleted file mode 100644
index d023b3e9f..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/ContextsReaderFactoryProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.context.util;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-
-
-public class ContextsReaderFactoryProvider implements Provider<ReaderFactory> {
-
- @Inject
- @Named("honeycomb-context")
- private DataBroker contextDataBroker;
-
- @Override
- public ReaderFactory get() {
- return new ContextsReaderFactory(contextDataBroker);
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/EidMappingContext.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/EidMappingContext.java
deleted file mode 100644
index 8f5dab7c9..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/context/util/EidMappingContext.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.context.util;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.util.EidTranslator;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.util.RWUtils;
-import java.util.stream.Collector;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.Contexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.EidMappingContextKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.MappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.MappingKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Utility class allowing {@link MappingId} to {@link Eid} mapping
- */
-public class EidMappingContext implements EidTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(EidMappingContext.class);
- private static final Collector<Mapping, ?, Mapping> SINGLE_ITEM_COLLECTOR = RWUtils.singleItemCollector();
-
- private final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.EidMappingContext, EidMappingContextKey>
- namingContextIid;
-
- /**
- * Create new naming context
- *
- * @param instanceName name of this context instance. Will be used as list item identifier within context data tree
- */
- public EidMappingContext(@Nonnull final String instanceName) {
- namingContextIid = InstanceIdentifier.create(Contexts.class).child(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.EidMappingContext.class,
- new EidMappingContextKey(instanceName));
- }
-
- /**
- * Retrieve name for mapping stored provided mappingContext instance.
- *
- * @param remoteEid eid of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return name mapped to provided index
- */
- @Nonnull
- public synchronized MappingId getId(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid remoteEid,
- @Nonnull final MappingContext mappingContext) {
-
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
- checkState(read.isPresent(), "Mapping for eid: %s is not present. But should be", remoteEid);
-
- return read.get().getMapping()
- .stream()
- //cannot split to map + filtering,because its collecting mappings,not eid's
- .filter(mapping -> compareEids(mapping.getEid(), remoteEid))
- .collect(SINGLE_ITEM_COLLECTOR).getId();
- }
-
- /**
- * Retrieve name for mapping stored provided mappingContext instance.
- *
- * @param eid eid of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return name mapped to provided index
- */
- @Nonnull
- public synchronized MappingId getId(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid eid,
- @Nonnull final MappingContext mappingContext) {
-
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
- //don't create artificial name as naming context, to not create reference to some artificial(in vpp non-existing)eid
- checkState(read.isPresent(), "Mapping for eid: %s is not present. But should be", eid);
-
- return read.get().getMapping().stream()
- .filter(mapping -> compareEids(mapping.getEid(), eid))
- .collect(SINGLE_ITEM_COLLECTOR).getId();
- }
-
- /**
- * Check whether mapping is present for index.
- *
- * @param eid eid of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsId(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid eid,
- @Nonnull final MappingContext mappingContext) {
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
-
- return read.isPresent() &&
- read.get().getMapping()
- .stream()
- .anyMatch(mapping -> compareEids(mapping.getEid(), eid));
- }
-
- /**
- * Check whether mapping is present for index.
- *
- * @param eid eid of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsId(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid eid,
- @Nonnull final MappingContext mappingContext) {
- final Optional<Mappings> read = mappingContext.read(namingContextIid.child(Mappings.class));
-
- return read.isPresent() &&
- read.get().getMapping()
- .stream()
- .anyMatch(mapping -> compareEids(mapping.getEid(), eid));
- }
-
-
- /**
- * Add mapping to current context
- *
- * @param index index of a mapped item
- * @param eid eid data
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void addEid(
- @Nonnull final MappingId index,
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid eid,
- final MappingContext mappingContext) {
-
- final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = getMappingIid(index);
- mappingContext.put(mappingIid, new MappingBuilder().setId(index).setEid(copyEid(eid)).build());
- }
-
- /**
- * Add mapping to current context
- *
- * @param index index of a mapped item
- * @param eid eid data
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void addEid(
- @Nonnull final MappingId index,
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid eid,
- final MappingContext mappingContext) {
-
- final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = getMappingIid(index);
- mappingContext.put(mappingIid, new MappingBuilder().setId(index).setEid(copyEid(eid)).build());
- }
-
- private KeyedInstanceIdentifier<Mapping, MappingKey> getMappingIid(final MappingId index) {
- return namingContextIid.child(Mappings.class).child(Mapping.class, new MappingKey(index));
- }
-
- private Eid copyEid(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid eid) {
- return new EidBuilder().setAddress(eid.getAddress()).setAddressType(eid.getAddressType())
- .setVirtualNetworkId(eid.getVirtualNetworkId()).build();
- }
-
- private Eid copyEid(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid eid) {
- return new EidBuilder().setAddress(eid.getAddress()).setAddressType(eid.getAddressType())
- .setVirtualNetworkId(eid.getVirtualNetworkId()).build();
- }
-
- /**
- * Remove mapping from current context
- *
- * @param index identificator of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- */
- public synchronized void removeEid(@Nonnull final MappingId index, final MappingContext mappingContext) {
- mappingContext.delete(getMappingIid(index));
- }
-
- /**
- * Returns index value associated with the given name.
- *
- * @param index index whitch should value sits on
- * @param mappingContext mapping context providing context data for current transaction
- * @return integer index value matching supplied name
- * @throws IllegalArgumentException if name was not found
- */
- public synchronized Eid getEid(@Nonnull final MappingId index, final MappingContext mappingContext) {
- final Optional<Mapping> read = mappingContext.read(getMappingIid(index));
- checkArgument(read.isPresent(), "No mapping stored for index: %s", index);
- return read.get().getEid();
- }
-
- /**
- * Check whether mapping is present for name.
- *
- * @param index index of a mapped item
- * @param mappingContext mapping context providing context data for current transaction
- * @return true if present, false otherwise
- */
- public synchronized boolean containsEid(@Nonnull final MappingId index,
- @Nonnull final MappingContext mappingContext) {
- return mappingContext.read(getMappingIid(index)).isPresent();
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java
deleted file mode 100755
index d7003c802..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizer.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
-import io.fd.honeycomb.lisp.translate.util.EidTranslator;
-import io.fd.honeycomb.translate.MappingContext;
-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.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispAdjacenciesGet;
-import io.fd.vpp.jvpp.core.dto.LispAdjacenciesGetReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import io.fd.vpp.jvpp.core.types.LispAdjacency;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPair;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPairBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.AdjacenciesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class AdjacencyCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<Adjacency, AdjacencyKey, AdjacencyBuilder>, JvppReplyConsumer, EidTranslator {
-
- private final DumpCacheManager<LispAdjacenciesGetReply, AdjacencyDumpParams> dumpCacheManager;
- private final AdjacenciesMappingContext adjacenciesMappingContext;
- private final EidPairProducer eidPairProducer;
-
-
- public AdjacencyCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final EidMappingContext localMappingContext,
- @Nonnull final EidMappingContext remoteMappingContext,
- @Nonnull final AdjacenciesMappingContext adjacenciesMappingContext) {
- super(futureJvpp);
- dumpCacheManager = new DumpCacheManager.DumpCacheManagerBuilder<LispAdjacenciesGetReply, AdjacencyDumpParams>()
- .withExecutor(createExecutor())
- .build();
-
- this.adjacenciesMappingContext =
- checkNotNull(adjacenciesMappingContext, "Adjacencies mapping context cannot be null");
- this.eidPairProducer = new EidPairProducer(localMappingContext, remoteMappingContext);
- }
-
- @Nonnull
- @Override
- public List<AdjacencyKey> getAllIds(@Nonnull final InstanceIdentifier<Adjacency> id,
- @Nonnull final ReadContext context) throws ReadFailedException {
-
- final int vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue();
-
- final Optional<LispAdjacenciesGetReply> optionalDump =
- dumpCacheManager.getDump(id, context.getModificationCache(), new AdjacencyDumpParams(vni));
-
-
- if (optionalDump.isPresent()) {
- return Arrays.stream(optionalDump.get().adjacencies)
- .map(lispAdjacency -> eidPairProducer.createPair(lispAdjacency, vni, context.getMappingContext()))
- .map(pair -> adjacenciesMappingContext
- .getAdjacencyId(pair.getLocalEidId().getValue(), pair.getRemoteEidId().getValue(),
- context.getMappingContext()))
- .map(AdjacencyKey::new)
- .collect(Collectors.toList());
- }
-
- //does not throw exception to not disturb lisp state reading
- return Collections.emptyList();
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<Adjacency> readData) {
- ((AdjacenciesBuilder) builder).setAdjacency(readData);
- }
-
- @Nonnull
- @Override
- public AdjacencyBuilder getBuilder(@Nonnull final InstanceIdentifier<Adjacency> id) {
- return new AdjacencyBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Adjacency> id,
- @Nonnull final AdjacencyBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
-
- final int vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue();
-
- final Optional<LispAdjacenciesGetReply> optionalDump = dumpCacheManager
- .getDump(id, ctx.getModificationCache(), new AdjacencyDumpParams(vni));
-
- if (!optionalDump.isPresent() || optionalDump.get().adjacencies.length == 0) {
- return;
- }
-
- final String currentAdjacencyId = id.firstKeyOf(Adjacency.class).getId();
- final EidIdentificatorPair currentAdjacencyIdentificationPair =
- adjacenciesMappingContext.getEidPair(currentAdjacencyId, ctx.getMappingContext());
-
- final LispAdjacency currentAdjacency = Arrays.stream(optionalDump.get().adjacencies)
- .filter(lispAdjacency -> Objects.equals(currentAdjacencyIdentificationPair,
- eidPairProducer.createPair(lispAdjacency, vni, ctx.getMappingContext())))
- .collect(RWUtils.singleItemCollector());
-
- builder.setId(currentAdjacencyId)
- .setKey(new AdjacencyKey(currentAdjacencyId))
- .setLocalEid(getArrayAsLocalEid(
- MappingsDumpParams.EidType.valueOf(currentAdjacency.eidType), currentAdjacency.leid, vni))
- .setRemoteEid(getArrayAsRemoteEid(
- MappingsDumpParams.EidType.valueOf(currentAdjacency.eidType), currentAdjacency.reid, vni));
- }
-
- private EntityDumpExecutor<LispAdjacenciesGetReply, AdjacencyDumpParams> createExecutor() {
- return (final InstanceIdentifier<?> identifier, final AdjacencyDumpParams params) -> {
- checkNotNull(params, "Dump parameters cannot be null");
-
- final LispAdjacenciesGet request = new LispAdjacenciesGet();
- request.vni = params.getVni();
-
- return getReplyForRead(getFutureJVpp().lispAdjacenciesGet(request).toCompletableFuture(), identifier);
- };
- }
-
- private class EidPairProducer implements EidTranslator {
-
- private final EidMappingContext localMappingContext;
- private final EidMappingContext remoteMappingContext;
-
- public EidPairProducer(final EidMappingContext localMappingContext,
- final EidMappingContext remoteMappingContext) {
- this.localMappingContext = checkNotNull(localMappingContext, "Local mapping context cannot be null");
- this.remoteMappingContext = checkNotNull(remoteMappingContext, "Remote mapping context cannot be null");
- }
-
- public EidIdentificatorPair createPair(final LispAdjacency data, final int vni,
- final MappingContext mappingContext) {
- return new EidIdentificatorPairBuilder()
- .setLocalEidId(new MappingId(localMappingContext.getId(getArrayAsEidLocal(
- MappingsDumpParams.EidType.valueOf(data.eidType), data.leid, vni), mappingContext)))
- .setRemoteEidId(new MappingId(remoteMappingContext.getId(getArrayAsEidLocal(
- MappingsDumpParams.EidType.valueOf(data.eidType), data.reid, vni), mappingContext)))
- .build();
- }
- }
-
- private static final class AdjacencyDumpParams {
-
- private final int vni;
-
- AdjacencyDumpParams(final int vni) {
- this.vni = vni;
- }
-
- public int getVni() {
- return this.vni;
- }
- }
-}
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
deleted file mode 100644
index 1d0d8a019..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizer.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
-import io.fd.honeycomb.lisp.translate.read.trait.SubtableReader;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.List;
-import java.util.stream.Collectors;
-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.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtableBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BridgeDomainSubtableCustomizer extends FutureJVppCustomizer implements
- ReaderCustomizer<BridgeDomainSubtable, BridgeDomainSubtableBuilder>, SubtableReader {
-
- private static final Logger LOG = LoggerFactory.getLogger(BridgeDomainSubtableCustomizer.class);
-
- 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();
- this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
- }
-
- @Nonnull
- @Override
- public BridgeDomainSubtableBuilder getBuilder(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id) {
- return new BridgeDomainSubtableBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id,
- @Nonnull final BridgeDomainSubtableBuilder builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- final int vni = checkNotNull(id.firstKeyOf(VniTable.class), "Cannot find parent VNI Table")
- .getVirtualNetworkIdentifier().intValue();
- LOG.debug("Read attributes for id {}", id);
- //dumps only L2(bridge domains)
- final Optional<LispEidTableMapDetailsReplyDump> reply =
- dumpManager.getDump(id, ctx.getModificationCache(), L2_PARAMS);
-
- if (!reply.isPresent() || reply.get().lispEidTableMapDetails.isEmpty()) {
- return;
- }
-
- // Single item collector cant be used in this case,because bridge-domain-subtable is container
- // so read is invoked every time parent is defined
- final List<LispEidTableMapDetails>
- details = reply.get().lispEidTableMapDetails.stream().filter(a -> a.vni == vni)
- .collect(Collectors.toList());
- if (details.size() == 1) {
- final LispEidTableMapDetails detail = details.get(0);
- builder.setBridgeDomainRef(bridgeDomainContext.getName(detail.dpTable, ctx.getMappingContext()));
- LOG.debug("Attributes for {} successfully loaded", id);
- }
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
- @Nonnull final BridgeDomainSubtable readValue) {
- ((VniTableBuilder) parentBuilder).setBridgeDomainSubtable(readValue);
- }
-}
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
deleted file mode 100755
index 7291afb03..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizer.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.base.Optional;
-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.lisp.translate.read.trait.LocatorReader;
-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.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-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.LocatorSetBuilder;
-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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * Customizer for reading {@code Interface}<br> Currently not supported by jvpp
- */
-public class InterfaceCustomizer
- extends FutureJVppCustomizer
- implements ListReaderCustomizer<Interface, InterfaceKey, InterfaceBuilder>, LocatorReader {
-
- private final NamingContext interfaceContext;
- private final NamingContext locatorSetContext;
- private final DumpCacheManager<LispLocatorDetailsReplyDump, LocatorDumpParams> dumpCacheManager;
-
- public InterfaceCustomizer(@Nonnull final FutureJVppCore futureJvpp, @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext) {
- super(futureJvpp);
- this.interfaceContext = checkNotNull(interfaceContext, "Interface context cannot be null");
- this.locatorSetContext = checkNotNull(locatorSetContext, "Locator set context cannot be null");
- this.dumpCacheManager =
- new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorDetailsReplyDump, LocatorDumpParams>()
- .withExecutor(createLocatorDumpExecutor(futureJvpp))
- .build();
- }
-
- @Override
- public InterfaceBuilder getBuilder(InstanceIdentifier<Interface> id) {
- return new InterfaceBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<Interface> id, InterfaceBuilder builder, ReadContext ctx)
- throws ReadFailedException {
-
- final String locatorSetName = id.firstKeyOf(LocatorSet.class).getName();
- final String referencedInterfaceName = id.firstKeyOf(Interface.class).getInterfaceRef();
-
- checkState(interfaceContext.containsIndex(referencedInterfaceName, ctx.getMappingContext()),
- "No interface mapping for name %s", referencedInterfaceName);
- checkState(locatorSetContext.containsIndex(locatorSetName, ctx.getMappingContext()),
- "No locator set mapping for name %s", locatorSetName);
-
- final int locatorSetIndexIndex = locatorSetContext.getIndex(locatorSetName, ctx.getMappingContext());
- final int referencedInterfaceIndex =
- interfaceContext.getIndex(referencedInterfaceName, ctx.getMappingContext());
-
- final LocatorDumpParams params =
- new LocatorDumpParamsBuilder().setLocatorSetIndex(locatorSetIndexIndex).build();
-
- final Optional<LispLocatorDetailsReplyDump> reply =
- dumpCacheManager.getDump(id, ctx.getModificationCache(), params);
-
- if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) {
- return;
- }
-
- final LispLocatorDetails details = reply.get()
- .lispLocatorDetails
- .stream()
- .filter(a -> a.swIfIndex == referencedInterfaceIndex)
- .collect(RWUtils.singleItemCollector());
-
- final String interfaceRef = interfaceContext.getName(details.swIfIndex, ctx.getMappingContext());
-
- builder.setPriority(Byte.valueOf(details.priority).shortValue());
- builder.setWeight(Byte.valueOf(details.weight).shortValue());
- builder.setInterfaceRef(interfaceRef);
- builder.setKey(new InterfaceKey(interfaceRef));
- }
-
- @Override
- public List<InterfaceKey> getAllIds(InstanceIdentifier<Interface> id, ReadContext context)
- throws ReadFailedException {
-
- checkState(id.firstKeyOf(LocatorSet.class) != null, "Cannot find reference to parent locator set");
- final String name = id.firstKeyOf(LocatorSet.class).getName();
-
- checkState(locatorSetContext.containsIndex(name, context.getMappingContext()), "No mapping for %s", name);
- final LocatorDumpParams params = new LocatorDumpParamsBuilder()
- .setLocatorSetIndex(locatorSetContext.getIndex(name, context.getMappingContext())).build();
-
- final Optional<LispLocatorDetailsReplyDump> reply =
- dumpCacheManager.getDump(id, context.getModificationCache(), params);
-
- if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return reply.get()
- .lispLocatorDetails
- .stream()
- .map(a -> new InterfaceKey(interfaceContext.getName(a.swIfIndex, context.getMappingContext())))
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<Interface> readData) {
- ((LocatorSetBuilder) builder).setInterface(readData);
- }
-} \ No newline at end of file
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
deleted file mode 100644
index 8e8fd5848..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-
-import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocs;
-import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocsReply;
-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.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureDataBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer
- implements ReaderCustomizer<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder>, ByteDataTranslator,
- JvppReplyConsumer {
-
- private final DumpCacheManager<LispGetMapRequestItrRlocsReply, Void> dumpCacheManager;
-
- public ItrRemoteLocatorSetCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
- super(futureJVppCore);
- dumpCacheManager = new DumpCacheManagerBuilder<LispGetMapRequestItrRlocsReply, Void>()
- .withExecutor(((identifier, params) -> getReplyForRead(
- futureJVppCore.lispGetMapRequestItrRlocs(new LispGetMapRequestItrRlocs()).toCompletableFuture(),
- identifier)))
- .build();
- }
-
- @Nonnull
- @Override
- public ItrRemoteLocatorSetBuilder getBuilder(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id) {
- return new ItrRemoteLocatorSetBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id,
- @Nonnull final ItrRemoteLocatorSetBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
-
- final Optional<LispGetMapRequestItrRlocsReply> reply =
- dumpCacheManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
- if (!reply.isPresent() || reply.get().locatorSetName == null) {
- return;
- }
-
- builder.setRemoteLocatorSetName(toString(reply.get().locatorSetName));
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
- @Nonnull final ItrRemoteLocatorSet readValue) {
- ((LispFeatureDataBuilder) parentBuilder).setItrRemoteLocatorSet(readValue);
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizer.java
deleted file mode 100755
index 77374f9ad..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ShowLispStatus;
-import io.fd.vpp.jvpp.core.dto.ShowLispStatusReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispStateBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Customizer that handles reads of {@code LispState}
- */
-public class LispStateCustomizer extends FutureJVppCustomizer
- implements InitializingReaderCustomizer<LispState, LispStateBuilder>, JvppReplyConsumer, ByteDataTranslator {
-
- private static final Logger LOG = LoggerFactory.getLogger(LispStateCustomizer.class);
-
- public LispStateCustomizer(FutureJVppCore futureJvpp) {
- super(futureJvpp);
- }
-
- @Override
- public LispStateBuilder getBuilder(InstanceIdentifier<LispState> id) {
- return new LispStateBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<LispState> id, LispStateBuilder builder, ReadContext ctx)
- throws ReadFailedException {
-
- ShowLispStatusReply reply;
- try {
- reply = getReply(getFutureJVpp().showLispStatus(new ShowLispStatus()).toCompletableFuture());
- } catch (TimeoutException | VppBaseCallException e) {
- throw new ReadFailedException(id, e);
- }
-
- builder.setEnable(byteToBoolean(reply.featureStatus));
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final LispState readValue) {
- LOG.warn("Merge is unsupported for data roots");
- }
-
- @Override
- public Initialized<Lisp> init(
- @Nonnull final InstanceIdentifier<LispState> id, @Nonnull final LispState readValue,
- @Nonnull final ReadContext ctx) {
- return Initialized.create(InstanceIdentifier.create(Lisp.class),
-
- // set everything from LispState to LispBuilder
- // this is necessary in cases, when HC connects to a running VPP with some LISP configuration. HC needs to
- // reconstruct configuration based on what's present in VPP in order to support subsequent configuration changes
- // without any issues
-
- // the other reason this should work is HC persistence, so that HC after restart only performs diff (only push
- // configuration that is not currently in VPP, but is persisted. If they are equal skip any VPP calls)
- // updates to VPP. If this is not fully implemented (depending on VPP implementation, restoration of persisted
- // configuration can fail)
- new LispBuilder()
- .setEnable(readValue.isEnable())
- .setLispFeatureData(readValue.getLispFeatureData())
- .build());
- }
-}
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
deleted file mode 100755
index e989a393d..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizer.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.valueOf;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.FilterType;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.MappingsDumpParamsBuilder;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.QuantityType;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
-import io.fd.honeycomb.lisp.translate.read.trait.MappingReader;
-import io.fd.honeycomb.lisp.translate.util.EidTranslator;
-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.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.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Customizer for reading {@code LocalMapping}<br> Currently unsupported by jvpp
- */
-public class LocalMappingCustomizer
- extends FutureJVppCustomizer
- implements ListReaderCustomizer<LocalMapping, LocalMappingKey, LocalMappingBuilder>, EidTranslator,
- MappingReader {
-
- private static final Logger LOG = LoggerFactory.getLogger(LocalMappingCustomizer.class);
-
- private final DumpCacheManager<LispEidTableDetailsReplyDump, MappingsDumpParams> dumpManager;
- private final NamingContext locatorSetContext;
- private final EidMappingContext localMappingContext;
-
- public LocalMappingCustomizer(@Nonnull FutureJVppCore futureJvpp, @Nonnull NamingContext locatorSetContext,
- @Nonnull EidMappingContext localMappingsContext) {
- super(futureJvpp);
- this.locatorSetContext = checkNotNull(locatorSetContext, "Locator Set Mapping Context cannot be null");
- this.localMappingContext = checkNotNull(localMappingsContext, "Local mappings context cannot be null");
- this.dumpManager =
- new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableDetailsReplyDump, MappingsDumpParams>()
- .withExecutor(createMappingDumpExecutor(futureJvpp))
- .build();
- }
-
- @Override
- public LocalMappingBuilder getBuilder(InstanceIdentifier<LocalMapping> id) {
- return new LocalMappingBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<LocalMapping> id, LocalMappingBuilder builder,
- ReadContext ctx) throws ReadFailedException {
- checkState(id.firstKeyOf(LocalMapping.class) != null, "No key present for id({})", id);
- checkState(id.firstKeyOf(VniTable.class) != null, "Parent VNI table not specified");
-
- //checks whether there is an existing mapping
- final MappingId mappingId = id.firstKeyOf(LocalMapping.class).getId();
- checkState(localMappingContext.containsEid(mappingId, ctx.getMappingContext()));
-
- final long vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier();
-
- final String localMappingId = id.firstKeyOf(LocalMapping.class).getId().getValue();
- final Eid eid = localMappingContext.getEid(mappingId, ctx.getMappingContext());
-
- //Requesting for specific mapping dump,only from local mappings with specified eid/vni/eid type
- final MappingsDumpParams dumpParams = new MappingsDumpParams.MappingsDumpParamsBuilder()
- .setEidSet(QuantityType.SPECIFIC)
- .setVni(Long.valueOf(vni).intValue())
- .setEid(getEidAsByteArray(eid))
- .setEidType(getEidType(eid))
- .setPrefixLength(getPrefixLength(eid))
- .build();
-
- LOG.debug("Dumping data for LocalMappings(id={})", id);
- final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, ctx.getModificationCache(), dumpParams);
-
- if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
- return;
- }
-
- LispEidTableDetails details = replyOptional.get().lispEidTableDetails.stream()
- .filter(subtableFilterForLocalMappings(id))
- .filter(detail -> compareAddresses(eid.getAddress(), getAddressFromDumpDetail(detail)))
- .collect(RWUtils.singleItemCollector());
-
- //in case of local mappings,locator_set_index stands for interface index
- checkState(locatorSetContext.containsName(details.locatorSetIndex, ctx.getMappingContext()),
- "No Locator Set name found for index %s", details.locatorSetIndex);
- builder.setLocatorSet(locatorSetContext.getName(details.locatorSetIndex, ctx.getMappingContext()));
- builder.setKey(new LocalMappingKey(new MappingId(id.firstKeyOf(LocalMapping.class).getId())));
- builder.setEid(getArrayAsEidLocal(valueOf(details.eidType), details.eid, details.vni));
- }
-
- private Address getAddressFromDumpDetail(final LispEidTableDetails detail) {
- return getArrayAsEidLocal(valueOf(detail.eidType), detail.eid, detail.vni).getAddress();
- }
-
- @Override
- public List<LocalMappingKey> getAllIds(InstanceIdentifier<LocalMapping> id, ReadContext context)
- 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()
- .setFilter(FilterType.LOCAL)
- .setEidSet(QuantityType.ALL)
- .build();
-
- LOG.debug("Dumping data for LocalMappings(id={})", id);
- final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, context.getModificationCache(), dumpParams);
-
- if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
-
- return replyOptional.get().lispEidTableDetails.stream()
- .filter(a -> a.vni == vni)
- .filter(subtableFilterForLocalMappings(id))
- .map(detail -> getArrayAsEidLocal(valueOf(detail.eidType), detail.eid, detail.vni))
- .map(localEid -> localMappingContext.getId(localEid, context.getMappingContext()))
- .map(MappingId::new)
- .map(LocalMappingKey::new)
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<LocalMapping> readData) {
- ((LocalMappingsBuilder) builder).setLocalMapping(readData);
- }
-}
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
deleted file mode 100755
index ff0855a74..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizer.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.trait.LocatorSetReader;
-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.read.cache.DumpCacheManager;
-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.LispLocatorSetDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.LocatorSetsBuilder;
-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.LocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LocatorSetCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<LocatorSet, LocatorSetKey, LocatorSetBuilder>, ByteDataTranslator,
- LocatorSetReader {
-
- private static final Logger LOG = LoggerFactory.getLogger(LocatorSetCustomizer.class);
-
- private final DumpCacheManager<LispLocatorSetDetailsReplyDump, Void> dumpManager;
- private final NamingContext locatorSetContext;
-
- public LocatorSetCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final NamingContext locatorSetContext) {
- super(futureJvpp);
- this.locatorSetContext = checkNotNull(locatorSetContext, "Locator Set mapping context cannot be null");
- this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispLocatorSetDetailsReplyDump, Void>()
- .withExecutor(createExecutor(futureJvpp))
- .build();
- }
-
- @Override
- public LocatorSetBuilder getBuilder(InstanceIdentifier<LocatorSet> id) {
- return new LocatorSetBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<LocatorSet> id, LocatorSetBuilder builder, ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes for Locator Set {}", id);
-
- final Optional<LispLocatorSetDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
-
- if (!dumpOptional.isPresent() || dumpOptional.get().lispLocatorSetDetails.isEmpty()) {
- return;
- }
-
- String keyName = id.firstKeyOf(LocatorSet.class).getName();
- LispLocatorSetDetailsReplyDump dump = dumpOptional.get();
-
- java.util.Optional<LispLocatorSetDetails> details = dump.lispLocatorSetDetails.stream()
- .filter(n -> keyName.equals(toString(n.lsName)))
- .findFirst();
-
- if (details.isPresent()) {
- final String name = toString(details.get().lsName);
-
- builder.setName(name);
- builder.setKey(new LocatorSetKey(name));
- } else {
- LOG.warn("Locator Set {} not found in dump", id);
- }
- }
-
- @Override
- public List<LocatorSetKey> getAllIds(InstanceIdentifier<LocatorSet> id, ReadContext context)
- throws ReadFailedException {
- LOG.debug("Dumping Locator Set {}", id);
-
- final Optional<LispLocatorSetDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, context.getModificationCache(), NO_PARAMS);
-
- if (!dumpOptional.isPresent() || dumpOptional.get().lispLocatorSetDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return dumpOptional.get().lispLocatorSetDetails.stream()
- .map(set -> {
-
- final String locatorSetName = toString(set.lsName);
- //creates mapping for existing locator-set(if it is'nt already existing one)
- if (!locatorSetContext.containsIndex(locatorSetName, context.getMappingContext())) {
- locatorSetContext.addName(set.lsIndex, locatorSetName, context.getMappingContext());
- }
-
- LOG.trace("Locator Set with name: {}, VPP name: {} and index: {} found in VPP",
- locatorSetContext.getName(set.lsIndex, context.getMappingContext()),
- locatorSetName,
- set.lsIndex);
-
- return set;
- })
- .map(set -> new LocatorSetKey(toString(set.lsName)))
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<LocatorSet> readData) {
- ((LocatorSetsBuilder) builder).setLocatorSet(readData);
- }
-}
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
deleted file mode 100755
index fb44e13e9..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizer.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
-
-import com.google.common.base.Optional;
-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.vpp.util.AddressTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetails;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Arrays;
-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.rev161214.map.resolvers.grouping.MapResolversBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MapResolverCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<MapResolver, MapResolverKey, MapResolverBuilder>, AddressTranslator,
- JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(MapResolverCustomizer.class);
-
- 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();
- }
-
- @Override
- public MapResolverBuilder getBuilder(InstanceIdentifier<MapResolver> id) {
- return new MapResolverBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<MapResolver> id, MapResolverBuilder builder, ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading attributes...");
-
- final Optional<LispMapResolverDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
-
- if (!dumpOptional.isPresent() || dumpOptional.get().lispMapResolverDetails.isEmpty()) {
- LOG.warn("No data dumped");
- return;
- }
-
- final MapResolverKey key = id.firstKeyOf(MapResolver.class);
- final LispMapResolverDetails mapResolverDetails =
- dumpOptional.get().lispMapResolverDetails.stream()
- .filter(a -> addressesEqual(key.getIpAddress(),
- arrayToIpAddressReversed(byteToBoolean(a.isIpv6), a.ipAddress)))
- .collect(RWUtils.singleItemCollector());
-
- builder.setKey(key);
- builder.setIpAddress(
- arrayToIpAddress(byteToBoolean(mapResolverDetails.isIpv6), mapResolverDetails.ipAddress));
- }
-
- // safest way to compare addresses - prevents returning false while using different types from hierarchy
- // Ex. Key for MapResolver contains Ipv4Address as value but we translate addresses from binary data to Ipv4AddressNoZone
- private boolean addressesEqual(final IpAddress left, final IpAddress right) {
- return Arrays.equals(left.getValue(), right.getValue());
- }
-
- @Override
- public List<MapResolverKey> getAllIds(InstanceIdentifier<MapResolver> id, ReadContext context)
- throws ReadFailedException {
- LOG.debug("Dumping MapResolver...");
-
- final Optional<LispMapResolverDetailsReplyDump> dumpOptional =
- dumpManager.getDump(id, context.getModificationCache(), NO_PARAMS);
-
- if (!dumpOptional.isPresent() || dumpOptional.get().lispMapResolverDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return dumpOptional.get().lispMapResolverDetails.stream()
- .map(resolver -> new MapResolverKey(
- arrayToIpAddressReversed(byteToBoolean(resolver.isIpv6), resolver.ipAddress)))
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<MapResolver> readData) {
- ((MapResolversBuilder) builder).setMapResolver(readData);
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java
deleted file mode 100755
index 7b049c043..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import java.util.concurrent.TimeoutException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureDataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfgBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.ShowLispPitr;
-import io.fd.vpp.jvpp.core.dto.ShowLispPitrReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Customizer for reading {@link PitrCfg}<br> Currently unsupported in jvpp
- */
-public class PitrCfgCustomizer extends FutureJVppCustomizer
- implements ReaderCustomizer<PitrCfg, PitrCfgBuilder>, ByteDataTranslator, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(PitrCfgCustomizer.class);
-
- public PitrCfgCustomizer(FutureJVppCore futureJvpp) {
- super(futureJvpp);
- }
-
- @Override
- public PitrCfgBuilder getBuilder(InstanceIdentifier<PitrCfg> id) {
- return new PitrCfgBuilder();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<PitrCfg> id, PitrCfgBuilder builder, ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Reading status for Lisp Pitr node {}", id);
-
- ShowLispPitrReply reply;
-
- try {
- reply = getPitrStatus();
- } catch (TimeoutException | VppBaseCallException e) {
- throw new ReadFailedException(id, e);
- }
-
- builder.setLocatorSet(toString(reply.locatorSetName));
- LOG.debug("Reading status for Lisp Pitr node {} successfull", id);
- }
-
- @Override
- public void merge(Builder<? extends DataObject> parentBuilder, PitrCfg readValue) {
- ((LispFeatureDataBuilder) parentBuilder).setPitrCfg(readValue);
- }
-
- public ShowLispPitrReply getPitrStatus() throws TimeoutException, VppBaseCallException {
- return getReply(getFutureJVpp().showLispPitr(new ShowLispPitr()).toCompletableFuture());
- }
-}
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
deleted file mode 100755
index b0e9056fc..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizer.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.valueOf;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.FilterType;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.MappingsDumpParamsBuilder;
-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;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.QuantityType;
-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;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-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.rev161214.MapReplyAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.PositiveMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.negative.mapping.MapReplyBuilder;
-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.RlocsBuilder;
-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.Locator;
-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;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Customizer for reading {@code RemoteMapping}<br>
- */
-public class RemoteMappingCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<RemoteMapping, RemoteMappingKey, RemoteMappingBuilder>,
- EidTranslator, AddressTranslator, ByteDataTranslator, MappingReader, LocatorReader {
-
- private static final Logger LOG = LoggerFactory.getLogger(RemoteMappingCustomizer.class);
-
- private final DumpCacheManager<LispEidTableDetailsReplyDump, MappingsDumpParams> dumpManager;
- private final DumpCacheManager<LispLocatorDetailsReplyDump, LocatorDumpParams> locatorsDumpManager;
- private final NamingContext locatorSetContext;
- private final 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();
- }
-
-
- @Override
- public RemoteMappingBuilder getBuilder(InstanceIdentifier<RemoteMapping> id) {
- return new RemoteMappingBuilder();
- }
-
- private Eid copyEid(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid eid) {
- return new EidBuilder().setAddress(eid.getAddress()).setAddressType(eid.getAddressType())
- .setVirtualNetworkId(eid.getVirtualNetworkId()).build();
- }
-
- @Override
- public void readCurrentAttributes(InstanceIdentifier<RemoteMapping> id, RemoteMappingBuilder builder,
- ReadContext ctx)
- throws ReadFailedException {
- checkState(id.firstKeyOf(RemoteMapping.class) != null, "No key present for id({})", id);
- checkState(id.firstKeyOf(VniTable.class) != null, "Parent VNI table not specified");
-
- final MappingId mappingId = id.firstKeyOf(RemoteMapping.class).getId();
- checkState(remoteMappingContext.containsEid(mappingId, ctx.getMappingContext()),
- "No mapping stored for id %s", mappingId);
-
- final long vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier();
- final String remoteMappingId = id.firstKeyOf(RemoteMapping.class).getId().getValue();
- final Eid eid = copyEid(remoteMappingContext.getEid(mappingId, ctx.getMappingContext()));
- final MappingsDumpParams dumpParams = new MappingsDumpParamsBuilder()
- .setVni(Long.valueOf(vni).intValue())
- .setEidSet(QuantityType.SPECIFIC)
- .setEidType(getEidType(eid))
- .setEid(getEidAsByteArray(eid))
- .setPrefixLength(getPrefixLength(eid))
- .setFilter(FilterType.REMOTE)
- .build();
-
- LOG.debug("Dumping data for LocalMappings(id={})", id);
- final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, ctx.getModificationCache(), dumpParams);
-
- if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
- return;
- }
-
- LOG.debug("Valid dump loaded");
-
- LispEidTableDetails details = replyOptional.get().lispEidTableDetails.stream()
- .filter(subtableFilterForRemoteMappings(id))
- .filter(a -> compareAddresses(eid.getAddress(),
- getArrayAsEidLocal(valueOf(a.eidType), a.eid, a.vni).getAddress()))
- .collect(
- RWUtils.singleItemCollector());
-
- builder.setEid(getArrayAsEidRemote(valueOf(details.eidType), details.eid, details.vni));
- builder.setKey(new RemoteMappingKey(new MappingId(id.firstKeyOf(RemoteMapping.class).getId())));
- builder.setTtl(resolveTtl(details.ttl));
- builder.setAuthoritative(
- new RemoteMapping.Authoritative(byteToBoolean(details.authoritative)));
- resolveMappings(id, builder, details, ctx.getModificationCache(), ctx.getMappingContext());
- }
-
- //compensate ~0 as default value of ttl
- private static long resolveTtl(final int ttlValue) {
- return ttlValue == -1
- ? Integer.MAX_VALUE
- : ttlValue;
- }
-
- @Override
- public List<RemoteMappingKey> getAllIds(InstanceIdentifier<RemoteMapping> id, ReadContext context)
- 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
- // it's 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()
- .setEidSet(QuantityType.ALL)
- .setFilter(FilterType.REMOTE)
- .build();
-
- LOG.debug("Dumping data for LocalMappings(id={})", id);
- final Optional<LispEidTableDetailsReplyDump> replyOptional =
- dumpManager.getDump(id, context.getModificationCache(), dumpParams);
-
- if (!replyOptional.isPresent() || replyOptional.get().lispEidTableDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return replyOptional.get()
- .lispEidTableDetails
- .stream()
- .filter(a -> a.vni == vni)
- .filter(subtableFilterForRemoteMappings(id))
- .map(detail -> getArrayAsEidRemote(valueOf(detail.eidType), detail.eid, detail.vni))
- .map(remoteEid -> remoteMappingContext.getId(remoteEid, context.getMappingContext()))
- .map(MappingId::new)
- .map(RemoteMappingKey::new)
- .collect(Collectors.toList());
- }
-
- @Override
- public void merge(Builder<? extends DataObject> builder, List<RemoteMapping> readData) {
- ((RemoteMappingsBuilder) builder).setRemoteMapping(readData);
- }
-
- 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
- bindNegativeMapping(builder, MapReplyAction.forValue(details.action));
- } else {
- // in this case, there is no clear determination whether negative action with NO_ACTION(value == 0) was defined,
- // or if its default value and remote locators, are defined, so only chance to determine so, is to dump locators for this mapping
-
- // 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(locatorIfaceIdentifier, cache,
- new LocatorDumpParamsBuilder().setLocatorSetIndex(details.locatorSetIndex).build());
- } catch (ReadFailedException e) {
- throw new ReadFailedException(id,
- new IllegalStateException("Unable to resolve Positive/Negative mapping for RemoteMapping",
- e.getCause()));
- }
-
- if (!reply.isPresent() || reply.get().lispLocatorDetails.isEmpty()) {
- // no remote locators exist, therefore there was NO_ACTION defined
- bindNegativeMapping(builder, NoAction);
- } else {
- // bind remote locators
- bindPositiveMapping(builder, reply.get());
- }
- }
- }
-
- private void bindNegativeMapping(final RemoteMappingBuilder builder,
- final MapReplyAction action) {
- builder.setLocatorList(
- new NegativeMappingBuilder().setMapReply(new MapReplyBuilder().setMapReplyAction(action).build())
- .build());
- }
-
- private void bindPositiveMapping(final RemoteMappingBuilder builder, final LispLocatorDetailsReplyDump reply) {
- builder.setLocatorList(
- new PositiveMappingBuilder()
- .setRlocs(
- new RlocsBuilder()
- .setLocator(reply
- .lispLocatorDetails
- .stream()
- .map(this::detailsToLocator)
- .collect(Collectors.toList()))
- .build()
- )
- .build()
- );
- }
-
- private Locator detailsToLocator(final LispLocatorDetails details) {
- final IpAddress address = arrayToIpAddressReversed(byteToBoolean(details.isIpv6), details.ipAddress);
- return new LocatorBuilder()
- .setAddress(address)
- .setKey(new LocatorKey(address))
- .setPriority((short) details.priority)
- .setWeight((short) details.weight)
- .build();
- }
-}
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
deleted file mode 100755
index 49047bcc9..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizer.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
-
-import com.google.common.base.Optional;
-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.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispEidTableVniDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTableBuilder;
-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.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Handles the reads of {@link VniTable} nodes
- */
-public class VniTableCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<VniTable, VniTableKey, VniTableBuilder>, JvppReplyConsumer {
-
- private static final Logger LOG = LoggerFactory.getLogger(VniTableCustomizer.class);
-
- private final DumpCacheManager<LispEidTableVniDetailsReplyDump, Void> dumpManager;
-
- public VniTableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
- super(futureJvpp);
- this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder<LispEidTableVniDetailsReplyDump, Void>()
- .withExecutor(((identifier, params) -> getReplyForRead(
- futureJvpp.lispEidTableVniDump(new LispEidTableVniDump()).toCompletableFuture(), identifier)))
- .build();
- }
-
- private static VniTableKey detailsToKey(final LispEidTableVniDetails lispEidTableMapDetails) {
- return new VniTableKey(Integer.valueOf(lispEidTableMapDetails.vni).longValue());
-
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<VniTable> readData) {
- ((EidTableBuilder) builder).setVniTable(readData);
- }
-
- @Nonnull
- @Override
- public VniTableBuilder getBuilder(@Nonnull final InstanceIdentifier<VniTable> id) {
- return new VniTableBuilder();
- }
-
- @Nonnull
- @Override
- public List<VniTableKey> getAllIds(@Nonnull final InstanceIdentifier<VniTable> id,
- @Nonnull final ReadContext context)
- throws ReadFailedException {
- LOG.trace("Reading all IDS...");
-
- final Optional<LispEidTableVniDetailsReplyDump> optionalReply =
- dumpManager.getDump(id, context.getModificationCache(), NO_PARAMS);
-
- if (!optionalReply.isPresent() || optionalReply.get().lispEidTableVniDetails.isEmpty()) {
- return Collections.emptyList();
- }
-
- return optionalReply.get().lispEidTableVniDetails.stream().map(VniTableCustomizer::detailsToKey)
- .collect(Collectors.toList());
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<VniTable> id,
- @Nonnull final VniTableBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
-
- checkState(id.firstKeyOf(VniTable.class) != null, "No VNI present");
- VniTableKey key = new VniTableKey(id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier());
-
- final Optional<LispEidTableVniDetailsReplyDump> optionalReply =
- dumpManager.getDump(id, ctx.getModificationCache(), NO_PARAMS);
-
- if (!optionalReply.isPresent() || optionalReply.get().lispEidTableVniDetails.isEmpty()) {
- return;
- }
-
- //transforming right away to single detail(specific request should do the magic)
- final LispEidTableVniDetails details = optionalReply.get()
- .lispEidTableVniDetails
- .stream()
- .filter(a -> a.vni == key.getVirtualNetworkIdentifier().intValue())
- .collect(RWUtils.singleItemCollector());
-
- builder.setVirtualNetworkIdentifier((long) details.vni);
- builder.setKey(new VniTableKey(Long.valueOf(details.vni)));
- }
-}
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
deleted file mode 100644
index af48a6500..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizer.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
-import io.fd.honeycomb.lisp.translate.read.trait.SubtableReader;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.List;
-import java.util.stream.Collectors;
-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.VniTableBuilder;
-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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtableBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class VrfSubtableCustomizer extends FutureJVppCustomizer
- implements ReaderCustomizer<VrfSubtable, VrfSubtableBuilder>, SubtableReader {
-
- private static final Logger LOG = LoggerFactory.getLogger(VrfSubtableCustomizer.class);
-
- private final DumpCacheManager<LispEidTableMapDetailsReplyDump, SubtableDumpParams> dumpManager;
-
- public VrfSubtableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
- super(futureJvpp);
- dumpManager = new DumpCacheManagerBuilder<LispEidTableMapDetailsReplyDump, SubtableDumpParams>()
- .withExecutor(createExecutor(futureJvpp))
- .build();
- }
-
- @Nonnull
- @Override
- public VrfSubtableBuilder getBuilder(@Nonnull final InstanceIdentifier<VrfSubtable> id) {
- return new VrfSubtableBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<VrfSubtable> id,
- @Nonnull final VrfSubtableBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- LOG.debug("Read attributes for {}", id);
- final int vni = checkNotNull(id.firstKeyOf(VniTable.class), "Cannot find parent VNI Table")
- .getVirtualNetworkIdentifier().intValue();
-
- final Optional<LispEidTableMapDetailsReplyDump> reply = dumpManager.getDump(id, ctx.getModificationCache(), L3_PARAMS);
-
- if (!reply.isPresent() || reply.get().lispEidTableMapDetails.isEmpty()) {
- return;
- }
-
- // Single item collector cant be used in this case,because vrf-subtable is container
- // so read is invoked every time parent is defined
- final List<LispEidTableMapDetails> details =
- reply.get().lispEidTableMapDetails.stream().filter(a -> a.vni == vni)
- .collect(Collectors.toList());
- if (details.size() == 1) {
- final LispEidTableMapDetails detail = details.get(0);
- builder.setTableId(Integer.valueOf(detail.dpTable).longValue());
-
- LOG.debug("Attributes for {} successfully loaded", id);
- }
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
- @Nonnull final VrfSubtable readValue) {
- ((VniTableBuilder) parentBuilder).setVrfSubtable(readValue);
- }
-}
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
deleted file mode 100644
index 7528d1d68..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/LocatorDumpParams.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.dump.executor.params;
-
-/**
- * Params for dumping locators
- */
-public final class LocatorDumpParams {
-
- private final int locatorSetIndex;
-
- private LocatorDumpParams(LocatorDumpParamsBuilder builder) {
- this.locatorSetIndex = builder.locatorSetIndex;
- }
-
- public int getLocatorSetIndex() {
- return locatorSetIndex;
- }
-
- public static final class LocatorDumpParamsBuilder {
-
- private int locatorSetIndex;
-
- public LocatorDumpParamsBuilder setLocatorSetIndex(final int locatorSetIndex) {
- this.locatorSetIndex = locatorSetIndex;
- return this;
- }
-
- public LocatorDumpParams build() {
- return new LocatorDumpParams(this);
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java
deleted file mode 100755
index d1af212b8..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/MappingsDumpParams.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.dump.executor.params;
-
-import java.util.Arrays;
-
-/**
- * Parameters for executing dump of mappings
- */
-public final class MappingsDumpParams {
-
- private final byte eidSet;
- private final byte prefixLength;
- private final int vni;
- private final byte eidType;
- private final byte[] eid;
- private final byte filter;
-
- private MappingsDumpParams(MappingsDumpParamsBuilder builder) {
- this.eidSet = builder.eidSet;
- this.prefixLength = builder.prefixLength;
- this.vni = builder.vni;
- this.eidType = builder.eidType;
- this.eid = builder.eid;
- this.filter = builder.filter;
- }
-
-
- public byte getEidSet() {
- return eidSet;
- }
-
- public byte getPrefixLength() {
- return prefixLength;
- }
-
- public int getVni() {
- return vni;
- }
-
- public byte getEidType() {
- return eidType;
- }
-
- public byte[] getEid() {
- return eid;
- }
-
- public final byte getFilter() {
- return filter;
- }
-
- @Override
- public String toString() {
- return "MappingsDumpParams{" +
- "eidSet=" + eidSet +
- ", prefixLength=" + prefixLength +
- ", vni=" + vni +
- ", eidType=" + eidType +
- ", eid=" + Arrays.toString(eid) +
- ", filter=" + filter +
- '}';
- }
-
- /**
- * Type of requested mapping eid
- */
- public enum EidType {
- IPV4(0),
- IPV6(1),
- MAC(2);
-
- private final int value;
-
- private EidType(final int value) {
- this.value = value;
- }
-
- public static final EidType valueOf(int value) {
- switch (value) {
- case 0:
- return IPV4;
- case 1:
- return IPV6;
- case 2:
- return MAC;
- default:
- throw new IllegalArgumentException("Illegal value");
- }
- }
-
- public final int getValue() {
- return this.value;
- }
- }
-
- /**
- * Type of requested mapping
- */
- public enum FilterType {
- ALL(0),
- LOCAL(1),
- REMOTE(2);
-
- private final int value;
-
- private FilterType(final int value) {
- this.value = value;
- }
-
- public final int getValue() {
- return this.value;
- }
- }
-
- public enum QuantityType {
- ALL(0),
- SPECIFIC(1);
-
- private final int value;
-
- private QuantityType(final int value) {
- this.value = value;
- }
-
- public final int getValue() {
- return this.value;
- }
- }
-
- public static final class MappingsDumpParamsBuilder {
- private byte eidSet;
- private byte prefixLength;
- private int vni;
- private byte eidType;
- private byte[] eid;
- private byte filter;
-
- public static final MappingsDumpParamsBuilder newInstance() {
- return new MappingsDumpParamsBuilder();
- }
-
- public MappingsDumpParamsBuilder setEidSet(final QuantityType quantityType) {
- this.eidSet = (byte) quantityType.getValue();
- return this;
- }
-
- public MappingsDumpParamsBuilder setPrefixLength(final byte prefixLength) {
- this.prefixLength = prefixLength;
- return this;
- }
-
- public MappingsDumpParamsBuilder setVni(final int vni) {
- this.vni = vni;
- return this;
- }
-
- public MappingsDumpParamsBuilder setEidType(final EidType eidType) {
- this.eidType = (byte) eidType.getValue();
- return this;
- }
-
- public MappingsDumpParamsBuilder setEid(final byte[] eid) {
- this.eid = eid;
- return this;
- }
-
- public MappingsDumpParamsBuilder setFilter(final FilterType filterType) {
- this.filter = (byte) filterType.getValue();
- return this;
- }
-
- public MappingsDumpParams build() {
- return new MappingsDumpParams(this);
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/SubtableDumpParams.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/SubtableDumpParams.java
deleted file mode 100644
index 678255c02..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/dump/executor/params/SubtableDumpParams.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.dump.executor.params;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtable;
-
-/**
- * Parameters for dumping {@link VrfSubtable}/{@link BridgeDomainSubtable}
- */
-public final class SubtableDumpParams {
-
- private final byte isL2;
-
- private SubtableDumpParams(SubtableDumpParamsBuilder builder) {
- this.isL2 = builder.isL2;
- }
-
- public byte isL2() {
- return isL2;
- }
-
- @Override
- public String toString() {
- return "SubtableDumpParams{" +
- "isL2=" + isL2 +
- '}';
- }
-
- public enum MapLevel {
- L2(1),
- L3(0);
-
- private final int value;
-
- private MapLevel(final int value) {
- this.value = value;
- }
-
- public int getValue() {
- return value;
- }
- }
-
- public static final class SubtableDumpParamsBuilder {
-
- private byte isL2;
-
- public SubtableDumpParamsBuilder setL2(@Nonnull final MapLevel mapLevel) {
- isL2 = Integer.valueOf(checkNotNull(mapLevel, "Cannot set null map level").getValue()).byteValue();
- return this;
- }
-
- public SubtableDumpParams build() {
- return new SubtableDumpParams(this);
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/AbstractLispReaderFactoryBase.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/AbstractLispReaderFactoryBase.java
deleted file mode 100644
index 8eb3d53da..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/AbstractLispReaderFactoryBase.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispState;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Basic attributes for lisp reader factories
- */
-abstract class AbstractLispReaderFactoryBase {
-
- protected final InstanceIdentifier<LispState> lispStateId;
- protected final FutureJVppCore vppApi;
- protected NamingContext interfaceContext;
- protected NamingContext locatorSetContext;
- protected NamingContext bridgeDomainContext;
- protected EidMappingContext localMappingContext;
- protected EidMappingContext remoteMappingContext;
-
- protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi) {
- this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP api refference is null");
- }
-
- protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final EidMappingContext localMappingContext,
- @Nonnull final EidMappingContext remoteMappingContext) {
- this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP api reference is null");
- this.interfaceContext = checkNotNull(interfaceContext,
- "Interface naming context is null,for readers that don't need this dependency,use different constructor");
- this.localMappingContext = checkNotNull(localMappingContext,
- "Local mappings reference is null,for readers that don't need this dependency use different constructor");
- this.remoteMappingContext = checkNotNull(remoteMappingContext,
- "Remote mappings reference is null,for readers that don't need this dependency use different constructor");
- }
-
- protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext,
- @Nonnull final EidMappingContext localMappingContext,
- @Nonnull final EidMappingContext remoteMappingContext) {
- this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP api reference is null");
- this.interfaceContext = checkNotNull(interfaceContext,
- "Interface naming context is null,for readers that don't need this dependency,use different constructor");
- this.locatorSetContext = checkNotNull(locatorSetContext,
- "Locator set naming context is null,for readers that don't need this dependency,use different constructor");
- this.localMappingContext = checkNotNull(localMappingContext,
- "Local mappings reference is null,for readers that don't need this dependency use different constructor");
- this.remoteMappingContext = checkNotNull(remoteMappingContext,
- "Remote mappings reference is null,for readers that don't need this dependency use different constructor");
- }
-
- protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext,
- @Nonnull final NamingContext bridgeDomainContext,
- @Nonnull final EidMappingContext localMappingContext,
- @Nonnull final EidMappingContext remoteMappingContext) {
- this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP api reference is null");
- this.interfaceContext = checkNotNull(interfaceContext,
- "Interface naming context is null,for readers that don't need this dependency,use different constructor");
- this.locatorSetContext = checkNotNull(locatorSetContext,
- "Locator set naming context is null,for readers that don't need this dependency,use different constructor");
- this.bridgeDomainContext = checkNotNull(bridgeDomainContext,
- "Bridge domain naming context is null,for readers that don't need this dependency,use different constructor");
- this.localMappingContext = checkNotNull(localMappingContext,
- "Local mappings reference is null,for readers that don't need this dependency use different constructor");
- this.remoteMappingContext = checkNotNull(remoteMappingContext,
- "Remote mappings reference is null,for readers that don't need this dependency use different constructor");
- }
-}
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
deleted file mode 100755
index 553b5b548..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/EidTableReaderFactory.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.factory;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.collect.ImmutableSet;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.AdjacencyCustomizer;
-import io.fd.honeycomb.lisp.translate.read.BridgeDomainSubtableCustomizer;
-import io.fd.honeycomb.lisp.translate.read.LocalMappingCustomizer;
-import io.fd.honeycomb.lisp.translate.read.RemoteMappingCustomizer;
-import io.fd.honeycomb.lisp.translate.read.VniTableCustomizer;
-import io.fd.honeycomb.lisp.translate.read.VrfSubtableCustomizer;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.impl.read.GenericReader;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-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.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.AdjacenciesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.negative.mapping.MapReply;
-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;
-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.Locator;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTableBuilder;
-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.BridgeDomainSubtable;
-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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * Factory that produces {@code Reader} for {@code EidTable}<br> with all its inhired child readers
- */
-final class EidTableReaderFactory extends AbstractLispReaderFactoryBase implements ReaderFactory {
-
- private final AdjacenciesMappingContext adjacenciesMappingContext;
-
- private EidTableReaderFactory(final InstanceIdentifier<LispState> lispStateId,
- final FutureJVppCore vppApi,
- final NamingContext interfaceContext,
- final NamingContext locatorSetContext,
- final NamingContext bridgeDomainContext,
- final EidMappingContext localMappingContext,
- final EidMappingContext remoteMappingContext,
- final AdjacenciesMappingContext adjacenciesMappingContext) {
- super(lispStateId, vppApi, interfaceContext, locatorSetContext, bridgeDomainContext, localMappingContext,
- remoteMappingContext);
- this.adjacenciesMappingContext = checkNotNull(adjacenciesMappingContext, "Adjacencies context cannot be null");
- }
-
- public static EidTableReaderFactory newInstance(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext,
- @Nonnull final NamingContext bridgeDomainContext,
- @Nonnull final EidMappingContext localMappingContext,
- @Nonnull final EidMappingContext remoteMappingContext,
- @Nonnull final AdjacenciesMappingContext adjacenciesMappingContext) {
- return new EidTableReaderFactory(lispStateId, vppApi, interfaceContext, locatorSetContext, bridgeDomainContext,
- localMappingContext, remoteMappingContext, adjacenciesMappingContext);
- }
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- final InstanceIdentifier<EidTable> eidTableInstanceIdentifier =
- lispStateId.child(LispFeatureData.class).child(EidTable.class);
- final InstanceIdentifier<VniTable> vniTableInstanceIdentifier =
- eidTableInstanceIdentifier.child(VniTable.class);
- final InstanceIdentifier<VrfSubtable> vrfSubtable = vniTableInstanceIdentifier.child(VrfSubtable.class);
- final InstanceIdentifier<BridgeDomainSubtable> bridgeDomainSubtable =
- vniTableInstanceIdentifier.child(BridgeDomainSubtable.class);
-
- final InstanceIdentifier<LocalMappings> vrfTableLocalMappingsInstanceIdentifier =
- vrfSubtable.child(LocalMappings.class);
- final InstanceIdentifier<RemoteMappings> vrfTableRemoteMappingsInstanceIdentifier =
- vrfSubtable.child(RemoteMappings.class);
- final InstanceIdentifier<Adjacencies> vrfTableAdjacenciesInstanceIdentifier =
- vrfSubtable.child(RemoteMappings.class).child(RemoteMapping.class).child(Adjacencies.class);
-
- final InstanceIdentifier<LocalMappings> bridgeDomainLocalMappingsInstanceIdentifier =
- bridgeDomainSubtable.child(LocalMappings.class);
- final InstanceIdentifier<RemoteMappings> bridgeDomainRemoteMappingsInstanceIdentifier =
- bridgeDomainSubtable.child(RemoteMappings.class);
- final InstanceIdentifier<Adjacencies> bridgeDomainAdjacenciesInstanceIdentifier =
- bridgeDomainSubtable.child(RemoteMappings.class).child(RemoteMapping.class).child(Adjacencies.class);
-
- //EidTable
- registry.addStructuralReader(eidTableInstanceIdentifier, EidTableBuilder.class);
- //EidTable -> VniTable
- registry.add(new GenericListReader<>(vniTableInstanceIdentifier, new VniTableCustomizer(vppApi)));
-
- //EidTable -> VniTable -> VrfSubtable
- registry.add(new GenericReader<>(vrfSubtable, new VrfSubtableCustomizer(vppApi)));
-
- //EidTable -> VniTable -> BridgeDomainSubtable
- registry.add(new GenericReader<>(bridgeDomainSubtable,
- new BridgeDomainSubtableCustomizer(vppApi, bridgeDomainContext)));
-
- //EidTable -> VniTable -> VrfSubtable -> LocalMappings
- registry.addStructuralReader(vrfTableLocalMappingsInstanceIdentifier, LocalMappingsBuilder.class);
- //EidTable -> VniTable -> BridgeDomainSubtable -> LocalMappings
- registry.addStructuralReader(bridgeDomainLocalMappingsInstanceIdentifier, LocalMappingsBuilder.class);
-
- final InstanceIdentifier<LocalMapping> localMappingSubtreeId = InstanceIdentifier.create(LocalMapping.class);
- //EidTable -> VniTable -> VrfSubtable -> LocalMappings -> LocalMapping
- registry.subtreeAdd(ImmutableSet.of(localMappingSubtreeId
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid.class)),
- new GenericListReader<>(vrfTableLocalMappingsInstanceIdentifier.child(LocalMapping.class),
- new LocalMappingCustomizer(vppApi, locatorSetContext, localMappingContext)));
-
- //EidTable -> VniTable -> BridgeDomainSubtable -> LocalMappings -> LocalMapping
- registry.subtreeAdd(ImmutableSet.of(localMappingSubtreeId
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid.class)),
- new GenericListReader<>(bridgeDomainLocalMappingsInstanceIdentifier.child(LocalMapping.class),
- new LocalMappingCustomizer(vppApi, locatorSetContext, localMappingContext)));
-
- //EidTable -> VniTable -> VrfSubtable -> RemoteMappings
- registry.addStructuralReader(vrfTableRemoteMappingsInstanceIdentifier, RemoteMappingsBuilder.class);
- registry.addStructuralReader(bridgeDomainRemoteMappingsInstanceIdentifier, RemoteMappingsBuilder.class);
-
- final InstanceIdentifier<RemoteMapping> remoteMappingSubtreeId = InstanceIdentifier.create(RemoteMapping.class);
- 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<>(vrfTableRemoteMappingsInstanceIdentifier.child(RemoteMapping.class),
- 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, locatorSetContext, remoteMappingContext)));
-
- registry.addStructuralReader(vrfTableAdjacenciesInstanceIdentifier, AdjacenciesBuilder.class);
- registry.addStructuralReader(bridgeDomainAdjacenciesInstanceIdentifier, AdjacenciesBuilder.class);
-
- final InstanceIdentifier<Adjacency> adjacencySubtreeId = InstanceIdentifier.create(Adjacency.class);
- registry.subtreeAdd(
- ImmutableSet.of(adjacencySubtreeId.child(LocalEid.class), adjacencySubtreeId.child(RemoteEid.class)),
- new GenericListReader<>(vrfTableAdjacenciesInstanceIdentifier.child(Adjacency.class),
- new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext,
- adjacenciesMappingContext)));
- registry.subtreeAdd(
- ImmutableSet.of(adjacencySubtreeId.child(LocalEid.class), adjacencySubtreeId.child(RemoteEid.class)),
- new GenericListReader<>(bridgeDomainAdjacenciesInstanceIdentifier.child(Adjacency.class),
- new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext,
- adjacenciesMappingContext)));
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java
deleted file mode 100755
index e96246b43..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LispStateReaderFactory.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.ADJACENCIES_IDENTIFICATION_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.INTERFACE_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCAL_MAPPING_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCATOR_SET_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.REMOTE_MAPPING_CONTEXT;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.LispStateCustomizer;
-import io.fd.honeycomb.lisp.translate.read.PitrCfgCustomizer;
-import io.fd.honeycomb.translate.impl.read.GenericReader;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-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.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureDataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * Initialize readers for {@link LispState}
- */
-public class LispStateReaderFactory extends AbstractLispReaderFactoryBase implements ReaderFactory {
-
- private final AdjacenciesMappingContext adjacenciesIdentificationContext;
-
- @Inject
- public LispStateReaderFactory(final FutureJVppCore vppApi,
- @Named(INTERFACE_CONTEXT) final NamingContext interfaceContext,
- @Named(LOCATOR_SET_CONTEXT) final NamingContext locatorSetContext,
- @Named("bridge-domain-context") final NamingContext bridgeDomainContext,
- @Named(LOCAL_MAPPING_CONTEXT) final EidMappingContext localMappingContext,
- @Named(REMOTE_MAPPING_CONTEXT) final EidMappingContext remoteMappingContext,
- @Named(ADJACENCIES_IDENTIFICATION_CONTEXT) final
- AdjacenciesMappingContext adjacenciesIdentificationContext) {
- super(InstanceIdentifier.create(LispState.class), vppApi, interfaceContext, locatorSetContext,
- bridgeDomainContext, localMappingContext, remoteMappingContext);
- this.adjacenciesIdentificationContext =
- checkNotNull(adjacenciesIdentificationContext, "Adjacencies mapping context cannot be null");
- }
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
-
- registry.add(new GenericReader<>(lispStateId, new LispStateCustomizer(vppApi)));
- registry.addStructuralReader(lispStateId.child(LispFeatureData.class), LispFeatureDataBuilder.class);
-
- LocatorSetsReaderFactory.newInstance(lispStateId, vppApi, interfaceContext, locatorSetContext).init(registry);
- MapResolversReaderFactory.newInstance(lispStateId, vppApi).init(registry);
- EidTableReaderFactory
- .newInstance(lispStateId, vppApi, interfaceContext, locatorSetContext, bridgeDomainContext,
- localMappingContext, remoteMappingContext, adjacenciesIdentificationContext)
- .init(registry);
-
- registry.add(new GenericReader<>(lispStateId.child(LispFeatureData.class).child(PitrCfg.class),
- new PitrCfgCustomizer(vppApi)));
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java
deleted file mode 100755
index c0d9468af..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/LocatorSetsReaderFactory.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.factory;
-
-
-import io.fd.honeycomb.lisp.translate.read.InterfaceCustomizer;
-import io.fd.honeycomb.lisp.translate.read.LocatorSetCustomizer;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-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.LocatorSetsBuilder;
-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.locator.set.Interface;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Produces reader for {@link LocatorSets} <br> and all its inhired child readers.
- */
-public class LocatorSetsReaderFactory extends AbstractLispReaderFactoryBase implements ReaderFactory {
-
-
- private LocatorSetsReaderFactory(final InstanceIdentifier<LispState> lispStateId,
- final FutureJVppCore vppApi,
- final NamingContext interfaceContext,
- final NamingContext locatorSetContext) {
- super(lispStateId, vppApi);
- this.interfaceContext = interfaceContext;
- this.locatorSetContext = locatorSetContext;
- }
-
- public static final LocatorSetsReaderFactory newInstance(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi,
- final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext) {
- return new LocatorSetsReaderFactory(lispStateId, vppApi, interfaceContext, locatorSetContext);
- }
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- InstanceIdentifier<LocatorSets> locatorSetsInstanceIdentifier = lispStateId.child(LispFeatureData.class).child(LocatorSets.class);
- InstanceIdentifier<LocatorSet> locatorSetInstanceIdentifier =
- locatorSetsInstanceIdentifier.child(LocatorSet.class);
-
- registry.addStructuralReader(locatorSetsInstanceIdentifier, LocatorSetsBuilder.class);
- registry.add(new GenericListReader<>(locatorSetInstanceIdentifier,
- new LocatorSetCustomizer(vppApi, locatorSetContext)));
- registry.add(new GenericListReader<>(locatorSetInstanceIdentifier.child(Interface.class),
- new InterfaceCustomizer(vppApi, interfaceContext, locatorSetContext)));
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java
deleted file mode 100755
index 866f13719..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/factory/MapResolversReaderFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.factory;
-
-
-import io.fd.honeycomb.lisp.translate.read.MapResolverCustomizer;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolvers;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolversBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Builds reader for {@link MapResolvers}<br> and all its inhired child readers
- */
-public class MapResolversReaderFactory extends AbstractLispReaderFactoryBase implements ReaderFactory {
-
- private MapResolversReaderFactory(final InstanceIdentifier<LispState> lispStateId, final FutureJVppCore vppApi) {
- super(lispStateId, vppApi);
- }
-
- public static MapResolversReaderFactory newInstance(@Nonnull final InstanceIdentifier<LispState> lispStateId,
- @Nonnull final FutureJVppCore vppApi) {
- return new MapResolversReaderFactory(lispStateId, vppApi);
- }
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
-
- InstanceIdentifier<MapResolvers> mapResolversInstanceIdentifier =
- lispStateId.child(LispFeatureData.class).child(MapResolvers.class);
-
- registry.addStructuralReader(mapResolversInstanceIdentifier, MapResolversBuilder.class);
- registry.add(new GenericListReader<>(mapResolversInstanceIdentifier.child(MapResolver.class),
- new MapResolverCustomizer(vppApi)));
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java
deleted file mode 100644
index 54fef659e..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorReader.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.trait;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.LocatorDumpParams;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-
-/**
- * Provides common logic for reading of locators
- */
-public interface LocatorReader extends JvppReplyConsumer {
-
- default EntityDumpExecutor<LispLocatorDetailsReplyDump, LocatorDumpParams> createLocatorDumpExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- checkNotNull(params, "Params for dump request not present");
- final LispLocatorDump request = new LispLocatorDump();
- request.lsIndex = params.getLocatorSetIndex();
- //flag that lsIndex is set
- request.isIndexSet = (byte) 1;
-
- return getReplyForRead(vppApi.lispLocatorDump(request).toCompletableFuture(), identifier);
- };
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java
deleted file mode 100644
index 7085b047d..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/LocatorSetReader.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.trait;
-
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDump;
-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.locator.sets.grouping.locator.sets.LocatorSet;
-
-/**
- * Provides common logic for reading {@link LocatorSet}
- */
-public interface LocatorSetReader extends JvppReplyConsumer {
-
- default EntityDumpExecutor<LispLocatorSetDetailsReplyDump, Void> createExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- final LispLocatorSetDump request = new LispLocatorSetDump();
- //only local
- request.filter = 1;
- return getReplyForRead(vppApi.lispLocatorSetDump(request).toCompletableFuture(), identifier);
- };
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducer.java
deleted file mode 100644
index 92e5c3191..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducer.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.trait;
-
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6Afi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-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.InstanceIdentifier;
-
-/**
- * Trait that verifies data for mappings
- */
-public interface MappingProducer {
-
- /**
- * Checks whether provided {@link LocalMapping} can be written under subtree idenfied by {@link InstanceIdentifier}
- */
- default void checkAllowedCombination(@Nonnull final InstanceIdentifier<LocalMapping> identifier,
- @Nonnull final LocalMapping data) throws WriteFailedException {
- final Class<? extends LispAddressFamily> eidAddressType = data.getEid().getAddressType();
-
- if (identifier.firstIdentifierOf(VrfSubtable.class) != null) {
- if (Ipv4Afi.class != eidAddressType && Ipv6Afi.class != eidAddressType) {
- throw new WriteFailedException.CreateFailedException(identifier, data,
- new IllegalArgumentException("Only Ipv4/Ipv6 eid's are allowed for Vrf Subtable"));
- }
- } else if (identifier.firstIdentifierOf(BridgeDomainSubtable.class) != null) {
- if (MacAfi.class != eidAddressType) {
- throw new WriteFailedException.CreateFailedException(identifier, data,
- new IllegalArgumentException("Only Mac eid's are allowed for Bridge Domain Subtable"));
- }
- }
- }
-
- default void checkAllowedCombination(@Nonnull final InstanceIdentifier<RemoteMapping> identifier,
- @Nonnull final RemoteMapping data) throws WriteFailedException {
- final Class<? extends LispAddressFamily> eidAddressType = data.getEid().getAddressType();
-
- if (identifier.firstIdentifierOf(VrfSubtable.class) != null) {
- if (Ipv4Afi.class != eidAddressType && Ipv6Afi.class != eidAddressType) {
- throw new WriteFailedException.CreateFailedException(identifier, data,
- new IllegalArgumentException("Only Ipv4/Ipv6 eid's are allowed for Vrf Subtable"));
- }
- } else if (identifier.firstIdentifierOf(BridgeDomainSubtable.class) != null) {
- if (MacAfi.class != eidAddressType) {
- throw new WriteFailedException.CreateFailedException(identifier, data,
- new IllegalArgumentException("Only Mac eid's are allowed for Bridge Domain Subtable"));
- }
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReader.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReader.java
deleted file mode 100644
index 759e52ae4..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReader.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.trait;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.MAC;
-
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.function.Predicate;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-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.InstanceIdentifier;
-
-/**
- * Trait providing predicates to filter mappings to respective subtables
- */
-public interface MappingReader extends JvppReplyConsumer {
-
- Predicate<LispEidTableDetails> BRIDGE_DOMAIN_MAPPINGS_ONLY =
- (LispEidTableDetails detail) -> detail.eidType == MAC.getValue();
-
- Predicate<LispEidTableDetails> VRF_MAPPINGS_ONLY =
- (LispEidTableDetails detail) -> detail.eidType == IPV4.getValue() || detail.eidType == IPV6.getValue();
-
- default Predicate<LispEidTableDetails> subtableFilterForLocalMappings(
- @Nonnull final InstanceIdentifier<LocalMapping> identifier) {
-
- if (identifier.firstIdentifierOf(VrfSubtable.class) != null) {
- return VRF_MAPPINGS_ONLY;
- } else if (identifier.firstIdentifierOf(BridgeDomainSubtable.class) != null) {
- return BRIDGE_DOMAIN_MAPPINGS_ONLY;
- } else {
- throw new IllegalArgumentException("Cannot determine mappings predicate for " + identifier);
- }
- }
-
- default Predicate<LispEidTableDetails> subtableFilterForRemoteMappings(
- @Nonnull final InstanceIdentifier<RemoteMapping> identifier) {
-
- if (identifier.firstIdentifierOf(VrfSubtable.class) != null) {
- return VRF_MAPPINGS_ONLY;
- } else if (identifier.firstIdentifierOf(BridgeDomainSubtable.class) != null) {
- return BRIDGE_DOMAIN_MAPPINGS_ONLY;
- } else {
- throw new IllegalArgumentException("Cannot determine mappings predicate for " + identifier);
- }
- }
-
- default EntityDumpExecutor<LispEidTableDetailsReplyDump, MappingsDumpParams> createMappingDumpExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- checkNotNull(params, "Params for dump request not present");
-
- LispEidTableDump request = new LispEidTableDump();
- request.eid = params.getEid();
- request.eidSet = params.getEidSet();
- request.eidType = params.getEidType();
- request.prefixLength = params.getPrefixLength();
- request.vni = params.getVni();
- request.filter = params.getFilter();
-
- return getReplyForRead(vppApi.lispEidTableDump(request).toCompletableFuture(), identifier);
- };
- }
-}
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
deleted file mode 100644
index a4a6e21ab..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReader.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.trait;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L2;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L3;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.SubtableDumpParamsBuilder;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams;
-import io.fd.honeycomb.translate.ModificationCache;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-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;
-
-/**
- * Provides common logic for reading Eid subtables
- */
-public interface SubtableReader extends JvppReplyConsumer {
-
- SubtableDumpParams L2_PARAMS = new SubtableDumpParamsBuilder().setL2(L2).build();
- SubtableDumpParams L3_PARAMS = new SubtableDumpParamsBuilder().setL2(L3).build();
-
- default EntityDumpExecutor<LispEidTableMapDetailsReplyDump, SubtableDumpParams> createExecutor(
- @Nonnull final FutureJVppCore vppApi) {
- return (identifier, params) -> {
- final LispEidTableMapDump request = new LispEidTableMapDump();
- request.isL2 = checkNotNull(params, "Cannot bind null params").isL2();
- return getReplyForRead(vppApi.lispEidTableMapDump(request).toCompletableFuture(), identifier);
- };
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidMetadataProvider.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidMetadataProvider.java
deleted file mode 100644
index 88571f717..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidMetadataProvider.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.util;
-
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEidBuilder;
-
-/**
- * Trait providing metadata for eid's
- */
-public interface EidMetadataProvider {
-
- /**
- * Returns new {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder}
- * binded with metadata
- */
- default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder newRemoteEidBuilder(
- @Nonnull final Class<? extends LispAddressFamily> eidAddressType,
- final int vni) {
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddressType(eidAddressType)
- .setVirtualNetworkId(new InstanceIdType(Long.valueOf(vni)));
- }
-
- /**
- * Returns new {@link org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder}
- * binded with metadata
- */
- default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder newLocalEidBuilder(
- @Nonnull final Class<? extends LispAddressFamily> eidAddressType,
- final int vni) {
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder()
- .setAddressType(eidAddressType)
- .setVirtualNetworkId(new InstanceIdType(Long.valueOf(vni)));
- }
-
- default LocalEidBuilder newEidBuilderLocal(@Nonnull final Class<? extends LispAddressFamily> eidAddressType,
- final int vni) {
- return new LocalEidBuilder()
- .setAddressType(eidAddressType)
- .setVirtualNetworkId(new InstanceIdType(Long.valueOf(vni)));
- }
-
- default RemoteEidBuilder newEidBuilderRemote(@Nonnull final Class<? extends LispAddressFamily> eidAddressType,
- final int vni) {
- return new RemoteEidBuilder()
- .setAddressType(eidAddressType)
- .setVirtualNetworkId(new InstanceIdType(Long.valueOf(vni)));
- }
-
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java
deleted file mode 100755
index 0b7faba31..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/util/EidTranslator.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.util;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.MAC;
-
-import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
-import java.util.Arrays;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6Afi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Mac;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.MacBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid;
-
-
-/**
- * Trait providing converting logic for eid's
- */
-public interface EidTranslator extends AddressTranslator, EidMetadataProvider {
-
-
- default byte getPrefixLength(LocalEid address) {
- return resolverPrefixLength(address.getAddress());
- }
-
- default byte getPrefixLength(RemoteEid address) {
- return resolverPrefixLength(address.getAddress());
- }
-
- default byte getPrefixLength(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid address) {
- return resolverPrefixLength(address.getAddress());
- }
-
- default byte getPrefixLength(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid address) {
- return resolverPrefixLength(address.getAddress());
- }
-
- default byte getPrefixLength(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid address) {
- return resolverPrefixLength(address.getAddress());
- }
-
- static byte resolverPrefixLength(Address address) {
-
- switch (resolveType(address)) {
- case IPV4:
- return 32;
- case IPV6:
- return (byte) 128;
- case MAC:
- return 0;
- default:
- throw new IllegalArgumentException("Illegal type");
- }
- }
-
- default Eid getArrayAsEidLocal(@Nonnull final EidType type, final byte[] address, final int vni) {
-
- switch (type) {
- case IPV4: {
- return newLocalEidBuilder(Ipv4Afi.class, vni).setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address)).build())
- .build();
- }
- case IPV6: {
- return newLocalEidBuilder(Ipv6Afi.class, vni).setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address)).build())
- .build();
- }
- case MAC: {
- return newLocalEidBuilder(MacAfi.class, vni).setAddress(
- new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address)))
- .build()).build();
- }
- default: {
- throw new IllegalStateException("Unknown type detected");
- }
- }
- }
-
- default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid getArrayAsEidRemote(
- @Nonnull final EidType type, final byte[] address, final int vni) {
-
- switch (type) {
- case IPV4: {
- return newRemoteEidBuilder(Ipv4Afi.class, vni)
- .setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case IPV6: {
- return newRemoteEidBuilder(Ipv6Afi.class, vni)
- .setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case MAC: {
- return newRemoteEidBuilder(MacAfi.class, vni)
- .setAddress(
- new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address)))
- .build()).build();
- }
- default: {
- throw new IllegalStateException("Unknown type detected");
- }
- }
- }
-
- default LocalEid getArrayAsLocalEid(@Nonnull final EidType type, final byte[] address, final int vni) {
- switch (type) {
- case IPV4: {
- return newEidBuilderLocal(Ipv4Afi.class, vni)
- .setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case IPV6: {
- return newEidBuilderLocal(Ipv6Afi.class, vni)
- .setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case MAC: {
- return newEidBuilderLocal(MacAfi.class, vni)
- .setAddress(
- new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address)))
- .build()).build();
- }
- default: {
- throw new IllegalStateException("Unknown type detected");
- }
- }
- }
-
- default RemoteEid getArrayAsRemoteEid(@Nonnull final EidType type, final byte[] address, final int vni) {
- switch (type) {
- case IPV4: {
- return newEidBuilderRemote(Ipv4Afi.class, vni)
- .setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case IPV6: {
- return newEidBuilderRemote(Ipv6Afi.class, vni)
- .setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address))
- .build())
- .build();
- }
- case MAC: {
- return newEidBuilderRemote(MacAfi.class, vni)
- .setAddress(
- new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address)))
- .build()).build();
- }
- default: {
- throw new IllegalStateException("Unknown type detected");
- }
- }
- }
-
- default String getArrayAsEidString(
- EidType type, byte[] address) {
- switch (type) {
- case IPV4: {
- return arrayToIpv4AddressNoZoneReversed(address).getValue();
- }
- case IPV6: {
- return arrayToIpv6AddressNoZoneReversed(address).getValue();
- }
- case MAC: {
- //as wrong as it looks ,its right(second param is not end index,but count)
- return byteArrayToMacSeparated(Arrays.copyOfRange(address, 0, 6));
- }
- default: {
- throw new IllegalStateException("Unknown type detected");
- }
- }
- }
-
-
- default EidType getEidType(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid address) {
- checkNotNull(address, "SimpleAddress cannot be null");
-
- return resolveType(address.getAddress());
- }
-
- default EidType getEidType(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid address) {
- checkNotNull(address, "SimpleAddress cannot be null");
-
- return resolveType(address.getAddress());
- }
-
-
- default EidType getEidType(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid address) {
- checkNotNull(address, "Address cannot be null");
-
- return resolveType(address.getAddress());
- }
-
-
- default EidType getEidType(final LocalEid address) {
- checkNotNull(address, "Address cannot be null");
-
- return resolveType(address.getAddress());
- }
-
- default EidType getEidType(final RemoteEid address) {
- checkNotNull(address, "Address cannot be null");
-
- return resolveType(address.getAddress());
- }
-
- static EidType resolveType(
- Address address) {
-
- if (address instanceof Ipv4) {
- return IPV4;
- } else if (address instanceof Ipv6) {
- return IPV6;
- } else if (address instanceof Mac) {
- return MAC;
- } else {
- throw new IllegalStateException("Unknown type detected");
- }
- }
-
- default byte[] getEidAsByteArray(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid address) {
- checkNotNull(address, "Eid cannot be null");
-
- return resolveByteArray(getEidType(address), address.getAddress());
- }
-
- default byte[] getEidAsByteArray(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid address) {
- checkNotNull(address, "Eid cannot be null");
-
- return resolveByteArray(getEidType(address), address.getAddress());
- }
-
- default byte[] getEidAsByteArray(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid address) {
- checkNotNull(address, "Eid cannot be null");
-
- return resolveByteArray(getEidType(address), address.getAddress());
- }
-
- default byte[] getEidAsByteArray(final LocalEid address) {
- checkNotNull(address, "Eid cannot be null");
-
- return resolveByteArray(getEidType(address), address.getAddress());
- }
-
-
- default byte[] getEidAsByteArray(final RemoteEid address) {
- checkNotNull(address, "Eid cannot be null");
-
- return resolveByteArray(getEidType(address), address.getAddress());
- }
-
- default byte[] resolveByteArray(EidType type, Address address) {
- switch (type) {
- case IPV4:
- return ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(((Ipv4) address).getIpv4()));
- case IPV6:
- return ipv6AddressNoZoneToArray(new Ipv6AddressNoZone(((Ipv6) address).getIpv6()));
- case MAC:
- return parseMac(((Mac) address).getMac().getValue());
- default:
- throw new IllegalArgumentException("Unsupported type");
- }
- }
-
- default boolean compareEids(
- LispAddress first,
- LispAddress second) {
-
- return compareAddresses(checkNotNull(first, "First eid is null").getAddress(),
- checkNotNull(second, "Second eid is null").getAddress());
- }
-
- default boolean compareAddresses(Address firstAddress, Address secondAddress) {
-
- checkNotNull(firstAddress, "First address is null");
- checkNotNull(secondAddress, "Second address is null");
-
- if (firstAddress instanceof Ipv4 && secondAddress instanceof Ipv4) {
- return ((Ipv4) firstAddress).getIpv4().getValue().equals(((Ipv4) secondAddress).getIpv4().getValue());
- }
-
- if (firstAddress instanceof Ipv6 && secondAddress instanceof Ipv6) {
- return ((Ipv6) firstAddress).getIpv6().getValue().equals(((Ipv6) secondAddress).getIpv6().getValue());
- }
-
- if (firstAddress instanceof Mac && secondAddress instanceof Mac) {
- return ((Mac) firstAddress).getMac().getValue().equals(((Mac) secondAddress).getMac().getValue());
- }
-
- return false;
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java
deleted file mode 100755
index b394f2a69..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizer.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType;
-
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.util.EidTranslator;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelAdjacency;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class AdjacencyCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<Adjacency, AdjacencyKey>, ByteDataTranslator, EidTranslator,
- JvppReplyConsumer {
-
- private final EidMappingContext localEidsMappingContext;
- private final EidMappingContext remoteEidsMappingContext;
- private final AdjacenciesMappingContext adjacenciesMappingContext;
-
- public AdjacencyCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final EidMappingContext localEidsMappingContext,
- @Nonnull final EidMappingContext remoteEidsMappingContext,
- @Nonnull final AdjacenciesMappingContext adjacenciesMappingContext) {
- super(futureJvpp);
- this.localEidsMappingContext =
- checkNotNull(localEidsMappingContext, "Eid context for local eid's cannot be null");
- this.remoteEidsMappingContext =
- checkNotNull(remoteEidsMappingContext, "Eid context for remote eid's cannot be null");
- this.adjacenciesMappingContext = checkNotNull(adjacenciesMappingContext, "Adjacencies context cannot be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Adjacency> id,
- @Nonnull final Adjacency dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- try {
- addDelAdjacency(true, id, dataAfter, writeContext);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- //after successful creation, create mapping
- adjacenciesMappingContext.addEidPair(adjacencyId(id),
- localEidId(dataAfter, writeContext),
- remoteEidId(dataAfter, writeContext),
- writeContext.getMappingContext());
- }
-
- private String remoteEidId(final @Nonnull Adjacency dataAfter, final @Nonnull WriteContext writeContext) {
- return remoteEidsMappingContext.getId(toRemoteEid(dataAfter.getRemoteEid()), writeContext.getMappingContext())
- .getValue();
- }
-
- private String localEidId(final @Nonnull Adjacency dataAfter, final @Nonnull WriteContext writeContext) {
- return localEidsMappingContext.getId(toLocalEid(dataAfter.getLocalEid()), writeContext.getMappingContext())
- .getValue();
- }
-
- private String adjacencyId(final @Nonnull InstanceIdentifier<Adjacency> id) {
- return id.firstKeyOf(Adjacency.class).getId();
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Adjacency> id,
- @Nonnull final Adjacency dataBefore, @Nonnull final Adjacency dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Adjacency> id,
- @Nonnull final Adjacency dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- try {
- addDelAdjacency(false, id, dataBefore, writeContext);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
- }
-
- //after successful creation, create mapping
- adjacenciesMappingContext.removeForIndex(adjacencyId(id),
- writeContext.getMappingContext());
- }
-
- private void addDelAdjacency(boolean add, final InstanceIdentifier<Adjacency> id, final Adjacency data,
- final WriteContext writeContext)
- throws TimeoutException, VppBaseCallException {
-
- final int vni = checkNotNull(id.firstKeyOf(VniTable.class), "Unable to find parent VNI for {}", id)
- .getVirtualNetworkIdentifier().intValue();
-
- // both local and remote eids must be referenced to have respective mapping,
- // if there is an attempt to add adjacency.
- // In our case its enough to check if local/remote mapping exist for respective eid,
- // because such mappings are created while creating mappings
- final LocalEid localEid = add
- ? verifiedLocalEid(data.getLocalEid(), writeContext)
- : data.getLocalEid();
- final RemoteEid remoteEid = add
- ? verifiedRemoteEid(data.getRemoteEid(), writeContext)
- : data.getRemoteEid();
- final EidType localEidType = getEidType(localEid);
- final EidType remoteEidType = getEidType(data.getRemoteEid());
-
- checkArgument(localEidType ==
- remoteEidType, "Local[%s] and Remote[%s] eid types must be the same", localEidType, remoteEidType);
-
- LispAddDelAdjacency request = new LispAddDelAdjacency();
-
- request.isAdd = booleanToByte(add);
- request.leid = getEidAsByteArray(localEid);
- request.leidLen = getPrefixLength(localEid);
- request.reid = getEidAsByteArray(remoteEid);
- request.reidLen = getPrefixLength(remoteEid);
- request.eidType = (byte) localEidType.getValue();
- request.vni = vni;
-
- getReply(getFutureJVpp().lispAddDelAdjacency(request).toCompletableFuture());
- }
-
- private LocalEid verifiedLocalEid(final LocalEid localEid, final WriteContext writeContext) {
- if (localEidsMappingContext.containsId(toLocalEid(localEid), writeContext.getMappingContext())) {
- return localEid;
- }
- throw new IllegalStateException(
- "Referenced Local Eid[" + localEid +
- "] doesn't have local mapping defined, therefore it can't be used in adjacency");
- }
-
- private RemoteEid verifiedRemoteEid(final RemoteEid remoteEid, final WriteContext writeContext) {
- if (remoteEidsMappingContext.containsId(toRemoteEid(remoteEid), writeContext.getMappingContext())) {
- return remoteEid;
- }
- throw new IllegalStateException(
- "Referenced Remote Eid[" + remoteEid +
- "] doesn't have remote mapping defined, therefore it can't be used in adjacency");
- }
-
- private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid toRemoteEid(
- final RemoteEid remoteEid) {
- return newRemoteEidBuilder(remoteEid.getAddressType(), remoteEid.getVirtualNetworkId().getValue().intValue())
- .setAddress(remoteEid.getAddress()).build();
- }
-
- private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid toLocalEid(
- LocalEid localEid) {
- return newLocalEidBuilder(localEid.getAddressType(), localEid.getVirtualNetworkId().getValue().intValue())
- .setAddress(localEid.getAddress()).build();
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainSubtableCustomizer.java
deleted file mode 100644
index 41e1adc15..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainSubtableCustomizer.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import io.fd.honeycomb.lisp.translate.write.trait.SubtableWriter;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BridgeDomainSubtableCustomizer extends FutureJVppCustomizer
- implements WriterCustomizer<BridgeDomainSubtable>, SubtableWriter {
-
- private static final Logger LOG = LoggerFactory.getLogger(BridgeDomainSubtableCustomizer.class);
-
- private final NamingContext bridgeDomainContext;
-
- public BridgeDomainSubtableCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final NamingContext bridgeDomainContext) {
- super(futureJvpp);
- this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id,
- @Nonnull final BridgeDomainSubtable dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Writing Id {} ", id);
-
- try {
- addDelSubtableMapping(getFutureJVpp(), true, extractVni(id),
- extractBridgeDomainId(dataAfter.getBridgeDomainRef(), writeContext.getMappingContext()), true, LOG);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- LOG.debug("{} successfully written", id);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id,
- @Nonnull final BridgeDomainSubtable dataBefore,
- @Nonnull final BridgeDomainSubtable dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id,
- @Nonnull final BridgeDomainSubtable dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Removing Id {}", id);
-
- try {
- addDelSubtableMapping(getFutureJVpp(), false, extractVni(id),
- extractBridgeDomainId(dataBefore.getBridgeDomainRef(), writeContext.getMappingContext()), true,
- LOG);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
- }
-
- LOG.debug("{} successfully removed", id);
- }
-
- private int extractBridgeDomainId(final String bridgeDomainName, final MappingContext mappingContext) {
- checkState(bridgeDomainContext.containsIndex(bridgeDomainName, mappingContext),
- "No mapping for bridge domain name %s", bridgeDomainName);
- return bridgeDomainContext.getIndex(bridgeDomainName, mappingContext);
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizer.java
deleted file mode 100755
index fa477e536..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizer.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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 java.nio.charset.StandardCharsets.UTF_8;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.io.UnsupportedEncodingException;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-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.locator.set.Interface;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocator;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Customizer for updating {@link Interface}
- *
- * @see Interface
- */
-public class InterfaceCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<Interface, InterfaceKey>, ByteDataTranslator, JvppReplyConsumer {
-
- private final NamingContext interfaceContext;
-
- public InterfaceCustomizer(@Nonnull FutureJVppCore futureJvpp, @Nonnull NamingContext interfaceContext) {
- super(futureJvpp);
- this.interfaceContext = checkNotNull(interfaceContext, "Naming context is null");
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<Interface> id, Interface dataAfter, WriteContext writeContext)
- throws WriteFailedException {
-
- checkNotNull(dataAfter, "Interface is null");
- checkNotNull(dataAfter.getPriority(), "Priority is null");
- checkNotNull(dataAfter.getWeight(), "Weight is null");
- checkState(id.firstKeyOf(Interface.class) != null, "Parent interface not found");
- checkState(id.firstKeyOf(LocatorSet.class) != null, "Parent locator set not found");
-
- String interfaceName = id.firstKeyOf(Interface.class).getInterfaceRef();
- String locatorSetName = id.firstKeyOf(LocatorSet.class).getName();
-
- checkState(interfaceContext.containsIndex(interfaceName, writeContext.getMappingContext()),
- "No mapping stored for interface %s", interfaceName);
-
- try {
- addDelInterfaceAndReply(true, dataAfter,
- interfaceContext.getIndex(interfaceName, writeContext.getMappingContext()), locatorSetName);
- } catch (VppBaseCallException | TimeoutException | UnsupportedEncodingException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<Interface> id, Interface dataBefore, Interface dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<Interface> id, Interface dataBefore,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataBefore, "Interface is null");
- checkNotNull(dataBefore.getPriority(), "Priority is null");
- checkNotNull(dataBefore.getWeight(), "Weight is null");
- checkState(id.firstKeyOf(Interface.class) != null, "Parent interface not found");
- checkState(id.firstKeyOf(LocatorSet.class) != null, "Parent locator set not found");
-
- String interfaceName = id.firstKeyOf(Interface.class).getInterfaceRef();
- String locatorSetName = id.firstKeyOf(LocatorSet.class).getName();
-
- checkState(interfaceContext.containsIndex(interfaceName, writeContext.getMappingContext()),
- "No mapping stored for interface %s", interfaceName);
- try {
- addDelInterfaceAndReply(false, dataBefore,
- interfaceContext.getIndex(interfaceName, writeContext.getMappingContext()), locatorSetName);
- } catch (VppBaseCallException | TimeoutException | UnsupportedEncodingException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
- }
-
- private void addDelInterfaceAndReply(boolean add, Interface data, int interfaceIndex, String locatorSetName)
- throws VppBaseCallException, TimeoutException, UnsupportedEncodingException {
- LispAddDelLocator request = new LispAddDelLocator();
-
- request.isAdd = booleanToByte(add);
- request.priority = data.getPriority().byteValue();
- request.weight = data.getWeight().byteValue();
- request.swIfIndex = interfaceIndex;
- request.locatorSetName = locatorSetName.getBytes(UTF_8);
-
- getReply(getFutureJVpp().lispAddDelLocator(request).toCompletableFuture());
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java
deleted file mode 100644
index 8ba1bcf3f..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.nio.charset.StandardCharsets;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelMapRequestItrRlocs;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-public class ItrRemoteLocatorSetCustomizer extends FutureJVppCustomizer implements
- WriterCustomizer<ItrRemoteLocatorSet>, ByteDataTranslator, JvppReplyConsumer {
-
- public ItrRemoteLocatorSetCustomizer(@Nonnull final FutureJVppCore futureJVppCore) {
- super(futureJVppCore);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id,
- @Nonnull final ItrRemoteLocatorSet dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- try {
- addDelItrRemoteLocatorSet(true, dataAfter);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id,
- @Nonnull final ItrRemoteLocatorSet dataBefore,
- @Nonnull final ItrRemoteLocatorSet dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Operation not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id,
- @Nonnull final ItrRemoteLocatorSet dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- try {
- addDelItrRemoteLocatorSet(false, dataBefore);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
- }
-
- private void addDelItrRemoteLocatorSet(final boolean add, @Nonnull final ItrRemoteLocatorSet data)
- throws TimeoutException, VppBaseCallException {
-
- LispAddDelMapRequestItrRlocs request = new LispAddDelMapRequestItrRlocs();
- request.isAdd = booleanToByte(add);
- request.locatorSetName = data.getRemoteLocatorSetName().getBytes(StandardCharsets.UTF_8);
-
- getReply(getFutureJVpp().lispAddDelMapRequestItrRlocs(request).toCompletableFuture());
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LispCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LispCustomizer.java
deleted file mode 100755
index ba2e24038..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LispCustomizer.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import com.google.common.base.Preconditions;
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.concurrent.CompletionStage;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispEnableDisable;
-import io.fd.vpp.jvpp.core.dto.LispEnableDisableReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Handles updates of {@link Lisp} node. Takes care of LISP enable/disable
- */
-public class LispCustomizer extends FutureJVppCustomizer
- implements WriterCustomizer<Lisp>, ByteDataTranslator, JvppReplyConsumer {
-
- public LispCustomizer(final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Lisp> id, @Nonnull final Lisp dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- Preconditions.checkNotNull(dataAfter, "Lisp is null");
-
- try {
- enableDisableLisp(dataAfter.isEnable());
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Lisp> id, @Nonnull final Lisp dataBefore,
- @Nonnull final Lisp dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- Preconditions.checkNotNull(dataAfter, "Lisp is null");
-
- try {
- enableDisableLisp(dataAfter.isEnable());
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Lisp> id, @Nonnull final Lisp dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- Preconditions.checkNotNull(dataBefore, "Lisp is null");
-
- try {
- enableDisableLisp(false);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
-
- }
-
-
- private void enableDisableLisp(final boolean enable) throws VppBaseCallException, TimeoutException {
- final CompletionStage<LispEnableDisableReply> lispEnableDisableReplyCompletionStage =
- getFutureJVpp().lispEnableDisable(getRequest(enable));
- getReply(lispEnableDisableReplyCompletionStage.toCompletableFuture());
- }
-
- private LispEnableDisable getRequest(final boolean enable) {
- final LispEnableDisable lispEnableDisable = new LispEnableDisable();
- lispEnableDisable.isEn = booleanToByte(enable);
- return lispEnableDisable;
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java
deleted file mode 100755
index 93f39f49b..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.trait.MappingProducer;
-import io.fd.honeycomb.lisp.translate.util.EidTranslator;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.io.UnsupportedEncodingException;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocalEid;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Customizer that writes changes for {@link LocalMapping}
- */
-public class LocalMappingCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<LocalMapping, LocalMappingKey>, ByteDataTranslator, EidTranslator,
- JvppReplyConsumer, MappingProducer {
-
- private final EidMappingContext localMappingsContext;
-
- public LocalMappingCustomizer(@Nonnull FutureJVppCore futureJvpp, @Nonnull EidMappingContext localMappingsContext) {
- super(futureJvpp);
- this.localMappingsContext = checkNotNull(localMappingsContext, "No local mappings context defined");
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<LocalMapping> id, LocalMapping dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataAfter, "Mapping is null");
- checkNotNull(dataAfter.getEid(), "Eid is null");
- checkNotNull(dataAfter.getLocatorSet(), "Locator set is null");
- checkState(id.firstKeyOf(VniTable.class) != null, "Parent vni table not found");
- checkAllowedCombination(id, dataAfter);
-
- //checks whether value with specified mapping-id does not exist in mapping allready
- final MappingId mappingId = id.firstKeyOf(LocalMapping.class).getId();
- checkState(!localMappingsContext
- .containsEid(mappingId, writeContext.getMappingContext()),
- "Local mapping with id %s already defined", id);
-
-
- try {
- addDelMappingAndReply(true, dataAfter,
- id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue());
- } catch (VppBaseCallException | TimeoutException | UnsupportedEncodingException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- //adds mapping for id and eid
- localMappingsContext.addEid(mappingId, dataAfter.getEid(), writeContext.getMappingContext());
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<LocalMapping> id, LocalMapping dataBefore,
- LocalMapping dataAfter, WriteContext writeContext)
- throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<LocalMapping> id, LocalMapping dataBefore,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataBefore, "Mapping is null");
- checkNotNull(dataBefore.getEid(), "Eid is null");
- checkNotNull(dataBefore.getLocatorSet(), "LocatorSet is null");
- checkState(id.firstKeyOf(VniTable.class) != null, "Parent vni table not found");
-
- //checks whether value with specified mapping-id does exist in mapping,so there is something to delete
- MappingId mappingId = id.firstKeyOf(LocalMapping.class).getId();
- checkState(localMappingsContext
- .containsEid(mappingId, writeContext.getMappingContext()),
- "Local mapping with id %s not present in mapping", id);
-
- try {
- addDelMappingAndReply(false, dataBefore,
- id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue());
- } catch (VppBaseCallException | TimeoutException | UnsupportedEncodingException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
-
- //removes value also from mapping
- localMappingsContext.removeEid(mappingId, writeContext.getMappingContext());
- }
-
- private void addDelMappingAndReply(boolean add, LocalMapping data, int vni) throws VppBaseCallException,
- TimeoutException, UnsupportedEncodingException {
-
- LispAddDelLocalEid request = new LispAddDelLocalEid();
-
- request.isAdd = booleanToByte(add);
- request.eid = getEidAsByteArray(data.getEid());
- request.eidType = (byte) getEidType(data.getEid()).getValue();
- request.locatorSetName = data.getLocatorSet().getBytes(UTF_8);
- request.vni = vni;
-
- //default prefixes
- if (request.eidType == IPV4.getValue()) {
- request.prefixLen = 32;
- } else if (request.eidType == IPV6.getValue()) {
- request.prefixLen = (byte) 128;
- }
-
- getReply(getFutureJVpp().lispAddDelLocalEid(request).toCompletableFuture());
- }
-
-}
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
deleted file mode 100755
index 749255836..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizer.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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 java.nio.charset.StandardCharsets.UTF_8;
-
-import io.fd.honeycomb.lisp.translate.read.trait.LocatorSetReader;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-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.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocatorSet;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.util.List;
-import javax.annotation.Nonnull;
-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.yang.binding.InstanceIdentifier;
-
-
-/**
- * Customizer for {@link LocatorSet} entity.
- *
- * @see LocatorSet
- */
-public class LocatorSetCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<LocatorSet, LocatorSetKey>, ByteDataTranslator,
- LocatorSetReader {
-
- private final NamingContext locatorSetContext;
-
- public LocatorSetCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final NamingContext locatorSetContext) {
- super(futureJvpp);
- this.locatorSetContext = checkNotNull(locatorSetContext, "Locator set context cannot be null");
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull InstanceIdentifier<LocatorSet> id,
- @Nonnull LocatorSet dataAfter,
- @Nonnull WriteContext writeContext) throws WriteFailedException {
- checkState(isNonEmptyLocatorSet(writeContext.readAfter(id).get()),
- "Creating empty locator-sets is not allowed");
- final String locatorSetName = dataAfter.getName();
- checkState(!locatorSetContext.containsIndex(locatorSetName, writeContext.getMappingContext()),
- "Locator set with name %s already defined", locatorSetName);
-
- final int locatorSetIndex = addDelLocatorSetAndReply(true, dataAfter.getName(), id);
- locatorSetContext.addName(locatorSetIndex, locatorSetName, writeContext.getMappingContext());
- }
-
- 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,
- @Nonnull LocatorSet dataAfter,
- @Nonnull WriteContext writeContext) throws WriteFailedException {
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter,
- new UnsupportedOperationException("Operation not supported"));
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<LocatorSet> id,
- @Nonnull LocatorSet dataBefore,
- @Nonnull WriteContext writeContext) throws WriteFailedException {
- final String locatorSetName = dataBefore.getName();
- addDelLocatorSetAndReply(false, dataBefore.getName(), id);
- //removes mapping after successful delete
- locatorSetContext.removeName(locatorSetName, writeContext.getMappingContext());
- }
-
- private int addDelLocatorSetAndReply(final boolean add, final String name, final InstanceIdentifier<LocatorSet> id)
- throws WriteFailedException {
-
- LispAddDelLocatorSet addDelSet = new LispAddDelLocatorSet();
-
- addDelSet.isAdd = booleanToByte(add);
- addDelSet.locatorSetName = name.getBytes(UTF_8);
-
- return getReplyForWrite(getFutureJVpp().lispAddDelLocatorSet(addDelSet).toCompletableFuture(), id).lsIndex;
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizer.java
deleted file mode 100755
index 42066c442..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelMapResolver;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Handles updates of {@link MapResolver} list
- */
-public class MapResolverCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<MapResolver, MapResolverKey>, AddressTranslator,
- JvppReplyConsumer {
-
- public MapResolverCustomizer(final FutureJVppCore vppApi) {
- super(vppApi);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<MapResolver> id,
- @Nonnull final MapResolver dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- checkNotNull(dataAfter, "Data is null");
- checkNotNull(dataAfter.getIpAddress(), "Address is null");
-
- try {
- addDelMapResolverAndReply(true, dataAfter);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<MapResolver> id,
- @Nonnull final MapResolver dataBefore, @Nonnull final MapResolver dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<MapResolver> id,
- @Nonnull final MapResolver dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- checkNotNull(dataBefore, "Data is null");
- checkNotNull(dataBefore.getIpAddress(), "Address is null");
-
- try {
- addDelMapResolverAndReply(false, dataBefore);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
- }
- }
-
- private void addDelMapResolverAndReply(boolean add, MapResolver data) throws VppBaseCallException,
- TimeoutException {
-
- LispAddDelMapResolver request = new LispAddDelMapResolver();
- request.isAdd = booleanToByte(add);
-
-
- boolean ipv6 = isIpv6(data.getIpAddress());
-
- request.isIpv6 = booleanToByte(ipv6);
- request.ipAddress = ipAddressToArray(ipv6, data.getIpAddress());
-
- getReply(getFutureJVpp().lispAddDelMapResolver(request).toCompletableFuture());
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java
deleted file mode 100755
index 035db3c33..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizer.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.concurrent.TimeoutException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispPitrSetLocatorSet;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Customizer for {@code PitrCfg}
- */
-public class PitrCfgCustomizer extends FutureJVppCustomizer
- implements WriterCustomizer<PitrCfg>, JvppReplyConsumer, ByteDataTranslator {
-
- private static final String DEFAULT_LOCATOR_SET_NAME = "N/A";
-
- public PitrCfgCustomizer(FutureJVppCore futureJvpp) {
- super(futureJvpp);
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<PitrCfg> id, PitrCfg dataAfter, WriteContext writeContext)
- throws WriteFailedException {
- checkNotNull(dataAfter, "PitrCfg is null");
- checkNotNull(dataAfter.getLocatorSet(), "Locator set name is null");
-
- try {
- addDelPitrSetLocatorSetAndReply(true, dataAfter);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<PitrCfg> id, PitrCfg dataBefore, PitrCfg dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataAfter, "PitrCfg is null");
- checkNotNull(dataAfter.getLocatorSet(), "Locator set name is null");
-
- try {
- addDelPitrSetLocatorSetAndReply(true, dataAfter);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<PitrCfg> id, PitrCfg dataBefore, WriteContext writeContext)
- throws WriteFailedException {
- checkNotNull(dataBefore, "PitrCfg is null");
- checkNotNull(dataBefore.getLocatorSet(), "Locator set name is null");
-
- try {
- addDelPitrSetLocatorSetAndReply(false, dataBefore);
- } catch (VppBaseCallException | TimeoutException e) {
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
- }
- }
-
- private void addDelPitrSetLocatorSetAndReply(boolean add, PitrCfg data)
- throws VppBaseCallException, TimeoutException {
-
- if (DEFAULT_LOCATOR_SET_NAME.equals(data.getLocatorSet())) {
- // ignores attempts to write default locator set
- // therefore even while its loaded to config data of honeycomb while starting
- // you can still enable/disable Lisp without having to define N/A as default pitr-set
- return;
- }
-
- LispPitrSetLocatorSet request = new LispPitrSetLocatorSet();
- request.isAdd = booleanToByte(add);
- request.lsName = data.getLocatorSet().getBytes(UTF_8);
-
- getReply(getFutureJVpp().lispPitrSetLocatorSet(request).toCompletableFuture());
- }
-
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java
deleted file mode 100755
index cb4313bc2..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizer.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.lisp.translate.write.RemoteMappingCustomizer.LocatorListType.NEGATIVE;
-import static io.fd.honeycomb.lisp.translate.write.RemoteMappingCustomizer.LocatorListType.POSITIVE;
-
-import com.google.common.base.Preconditions;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.trait.MappingProducer;
-import io.fd.honeycomb.lisp.translate.util.EidTranslator;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.AddressTranslator;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MapReplyAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.LocatorList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.PositiveMapping;
-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;
-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.Locator;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelRemoteMapping;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Customizer for {@link RemoteMapping}
- */
-public class RemoteMappingCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<RemoteMapping, RemoteMappingKey>, EidTranslator,
- AddressTranslator, JvppReplyConsumer, MappingProducer {
-
- private final EidMappingContext remoteMappingContext;
-
- public RemoteMappingCustomizer(@Nonnull final FutureJVppCore futureJvpp,
- @Nonnull final EidMappingContext remoteMappingContext) {
- super(futureJvpp);
- this.remoteMappingContext = remoteMappingContext;
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<RemoteMapping> id, RemoteMapping dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataAfter, "Mapping is null");
- checkNotNull(dataAfter.getEid(), "Eid is null");
- checkState(id.firstKeyOf(VniTable.class) != null, "Parent vni table not found");
- checkAllowedCombination(id, dataAfter);
-
- //checks whether mapping not already contains such key
- MappingId mappingId = id.firstKeyOf(RemoteMapping.class).getId();
- checkState(!remoteMappingContext.containsEid(mappingId, writeContext.getMappingContext()),
- "Mapping for id %s already defined", mappingId);
-
- try {
- addDelRemoteMappingAndReply(true, dataAfter,
- id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue());
- } catch (VppBaseCallException | TimeoutException | IOException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- //after successfull adition adds mapping
- remoteMappingContext.addEid(mappingId, dataAfter.getEid(), writeContext.getMappingContext());
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<RemoteMapping> id, RemoteMapping dataBefore,
- RemoteMapping dataAfter, WriteContext writeContext)
- throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<RemoteMapping> id, RemoteMapping dataBefore,
- WriteContext writeContext) throws WriteFailedException {
- checkNotNull(dataBefore, "Mapping is null");
- checkNotNull(dataBefore.getEid(), "Eid is null");
-
- //checks whether mapping already contains such key
- MappingId mappingId = id.firstKeyOf(RemoteMapping.class).getId();
- checkState(remoteMappingContext.containsEid(mappingId, writeContext.getMappingContext()),
- "Mapping for id %s is not existing,nothing to remove", mappingId);
-
- try {
- addDelRemoteMappingAndReply(false, dataBefore,
- id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier().intValue());
- } catch (VppBaseCallException | TimeoutException | IOException e) {
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
-
- //remote mapping after successfull remove of data
- remoteMappingContext.removeEid(mappingId, writeContext.getMappingContext());
- }
-
- private void addDelRemoteMappingAndReply(boolean add, RemoteMapping data, int vni)
- throws VppBaseCallException, TimeoutException, IOException {
-
- LispAddDelRemoteMapping request = new LispAddDelRemoteMapping();
-
- request.isAdd = booleanToByte(add);
- request.vni = vni;
- request.eidType = (byte) getEidType(data.getEid()).getValue();
- request.eid = getEidAsByteArray(data.getEid());
-
- //this is not length of eid array,but prefix length(bad naming by vpp)
- request.eidLen = getPrefixLength(data.getEid());
-
- if (LocatorListType.NEGATIVE
- .equals(resolveType(data.getLocatorList()))) {
- request.action = (byte) extractAction(data.getLocatorList()).getIntValue();
- } else {
- Rlocs rlocs = extractRemoteLocators(data.getLocatorList());
-
- checkArgument(rlocs != null, "No remote locators set for Positive mapping");
-
- request.rlocs = locatorsToBinaryData(rlocs.getLocator());
- request.rlocNum = Integer.valueOf(rlocs.getLocator().size()).byteValue();
- }
-
- getReply(getFutureJVpp().lispAddDelRemoteMapping(request).toCompletableFuture());
- }
-
- private static LocatorListType resolveType(LocatorList locatorList) {
- checkNotNull(locatorList, "Locator List cannot be null");
-
- if (locatorList instanceof PositiveMapping) {
- return POSITIVE;
- } else {
- return NEGATIVE;
- }
- }
-
- private static MapReplyAction extractAction(LocatorList locatorList) {
- checkNotNull(locatorList, "Locator List cannot be null");
- Preconditions.checkArgument(NEGATIVE.equals(resolveType(locatorList)),
- "Action can be extracted only from Negative Mapping");
-
- return ((NegativeMapping) locatorList).getMapReply().getMapReplyAction();
- }
-
- private static Rlocs extractRemoteLocators(LocatorList locatorList) {
- checkNotNull(locatorList, "Locator List cannot be null");
- Preconditions.checkArgument(POSITIVE.equals(resolveType(locatorList)),
- "RLocs can be extracted only from Positive Mapping");
-
- return ((PositiveMapping) locatorList).getRlocs();
- }
-
- //cant be static because of use of default methods from traits
- private byte[] locatorsToBinaryData(List<Locator> locators) throws IOException {
- checkNotNull(locators, "Cannot convert null list");
-
- ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
-
- DataOutputStream out = new DataOutputStream(byteArrayOut);
-
-
- for (Locator locator : locators) {
- boolean isIpv4;
- byte[] address;
-
- //first byte says that its v4/v6
- isIpv4 = !isIpv6(locator.getAddress());
- out.writeByte(booleanToByte(isIpv4));
-
- //then writes priority
- out.write(locator.getPriority());
-
- //and weight
- out.write(locator.getWeight());
-
- if (isIpv4) {
- //vpp in this case needs address as 16 byte array,regardless if it is ivp4 or ipv6
- address = Arrays.copyOf(
-
- ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(locator.getAddress().getIpv4Address())),
- 16);
-
- out.write(address);
- } else {
- out.write(
- ipv6AddressNoZoneToArray(new Ipv6AddressNoZone(locator.getAddress().getIpv6Address())));
- }
- }
-
- return byteArrayOut.toByteArray();
- }
-
- public enum LocatorListType {
-
- /**
- * Represents locator list as negative mapping
- */
- NEGATIVE,
-
- /**
- * Represents locator list as positive mapping
- */
- POSITIVE
- }
-
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java
deleted file mode 100755
index 005b336d6..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.util.RWUtils;
-
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-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.VniTableKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * This customizer serves only as a check if user is not trying to define VniTable <br>
- * without mapping to vrf/bd
- */
-public class VniTableCustomizer extends FutureJVppCustomizer implements ListWriterCustomizer<VniTable, VniTableKey> {
-
- private static final Logger LOG = LoggerFactory.getLogger(VniTableCustomizer.class);
-
- public VniTableCustomizer(FutureJVppCore futureJvpp) {
- super(futureJvpp);
- }
-
- @Override
- public void writeCurrentAttributes(InstanceIdentifier<VniTable> id, VniTable dataAfter, WriteContext writeContext)
- throws WriteFailedException {
- checkAtLeastOnChildExists(id, writeContext, false);
- }
-
- @Override
- public void updateCurrentAttributes(InstanceIdentifier<VniTable> id, VniTable dataBefore, VniTable dataAfter,
- WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(InstanceIdentifier<VniTable> id, VniTable dataBefore, WriteContext writeContext)
- throws WriteFailedException {
- checkAtLeastOnChildExists(id, writeContext, true);
- }
-
- private void checkAtLeastOnChildExists(final InstanceIdentifier<VniTable> id, final WriteContext writeContext,
- final boolean before) {
-
- Optional<VniTable> optData;
- final InstanceIdentifier<VniTable> trimmedId = RWUtils.cutId(id, InstanceIdentifier.create(VniTable.class));
- if (before) {
- optData = writeContext.readBefore(trimmedId);
- } else {
- optData = writeContext.readAfter(trimmedId);
- }
-
- checkState(optData.isPresent(), "Illegal after-write state");
-
- final VniTable dataAfter = optData.get();
- checkState(dataAfter.getVrfSubtable() != null || dataAfter.getBridgeDomainSubtable() != null,
- "At least one of VrfSubtable/BridgeDomainSubtable must be defined");
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizer.java
deleted file mode 100644
index a977871b5..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import io.fd.honeycomb.lisp.translate.write.trait.SubtableWriter;
-import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
-import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-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.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class VrfSubtableCustomizer extends FutureJVppCustomizer
- implements WriterCustomizer<VrfSubtable>, SubtableWriter {
-
- private static final Logger LOG = LoggerFactory.getLogger(VrfSubtableCustomizer.class);
-
- public VrfSubtableCustomizer(@Nonnull final FutureJVppCore futureJvpp) {
- super(futureJvpp);
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<VrfSubtable> id,
- @Nonnull final VrfSubtable dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- LOG.debug("Writing Id[{}]/Data[{}]", id, dataAfter);
-
- try {
- addDelSubtableMapping(getFutureJVpp(), true, extractVni(id), dataAfter.getTableId().intValue(), false, LOG);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
-
- LOG.debug("{} successfully written", id);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<VrfSubtable> id,
- @Nonnull final VrfSubtable dataBefore, @Nonnull final VrfSubtable dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- throw new UnsupportedOperationException("Operation not supported");
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<VrfSubtable> id,
- @Nonnull final VrfSubtable dataBefore, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
-
- LOG.debug("Removing Id[{}]/Data[{}]", id, dataBefore);
-
- try {
- addDelSubtableMapping(getFutureJVpp(), false, extractVni(id), dataBefore.getTableId().intValue(), false,
- LOG);
- } catch (TimeoutException | VppBaseCallException e) {
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
- }
-
- LOG.debug("{} successfully removed", id);
- }
-
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/AbstractLispWriterFactoryBase.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/AbstractLispWriterFactoryBase.java
deleted file mode 100644
index 366caf846..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/AbstractLispWriterFactoryBase.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Basic attributes for lisp writer factories
- */
-abstract class AbstractLispWriterFactoryBase {
-
- protected final InstanceIdentifier<Lisp> lispInstanceIdentifier;
- protected final FutureJVppCore vppApi;
- protected NamingContext interfaceContext;
- protected NamingContext locatorSetContext;
- protected EidMappingContext localMappingContext;
- protected EidMappingContext remoteMappingContext;
-
- protected AbstractLispWriterFactoryBase(@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- NamingContext interfaceContext) {
- this.lispInstanceIdentifier = checkNotNull(lispInstanceIdentifier, "Lisp identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP Api refference is null");
- this.interfaceContext = interfaceContext;
- }
-
- protected AbstractLispWriterFactoryBase(@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- NamingContext interfaceContext,
- NamingContext locatorSetContext) {
- this.lispInstanceIdentifier = checkNotNull(lispInstanceIdentifier, "Lisp identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP Api refference is null");
- this.interfaceContext = interfaceContext;
- this.locatorSetContext = locatorSetContext;
- }
-
- protected AbstractLispWriterFactoryBase(@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- EidMappingContext localMappingContext,
- EidMappingContext remoteMappingContext) {
- this.lispInstanceIdentifier = checkNotNull(lispInstanceIdentifier, "Lisp identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP Api refference is null");
- this.localMappingContext = localMappingContext;
- this.remoteMappingContext = remoteMappingContext;
- }
-
- protected AbstractLispWriterFactoryBase(@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- NamingContext interfaceContext,
- NamingContext locatorSetContext,
- EidMappingContext localMappingContext,
- EidMappingContext remoteMappingContext) {
- this.lispInstanceIdentifier = checkNotNull(lispInstanceIdentifier, "Lisp identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP Api refference is null");
- this.interfaceContext = interfaceContext;
- this.locatorSetContext = locatorSetContext;
- this.localMappingContext = localMappingContext;
- this.remoteMappingContext = remoteMappingContext;
- }
-
- protected AbstractLispWriterFactoryBase(@Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- NamingContext interfaceContext,
- EidMappingContext localMappingContext,
- EidMappingContext remoteMappingContext) {
- this.lispInstanceIdentifier = checkNotNull(lispInstanceIdentifier, "Lisp identifier is null");
- this.vppApi = checkNotNull(vppApi, "VPP Api refference is null");
- this.interfaceContext = interfaceContext;
- this.localMappingContext = localMappingContext;
- this.remoteMappingContext = remoteMappingContext;
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java
deleted file mode 100755
index 055aa72b9..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write.factory;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.ADJACENCIES_IDENTIFICATION_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.INTERFACE_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCAL_MAPPING_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCATOR_SET_CONTEXT;
-import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.REMOTE_MAPPING_CONTEXT;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.write.LispCustomizer;
-import io.fd.honeycomb.lisp.translate.write.PitrCfgCustomizer;
-import io.fd.honeycomb.translate.impl.write.GenericWriter;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
-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.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * Initialize writers for {@link Lisp}
- */
-public final class LispWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory {
-
- private final NamingContext bridgeDomainContext;
- private final AdjacenciesMappingContext adjacenciesMappingContext;
-
- @Inject
- public LispWriterFactory(final FutureJVppCore vppApi,
- @Named(INTERFACE_CONTEXT) final NamingContext interfaceContext,
- @Named(LOCATOR_SET_CONTEXT) final NamingContext locatorSetContext,
- @Named("bridge-domain-context") final NamingContext bridgeDomainContext,
- @Named(LOCAL_MAPPING_CONTEXT) final EidMappingContext localMappingContext,
- @Named(REMOTE_MAPPING_CONTEXT) final EidMappingContext remoteMappingContext,
- @Named(ADJACENCIES_IDENTIFICATION_CONTEXT) final AdjacenciesMappingContext adjacenciesMappingContext) {
- super(InstanceIdentifier.create(Lisp.class), vppApi, interfaceContext, locatorSetContext, localMappingContext,
- remoteMappingContext);
- this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
- this.adjacenciesMappingContext =
- checkNotNull(adjacenciesMappingContext, "Adjacencies mapping context cannot be null");
- }
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- registry.add(new GenericWriter<>(lispInstanceIdentifier, new LispCustomizer(vppApi)));
-
- VniTableWriterFactory.newInstance(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext,
- bridgeDomainContext, adjacenciesMappingContext)
- .init(registry);
- LocatorSetsWriterFactory.newInstance(lispInstanceIdentifier, vppApi, interfaceContext, locatorSetContext)
- .init(registry);
- MapResolversWriterFactory.newInstance(lispInstanceIdentifier, vppApi).init(registry);
-
- registry.add(new GenericWriter<>(lispInstanceIdentifier.child(LispFeatureData.class).child(PitrCfg.class),
- new PitrCfgCustomizer(vppApi)));
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java
deleted file mode 100755
index eabdfe27d..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LocatorSetsWriterFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write.factory;
-
-import io.fd.honeycomb.lisp.translate.write.InterfaceCustomizer;
-import io.fd.honeycomb.lisp.translate.write.LocatorSetCustomizer;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-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.locator.set.Interface;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Factory producing writers for {@code LocatorSets}
- */
-final class LocatorSetsWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory {
-
- private LocatorSetsWriterFactory(final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- final FutureJVppCore vppApi,
- final NamingContext interfaceContext,
- final NamingContext locatorSetContext) {
- super(lispInstanceIdentifier, vppApi, interfaceContext, locatorSetContext);
- }
-
- public static LocatorSetsWriterFactory newInstance(
- @Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext locatorSetContext) {
- return new LocatorSetsWriterFactory(lispInstanceIdentifier, vppApi, interfaceContext, locatorSetContext);
- }
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- InstanceIdentifier<LocatorSet> locatorSetId =
- lispInstanceIdentifier.child(LispFeatureData.class).child(LocatorSets.class).child(LocatorSet.class);
-
- registry.add(new GenericListWriter<>(locatorSetId, new LocatorSetCustomizer(vppApi, locatorSetContext)));
- registry.add(new GenericListWriter<>(locatorSetId.child(Interface.class),
- new InterfaceCustomizer(vppApi, interfaceContext)));
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java
deleted file mode 100755
index 0586f88cd..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/MapResolversWriterFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write.factory;
-
-
-import io.fd.honeycomb.lisp.translate.write.MapResolverCustomizer;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolvers;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-
-/**
- * Factory responsible for producing writers for {@code MapResolvers}
- */
-final class MapResolversWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory {
-
- private MapResolversWriterFactory(final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- final FutureJVppCore vppApi) {
- super(lispInstanceIdentifier, vppApi, null);
- }
-
- public static MapResolversWriterFactory newInstance(
- @Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi) {
- return new MapResolversWriterFactory(lispInstanceIdentifier, vppApi);
- }
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
- registry.add(new GenericListWriter<>(
- lispInstanceIdentifier.child(LispFeatureData.class).child(MapResolvers.class).child(MapResolver.class),
- new MapResolverCustomizer(vppApi)));
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java
deleted file mode 100755
index 9e9152ce0..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write.factory;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.collect.ImmutableSet;
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.write.AdjacencyCustomizer;
-import io.fd.honeycomb.lisp.translate.write.BridgeDomainSubtableCustomizer;
-import io.fd.honeycomb.lisp.translate.write.LocalMappingCustomizer;
-import io.fd.honeycomb.lisp.translate.write.RemoteMappingCustomizer;
-import io.fd.honeycomb.lisp.translate.write.VniTableCustomizer;
-import io.fd.honeycomb.lisp.translate.write.VrfSubtableCustomizer;
-import io.fd.honeycomb.translate.impl.write.GenericListWriter;
-import io.fd.honeycomb.translate.impl.write.GenericWriter;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
-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.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.negative.mapping.MapReply;
-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;
-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.Locator;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.BridgeDomainSubtable;
-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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-//TODO - HONEYCOMB-282 - refactor this and other factories for better readability
-
-/**
- * Factory for producing writers for {@code EidTable}
- */
-final class VniTableWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory {
-
- private final NamingContext bridgeDomainContext;
- private final AdjacenciesMappingContext adjacenciesMappingContext;
-
- private VniTableWriterFactory(final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- final FutureJVppCore vppApi,
- final EidMappingContext localMappingContext,
- final EidMappingContext remoteMappingContext,
- final NamingContext bridgeDomainContext,
- final AdjacenciesMappingContext adjacenciesMappingContext) {
- super(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext);
- this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null");
- this.adjacenciesMappingContext =
- checkNotNull(adjacenciesMappingContext, "Adjacencies mapping context cannot be null");
- }
-
- public static VniTableWriterFactory newInstance(
- @Nonnull final InstanceIdentifier<Lisp> lispInstanceIdentifier,
- @Nonnull final FutureJVppCore vppApi,
- @Nonnull final EidMappingContext localMappingContext,
- @Nonnull final EidMappingContext remoteMappingContext,
- @Nonnull final NamingContext bridgeDomainContext,
- @Nonnull final AdjacenciesMappingContext adjacenciesMappingContext) {
- return new VniTableWriterFactory(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext,
- bridgeDomainContext, adjacenciesMappingContext);
- }
-
- @Override
- public void init(final ModifiableWriterRegistryBuilder registry) {
- final InstanceIdentifier<VniTable> vniTableId =
- lispInstanceIdentifier.child(LispFeatureData.class).child(EidTable.class).child(VniTable.class);
-
- final InstanceIdentifier<VrfSubtable> vrfSubtableId = vniTableId.child(VrfSubtable.class);
- final InstanceIdentifier<BridgeDomainSubtable> bridgeDomainSubtableId =
- vniTableId.child(BridgeDomainSubtable.class);
-
- registry.add(new GenericListWriter<>(vniTableId, new VniTableCustomizer(vppApi)));
-
- registry.add(new GenericWriter<>(vrfSubtableId, new VrfSubtableCustomizer(vppApi)));
- registry.add(new GenericWriter<>(bridgeDomainSubtableId,
- new BridgeDomainSubtableCustomizer(vppApi, bridgeDomainContext)));
-
- //VniTable - > VrfSubtable -> LocalMappings - > LocalMapping
- final InstanceIdentifier<LocalMapping> localMappingSubtreeId = InstanceIdentifier.create(LocalMapping.class);
- registry.subtreeAdd(ImmutableSet.of(localMappingSubtreeId
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid.class)),
- new GenericListWriter<>(
- vrfSubtableId.child(LocalMappings.class).child(LocalMapping.class),
- new LocalMappingCustomizer(vppApi, localMappingContext)));
- //VniTable - > BridgeDomainSubtable -> LocalMappings - > LocalMapping
- registry.subtreeAdd(ImmutableSet.of(localMappingSubtreeId
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid.class)),
- new GenericListWriter<>(bridgeDomainSubtableId.child(LocalMappings.class)
- .child(LocalMapping.class),
- new LocalMappingCustomizer(vppApi, localMappingContext)));
-
- //VniTable - > VrfSubtable -> RemoteMappings - > RemoteMapping
- final InstanceIdentifier<RemoteMapping> remoteMappingSubtreeId = InstanceIdentifier.create(RemoteMapping.class);
- 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 GenericListWriter<>(
- vrfSubtableId.child(RemoteMappings.class).child(RemoteMapping.class),
- new RemoteMappingCustomizer(vppApi, remoteMappingContext)));
- //VniTable - > BridgeDomainSubtable -> RemoteMappings - > RemoteMapping
- 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 GenericListWriter<>(bridgeDomainSubtableId.child(RemoteMappings.class)
- .child(RemoteMapping.class),
- new RemoteMappingCustomizer(vppApi, remoteMappingContext)));
-
- //VniTable - > VrfSubtable -> RemoteMappings - > RemoteMapping - > Adjacencies - > Adjacency
- final InstanceIdentifier<Adjacency> adjacencySubtreeId = InstanceIdentifier.create(Adjacency.class);
- registry.subtreeAdd(ImmutableSet.of(adjacencySubtreeId
- .child(LocalEid.class), adjacencySubtreeId.child(RemoteEid.class)),
- new GenericListWriter<>(
- vrfSubtableId.child(RemoteMappings.class).child(RemoteMapping.class)
- .child(Adjacencies.class).child(Adjacency.class),
- new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext,
- adjacenciesMappingContext)));
- //VniTable - > BridgeDomainSubtable -> RemoteMappings - > RemoteMapping - > Adjacencies - > Adjacency
- registry.subtreeAdd(ImmutableSet.of(adjacencySubtreeId
- .child(LocalEid.class), adjacencySubtreeId.child(RemoteEid.class)),
- new GenericListWriter<>(
- bridgeDomainSubtableId.child(RemoteMappings.class)
- .child(RemoteMapping.class)
- .child(Adjacencies.class).child(Adjacency.class),
- new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext,
- adjacenciesMappingContext)));
- }
-}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriter.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriter.java
deleted file mode 100644
index b00bfc09f..000000000
--- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write.trait;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
-import java.util.concurrent.TimeoutException;
-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.BridgeDomainSubtable;
-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;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.LispEidTableAddDelMap;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.slf4j.Logger;
-
-/**
- * Trait providing logic for writing subtables
- */
-public interface SubtableWriter extends ByteDataTranslator, JvppReplyConsumer {
- int DEFAULT_VNI = 0;
-
- /**
- * Writes mapping from {@link VniTable}
- * to {@link VrfSubtable} or
- * {@link BridgeDomainSubtable}
- *
- * @param addDel true if add,delete otherwise
- * @param vni {@link VniTable} ID
- * @param tableId if <b>isL2</b> is true, than bridge domain subtable id,else vrf subtable id
- * @param isL2 indicates whether (false) writing to L3 vrfSubtrable of (true) L2 bridgeDomainSubtrable
- */
- default void addDelSubtableMapping(@Nonnull final FutureJVppCore vppApi, final boolean addDel, final int vni,
- final int tableId,
- final boolean isL2,
- final Logger logger) throws TimeoutException, VppBaseCallException {
-
- if (vni == DEFAULT_VNI) {
- // attempt to write subtable with default vni mapping(it does'nt make sense and it should'nt be possible)
- // also allows to enable lisp without defining default mapping in request
- logger.info("An attempt to write subtable[id = {}] with default vni {} was detected, ignoring write",
- tableId, DEFAULT_VNI);
- return;
- }
-
- checkNotNull(vppApi, "VPP Api refference cannot be null");
-
- LispEidTableAddDelMap request = new LispEidTableAddDelMap();
-
- request.isAdd = booleanToByte(addDel);
- request.vni = vni;
- request.dpTable = tableId;
- request.isL2 = booleanToByte(isL2);
-
- getReply(vppApi.lispEidTableAddDelMap(request).toCompletableFuture());
- }
-
- default int extractVni(@Nonnull final InstanceIdentifier<? extends ChildOf<VniTable>> id) {
- return checkNotNull(
- checkNotNull(id, "Identifier cannot be null").firstKeyOf(VniTable.class),
- "Parent VNI id not defined").getVirtualNetworkIdentifier().intValue();
- }
-}
diff --git a/lisp/lisp2vpp/src/main/resources/honeycomb-minimal-resources/config/lisp.json b/lisp/lisp2vpp/src/main/resources/honeycomb-minimal-resources/config/lisp.json
deleted file mode 100644
index 7a73a41bf..000000000
--- a/lisp/lisp2vpp/src/main/resources/honeycomb-minimal-resources/config/lisp.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java
deleted file mode 100644
index 20c6aa3f7..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import com.google.inject.testing.fieldbinder.Bind;
-import com.google.inject.testing.fieldbinder.BoundFieldModule;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import java.util.HashSet;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-
-public class LispModuleTest {
-
- @Named("interface-context")
- @Bind
- private NamingContext interfaceContext;
-
- @Named("bridge-domain-context")
- @Bind
- private NamingContext bridgeDomainContext;
-
- @Named("honeycomb-context")
- @Bind
- @Mock
- private DataBroker honeycombContext;
-
- @Named("honeycomb-initializer")
- @Bind
- @Mock
- private DataBroker honeycombInitializer;
-
- @Bind
- @Mock
- private FutureJVppCore futureJVppCore;
-
- @Inject
- private Set<ReaderFactory> readerFactories = new HashSet<>();
-
- @Inject
- private Set<WriterFactory> writerFactories = new HashSet<>();
-
- @Before
- public void setUp() throws Exception {
- initMocks(this);
- interfaceContext = new NamingContext("interfaceContext", "interfaceContext");
- bridgeDomainContext = new NamingContext("bridgeDomainContext", "bridgeDomainContext");
- Guice.createInjector(new LispModule(), BoundFieldModule.of(this)).injectMembers(this);
- }
-
- @Test
- public void testReaderFactories() throws Exception {
- assertThat(readerFactories, is(not(empty())));
-
- // Test registration process (all dependencies present, topological order of readers does exist, etc.)
- final CompositeReaderRegistryBuilder registryBuilder = new CompositeReaderRegistryBuilder();
- readerFactories.stream().forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-
- @Test
- public void testWriterFactories() throws Exception {
- assertThat(writerFactories, is(not(empty())));
-
- // Test registration process (all dependencies present, topological order of writers does exist, etc.)
- final FlatWriterRegistryBuilder registryBuilder = new FlatWriterRegistryBuilder();
- writerFactories.stream().forEach(factory -> factory.init(registryBuilder));
- assertNotNull(registryBuilder.build());
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContextTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContextTest.java
deleted file mode 100644
index 4a5302ba6..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/AdjacenciesMappingContextTest.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.context.util;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableSet;
-import io.fd.honeycomb.test.tools.HoneycombTestRunner;
-import io.fd.honeycomb.test.tools.annotations.InjectTestData;
-import io.fd.honeycomb.test.tools.annotations.InjectablesProcessor;
-import io.fd.honeycomb.test.tools.annotations.SchemaContextProvider;
-import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.util.RWUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.$YangModuleInfoImpl;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.AdjacenciesIdentificationContexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentification;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentificationKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.MappingKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPair;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-@RunWith(HoneycombTestRunner.class)
-public class AdjacenciesMappingContextTest implements InjectablesProcessor {
-
- private static final String PARENT_1 = "first";
- private static final String PARENT_2 = "second";
- private static final String PARENT_3 = "third";
- private static final String PARENT_4 = "fourth";
-
- private static final String LOCAL_EID_ID_1 = "local-eid-1";
- private static final String LOCAL_EID_ID_2 = "local-eid-2";
- private static final String LOCAL_EID_ID_3 = "local-eid-3";
-
- private static final String REMOTE_EID_ID_1 = "remote-eid-1";
- private static final String REMOTE_EID_ID_2 = "remote-eid-2";
- private static final String REMOTE_EID_ID_3 = "remote-eid-3";
-
- @Mock
- private MappingContext mappingContext;
-
- @Captor
- private ArgumentCaptor<Mapping> mappingArgumentCaptor;
-
- @Captor
- private ArgumentCaptor<KeyedInstanceIdentifier<Mapping, MappingKey>> keyedInstanceIdentifierArgumentCaptor;
-
- private AdjacenciesMappingContext adjacenciesMappingContext;
- private KeyedInstanceIdentifier<AdjacenciesIdentification, AdjacenciesIdentificationKey>
- adjacenciesMappingContextId;
-
- @SchemaContextProvider
- public ModuleInfoBackedContext schemaContext() {
- return provideSchemaContextFor(ImmutableSet.of($YangModuleInfoImpl.getInstance(),
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.$YangModuleInfoImpl
- .getInstance()));
- }
-
- @InjectTestData(resourcePath = "/adjacencies-identification-context.json", id = "/naming-context:contexts" +
- "/adjacencies-identification-context:adjacencies-identification-contexts" +
- "/adjacencies-identification-context:adjacencies-identification[adjacencies-identification-context:name='context']" +
- "/adjacencies-identification-context:mappings")
- private Mappings mappings;
-
- @Before
- public void init() {
- MockitoAnnotations.initMocks(this);
-
- adjacenciesMappingContext = new AdjacenciesMappingContext("context");
- adjacenciesMappingContextId = InstanceIdentifier.create(AdjacenciesIdentificationContexts.class).child(
- AdjacenciesIdentification.class, new AdjacenciesIdentificationKey("context"));
-
- when(mappingContext.read(adjacenciesMappingContextId.child(Mappings.class))).thenReturn(Optional.of(mappings));
- when(mappingContext.read(parentKey(PARENT_1))).thenReturn(Optional.of(filterForParent(PARENT_1)));
- when(mappingContext.read(parentKey(PARENT_2))).thenReturn(Optional.of(filterForParent(PARENT_2)));
- when(mappingContext.read(parentKey(PARENT_3))).thenReturn(Optional.of(filterForParent(PARENT_3)));
- }
-
- private Mapping filterForParent(final String parent) {
- return mappings.getMapping().stream()
- .filter(mapping -> mapping.getId().equals(parent))
- .collect(RWUtils.singleItemCollector());
- }
-
- private KeyedInstanceIdentifier<Mapping, MappingKey> parentKey(final String parent) {
- return adjacenciesMappingContextId.child(Mappings.class).child(Mapping.class, new MappingKey(parent));
- }
-
- @Test
- public void getAdjacencyId() throws Exception {
- assertEquals(PARENT_1,
- adjacenciesMappingContext.getAdjacencyId(LOCAL_EID_ID_1, REMOTE_EID_ID_1, mappingContext));
- assertEquals(PARENT_2,
- adjacenciesMappingContext.getAdjacencyId(LOCAL_EID_ID_2, REMOTE_EID_ID_2, mappingContext));
- assertEquals(PARENT_3,
- adjacenciesMappingContext.getAdjacencyId(LOCAL_EID_ID_3, REMOTE_EID_ID_3, mappingContext));
- }
-
- @Test
- public void containsId() throws Exception {
- assertTrue(adjacenciesMappingContext.containsId(LOCAL_EID_ID_1, REMOTE_EID_ID_1, mappingContext));
- assertTrue(adjacenciesMappingContext.containsId(LOCAL_EID_ID_2, REMOTE_EID_ID_2, mappingContext));
- assertTrue(adjacenciesMappingContext.containsId(LOCAL_EID_ID_3, REMOTE_EID_ID_3, mappingContext));
- }
-
- @Test
- public void addEidPair() throws Exception {
- adjacenciesMappingContext.addEidPair(PARENT_4, LOCAL_EID_ID_1, REMOTE_EID_ID_3, mappingContext);
- verify(mappingContext, times(1))
- .put(keyedInstanceIdentifierArgumentCaptor.capture(), mappingArgumentCaptor.capture());
-
- final KeyedInstanceIdentifier<Mapping, MappingKey> key = keyedInstanceIdentifierArgumentCaptor.getValue();
- final Mapping mapping = mappingArgumentCaptor.getValue();
-
- assertEquals(PARENT_4, key.getKey().getId());
- assertEquals(PARENT_4, mapping.getId());
- assertEquals(PARENT_4, mapping.getKey().getId());
-
- final EidIdentificatorPair pair = mapping.getEidIdentificatorPair();
- assertEquals(LOCAL_EID_ID_1, pair.getLocalEidId().getValue());
- assertEquals(REMOTE_EID_ID_3, pair.getRemoteEidId().getValue());
- }
-
- @Test
- public void removeForIndex() throws Exception {
- adjacenciesMappingContext.removeForIndex(PARENT_1, mappingContext);
- adjacenciesMappingContext.removeForIndex(PARENT_2, mappingContext);
- adjacenciesMappingContext.removeForIndex(PARENT_3, mappingContext);
- verify(mappingContext, times(1)).delete(parentKey(PARENT_1));
- verify(mappingContext, times(1)).delete(parentKey(PARENT_2));
- verify(mappingContext, times(1)).delete(parentKey(PARENT_3));
- }
-
- @Test
- public void getEidPair() throws Exception {
- final EidIdentificatorPair pair1 = adjacenciesMappingContext.getEidPair(PARENT_1, mappingContext);
- final EidIdentificatorPair pair2 = adjacenciesMappingContext.getEidPair(PARENT_2, mappingContext);
- final EidIdentificatorPair pair3 = adjacenciesMappingContext.getEidPair(PARENT_3, mappingContext);
-
- assertEquals(LOCAL_EID_ID_1, pair1.getLocalEidId().getValue());
- assertEquals(REMOTE_EID_ID_1, pair1.getRemoteEidId().getValue());
- assertEquals(LOCAL_EID_ID_2, pair2.getLocalEidId().getValue());
- assertEquals(REMOTE_EID_ID_2, pair2.getRemoteEidId().getValue());
- assertEquals(LOCAL_EID_ID_3, pair3.getLocalEidId().getValue());
- assertEquals(REMOTE_EID_ID_3, pair3.getRemoteEidId().getValue());
- }
-
- @Test
- public void containsEidPairForIndex() throws Exception {
- assertTrue(adjacenciesMappingContext.containsEidPairForIndex(PARENT_1, mappingContext));
- assertTrue(adjacenciesMappingContext.containsEidPairForIndex(PARENT_2, mappingContext));
- assertTrue(adjacenciesMappingContext.containsEidPairForIndex(PARENT_3, mappingContext));
- }
-
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java
deleted file mode 100644
index ccd38292e..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/context/util/EidMappingContextTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.context.util;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import io.fd.honeycomb.lisp.util.EidMappingContextHelper;
-import io.fd.honeycomb.translate.MappingContext;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder;
-
-public class EidMappingContextTest implements EidMappingContextHelper {
-
- private static final String EID_MAPPING_CONTEXT_NAME = "eidMappingContext";
-
- @Mock
- private MappingContext mappingContext;
-
- private EidMappingContext eidMappingContext;
- private Eid localEid;
- private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid
- remoteEid;
- private org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid
- mappingEid;
- private MappingId mappingId;
-
- @Before
- public void init() {
- MockitoAnnotations.initMocks(this);
- eidMappingContext = new EidMappingContext(EID_MAPPING_CONTEXT_NAME);
-
- localEid =
- new EidBuilder().setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build()).build();
- remoteEid = fromLocalToRemoteEid(localEid);
- mappingEid = fromLocalToMappingEid(localEid);
- mappingId = new MappingId("mapping");
-
- defineEidMapping(mappingContext, mappingEid, mappingId, EID_MAPPING_CONTEXT_NAME);
- }
-
- @Test
- public void testContainsEid() {
- assertTrue(eidMappingContext.containsEid(mappingId, mappingContext));
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid
- loadedEid = eidMappingContext.getEid(mappingId, mappingContext);
-
- assertEquals("192.168.2.1", ((Ipv4) (loadedEid.getAddress())).getIpv4().getValue());
- }
-
- @Test
- public void testContainsId() {
- assertTrue(eidMappingContext.containsId(localEid, mappingContext));
- assertTrue(eidMappingContext.containsId(remoteEid, mappingContext));
- }
-
- @Test
- public void testGetEid() {
- assertEquals(mappingEid, eidMappingContext.getEid(mappingId, mappingContext));
- }
-
- @Test
- public void testGetId() {
- assertEquals(mappingId, eidMappingContext.getId(localEid, mappingContext));
- assertEquals(mappingId, eidMappingContext.getId(remoteEid, mappingContext));
- }
-
- private org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid fromLocalToMappingEid(
- Eid eid) {
- return new org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder()
- .setAddress(eid.getAddress())
- .setAddressType(eid.getAddressType())
- .setVirtualNetworkId(eid.getVirtualNetworkId())
- .build();
- }
-
- private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid fromLocalToRemoteEid(
- Eid eid) {
- return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddress(eid.getAddress())
- .setAddressType(eid.getAddressType())
- .setVirtualNetworkId(eid.getVirtualNetworkId())
- .build();
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/AdjacencyData.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/AdjacencyData.java
deleted file mode 100644
index 2ecfe175f..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/AdjacencyData.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate;
-
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
-
-public class AdjacencyData {
-
- public static final Long VNI = 12L;
-
- public static final Ipv4Address ADDRESS_ONE = new Ipv4Address("192.168.2.1");
- public static final Ipv4Address ADDRESS_TWO = new Ipv4Address("192.168.2.2");
- public static final Ipv4Address ADDRESS_THREE = new Ipv4Address("192.168.2.3");
- public static final Ipv4Address ADDRESS_FOUR = new Ipv4Address("192.168.2.4");
-
- public static final Eid LOCAL_EID_ONE = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setVirtualNetworkId(new InstanceIdType(VNI))
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_ONE).build())
- .build();
-
- public static final Eid LOCAL_EID_TWO = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setVirtualNetworkId(new InstanceIdType(VNI))
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_TWO).build())
- .build();
-
- public static final Eid REMOTE_EID_ONE = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setVirtualNetworkId(new InstanceIdType(VNI))
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_THREE).build())
- .build();
- public static final Eid REMOTE_EID_TWO = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setVirtualNetworkId(new InstanceIdType(VNI))
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_FOUR).build())
- .build();
-
-
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java
deleted file mode 100644
index 09d4d27fb..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/AdjacencyCustomizerTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.ADDRESS_ONE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.ADDRESS_THREE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.LOCAL_EID_ONE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.LOCAL_EID_TWO;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.REMOTE_EID_ONE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.REMOTE_EID_TWO;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.hasSize;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.util.EidMetadataProvider;
-import io.fd.honeycomb.lisp.util.AdjacencyMappingContextTestHelper;
-import io.fd.honeycomb.lisp.util.EidMappingContextHelper;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.LispAdjacenciesGetReply;
-import io.fd.vpp.jvpp.core.types.LispAdjacency;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.AdjacenciesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class AdjacencyCustomizerTest
- extends ListReaderCustomizerTest<Adjacency, AdjacencyKey, AdjacencyBuilder>
- implements ByteDataTranslator, EidMetadataProvider, EidMappingContextHelper, AdjacencyMappingContextTestHelper {
-
- private InstanceIdentifier<Adjacency> identifier;
-
- public AdjacencyCustomizerTest() {
- super(Adjacency.class, AdjacenciesBuilder.class);
- }
-
- @Before
- public void init() {
- identifier = InstanceIdentifier.create(EidTable.class)
- .child(VniTable.class, new VniTableKey(2L))
- .child(BridgeDomainSubtable.class)
- .child(RemoteMappings.class)
- .child(RemoteMapping.class, new RemoteMappingKey(new MappingId("remote-mapping")))
- .child(Adjacencies.class)
- .child(Adjacency.class, new AdjacencyKey("adj-one"));
-
-
- mockApi();
- defineEidMapping(mappingContext, LOCAL_EID_ONE, new MappingId("local-eid-one"), "local-mapping-context");
- defineEidMapping(mappingContext, LOCAL_EID_TWO, new MappingId("local-eid-two"), "local-mapping-context");
- defineEidMapping(mappingContext, REMOTE_EID_ONE, new MappingId("remote-eid-one"), "remote-mapping-context");
- defineEidMapping(mappingContext, REMOTE_EID_TWO, new MappingId("remote-eid-two"), "remote-mapping-context");
-
- defineAdjacencyMapping(mappingContext, "local-eid-one", "remote-eid-one", "adj-one",
- "adjacencies-mapping-context");
- defineAdjacencyMapping(mappingContext, "local-eid-two", "remote-eid-two", "adj-two",
- "adjacencies-mapping-context");
- mockApi();
- }
-
- @Test
- public void getAllIds() throws Exception {
- final List<AdjacencyKey> keys = getCustomizer().getAllIds(identifier, ctx);
-
- assertThat(keys, hasSize(2));
- assertThat(keys, contains(new AdjacencyKey("adj-one"), new AdjacencyKey("adj-two")));
- }
-
- @Test
- public void readCurrentAttributes() throws Exception {
- final AdjacencyBuilder builder = new AdjacencyBuilder();
- getCustomizer().readCurrentAttributes(identifier, builder, ctx);
-
- assertEquals("adj-one", builder.getId());
- assertEquals(new AdjacencyKey("adj-one"), builder.getKey());
- assertEquals(ADDRESS_ONE.getValue(), Ipv4.class.cast(builder.getLocalEid().getAddress()).getIpv4().getValue());
- assertEquals(ADDRESS_THREE.getValue(),
- Ipv4.class.cast(builder.getRemoteEid().getAddress()).getIpv4().getValue());
- }
-
- @Override
- protected ReaderCustomizer<Adjacency, AdjacencyBuilder> initCustomizer() {
- return new AdjacencyCustomizer(api, new EidMappingContext("local-mapping-context"),
- new EidMappingContext("remote-mapping-context"),
- new AdjacenciesMappingContext("adjacencies-mapping-context"));
- }
-
-
- private void mockApi() {
- LispAdjacency adjacencyOne = new LispAdjacency();
- adjacencyOne.eidType = 0;
- adjacencyOne.leid = new byte[]{-64, -88, 2, 1};
- adjacencyOne.leidPrefixLen = 32;
- adjacencyOne.reid = new byte[]{-64, -88, 2, 3};
- adjacencyOne.reidPrefixLen = 32;
-
-
- LispAdjacency adjacencyTwo = new LispAdjacency();
- adjacencyTwo.eidType = 0;
- adjacencyTwo.leid = new byte[]{-64, -88, 2, 2};
- adjacencyTwo.leidPrefixLen = 32;
- adjacencyTwo.reid = new byte[]{-64, -88, 2, 4};
- adjacencyTwo.reidPrefixLen = 32;
-
- LispAdjacenciesGetReply reply = new LispAdjacenciesGetReply();
- reply.adjacencies = new LispAdjacency[]{adjacencyOne, adjacencyTwo};
-
- when(api.lispAdjacenciesGet(any())).thenReturn(future(reply));
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java
deleted file mode 100644
index b230b3435..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/BridgeDomainSubtableCustomizerTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L2;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import io.fd.honeycomb.lisp.translate.read.trait.SubtableReaderTestCase;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.vpp.jvpp.VppCallbackException;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtableBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class BridgeDomainSubtableCustomizerTest
- extends SubtableReaderTestCase<BridgeDomainSubtable, BridgeDomainSubtableBuilder> {
-
- private InstanceIdentifier<BridgeDomainSubtable> validId;
- private NamingContext bridgeDomainContext;
-
- public BridgeDomainSubtableCustomizerTest() {
- super(BridgeDomainSubtable.class, VniTableBuilder.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- bridgeDomainContext = new NamingContext("br", "br-domain-context");
- validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(expectedVni))
- .child(BridgeDomainSubtable.class);
-
- defineMapping(mappingContext, "br-domain", expectedTableId, "br-domain-context");
- }
-
- @Test
- public void testReadCurrentSuccessfull() throws ReadFailedException {
- doReturnValidNonEmptyDataOnDump();
- BridgeDomainSubtableBuilder builder = new BridgeDomainSubtableBuilder();
- customizer.readCurrentAttributes(validId, builder, ctx);
-
- verifyLispEidTableMapDumpCalled(L2);
-
- final BridgeDomainSubtable subtable = builder.build();
- assertNotNull(subtable);
- assertEquals("br-domain", subtable.getBridgeDomainRef());
- }
-
-
- @Test
- public void testReadCurrentEmptyDump() throws ReadFailedException {
- doReturnEmptyDataOnDump();
- BridgeDomainSubtableBuilder builder = new BridgeDomainSubtableBuilder();
- customizer.readCurrentAttributes(validId, builder, ctx);
-
- verifyLispEidTableMapDumpCalled(L2);
-
- final BridgeDomainSubtable subtable = builder.build();
- assertNotNull(subtable);
- assertNull(subtable.getBridgeDomainRef());
- }
-
- @Test
- public void testReadCurrentFailed() {
- doThrowOnDump();
- BridgeDomainSubtableBuilder builder = new BridgeDomainSubtableBuilder();
- try {
- customizer.readCurrentAttributes(validId, builder, ctx);
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- assertNull(builder.getBridgeDomainRef());
- verifyLispEidTableMapDumpNotCalled();
-
- return;
- }
-
- fail("Test should throw ReadFailedException");
- }
-
- @Test
- public void testGetBuilder() {
- final BridgeDomainSubtableBuilder builder = customizer.getBuilder(validId);
-
- assertNotNull(builder);
- assertNull(builder.getLocalMappings());
- assertNull(builder.getRemoteMappings());
- assertNull(builder.getBridgeDomainRef());
- }
-
- @Override
- protected ReaderCustomizer<BridgeDomainSubtable, BridgeDomainSubtableBuilder> initCustomizer() {
- return new BridgeDomainSubtableCustomizer(api, bridgeDomainContext);
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizerTest.java
deleted file mode 100644
index fb97dce5d..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/InterfaceCustomizerTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-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 java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-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.LocatorSetBuilder;
-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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
-
-public class InterfaceCustomizerTest
- extends ListReaderCustomizerTest<Interface, InterfaceKey, InterfaceBuilder> {
-
- public InterfaceCustomizerTest() {
- super(Interface.class, LocatorSetBuilder.class);
- }
-
- private InstanceIdentifier<Interface> validId;
-
- @Before
- public void init() {
- validId = InstanceIdentifier.create(LocatorSets.class).child(LocatorSet.class, new LocatorSetKey("loc-set-1"))
- .child(Interface.class, new InterfaceKey("interface-1"));
-
- //mappings
- defineMappings();
- //dump data
- defineDumpData();
- }
-
- private void defineDumpData() {
- final LispLocatorDetailsReplyDump dump = new LispLocatorDetailsReplyDump();
-
- final LispLocatorDetails detail1 = new LispLocatorDetails();
- detail1.swIfIndex = 1;
- detail1.ipAddress = new byte[]{-64, -88, 2, 1};
- detail1.isIpv6 = 0;
- detail1.local = 0;
- detail1.priority = 1;
- detail1.weight = 2;
-
- final LispLocatorDetails detail2 = new LispLocatorDetails();
- detail2.swIfIndex = 2;
- detail2.ipAddress = new byte[]{-64, -88, 2, 2};
- detail2.isIpv6 = 0;
- detail2.local = 0;
- detail2.priority = 2;
- detail2.weight = 3;
-
- dump.lispLocatorDetails = ImmutableList.of(detail1, detail2);
-
- when(api.lispLocatorDump(Mockito.any())).thenReturn(future(dump));
- }
-
- private void defineMappings() {
- defineMapping(mappingContext, "interface-1", 1, "interface-context");
- defineMapping(mappingContext, "interface-2", 2, "interface-context");
- defineMapping(mappingContext, "loc-set-1", 3, "locator-set-context");
- }
-
- @Test
- public void testGetAllIds() throws ReadFailedException {
-
- final List<InterfaceKey> keys = getCustomizer().getAllIds(validId, ctx);
-
- assertEquals(2, keys.size());
- assertEquals("interface-1", keys.get(0).getInterfaceRef());
- assertEquals("interface-2", keys.get(1).getInterfaceRef());
- }
-
- @Test
- public void testReadCurrentAttributes() throws ReadFailedException {
- InterfaceBuilder builder = new InterfaceBuilder();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
-
- final Interface iface = builder.build();
- assertEquals("interface-1", iface.getInterfaceRef());
- assertEquals("interface-1", iface.getKey().getInterfaceRef());
-
- }
-
- @Override
- protected ReaderCustomizer<Interface, InterfaceBuilder> initCustomizer() {
- return new InterfaceCustomizer(api, new NamingContext("interface", "interface-context"),
- new NamingContext("loc-set", "locator-set-context"));
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java
deleted file mode 100644
index 9b810b94d..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/ItrRemoteLocatorSetCustomizerTest.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.vpp.jvpp.VppCallbackException;
-import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocs;
-import io.fd.vpp.jvpp.core.dto.LispGetMapRequestItrRlocsReply;
-import java.nio.charset.StandardCharsets;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureDataBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class ItrRemoteLocatorSetCustomizerTest
- extends ReaderCustomizerTest<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder> {
-
- private static final String EXPECTED_LOCATOR_SET_NAME = "loc-set";
-
- private InstanceIdentifier<ItrRemoteLocatorSet> validId;
- private ItrRemoteLocatorSetBuilder builder;
-
- public ItrRemoteLocatorSetCustomizerTest() {
- super(ItrRemoteLocatorSet.class, LispFeatureDataBuilder.class);
- }
-
- @Before
- public void setUp() throws Exception {
- validId = InstanceIdentifier.create(ItrRemoteLocatorSet.class);
- builder = new ItrRemoteLocatorSetBuilder();
- }
-
- @Override
- protected ReaderCustomizer<ItrRemoteLocatorSet, ItrRemoteLocatorSetBuilder> initCustomizer() {
- return new ItrRemoteLocatorSetCustomizer(api);
- }
-
- @Test
- public void getBuilder() throws Exception {
- final ItrRemoteLocatorSetBuilder itrRemoteLocatorSetBuilder = getCustomizer().getBuilder(validId);
-
- assertNotNull(itrRemoteLocatorSetBuilder);
- assertNull(itrRemoteLocatorSetBuilder.getRemoteLocatorSetName());
- }
-
- @Test
- public void readCurrentAttributesSuccess() throws Exception {
- doReturnValidDataOnDump();
-
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
-
- assertNotNull(builder);
- assertEquals(EXPECTED_LOCATOR_SET_NAME, builder.getRemoteLocatorSetName());
- verifyLispGetMapRequestItrRlocsInvokedOnce();
- }
-
- @Test
- public void readCurrentAttributesEmptyData() throws Exception {
- doReturnEmptyDataOnDump();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
- verifyInvalidDataCase(builder);
- }
-
- @Test
- public void readCurrentAttributesFailedCallHalted() {
- doThrowExceptionOnDump();
- try {
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- assertNotNull(builder);
- assertNull(builder.getRemoteLocatorSetName());
-
- verifyLispGetMapRequestItrRlocsInvokedOnce();
- return;
- }
-
- fail("Test should have thrown exception");
- }
-
- @Test
- public void merge() throws Exception {
- LispFeatureDataBuilder builder = new LispFeatureDataBuilder();
- ItrRemoteLocatorSet set = new ItrRemoteLocatorSetBuilder().setRemoteLocatorSetName("loc-set").build();
- getCustomizer().merge(builder, set);
-
- assertNotNull(builder);
- assertEquals(set, builder.getItrRemoteLocatorSet());
- }
-
-
- private void doReturnValidDataOnDump() {
- LispGetMapRequestItrRlocsReply reply = new LispGetMapRequestItrRlocsReply();
- reply.locatorSetName = EXPECTED_LOCATOR_SET_NAME.getBytes(StandardCharsets.UTF_8);
-
- when(api.lispGetMapRequestItrRlocs(any(LispGetMapRequestItrRlocs.class)))
- .thenReturn(CompletableFuture.completedFuture(reply));
- }
-
- private void doReturnNullDataOnDump() {
- when(api.lispGetMapRequestItrRlocs(any(LispGetMapRequestItrRlocs.class)))
- .thenReturn(CompletableFuture.completedFuture(null));
- }
-
- private void doReturnEmptyDataOnDump() {
- when(api.lispGetMapRequestItrRlocs(any(LispGetMapRequestItrRlocs.class)))
- .thenReturn(CompletableFuture.completedFuture(new LispGetMapRequestItrRlocsReply()));
- }
-
- private void doThrowExceptionOnDump() {
- when(api.lispGetMapRequestItrRlocs(any(LispGetMapRequestItrRlocs.class))).
- thenReturn(new CompletableFuture<LispGetMapRequestItrRlocsReply>() {
- @Override
- public LispGetMapRequestItrRlocsReply get(final long l, final TimeUnit timeUnit)
- throws InterruptedException, ExecutionException, TimeoutException {
- throw new ExecutionException(new VppCallbackException("lispGetMapRequestItrRlocs", 1, -2));
- }
- });
- }
-
- private void verifyLispGetMapRequestItrRlocsInvokedOnce() {
- verify(api, times(1)).lispGetMapRequestItrRlocs(any(LispGetMapRequestItrRlocs.class));
- }
-
- private void verifyInvalidDataCase(final ItrRemoteLocatorSetBuilder builder) {
- assertNotNull(builder);
- assertNull(builder.getRemoteLocatorSetName());
-
- verifyLispGetMapRequestItrRlocsInvokedOnce();
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizerTest.java
deleted file mode 100644
index 33d956f8e..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LispStateCustomizerTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispStateBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.ShowLispStatusReply;
-
-public class LispStateCustomizerTest extends ReaderCustomizerTest<LispState, LispStateBuilder> {
-
- private InstanceIdentifier<LispState> identifier;
-
- public LispStateCustomizerTest() {
- super(LispState.class, null);
- }
-
- @Before
- public void init() {
- identifier = InstanceIdentifier.create(LispState.class);
- final ShowLispStatusReply reply = new ShowLispStatusReply();
- reply.featureStatus = 1;
-
- when(api.showLispStatus(Mockito.any())).thenReturn(future(reply));
- }
-
- @Test
- public void testReadCurrentAttributes() throws ReadFailedException {
-
- LispStateBuilder builder = new LispStateBuilder();
- getCustomizer().readCurrentAttributes(identifier, builder, ctx);
-
- assertEquals(true, builder.build().isEnable());
- }
-
- @Override
- protected ReaderCustomizer<LispState, LispStateBuilder> initCustomizer() {
- return new LispStateCustomizer(api);
- }
-
- @Override
- public void testMerge() throws Exception {
- //LispState is root node, so there is no way to implement merge(it is also not needed)
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java
deleted file mode 100644
index 065adcc4e..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocalMappingCustomizerTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams;
-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 java.util.List;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-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.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableDetailsReplyDump;
-
-public class LocalMappingCustomizerTest extends
- ListReaderCustomizerTest<LocalMapping, LocalMappingKey, LocalMappingBuilder> implements EidTranslator {
-
- private static final Ipv4
- EID_ADDRESS = new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build();
-
- @Mock
- private EidMappingContext localMappingContext;
-
- private InstanceIdentifier<LocalMapping> emptyIdentifier;
- private InstanceIdentifier<LocalMapping> validIdentifier;
-
- public LocalMappingCustomizerTest() {
- super(LocalMapping.class, LocalMappingsBuilder.class);
- }
-
-
- public void setUp() {
- emptyIdentifier = InstanceIdentifier.create(EidTable.class)
- .child(VniTable.class, new VniTableKey(12L))
- .child(VrfSubtable.class)
- .child(LocalMappings.class)
- .child(LocalMapping.class);
-
- validIdentifier = InstanceIdentifier.create(EidTable.class)
- .child(VniTable.class, new VniTableKey(12L))
- .child(VrfSubtable.class)
- .child(LocalMappings.class)
- .child(LocalMapping.class, new LocalMappingKey(new MappingId("local-mapping")));
-
- defineDumpData();
- defineMappings();
- }
-
- private void defineDumpData() {
- LispEidTableDetailsReplyDump replyDump = new LispEidTableDetailsReplyDump();
- LispEidTableDetails detail = new LispEidTableDetails();
- detail.action = 0;
- detail.authoritative = 1;
- detail.context = 4;
- detail.eid = new byte[]{-64, -88, 2, 1};
- detail.eidPrefixLen = 32;
- detail.eidType = (byte) IPV4.getValue();
- detail.isLocal = 1;
- detail.locatorSetIndex = 1;
- detail.ttl = 7;
- detail.vni = 12;
-
- replyDump.lispEidTableDetails = ImmutableList.of(detail);
- when(api.lispEidTableDump(any())).thenReturn(future(replyDump));
- }
-
- private void defineMappings() {
- //eid mapping
-
- when(localMappingContext.getId(any(Eid.class), any(MappingContext.class)))
- .thenReturn(new MappingId("local-mapping"));
- when(localMappingContext.containsEid(new MappingId("local-mapping"), mappingContext)).thenReturn(true);
- when(localMappingContext.getEid(new MappingId("local-mapping"), mappingContext)).thenReturn(new EidBuilder()
- .setAddress(EID_ADDRESS).build());
- //naming context for locator
- defineMapping(mappingContext, "loc-set", 1, "locator-set-context");
- }
-
- @Test
- public void readCurrentAttributes() throws Exception {
- LocalMappingBuilder builder = new LocalMappingBuilder();
- getCustomizer().readCurrentAttributes(validIdentifier, builder, ctx);
-
- final LocalMapping mapping = builder.build();
-
- assertNotNull(mapping);
- assertEquals(true, compareAddresses(EID_ADDRESS, mapping.getEid().getAddress()));
- assertEquals("loc-set", mapping.getLocatorSet());
- }
-
- @Test
- public void getAllIds() throws Exception {
- final List<LocalMappingKey> keys = getCustomizer().getAllIds(emptyIdentifier, ctx);
-
- assertEquals(1, keys.size());
- assertEquals("local-mapping", keys.get(0).getId().getValue());
- }
-
- @Override
- protected ReaderCustomizer<LocalMapping, LocalMappingBuilder> initCustomizer() {
- return new LocalMappingCustomizer(api, new NamingContext("loc", "locator-set-context"), localMappingContext);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizerTest.java
deleted file mode 100644
index e863ba2bb..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/LocatorSetCustomizerTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import com.google.common.collect.ImmutableList;
-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 java.nio.charset.StandardCharsets;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-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.LocatorSetsBuilder;
-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.LocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.LocatorSetKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-
-
-public class LocatorSetCustomizerTest
- extends ListReaderCustomizerTest<LocatorSet, LocatorSetKey, LocatorSetBuilder> {
-
- private InstanceIdentifier<LocatorSet> emptyId;
- private InstanceIdentifier<LocatorSet> validId;
-
- public LocatorSetCustomizerTest() {
- super(LocatorSet.class, LocatorSetsBuilder.class);
- }
-
- @Before
- public void init() {
- emptyId = InstanceIdentifier.create(LocatorSet.class);
- validId = InstanceIdentifier.create(LocatorSets.class).child(LocatorSet.class, new LocatorSetKey("loc-set"));
-
- defineDumpData();
- defineMapping(mappingContext, "loc-set", 1, "locator-set-context");
- }
-
- private void defineDumpData() {
- LispLocatorSetDetailsReplyDump dump = new LispLocatorSetDetailsReplyDump();
- LispLocatorSetDetails detail = new LispLocatorSetDetails();
- detail.context = 4;
- detail.lsName = "loc-set".getBytes(StandardCharsets.UTF_8);
- detail.lsIndex = 1;
-
- dump.lispLocatorSetDetails = ImmutableList.of(detail);
-
- when(api.lispLocatorSetDump(any())).thenReturn(future(dump));
- }
-
-
- @Test
- public void readCurrentAttributes() throws Exception {
- LocatorSetBuilder builder = new LocatorSetBuilder();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
-
- assertNotNull(builder);
- assertEquals("loc-set", builder.getName());
- assertEquals("loc-set", builder.getKey().getName());
- }
-
- @Test
- public void getAllIds() throws Exception {
- final List<LocatorSetKey> keys = getCustomizer().getAllIds(emptyId, ctx);
-
- assertEquals(1, keys.size());
- assertEquals("loc-set", keys.get(0).getName());
- }
-
- @Override
- protected ReaderCustomizer<LocatorSet, LocatorSetBuilder> initCustomizer() {
- return new LocatorSetCustomizer(api, new NamingContext("loc", "locator-set-context"));
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java
deleted file mode 100644
index adcbdb643..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/MapResolverCustomizerTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetails;
-import io.fd.vpp.jvpp.core.dto.LispMapResolverDetailsReplyDump;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolvers;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolversBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-public class MapResolverCustomizerTest
- extends ListReaderCustomizerTest<MapResolver, MapResolverKey, MapResolverBuilder> {
-
- private static final IpAddress IP_ADDRESS_REVERTED =
- new IpAddress(new Ipv4AddressNoZone("1.2.168.192"));
-
- private InstanceIdentifier<MapResolver> emptyId;
- private InstanceIdentifier<MapResolver> validId;
-
- public MapResolverCustomizerTest() {
- super(MapResolver.class, MapResolversBuilder.class);
- }
-
- @Before
- public void init() {
-
- emptyId = InstanceIdentifier.create(MapResolver.class);
- validId = InstanceIdentifier.create(MapResolvers.class)
- .child(MapResolver.class, new MapResolverKey(IP_ADDRESS_REVERTED));
- defineDumpData();
- }
-
- @Test
- public void readCurrentAttributes() throws Exception {
- MapResolverBuilder builder = new MapResolverBuilder();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
-
- MapResolver resolver = builder.build();
- assertNotNull(resolver);
- assertEquals("1.2.168.192", resolver.getIpAddress().getIpv4Address().getValue());
- }
-
- @Test
- public void getAllIds() throws Exception {
- final List<MapResolverKey> keys = getCustomizer().getAllIds(emptyId, ctx);
-
- assertEquals(1, keys.size());
-
- final MapResolverKey key = keys.get(0);
- assertNotNull(key);
- assertEquals("1.2.168.192", new String(key.getIpAddress().getValue()));
-
- }
-
- private void defineDumpData() {
- final LispMapResolverDetailsReplyDump replyDump = new LispMapResolverDetailsReplyDump();
- final LispMapResolverDetails detail = new LispMapResolverDetails();
- detail.context = 5;
- detail.ipAddress = new byte[]{1, 2, -88, -64};
- detail.isIpv6 = 0;
-
- replyDump.lispMapResolverDetails = ImmutableList.of(detail);
-
- when(api.lispMapResolverDump(any())).thenReturn(future(replyDump));
- }
-
- @Override
- protected ReaderCustomizer<MapResolver, MapResolverBuilder> initCustomizer() {
- return new MapResolverCustomizer(api);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java
deleted file mode 100644
index 52abdf818..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/PitrCfgCustomizerTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import java.nio.charset.StandardCharsets;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureDataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfgBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.ShowLispPitrReply;
-
-
-public class PitrCfgCustomizerTest extends ReaderCustomizerTest<PitrCfg, PitrCfgBuilder> {
-
- private static final byte[] LOC_SET_NAME_BYTES = "loc-set".getBytes(StandardCharsets.UTF_8);
-
- private InstanceIdentifier<PitrCfg> emptyId;
-
- public PitrCfgCustomizerTest() {
- super(PitrCfg.class, LispFeatureDataBuilder.class);
- }
-
- @Before
- public void init() {
- emptyId = InstanceIdentifier.create(PitrCfg.class);
-
- mockDumpData();
- }
-
- @Test
- public void readCurrentAttributes() throws Exception {
- PitrCfgBuilder builder = new PitrCfgBuilder();
- getCustomizer().readCurrentAttributes(emptyId, builder, ctx);
-
- final PitrCfg cfg = builder.build();
-
- assertNotNull(cfg);
- assertEquals("loc-set", cfg.getLocatorSet());
- }
-
- private void mockDumpData() {
- ShowLispPitrReply replyDump = new ShowLispPitrReply();
- replyDump.locatorSetName = LOC_SET_NAME_BYTES;
- replyDump.status = 1;
-
- when(api.showLispPitr(any())).thenReturn(future(replyDump));
- }
-
- @Override
- protected ReaderCustomizer<PitrCfg, PitrCfgBuilder> initCustomizer() {
- return new PitrCfgCustomizer(api);
- }
-} \ No newline at end of file
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
deleted file mode 100644
index 27c243e8b..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/RemoteMappingCustomizerTest.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import com.google.common.collect.ImmutableList;
-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;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorDetailsReplyDump;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MapReplyAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.PositiveMapping;
-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.Locator;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.VniTableKey;
-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.InstanceIdentifier;
-
-public class RemoteMappingCustomizerTest
- extends ListReaderCustomizerTest<RemoteMapping, RemoteMappingKey, RemoteMappingBuilder>
- implements EidTranslator {
-
- private static final Ipv4
- EID_ADDRESS = new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build();
-
- @Mock
- private EidMappingContext eidMappingContext;
-
- private InstanceIdentifier<RemoteMapping> validId;
-
- public RemoteMappingCustomizerTest() {
- super(RemoteMapping.class, RemoteMappingsBuilder.class);
- }
-
- @Before
- public void init() {
-
- validId = InstanceIdentifier.create(EidTable.class)
- .child(VniTable.class, new VniTableKey(12L))
- .child(VrfSubtable.class)
- .child(RemoteMappings.class)
- .child(RemoteMapping.class, new RemoteMappingKey(new MappingId("remote-mapping")));
- mockMappings();
- defineMapping(mappingContext,"loc-set",1,"loc-set-context");
- }
-
-
- private void mockDumpDataActionZero() {
- LispEidTableDetailsReplyDump replyDump = new LispEidTableDetailsReplyDump();
- LispEidTableDetails detail = new LispEidTableDetails();
- detail.action = 0;
- detail.authoritative = 1;
- detail.context = 4;
- detail.eid = new byte[]{-64, -88, 2, 1};
- detail.eidPrefixLen = 32;
- detail.isLocal = 0;
- detail.locatorSetIndex = 1;
- detail.ttl = 7;
- detail.vni = 12;
-
- replyDump.lispEidTableDetails = ImmutableList.of(detail);
-
- when(api.lispEidTableDump(any())).thenReturn(future(replyDump));
-
- LispLocatorDetailsReplyDump rlocs = new LispLocatorDetailsReplyDump();
- rlocs.lispLocatorDetails = Collections.emptyList();
- when(api.lispLocatorDump(any())).thenReturn(future(rlocs));
- }
-
- private void mockDumpDataActionOne() {
- LispEidTableDetailsReplyDump replyDump = new LispEidTableDetailsReplyDump();
- LispEidTableDetails detail = new LispEidTableDetails();
- detail.action = 1;
- detail.authoritative = 1;
- detail.context = 4;
- detail.eid = new byte[]{-64, -88, 2, 1};
- detail.eidPrefixLen = 32;
- detail.isLocal = 0;
- detail.locatorSetIndex = 1;
- detail.ttl = 7;
- detail.vni = 12;
-
- replyDump.lispEidTableDetails = ImmutableList.of(detail);
-
- when(api.lispEidTableDump(any())).thenReturn(future(replyDump));
- }
-
- private void mockDumpDataActionZeroWithRemotes() {
- LispEidTableDetailsReplyDump replyDump = new LispEidTableDetailsReplyDump();
- LispEidTableDetails detail = new LispEidTableDetails();
- detail.action = 0;
- detail.authoritative = 1;
- detail.context = 4;
- detail.eid = new byte[]{-64, -88, 2, 1};
- detail.eidPrefixLen = 32;
- detail.isLocal = 0;
- detail.locatorSetIndex = 1;
- detail.ttl = 7;
- detail.vni = 12;
-
- replyDump.lispEidTableDetails = ImmutableList.of(detail);
-
- when(api.lispEidTableDump(any())).thenReturn(future(replyDump));
-
- LispLocatorDetailsReplyDump rlocs = new LispLocatorDetailsReplyDump();
- LispLocatorDetails rloc = new LispLocatorDetails();
- rloc.ipAddress = new byte[]{-64, -88, 2, 1};
- rloc.isIpv6 = 0;
- rloc.priority = 1;
- rloc.weight = 2;
-
- rlocs.lispLocatorDetails = ImmutableList.of(rloc);
-
- when(api.lispLocatorDump(any())).thenReturn(future(rlocs));
- }
-
-
- private void mockMappings() {
-
- when(eidMappingContext.getId(any(Eid.class), any(MappingContext.class)))
- .thenReturn(new MappingId("remote-mapping"));
- 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
- public void readCurrentAttributesNegativeMappingOne() throws Exception {
- mockDumpDataActionOne();
- RemoteMappingBuilder builder = new RemoteMappingBuilder();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
-
- RemoteMapping mapping = builder.build();
-
- assertNotNull(mapping);
- assertEquals(true, compareAddresses(EID_ADDRESS, mapping.getEid().getAddress()));
- assertEquals(true, mapping.getAuthoritative().isA());
- assertEquals(7L, mapping.getTtl().longValue());
- assertTrue(mapping.getLocatorList() instanceof NegativeMapping);
- assertEquals(MapReplyAction.NativelyForward,
- ((NegativeMapping) mapping.getLocatorList()).getMapReply().getMapReplyAction());
- }
-
- @Test
- public void readCurrentAttributesNegativeMappingZero() throws Exception {
- mockDumpDataActionZero();
- RemoteMappingBuilder builder = new RemoteMappingBuilder();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
-
- RemoteMapping mapping = builder.build();
-
- assertNotNull(mapping);
- assertEquals(true, compareAddresses(EID_ADDRESS, mapping.getEid().getAddress()));
- assertEquals(true, mapping.getAuthoritative().isA());
- assertEquals(7L, mapping.getTtl().longValue());
- assertEquals(MapReplyAction.NoAction,
- ((NegativeMapping) mapping.getLocatorList()).getMapReply().getMapReplyAction());
- }
-
- @Test
- public void readCurrentAttributesPositiveMapping() throws Exception {
- mockDumpDataActionZeroWithRemotes();
- RemoteMappingBuilder builder = new RemoteMappingBuilder();
- getCustomizer().readCurrentAttributes(validId, builder, ctx);
-
- RemoteMapping mapping = builder.build();
-
- assertNotNull(mapping);
- assertEquals(true, compareAddresses(EID_ADDRESS, mapping.getEid().getAddress()));
- assertEquals(true, mapping.getAuthoritative().isA());
- assertEquals(7L, mapping.getTtl().longValue());
- assertTrue(mapping.getLocatorList() instanceof PositiveMapping);
-
- final List<Locator> locators = ((PositiveMapping) mapping.getLocatorList()).getRlocs().getLocator();
- assertEquals(1, locators.size());
- final Locator locator = locators.get(0);
- assertEquals("192.168.2.1", locator.getAddress().getIpv4Address().getValue());
- assertEquals(1, locator.getPriority().shortValue());
- assertEquals(2, locator.getWeight().shortValue());
- }
-
-
- @Test
- public void getAllIds() throws Exception {
- mockDumpDataActionOne();
- final List<RemoteMappingKey> keys = getCustomizer().getAllIds(validId, ctx);
-
- assertNotNull(keys);
- assertEquals(1, keys.size());
- assertEquals("remote-mapping", keys.get(0).getId().getValue());
- }
-
- @Override
- protected ReaderCustomizer<RemoteMapping, RemoteMappingBuilder> initCustomizer() {
- return new RemoteMappingCustomizer(api, new NamingContext("loc-set", "loc-set-context"), eidMappingContext);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java
deleted file mode 100644
index 1ff6cc631..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VniTableCustomizerTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.when;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.honeycomb.vpp.test.read.ListReaderCustomizerTest;
-import io.fd.vpp.jvpp.VppCallbackException;
-import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableVniDetailsReplyDump;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTableBuilder;
-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.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class VniTableCustomizerTest extends ListReaderCustomizerTest<VniTable, VniTableKey, VniTableBuilder> {
-
- private InstanceIdentifier<VniTable> validId;
-
- public VniTableCustomizerTest() {
- super(VniTable.class, EidTableBuilder.class);
- }
-
- @Before
- public void init() {
- validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(12L));
- }
-
- @Test
- public void testReadAllSuccessfull() throws ReadFailedException {
- whenLispEidTableVniDumpReturnValid();
- final List<VniTableKey> keys = getCustomizer().getAllIds(validId, ctx);
-
- assertNotNull(keys);
- assertEquals(3, keys.size());
- assertTrue(keys.contains(new VniTableKey(12L)));
- assertTrue(keys.contains(new VniTableKey(14L)));
- assertTrue(keys.contains(new VniTableKey(16L)));
- }
-
- @Test
- public void testReadAllFailed() {
- whenLispEidTableVniDumpThrowException();
- try {
- getCustomizer().getAllIds(validId, ctx);
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- return;
- }
-
- fail("Test should have thrown ReadFailedException");
- }
-
- @Test
- public void testReadAttributes() throws ReadFailedException {
- whenLispEidTableVniDumpReturnValid();
- VniTableBuilder builder = new VniTableBuilder();
-
- customizer.readCurrentAttributes(validId, builder, ctx);
-
- final VniTable table = builder.build();
- assertNotNull(table);
- assertEquals(12L, table.getVirtualNetworkIdentifier().longValue());
- }
-
- private void whenLispEidTableVniDumpReturnValid() {
-
- LispEidTableVniDetailsReplyDump dump = new LispEidTableVniDetailsReplyDump();
- LispEidTableVniDetails details1 = new LispEidTableVniDetails();
- details1.vni = 14;
-
- LispEidTableVniDetails details2 = new LispEidTableVniDetails();
- details2.vni = 12;
-
- LispEidTableVniDetails details3 = new LispEidTableVniDetails();
- details3.vni = 16;
-
- dump.lispEidTableVniDetails = ImmutableList.of(details1, details2, details3);
-
- when(api.lispEidTableVniDump(Mockito.any())).thenReturn(CompletableFuture.completedFuture(dump));
- }
-
- private void whenLispEidTableVniDumpThrowException() {
- when(api.lispEidTableVniDump(Mockito.any()))
- .thenReturn(failedFuture());
- }
-
- @Override
- protected ReaderCustomizer<VniTable, VniTableBuilder> initCustomizer() {
- return new VniTableCustomizer(api);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java
deleted file mode 100644
index 58965edc6..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/VrfSubtableCustomizerTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read;
-
-
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel.L3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import io.fd.honeycomb.lisp.translate.read.trait.SubtableReaderTestCase;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.vpp.jvpp.VppCallbackException;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.VniTableKey;
-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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtableBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class VrfSubtableCustomizerTest extends SubtableReaderTestCase<VrfSubtable, VrfSubtableBuilder> {
-
- private InstanceIdentifier<VrfSubtable> validId;
-
- public VrfSubtableCustomizerTest() {
- super(VrfSubtable.class, VrfSubtableBuilder.class);
- }
-
- @Before
- public void init() {
- validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(expectedVni))
- .child(VrfSubtable.class);
- }
-
- @Test
- public void testReadCurrentSuccessfull() throws ReadFailedException {
- doReturnValidNonEmptyDataOnDump();
- VrfSubtableBuilder builder = new VrfSubtableBuilder();
- customizer.readCurrentAttributes(validId, builder, ctx);
-
- verifyLispEidTableMapDumpCalled(L3);
-
- final VrfSubtable subtable = builder.build();
- assertNotNull(subtable);
- assertEquals(expectedTableId, subtable.getTableId().longValue());
- }
-
- @Test
- public void testReadCurrentEmptyDump() throws ReadFailedException {
- doReturnEmptyDataOnDump();
- VrfSubtableBuilder builder = new VrfSubtableBuilder();
- customizer.readCurrentAttributes(validId, builder, ctx);
-
- verifyLispEidTableMapDumpCalled(L3);
-
- final VrfSubtable subtable = builder.build();
- assertNotNull(subtable);
- assertNull(subtable.getTableId());
- }
-
- @Test
- public void testReadCurrentFailed() {
- doThrowOnDump();
- VrfSubtableBuilder builder = new VrfSubtableBuilder();
- try {
- customizer.readCurrentAttributes(validId, builder, ctx);
- } catch (ReadFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- assertTrue(builder.getTableId() == null);
- verifyLispEidTableMapDumpNotCalled();
-
- return;
- }
-
- fail("Test should throw ReadFailedException");
- }
-
- @Override
- protected ReaderCustomizer<VrfSubtable, VrfSubtableBuilder> initCustomizer() {
- return new VrfSubtableCustomizer(api);
- }
-
- @Test
- public void testGetBuilder() {
- final VrfSubtableBuilder builder = customizer.getBuilder(validId);
-
- assertNotNull(builder);
- assertNull(builder.getLocalMappings());
- assertNull(builder.getRemoteMappings());
- assertNull(builder.getTableId());
- }
-
- @Test
- public void testMerge() {
- VniTableBuilder parentBuilder = new VniTableBuilder();
- VrfSubtable subtable = new VrfSubtableBuilder().build();
-
- customizer.merge(parentBuilder, subtable);
- assertEquals(subtable, parentBuilder.getVrfSubtable());
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java
deleted file mode 100644
index 313f27dad..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingProducerTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.trait;
-
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6Afi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-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.InstanceIdentifier;
-
-public class MappingProducerTest implements MappingProducer {
-
- private InstanceIdentifier<LocalMapping> validVrfLocalMappingId;
- private InstanceIdentifier<LocalMapping> validBridgeDomainLocalMappingId;
- private InstanceIdentifier<RemoteMapping> validVrfRemoteMappingId;
- private InstanceIdentifier<RemoteMapping> validBridgeDomainRemoteMappingId;
-
- private LocalMapping ipv4LocalMapping;
- private LocalMapping ipv6LocalMapping;
- private LocalMapping macLocalMapping;
-
- private RemoteMapping ipv4RemoteMapping;
- private RemoteMapping ipv6RemoteMapping;
- private RemoteMapping macRemoteMapping;
-
- @Before
- public void init() {
- validVrfLocalMappingId = InstanceIdentifier.create(VrfSubtable.class)
- .child(LocalMappings.class)
- .child(LocalMapping.class);
-
- validBridgeDomainLocalMappingId = InstanceIdentifier.create(BridgeDomainSubtable.class)
- .child(LocalMappings.class)
- .child(LocalMapping.class);
-
- validVrfRemoteMappingId = InstanceIdentifier.create(VrfSubtable.class)
- .child(RemoteMappings.class)
- .child(RemoteMapping.class);
-
- validBridgeDomainRemoteMappingId = InstanceIdentifier.create(BridgeDomainSubtable.class)
- .child(RemoteMappings.class)
- .child(RemoteMapping.class);
-
- ipv4LocalMapping = new LocalMappingBuilder()
- .setEid(new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .build()).build();
-
- ipv6LocalMapping = new LocalMappingBuilder()
- .setEid(new EidBuilder()
- .setAddressType(Ipv6Afi.class)
- .build()).build();
- macLocalMapping = new LocalMappingBuilder()
- .setEid(new EidBuilder()
- .setAddressType(MacAfi.class)
- .build()).build();
-
- ipv4RemoteMapping = new RemoteMappingBuilder()
- .setEid(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddressType(Ipv4Afi.class).build()).build();
-
- ipv6RemoteMapping = new RemoteMappingBuilder()
- .setEid(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddressType(Ipv6Afi.class).build()).build();
-
- macRemoteMapping = new RemoteMappingBuilder()
- .setEid(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddressType(MacAfi.class).build()).build();
- }
-
- @Test
- public void testValidVrfLocal() {
- testPositiveCase(validVrfLocalMappingId, ipv4LocalMapping);
- testPositiveCase(validVrfLocalMappingId, ipv6LocalMapping);
- }
-
- @Test
- public void testValidBridgeDomainLocal() {
- testPositiveCase(validBridgeDomainLocalMappingId, macLocalMapping);
- }
-
- @Test
- public void testInvalidVrfLocal() {
- testNegativeCase(validVrfLocalMappingId, macLocalMapping);
- }
-
- @Test
- public void testInvalidBridgeDomainLocal() {
- testNegativeCase(validBridgeDomainLocalMappingId, ipv4LocalMapping);
- testNegativeCase(validBridgeDomainLocalMappingId, ipv6LocalMapping);
- }
-
-
- @Test
- public void testValidVrfRemote() {
- testPositiveCase(validVrfRemoteMappingId, ipv4RemoteMapping);
- testPositiveCase(validVrfRemoteMappingId, ipv6RemoteMapping);
- }
-
- @Test
- public void testValidBridgeDomainRemote() {
- testPositiveCase(validBridgeDomainRemoteMappingId, macRemoteMapping);
- }
-
- @Test
- public void testInvalidVrfRemote() {
- testNegativeCase(validVrfRemoteMappingId, macRemoteMapping);
- }
-
- @Test
- public void testInvalidBridgeDomainRemote() {
- testNegativeCase(validBridgeDomainRemoteMappingId, ipv4RemoteMapping);
- testNegativeCase(validBridgeDomainRemoteMappingId, ipv6RemoteMapping);
- }
-
- private void testNegativeCase(final InstanceIdentifier<LocalMapping> identifier, final LocalMapping data) {
- try {
- checkAllowedCombination(identifier, data);
- } catch (WriteFailedException e) {
- assertTrue(e instanceof WriteFailedException.CreateFailedException);
- assertTrue(e.getCause() instanceof IllegalArgumentException);
- return;
- }
-
- fail("Test should have failed");
- }
-
-
- private void testPositiveCase(final InstanceIdentifier<LocalMapping> identifier, final LocalMapping data) {
- try {
- checkAllowedCombination(identifier, data);
- } catch (WriteFailedException e) {
- fail("Test should have passed");
- }
- }
-
- private void testNegativeCase(final InstanceIdentifier<RemoteMapping> identifier, final RemoteMapping data) {
- try {
- checkAllowedCombination(identifier, data);
- } catch (WriteFailedException e) {
- assertTrue(e instanceof WriteFailedException.CreateFailedException);
- assertTrue(e.getCause() instanceof IllegalArgumentException);
- return;
- }
-
- fail("Test should have failed");
- }
-
-
- private void testPositiveCase(final InstanceIdentifier<RemoteMapping> identifier, final RemoteMapping data) {
- try {
- checkAllowedCombination(identifier, data);
- } catch (WriteFailedException e) {
- fail("Test should have passed");
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReaderTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReaderTest.java
deleted file mode 100644
index 9366037a1..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/MappingReaderTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.trait;
-
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-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.InstanceIdentifier;
-
-public class MappingReaderTest implements MappingReader {
-
- private InstanceIdentifier<LocalMapping> validVrfLocal;
- private InstanceIdentifier<LocalMapping> validBdLocal;
- private InstanceIdentifier<LocalMapping> invalidLocal;
-
- private InstanceIdentifier<RemoteMapping> validVrfRemote;
- private InstanceIdentifier<RemoteMapping> validBdRemote;
- private InstanceIdentifier<RemoteMapping> invalidRemote;
-
-
- @Before
- public void init() {
- validVrfLocal = InstanceIdentifier.create(VrfSubtable.class)
- .child(LocalMappings.class)
- .child(LocalMapping.class);
-
- validBdLocal = InstanceIdentifier.create(BridgeDomainSubtable.class)
- .child(LocalMappings.class)
- .child(LocalMapping.class);
-
- invalidLocal = InstanceIdentifier.create(LocalMapping.class);
-
- validVrfRemote = InstanceIdentifier.create(VrfSubtable.class)
- .child(RemoteMappings.class)
- .child(RemoteMapping.class);
-
- validBdRemote = InstanceIdentifier.create(BridgeDomainSubtable.class)
- .child(RemoteMappings.class)
- .child(RemoteMapping.class);
-
- invalidRemote = InstanceIdentifier.create(RemoteMapping.class);
- }
-
- @Test
- public void testVrfLocalValid() {
- assertEquals(VRF_MAPPINGS_ONLY, subtableFilterForLocalMappings(validVrfLocal));
- }
-
- @Test
- public void testBridgeDomainLocalValid() {
- assertEquals(BRIDGE_DOMAIN_MAPPINGS_ONLY, subtableFilterForLocalMappings(validBdLocal));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testLocalInvalid() {
- subtableFilterForLocalMappings(invalidLocal);
- }
-
- @Test
- public void testVrfRemoteValid() {
- assertEquals(VRF_MAPPINGS_ONLY, subtableFilterForRemoteMappings(validVrfRemote));
- }
-
- @Test
- public void testBridgeDomainRemoteValid() {
- assertEquals(BRIDGE_DOMAIN_MAPPINGS_ONLY, subtableFilterForRemoteMappings(validBdRemote));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testRemoteInvalid() {
- subtableFilterForRemoteMappings(invalidRemote);
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java
deleted file mode 100644
index 3313395df..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/read/trait/SubtableReaderTestCase.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.read.trait;
-
-
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.SubtableDumpParams.MapLevel;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
-import io.fd.vpp.jvpp.VppCallbackException;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetails;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.LispEidTableMapDump;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import org.junit.Before;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-
-public abstract class SubtableReaderTestCase<D extends DataObject, B extends Builder<D>>
- extends ReaderCustomizerTest<D, B>
- implements SubtableReader {
-
- protected final long expectedVni = 12;
- protected final int expectedTableId = 14;
-
- @Captor
- protected ArgumentCaptor<LispEidTableMapDump> requestCaptor;
-
- public SubtableReaderTestCase(final Class<D> dataObjectClass,
- final Class<? extends Builder<? extends DataObject>> parentBuilderClass) {
- super(dataObjectClass, parentBuilderClass);
- }
-
- protected void doReturnValidNonEmptyDataOnDump() {
- LispEidTableMapDetailsReplyDump reply = new LispEidTableMapDetailsReplyDump();
- LispEidTableMapDetails detailFirst = new LispEidTableMapDetails();
- detailFirst.vni = Long.valueOf(expectedVni).intValue();
- detailFirst.dpTable = expectedTableId;
-
- LispEidTableMapDetails detailSecond = new LispEidTableMapDetails();
- detailSecond.vni = 13;
- detailSecond.dpTable = 15;
-
- reply.lispEidTableMapDetails = ImmutableList.of(detailFirst, detailSecond);
-
- when(api.lispEidTableMapDump(any(LispEidTableMapDump.class)))
- .thenReturn(future(reply));
- }
-
- protected void doReturnEmptyDataOnDump() {
- LispEidTableMapDetailsReplyDump reply = new LispEidTableMapDetailsReplyDump();
- reply.lispEidTableMapDetails = Collections.emptyList();
- when(api.lispEidTableMapDump(any(LispEidTableMapDump.class)))
- .thenReturn(future(reply));
- }
-
- protected void doThrowOnDump() {
- when(api.lispEidTableMapDump(any(LispEidTableMapDump.class)))
- .thenReturn(failedFuture());
- }
-
- protected void verifyLispEidTableMapDumpCalled(@Nonnull final MapLevel expectedLevel) {
- verify(api, times(1)).lispEidTableMapDump(requestCaptor.capture());
- assertEquals(expectedLevel.getValue(), requestCaptor.getValue().isL2);
- }
-
- protected void verifyLispEidTableMapDumpNotCalled() {
- verify(api, times(1)).lispEidTableMapDump(any());
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java
deleted file mode 100755
index bc0bfc94a..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/util/EidTranslatorTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.util;
-
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.MAC;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.MacBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-
-public class EidTranslatorTest implements EidTranslator {
-
- @Test
- public void testGetEidType() {
- assertEquals(IPV4, getEidType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddress(
- new Ipv4Builder().setIpv4(
- new Ipv4Address("192.168.2.1"))
- .build())
- .build()));
-
- assertEquals(IPV6, getEidType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddress(
- new Ipv6Builder().setIpv6(
- new Ipv6Address("2001:0db8:0a0b:12f0:0000:0000:0000:0001"))
- .build())
- .build()));
-
- assertEquals(MAC, getEidType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder()
- .setAddress(
- new MacBuilder().setMac(
- new MacAddress("aa:bb:cc:dd:ee:ff"))
- .build())
- .build()));
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java
deleted file mode 100644
index 0b2536b85..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/AdjacencyCustomizerTest.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.ADDRESS_ONE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.ADDRESS_THREE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.LOCAL_EID_ONE;
-import static io.fd.honeycomb.lisp.translate.AdjacencyData.REMOTE_EID_ONE;
-import static io.fd.honeycomb.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext;
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.lisp.util.EidMappingContextHelper;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.LispAddDelAdjacency;
-import io.fd.vpp.jvpp.core.dto.LispAddDelAdjacencyReply;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.MacBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.AdjacencyKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.LocalEidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.adjacencies.grouping.adjacencies.adjacency.RemoteEidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class AdjacencyCustomizerTest extends WriterCustomizerTest implements EidMappingContextHelper {
-
- @Captor
- private ArgumentCaptor<LispAddDelAdjacency> requestCaptor;
-
- private EidMappingContext localMappingContext;
-
- private EidMappingContext remoteMappingContext;
-
- @Mock
- private AdjacenciesMappingContext adjacenciesMappingContext;
-
- private AdjacencyCustomizer customizer;
-
- private InstanceIdentifier<Adjacency> emptyId;
- private InstanceIdentifier<Adjacency> validId;
-
- private Adjacency emptyData;
- private Adjacency invalidData;
- private Adjacency validData;
-
- @Before
- public void init() {
- localMappingContext = new EidMappingContext("local-mapping-context");
- remoteMappingContext = new EidMappingContext("remote-mapping-context");
- customizer = new AdjacencyCustomizer(api, localMappingContext, remoteMappingContext, adjacenciesMappingContext);
-
- emptyId = InstanceIdentifier.create(Adjacency.class);
- validId = InstanceIdentifier.create(EidTable.class)
- .child(VniTable.class, new VniTableKey(2L))
- .child(BridgeDomainSubtable.class)
- .child(RemoteMappings.class)
- .child(RemoteMapping.class, new RemoteMappingKey(new MappingId("remote-mapping")))
- .child(Adjacencies.class)
- .child(Adjacency.class, new AdjacencyKey("adj-one"));
-
- emptyData = new AdjacencyBuilder().build();
-
- invalidData = new AdjacencyBuilder().setId("ID").setLocalEid(
- new LocalEidBuilder()
- .setVirtualNetworkId(new InstanceIdType(12L))
- .setAddressType(Ipv4Afi.class)
- .setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build())
- .build()).setRemoteEid(
- new RemoteEidBuilder()
- .setVirtualNetworkId(new InstanceIdType(12L))
- .setAddressType(MacAfi.class)
- .setAddress(new MacBuilder().setMac(new MacAddress("aa:aa:aa:aa:aa:aa")).build())
- .build())
- .build();
-
- validData = new AdjacencyBuilder().setId("ID").setLocalEid(
- new LocalEidBuilder()
- .setVirtualNetworkId(new InstanceIdType(12L))
- .setAddressType(Ipv4Afi.class)
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_ONE).build())
- .build()).setRemoteEid(
- new RemoteEidBuilder()
- .setVirtualNetworkId(new InstanceIdType(12L))
- .setAddressType(Ipv4Afi.class)
- .setAddress(new Ipv4Builder().setIpv4(ADDRESS_THREE).build()).build()).build();
-
- when(api.lispAddDelAdjacency(any())).thenReturn(future(new LispAddDelAdjacencyReply()));
- }
-
- @Test
- public void writeCurrentAttributesNoKey() throws Exception {
- try {
- customizer.writeCurrentAttributes(emptyId, emptyData, writeContext);
- } catch (NullPointerException e) {
- verify(api, times(0)).lispAddDelAdjacency(any());
- return;
- }
-
- fail("Test should have failed while reading parent vni table id");
- }
-
- @Test
- public void writeCurrentAttributesInvalidCombination() throws Exception {
- try {
- customizer.writeCurrentAttributes(emptyId, invalidData, writeContext);
- } catch (NullPointerException e) {
- verify(api, times(0)).lispAddDelAdjacency(any());
- return;
- }
-
- fail("Test should have failed while reading parent vni table id");
- }
-
-
- @Test
- public void writeCurrentAttributes() throws Exception {
- defineEidMapping(mappingContext, LOCAL_EID_ONE, new MappingId("local-eid-one"), "local-mapping-context");
- defineEidMapping(mappingContext, REMOTE_EID_ONE, new MappingId("remote-eid-one"), "remote-mapping-context");
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- verify(api, times(1)).lispAddDelAdjacency(requestCaptor.capture());
- verifyRequest(requestCaptor.getValue(), 1, new byte[]{-64, -88, 2, 1}, 32, new byte[]{-64, -88, 2, 3},
- 32, IPV4.getValue(), 2);
- verify(adjacenciesMappingContext, times(1))
- .addEidPair("adj-one", "local-eid-one", "remote-eid-one", mappingContext);
- }
-
- @Test
- public void writeCurrentAttributesNonExistingLocalMapping() throws Exception {
- noEidMappingDefined(mappingContext, "local-eid-one", "local-mapping-context");
- defineEidMapping(mappingContext, REMOTE_EID_ONE, new MappingId("remote-eid-one"), "remote-mapping-context");
- try {
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- } catch (IllegalStateException e) {
- verify(api, times(0)).lispAddDelAdjacency(any());
- return;
- }
-
- fail("Test should have failed while verifying local eid");
- }
-
- @Test
- public void writeCurrentAttributesNonExistingRemoteMapping() throws Exception {
- noEidMappingDefined(mappingContext, "remote-eid-one", "remote-mapping-context");
- defineEidMapping(mappingContext, LOCAL_EID_ONE, new MappingId("local-eid-one"), "local-mapping-context");
-
- try {
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- } catch (IllegalStateException e) {
- verify(api, times(0)).lispAddDelAdjacency(any());
- return;
- }
-
- fail("Test should have failed while verifying remote eid");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void updateCurrentAttributes() throws Exception {
- customizer.updateCurrentAttributes(emptyId, emptyData, emptyData, writeContext);
- }
-
- @Test
- public void deleteCurrentAttributesNoKey() throws Exception {
- try {
- customizer.deleteCurrentAttributes(emptyId, emptyData, writeContext);
- } catch (NullPointerException e) {
- verify(api, times(0)).lispAddDelAdjacency(any());
- return;
- }
-
- fail("Test should have failed while reading parent vni table id");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void deleteCurrentAttributesInvalidCombination() throws Exception {
- customizer.deleteCurrentAttributes(validId, invalidData, writeContext);
- }
-
- @Test
- public void deleteCurrentAttributes() throws Exception {
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- verify(api, times(1)).lispAddDelAdjacency(requestCaptor.capture());
- verifyRequest(requestCaptor.getValue(), 0, new byte[]{-64, -88, 2, 1}, 32, new byte[]{-64, -88, 2, 3},
- 32, IPV4.getValue(), 2);
- verify(adjacenciesMappingContext, times(1)).removeForIndex("adj-one", mappingContext);
- }
-
- private static void verifyRequest(final LispAddDelAdjacency request, final int isAdd, final byte[] leid,
- final int leidLen, final byte[] reid, final int reidLen, final int eidType,
- final int vni) {
-
- assertNotNull(request);
- assertEquals(isAdd, request.isAdd);
- assertArrayEquals(leid, request.leid);
- assertEquals(leidLen, request.leidLen);
- assertArrayEquals(reid, request.reid);
- assertEquals(reidLen, request.reidLen);
- assertEquals(eidType, request.eidType);
- assertEquals(vni, request.vni);
-
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainCustomizerTest.java
deleted file mode 100644
index ada98bfb8..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/BridgeDomainCustomizerTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import io.fd.honeycomb.lisp.translate.write.trait.SubtableWriterTestCase;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.VppCallbackException;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.VniTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.BridgeDomainSubtableBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class BridgeDomainCustomizerTest extends SubtableWriterTestCase {
-
- private BridgeDomainSubtableCustomizer customizer;
- private InstanceIdentifier<BridgeDomainSubtable> validId;
- private BridgeDomainSubtable validData;
- private NamingContext bridgeDomainContext;
-
- @Before
- public void init() {
- bridgeDomainContext = new NamingContext("br", "bridge-domain-context");
- customizer = new BridgeDomainSubtableCustomizer(api, bridgeDomainContext);
- validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(12L))
- .child(BridgeDomainSubtable.class);
- validData = new BridgeDomainSubtableBuilder().setBridgeDomainRef("br-domain").build();
- defineMapping(mappingContext, "br-domain", 10, "bridge-domain-context");
- }
-
- @Test
- public void testWriteSuccessfull() throws WriteFailedException {
- whenAddDelEidTableAddDelMapSuccess();
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- verifyAddDelEidTableAddDelMapInvokedCorrectly(1, 12, 10, 1);
- }
-
- @Test
- public void testWriteFailed() throws WriteFailedException {
- whenAddDelEidTableAddDelMapFail();
-
- try {
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- } catch (Exception e) {
- assertTrue(e instanceof WriteFailedException);
-
- final WriteFailedException realException = ((WriteFailedException) e);
- assertEquals(validId, realException.getFailedId());
- assertTrue(e.getCause() instanceof VppCallbackException);
- return;
- }
-
- fail("Test should throw exception");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws WriteFailedException {
- customizer.updateCurrentAttributes(validId, validData, validData, writeContext);
- }
-
- @Test
- public void testDeleteSuccessfull() throws WriteFailedException {
- whenAddDelEidTableAddDelMapSuccess();
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- verifyAddDelEidTableAddDelMapInvokedCorrectly(0, 12, 10, 1);
- }
-
- @Test
- public void testDeleteFailed() {
- whenAddDelEidTableAddDelMapFail();
-
- try {
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- } catch (Exception e) {
- assertTrue(e instanceof WriteFailedException);
-
- final WriteFailedException realException = ((WriteFailedException) e);
- assertEquals(validId, realException.getFailedId());
- assertTrue(e.getCause() instanceof VppCallbackException);
- return;
- }
-
- fail("Test should throw exception");
- }
-
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java
deleted file mode 100755
index a27e5ae94..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/InterfaceCustomizerTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.locator.sets.grouping.locator.sets.locator.set.InterfaceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocator;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocatorReply;
-
-public class InterfaceCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
-
- @Captor
- private ArgumentCaptor<LispAddDelLocator> intfCaptor;
-
- private InstanceIdentifier<Interface> id;
- private Interface intf;
- private InterfaceCustomizer customizer;
-
- @Override
- public void setUp() {
- final String ifcCtxName = "INInterruptedException, ExecutionException, STANCE";
- final String interfaceName = "Interface";
- defineMapping(mappingContext, interfaceName, 5, ifcCtxName);
-
- id = InstanceIdentifier.builder(Lisp.class)
- .child(LispFeatureData.class)
- .child(LocatorSets.class)
- .child(LocatorSet.class, new LocatorSetKey("Locator"))
- .child(Interface.class, new InterfaceKey(interfaceName))
- .build();
-
- intf = new InterfaceBuilder()
- .setPriority((short) 1)
- .setWeight((short) 2)
- .build();
-
- customizer = new InterfaceCustomizer(api, new NamingContext("PREFIX", ifcCtxName));
-
- when(api.lispAddDelLocator(any(LispAddDelLocator.class))).thenReturn(future(new LispAddDelLocatorReply()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullPriority() throws WriteFailedException {
- Interface intf = mock(Interface.class);
- when(intf.getWeight()).thenReturn((short) 1);
- when(intf.getPriority()).thenReturn(null);
-
- customizer.writeCurrentAttributes(null, intf, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullWeight() throws WriteFailedException {
- Interface intf = mock(Interface.class);
- when(intf.getWeight()).thenReturn(null);
- when(intf.getPriority()).thenReturn((short) 1);
-
- customizer.writeCurrentAttributes(null, intf, null);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- customizer.writeCurrentAttributes(id, intf, writeContext);
-
- verify(api, times(1)).lispAddDelLocator(intfCaptor.capture());
-
- LispAddDelLocator request = intfCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(1, request.isAdd);
- assertEquals(2, request.weight);
- assertEquals(1, request.priority);
- assertEquals(5, request.swIfIndex);
- assertEquals("Locator", toString(request.locatorSetName));
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- customizer.updateCurrentAttributes(null, null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullPriority() throws WriteFailedException {
- Interface interf = mock(Interface.class);
- when(interf.getWeight()).thenReturn((short) 1);
- when(interf.getPriority()).thenReturn(null);
-
- customizer.deleteCurrentAttributes(null, interf, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullWeight() throws WriteFailedException {
- Interface interf = mock(Interface.class);
- when(interf.getWeight()).thenReturn(null);
- when(interf.getPriority()).thenReturn((short) 1);
-
- customizer.deleteCurrentAttributes(null, interf, null);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException {
- customizer.deleteCurrentAttributes(id, intf, writeContext);
-
- verify(api, times(1)).lispAddDelLocator(intfCaptor.capture());
-
- LispAddDelLocator request = intfCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(0, request.isAdd);
- assertEquals(2, request.weight);
- assertEquals(1, request.priority);
- assertEquals(5, request.swIfIndex);
- assertEquals("Locator", toString(request.locatorSetName));
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java
deleted file mode 100644
index 585589470..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.VppCallbackException;
-import io.fd.vpp.jvpp.core.dto.LispAddDelMapRequestItrRlocs;
-import io.fd.vpp.jvpp.core.dto.LispAddDelMapRequestItrRlocsReply;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSet;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.itr.remote.locator.sets.grouping.ItrRemoteLocatorSetBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class ItrRemoteLocatorSetCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator {
-
- private static final String VALID_NAME = "loc-set";
-
- @Captor
- private ArgumentCaptor<LispAddDelMapRequestItrRlocs> requestCaptor;
-
- private ItrRemoteLocatorSetCustomizer customizer;
- private InstanceIdentifier<ItrRemoteLocatorSet> validId;
- private ItrRemoteLocatorSet validData;
-
- @Before
- public void setUp() throws Exception {
- initMocks(this);
- customizer = new ItrRemoteLocatorSetCustomizer(api);
- validId = InstanceIdentifier.create(ItrRemoteLocatorSet.class);
- validData = new ItrRemoteLocatorSetBuilder().setRemoteLocatorSetName(VALID_NAME).build();
- }
-
- @Test
- public void writeCurrentAttributesSuccess() throws Exception {
- onWriteSuccess();
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- verifyWriteInvoked(true, VALID_NAME);
- }
-
- @Test
- public void writeCurrentAttributesFailed() {
- onWriteThrow();
-
- try {
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- verifyWriteInvoked(true, VALID_NAME);
- return;
- }
-
- fail("Test should have thrown exception");
- }
-
- @Test
- public void updateCurrentAttributes() {
- try {
- customizer.updateCurrentAttributes(validId, validData, validData, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof UnsupportedOperationException);
- return;
- }
-
- fail("Test should have thrown exception");
- }
-
- @Test
- public void deleteCurrentAttributesSuccess() throws Exception {
- onWriteSuccess();
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- verifyWriteInvoked(false, VALID_NAME);
- }
-
- @Test
- public void deleteCurrentAttributesFailed() throws Exception {
- onWriteThrow();
-
- try {
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof VppCallbackException);
- verifyWriteInvoked(true, VALID_NAME);
- return;
- }
-
- fail("Test should have thrown exception");
- }
-
- private void onWriteSuccess() {
- when(api.lispAddDelMapRequestItrRlocs(any(LispAddDelMapRequestItrRlocs.class)))
- .thenReturn(CompletableFuture.completedFuture(new LispAddDelMapRequestItrRlocsReply()));
- }
-
- private void onWriteThrow() {
- when(api.lispAddDelMapRequestItrRlocs(any(LispAddDelMapRequestItrRlocs.class)))
- .thenReturn(new CompletableFuture<LispAddDelMapRequestItrRlocsReply>() {
- @Override
- public LispAddDelMapRequestItrRlocsReply get(final long l, final TimeUnit timeUnit)
- throws InterruptedException, ExecutionException, TimeoutException {
- throw new ExecutionException(new VppCallbackException("lispAddDelMapRequestItrRlocs", 1, -2));
- }
- });
- }
-
- private void verifyWriteInvoked(final boolean add, final String name) {
- verify(api, times(1)).lispAddDelMapRequestItrRlocs(requestCaptor.capture());
-
- final LispAddDelMapRequestItrRlocs request = requestCaptor.getValue();
- assertNotNull(request);
- assertEquals(booleanToByte(add), request.isAdd);
- assertEquals(name, toString(request.locatorSetName));
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LispCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LispCustomizerTest.java
deleted file mode 100755
index 380335cd3..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LispCustomizerTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispBuilder;
-import io.fd.vpp.jvpp.core.dto.LispEnableDisable;
-import io.fd.vpp.jvpp.core.dto.LispEnableDisableReply;
-
-
-public class LispCustomizerTest extends WriterCustomizerTest {
-
- private LispCustomizer customizer;
-
- @Override
- public void setUp() {
- customizer = new LispCustomizer(api);
- }
-
- private void whenlispEnableDisableThenSuccess() {
- when(api.lispEnableDisable(any(LispEnableDisable.class))).thenReturn(future(new LispEnableDisableReply()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, null);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- Lisp intf = new LispBuilder().setEnable(true).build();
-
- whenlispEnableDisableThenSuccess();
- customizer.writeCurrentAttributes(null, intf, null);
-
- ArgumentCaptor<LispEnableDisable> mappingCaptor = ArgumentCaptor.forClass(LispEnableDisable.class);
- verify(api, times(1)).lispEnableDisable(mappingCaptor.capture());
-
- LispEnableDisable request = mappingCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(1, request.isEn);
- }
-
- @Test(expected = NullPointerException.class)
- public void testUpdateCurrentAttributesNullData() throws WriteFailedException {
- customizer.updateCurrentAttributes(null, null, null, null);
- }
-
- @Test
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- Lisp lisp = new LispBuilder().setEnable(true).build();
-
- whenlispEnableDisableThenSuccess();
- customizer.updateCurrentAttributes(null, null, lisp, null);
-
- ArgumentCaptor<LispEnableDisable> lispCaptor = ArgumentCaptor.forClass(LispEnableDisable.class);
- verify(api, times(1)).lispEnableDisable(lispCaptor.capture());
-
- LispEnableDisable request = lispCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(1, request.isEn);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, null, null);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException {
- Lisp lisp = new LispBuilder().setEnable(true).build();
-
- whenlispEnableDisableThenSuccess();
- customizer.deleteCurrentAttributes(null, lisp, null);
-
- ArgumentCaptor<LispEnableDisable> lispCaptor = ArgumentCaptor.forClass(LispEnableDisable.class);
- verify(api, times(1)).lispEnableDisable(lispCaptor.capture());
-
- LispEnableDisable request = lispCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(0, request.isEn);
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java
deleted file mode 100755
index cfcc2befb..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocalMappingCustomizerTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.concurrent.ExecutionException;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.LocalMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.LocalMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.VniTableKey;
-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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocalEid;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocalEidReply;
-
-public class LocalMappingCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator, Ipv4Translator {
-
- @Mock
- private EidMappingContext eidMappingContext;
- @Captor
- private ArgumentCaptor<LispAddDelLocalEid> mappingCaptor;
-
- private InstanceIdentifier<LocalMapping> id;
- private LocalMapping mapping;
- private LocalMappingCustomizer customizer;
-
- @Override
- public void setUp() {
- final Eid
- eid = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setAddress(
- new Ipv4Builder().setIpv4(
- new Ipv4Address("192.168.2.1"))
- .build())
- .build();
-
- mapping = new LocalMappingBuilder()
- .setEid(eid)
- .setLocatorSet("Locator")
- .build();
-
- id = InstanceIdentifier.builder(Lisp.class)
- .child(LispFeatureData.class)
- .child(EidTable.class)
- .child(VniTable.class, new VniTableKey(25L))
- .child(VrfSubtable.class)
- .child(LocalMappings.class)
- .child(LocalMapping.class, new LocalMappingKey(new MappingId("local")))
- .build();
-
- customizer = new LocalMappingCustomizer(api, eidMappingContext);
-
- when(api.lispAddDelLocalEid(any(LispAddDelLocalEid.class))).thenReturn(future(new LispAddDelLocalEidReply()));
- }
-
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullEid() throws WriteFailedException {
- LocalMapping mapping = mock(LocalMapping.class);
- when(mapping.getEid()).thenReturn(null);
- when(mapping.getLocatorSet()).thenReturn("Locator");
-
- customizer.writeCurrentAttributes(null, mapping, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullLocator() throws WriteFailedException {
- LocalMapping mapping = mock(LocalMapping.class);
- when(mapping.getEid()).thenReturn(mock(Eid.class));
- when(mapping.getLocatorSet()).thenReturn(null);
-
- customizer.writeCurrentAttributes(null, mapping, writeContext);
- }
-
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- customizer.writeCurrentAttributes(id, mapping, writeContext);
-
- verify(api, times(1)).lispAddDelLocalEid(mappingCaptor.capture());
-
- LispAddDelLocalEid request = mappingCaptor.getValue();
-
- assertNotNull(request);
- assertEquals("Locator", new String(request.locatorSetName));
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.eid).getValue());
- assertEquals(0, request.eidType);
- assertEquals(1, request.isAdd);
- assertEquals(25, request.vni);
- assertEquals("Locator", toString(request.locatorSetName));
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- customizer.updateCurrentAttributes(null, null, null, writeContext);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException, InterruptedException, ExecutionException {
- when(eidMappingContext.containsEid(any(), eq(mappingContext))).thenReturn(true);
- customizer.deleteCurrentAttributes(id, mapping, writeContext);
-
- verify(api, times(1)).lispAddDelLocalEid(mappingCaptor.capture());
-
- LispAddDelLocalEid request = mappingCaptor.getValue();
-
- assertNotNull(request);
- assertEquals("Locator", new String(request.locatorSetName));
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.eid).getValue());
- assertEquals(0, request.eidType);
- assertEquals(0, request.isAdd);
- assertEquals(25, request.vni);
- assertEquals("Locator", toString(request.locatorSetName));
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java
deleted file mode 100755
index 30d33a51b..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/LocatorSetCustomizerTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocatorSet;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocatorSetReply;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetails;
-import io.fd.vpp.jvpp.core.dto.LispLocatorSetDetailsReplyDump;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.concurrent.ExecutionException;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-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.LocatorSetBuilder;
-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.InterfaceBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class LocatorSetCustomizerTest extends WriterCustomizerTest {
-
- private LocatorSetCustomizer customizer;
-
- @Override
- public void setUp() {
- customizer = new LocatorSetCustomizer(api, new NamingContext("locator-set", "locator-set-context"));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesBadData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, mock(LocatorSet.class), writeContext);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException, InterruptedException, ExecutionException {
- noMappingDefined(mappingContext, "Locator", "locator-set-context");
- LocatorSet locatorSet = new LocatorSetBuilder()
- .setName("Locator")
- .setInterface(Arrays.asList(new InterfaceBuilder().build()))
- .build();
-
- InstanceIdentifier<LocatorSet> validId =
- InstanceIdentifier.create(LocatorSets.class).child(LocatorSet.class, new LocatorSetKey("Locator"));
-
-
- ArgumentCaptor<LispAddDelLocatorSet> locatorSetCaptor = ArgumentCaptor.forClass(LispAddDelLocatorSet.class);
-
- when(api.lispAddDelLocatorSet(any(LispAddDelLocatorSet.class)))
- .thenReturn(future(new LispAddDelLocatorSetReply()));
- when(writeContext.readAfter(validId)).thenReturn(Optional.of(locatorSet));
-
- final LispLocatorSetDetailsReplyDump reply = new LispLocatorSetDetailsReplyDump();
- LispLocatorSetDetails details = new LispLocatorSetDetails();
- details.lsName = "Locator".getBytes(StandardCharsets.UTF_8);
- reply.lispLocatorSetDetails = ImmutableList.of(details);
-
- customizer.writeCurrentAttributes(validId, locatorSet, writeContext);
-
- verify(api, times(1)).lispAddDelLocatorSet(locatorSetCaptor.capture());
-
- LispAddDelLocatorSet request = locatorSetCaptor.getValue();
-
- assertNotNull(request);
- assertEquals("Locator", new String(request.locatorSetName));
- assertEquals(1, request.isAdd);
- }
-
- @Test
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- final InstanceIdentifier<LocatorSet> identifier = InstanceIdentifier.create(LocatorSet.class);
- try {
- customizer
- .updateCurrentAttributes(identifier, mock(LocatorSet.class), mock(LocatorSet.class), writeContext);
- } catch (WriteFailedException e) {
- assertTrue(e.getCause() instanceof UnsupportedOperationException);
- assertEquals(identifier, e.getFailedId());
- return;
- }
- fail("Test should have failed");
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, null, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesBadData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, mock(LocatorSet.class), writeContext);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws InterruptedException, ExecutionException, WriteFailedException {
- LocatorSet locatorSet = new LocatorSetBuilder()
- .setName("Locator")
- .build();
-
- ArgumentCaptor<LispAddDelLocatorSet> locatorSetCaptor = ArgumentCaptor.forClass(LispAddDelLocatorSet.class);
-
- when(api.lispAddDelLocatorSet(any(LispAddDelLocatorSet.class)))
- .thenReturn(future(new LispAddDelLocatorSetReply()));
-
- customizer.deleteCurrentAttributes(null, locatorSet, writeContext);
-
- verify(api, times(1)).lispAddDelLocatorSet(locatorSetCaptor.capture());
-
- LispAddDelLocatorSet request = locatorSetCaptor.getValue();
-
- assertNotNull(request);
- assertEquals("Locator", new String(request.locatorSetName));
- assertEquals(0, request.isAdd);
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizerTest.java
deleted file mode 100755
index ba5bf01b6..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/MapResolverCustomizerTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.concurrent.ExecutionException;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolverBuilder;
-import io.fd.vpp.jvpp.core.dto.LispAddDelMapResolver;
-import io.fd.vpp.jvpp.core.dto.LispAddDelMapResolverReply;
-
-
-public class MapResolverCustomizerTest extends WriterCustomizerTest implements Ipv4Translator {
-
- private MapResolverCustomizer customizer;
-
- @Override
- public void setUp() {
- customizer = new MapResolverCustomizer(api);
- }
-
- private void whenLispAddDelMapResolverThenSuccess() {
- when(api.lispAddDelMapResolver(any(LispAddDelMapResolver.class)))
- .thenReturn(future(new LispAddDelMapResolverReply()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesBadData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, new MapResolverBuilder().build(), null);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- Ipv4Address address = new Ipv4Address("192.168.2.1");
- MapResolver resolver = new MapResolverBuilder().setIpAddress(new IpAddress(address)).build();
-
- whenLispAddDelMapResolverThenSuccess();
-
- customizer.writeCurrentAttributes(null, resolver, null);
-
- ArgumentCaptor<LispAddDelMapResolver> resolverCaptor = ArgumentCaptor.forClass(LispAddDelMapResolver.class);
- verify(api, times(1)).lispAddDelMapResolver(resolverCaptor.capture());
-
- LispAddDelMapResolver request = resolverCaptor.getValue();
- assertEquals(1, request.isAdd);
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.ipAddress).getValue());
- }
-
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- customizer.updateCurrentAttributes(null, null, null, null);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws InterruptedException, ExecutionException, WriteFailedException {
- Ipv4Address address = new Ipv4Address("192.168.2.1");
- MapResolver resolver = new MapResolverBuilder().setIpAddress(new IpAddress(address)).build();
-
- whenLispAddDelMapResolverThenSuccess();
-
- customizer.deleteCurrentAttributes(null, resolver, null);
-
- ArgumentCaptor<LispAddDelMapResolver> resolverCaptor = ArgumentCaptor.forClass(LispAddDelMapResolver.class);
- verify(api, times(1)).lispAddDelMapResolver(resolverCaptor.capture());
-
- LispAddDelMapResolver request = resolverCaptor.getValue();
- assertEquals(0, request.isAdd);
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.ipAddress).getValue());
- }
-
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizerTest.java
deleted file mode 100755
index fa2061c49..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/PitrCfgCustomizerTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import java.util.concurrent.ExecutionException;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfgBuilder;
-import io.fd.vpp.jvpp.core.dto.LispPitrSetLocatorSet;
-import io.fd.vpp.jvpp.core.dto.LispPitrSetLocatorSetReply;
-
-
-public class PitrCfgCustomizerTest extends WriterCustomizerTest {
-
- private PitrCfgCustomizer customizer;
-
- @Override
- public void setUp() {
- customizer = new PitrCfgCustomizer(api);
- }
-
- private void whenLispPitrSetLocatorSetThenSuccess() {
- when(api.lispPitrSetLocatorSet(any(LispPitrSetLocatorSet.class))).thenReturn(future(new LispPitrSetLocatorSetReply()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesBadData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, mock(PitrCfg.class), null);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- PitrCfg cfg = new PitrCfgBuilder().setLocatorSet("Locator").build();
-
- whenLispPitrSetLocatorSetThenSuccess();
- customizer.writeCurrentAttributes(null, cfg, null);
-
- ArgumentCaptor<LispPitrSetLocatorSet> cfgCaptor = ArgumentCaptor.forClass(LispPitrSetLocatorSet.class);
- verify(api, times(1)).lispPitrSetLocatorSet(cfgCaptor.capture());
-
- LispPitrSetLocatorSet request = cfgCaptor.getValue();
- assertEquals(1, request.isAdd);
- assertEquals("Locator", new String(request.lsName));
- }
-
- @Test
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- PitrCfg cfg = new PitrCfgBuilder().setLocatorSet("Locator").build();
-
- whenLispPitrSetLocatorSetThenSuccess();
-
- customizer.writeCurrentAttributes(null, cfg, null);
-
- ArgumentCaptor<LispPitrSetLocatorSet> cfgCaptor = ArgumentCaptor.forClass(LispPitrSetLocatorSet.class);
- verify(api, times(1)).lispPitrSetLocatorSet(cfgCaptor.capture());
-
- LispPitrSetLocatorSet request = cfgCaptor.getValue();
- assertEquals(1, request.isAdd);
- assertEquals("Locator", new String(request.lsName));
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, null, null);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesBadData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, mock(PitrCfg.class), null);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException, InterruptedException, ExecutionException {
- PitrCfg cfg = new PitrCfgBuilder().setLocatorSet("Locator").build();
-
- whenLispPitrSetLocatorSetThenSuccess();
-
- customizer.deleteCurrentAttributes(null, cfg, null);
-
- ArgumentCaptor<LispPitrSetLocatorSet> cfgCaptor = ArgumentCaptor.forClass(LispPitrSetLocatorSet.class);
- verify(api, times(1)).lispPitrSetLocatorSet(cfgCaptor.capture());
-
- LispPitrSetLocatorSet request = cfgCaptor.getValue();
- assertEquals(0, request.isAdd);
- assertEquals("Locator", new String(request.lsName));
- }
-
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java
deleted file mode 100755
index f0fe32a63..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/RemoteMappingCustomizerTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.lisp.context.util.EidMappingContext;
-import io.fd.honeycomb.translate.vpp.util.Ipv4Translator;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.LispAddDelRemoteMapping;
-import io.fd.vpp.jvpp.core.dto.LispAddDelRemoteMappingReply;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.Lisp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MapReplyAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.RemoteMappings;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMapping;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.RemoteMappingKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.EidBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.NegativeMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.negative.mapping.MapReplyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.VniTableKey;
-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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class RemoteMappingCustomizerTest extends WriterCustomizerTest implements Ipv4Translator {
-
- @Captor
- private ArgumentCaptor<LispAddDelRemoteMapping> mappingCaptor;
-
- private MappingId mappingId;
- private RemoteMappingCustomizer customizer;
- private RemoteMapping intf;
- private InstanceIdentifier<RemoteMapping> id;
-
- @Mock
- private EidMappingContext remoteMappingContext;
-
- @Override
- public void setUp() {
- final Eid eid = new EidBuilder()
- .setAddressType(Ipv4Afi.class)
- .setAddress(
- new Ipv4Builder().setIpv4(
- new Ipv4Address("192.168.2.1"))
- .build())
- .build();
-
- mappingId = new MappingId("REMOTE");
- final RemoteMappingKey key = new RemoteMappingKey(mappingId);
-
- intf = new RemoteMappingBuilder()
- .setEid(
- eid)
- .setLocatorList(new NegativeMappingBuilder()
- .setMapReply(new MapReplyBuilder().setMapReplyAction(MapReplyAction.Drop).build()).build())
- .build();
-
- id = InstanceIdentifier.builder(Lisp.class)
- .child(LispFeatureData.class)
- .child(EidTable.class)
- .child(VniTable.class, new VniTableKey(25L))
- .child(VrfSubtable.class)
- .child(RemoteMappings.class)
- .child(RemoteMapping.class, key).build();
-
- customizer = new RemoteMappingCustomizer(api, remoteMappingContext);
-
- when(api.lispAddDelRemoteMapping(any())).thenReturn(future(new LispAddDelRemoteMappingReply()));
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesNullData() throws WriteFailedException {
- customizer.writeCurrentAttributes(null, null, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testWriteCurrentAttributesBadData() throws WriteFailedException {
- customizer
- .writeCurrentAttributes(null, mock(RemoteMapping.class), writeContext);
- }
-
- @Test
- public void testWriteCurrentAttributes() throws WriteFailedException {
- customizer.writeCurrentAttributes(id, intf, writeContext);
-
- verify(api, times(1)).lispAddDelRemoteMapping(mappingCaptor.capture());
-
- LispAddDelRemoteMapping request = mappingCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(1, request.isAdd);
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.eid).getValue());
- assertEquals(25, request.vni);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdateCurrentAttributes() throws WriteFailedException {
- customizer.updateCurrentAttributes(null, null, null, writeContext);
- }
-
- @Test(expected = NullPointerException.class)
- public void testDeleteCurrentAttributesNullData() throws WriteFailedException {
- customizer.deleteCurrentAttributes(null, null, writeContext);
- }
-
- @Test
- public void testDeleteCurrentAttributes() throws WriteFailedException {
- when(remoteMappingContext.containsEid(any(), eq(mappingContext))).thenReturn(true);
- customizer.deleteCurrentAttributes(id, intf, writeContext);
-
- verify(api, times(1)).lispAddDelRemoteMapping(mappingCaptor.capture());
-
- LispAddDelRemoteMapping request = mappingCaptor.getValue();
-
- assertNotNull(request);
- assertEquals(0, request.isAdd);
- assertEquals("1.2.168.192", arrayToIpv4AddressNoZone(request.eid).getValue());
- assertEquals(25, request.vni);
- }
-
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java
deleted file mode 100644
index ac56896c4..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VniTableCustomizerTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import org.junit.Before;
-import org.junit.Test;
-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.VniTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtableBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class VniTableCustomizerTest extends WriterCustomizerTest {
-
- private VniTableCustomizer customizer;
- private InstanceIdentifier<VniTable> validId;
- private VniTable validData;
-
- @Before
- public void init() {
- initMocks(this);
- customizer = new VniTableCustomizer(api);
-
- validId = InstanceIdentifier.create(VniTable.class);
- validData = new VniTableBuilder()
- .setVrfSubtable(new VrfSubtableBuilder()
- .build()).build();
- }
-
- @Test
- public void testWriteSuccessfull() {
- whenReadAfterReturnValid();
- try {
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- } catch (Exception e) {
- fail("Test should pass without exception");
- }
- }
-
- @Test(expected = IllegalStateException.class)
- public void testWriteFailed() throws WriteFailedException {
- whenReadAfterReturnInvalid();
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws WriteFailedException {
- customizer.updateCurrentAttributes(validId, validData, validData, writeContext);
- }
-
- @Test
- public void testDeleteSuccessfull() {
- whenReadBeforeReturnValid();
- try {
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- } catch (Exception e) {
- fail("Test should pass without exception");
- }
- }
-
- @Test(expected = IllegalStateException.class)
- public void testDeleteFailed() throws WriteFailedException {
- whenReadBeforeReturnInvalid();
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- }
-
- private void whenReadBeforeReturnValid() {
- when(writeContext.readBefore(validId)).thenReturn(Optional.of(validData));
- }
-
- private void whenReadBeforeReturnInvalid() {
- when(writeContext.readBefore(validId)).thenReturn(Optional.absent());
- }
-
- private void whenReadAfterReturnValid() {
- when(writeContext.readAfter(validId)).thenReturn(Optional.of(validData));
- }
-
- private void whenReadAfterReturnInvalid() {
- when(writeContext.readAfter(validId)).thenReturn(Optional.absent());
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizerTest.java
deleted file mode 100644
index 3f814bfc5..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/VrfSubtableCustomizerTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import io.fd.honeycomb.lisp.translate.write.trait.SubtableWriterTestCase;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import io.fd.vpp.jvpp.VppCallbackException;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.EidTable;
-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.VniTableKey;
-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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.eid.table.grouping.eid.table.vni.table.VrfSubtableBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class VrfSubtableCustomizerTest extends SubtableWriterTestCase {
-
- private VrfSubtableCustomizer customizer;
- private InstanceIdentifier<VrfSubtable> validId;
- private VrfSubtable validData;
-
- @Before
- public void init() {
- customizer = new VrfSubtableCustomizer(api);
- validId = InstanceIdentifier.create(EidTable.class).child(VniTable.class, new VniTableKey(12L))
- .child(VrfSubtable.class);
- validData = new VrfSubtableBuilder().setTableId(10L).build();
- }
-
- @Test
- public void testWriteSuccessfull() throws WriteFailedException {
- whenAddDelEidTableAddDelMapSuccess();
-
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- verifyAddDelEidTableAddDelMapInvokedCorrectly(1, 12, 10, 0);
- }
-
- @Test
- public void testWriteFailed() {
- whenAddDelEidTableAddDelMapFail();
-
- try {
- customizer.writeCurrentAttributes(validId, validData, writeContext);
- } catch (Exception e) {
- assertTrue(e instanceof WriteFailedException);
-
- final WriteFailedException realException = ((WriteFailedException) e);
- assertEquals(validId, realException.getFailedId());
- assertTrue(e.getCause() instanceof VppCallbackException);
- return;
- }
-
- fail("Test should throw exception");
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws WriteFailedException {
- customizer.updateCurrentAttributes(validId, validData, validData, writeContext);
- }
-
- @Test
- public void testDeleteSuccessfull() throws WriteFailedException {
- whenAddDelEidTableAddDelMapSuccess();
-
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- verifyAddDelEidTableAddDelMapInvokedCorrectly(0, 12, 10, 0);
- }
-
- @Test
- public void testDeleteFailed() {
- whenAddDelEidTableAddDelMapFail();
-
- try {
- customizer.deleteCurrentAttributes(validId, validData, writeContext);
- } catch (Exception e) {
- assertTrue(e instanceof WriteFailedException);
-
- final WriteFailedException realException = ((WriteFailedException) e);
- assertEquals(validId, realException.getFailedId());
- assertTrue(e.getCause() instanceof VppCallbackException);
- return;
- }
-
- fail("Test should throw exception");
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriterTestCase.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriterTestCase.java
deleted file mode 100644
index 3f80ae561..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/translate/write/trait/SubtableWriterTestCase.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.translate.write.trait;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.LispEidTableAddDelMap;
-import io.fd.vpp.jvpp.core.dto.LispEidTableAddDelMapReply;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mockito;
-
-public class SubtableWriterTestCase extends WriterCustomizerTest implements SubtableWriter {
- @Captor
- protected ArgumentCaptor<LispEidTableAddDelMap> requestCaptor;
-
-
- protected void verifyAddDelEidTableAddDelMapInvokedCorrectly(final int addDel, final int vni, final int tableId,
- final int isL2) {
- verify(api, times(1)).lispEidTableAddDelMap(requestCaptor.capture());
-
- final LispEidTableAddDelMap request = requestCaptor.getValue();
- assertNotNull(request);
- assertEquals(addDel, request.isAdd);
- assertEquals(vni, request.vni);
- assertEquals(tableId, request.dpTable);
- assertEquals(isL2, request.isL2);
- }
-
- protected void whenAddDelEidTableAddDelMapSuccess() {
- when(api.lispEidTableAddDelMap(Mockito.any(LispEidTableAddDelMap.class)))
- .thenReturn(future(new LispEidTableAddDelMapReply()));
- }
-
- protected void whenAddDelEidTableAddDelMapFail() {
- when(api.lispEidTableAddDelMap(Mockito.any(LispEidTableAddDelMap.class)))
- .thenReturn(failedFuture());
- }
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/AdjacencyMappingContextTestHelper.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/AdjacencyMappingContextTestHelper.java
deleted file mode 100644
index 1d6615472..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/AdjacencyMappingContextTestHelper.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.util;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.mockito.Mockito.doReturn;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.translate.MappingContext;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.AdjacenciesIdentificationContexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentification;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.AdjacenciesIdentificationKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.MappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.MappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.MappingKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPair;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.adjacencies.identification.context.rev160801.adjacencies.identification.context.attributes.adjacencies.identification.contexts.adjacencies.identification.mappings.mapping.EidIdentificatorPairBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-/**
- * Utility for mocking adjacency mappings
- */
-public interface AdjacencyMappingContextTestHelper {
-
- /**
- * Creates {@link Mapping} for given data.
- *
- * @param pair to be mapped
- * @param id to be mapped
- * @return eid to id mapping
- */
- default Optional<Mapping> mapping(@Nonnull final EidIdentificatorPair pair, final String id) {
- return Optional.of(new MappingBuilder().setEidIdentificatorPair(pair).setId(id).build());
- }
-
- /**
- * Creates {@link KeyedInstanceIdentifier} for {@link Mapping} in {@link AdjacenciesIdentificationContexts}.
- *
- * @param id identificator of the mapping
- * @param mappingContextName identificator of the mapping context
- * @return identifier for the mapping
- */
- static KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid(@Nonnull final String id,
- @Nonnull final String mappingContextName) {
- return InstanceIdentifier.create(AdjacenciesIdentificationContexts.class).child(AdjacenciesIdentification.class,
- new AdjacenciesIdentificationKey(mappingContextName)).child(Mappings.class)
- .child(Mapping.class, new MappingKey(id));
- }
-
- static EidIdentificatorPair pairOf(@Nonnull final String local, @Nonnull final String remote) {
- return new EidIdentificatorPairBuilder()
- .setLocalEidId(new MappingId(checkNotNull(local, "Local id cannot be null")))
- .setRemoteEidId(new MappingId(checkNotNull(remote, "Remote id cannot be null")))
- .build();
- }
-
- /**
- * Stubs {@link MappingContext#read} to include given mapping in {@link AdjacenciesIdentification}.
- *
- * @param mappingContext mock instance of {@link MappingContext}
- * @param localEidId local id for identification pair
- * @param remoteEidId remote id for identification pair
- * @param mappingName index to be mapped
- * @param namingContextName name of the naming context
- */
- default void defineAdjacencyMapping(@Nonnull final MappingContext mappingContext, @Nonnull final String localEidId,
- @Nonnull final String remoteEidId, @Nonnull final String mappingName,
- @Nonnull final String namingContextName) {
- final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = mappingIid(mappingName, namingContextName);
- final InstanceIdentifier<Mappings> mappingsIid = mappingIid.firstIdentifierOf(Mappings.class);
-
- final Optional<Mapping> singleMapping = mapping(pairOf(localEidId, remoteEidId), mappingName);
- final List<Mapping> list = Common.getMappingList(mappingContext, mappingsIid);
- list.add(singleMapping.get());
-
- doReturn(Optional.of(new MappingsBuilder().setMapping(list).build())).when(mappingContext).read(mappingsIid);
- doReturn(singleMapping).when(mappingContext).read(mappingIid);
- }
-
- default void noAdjacencyMappingDefined(@Nonnull final MappingContext mappingContext, @Nonnull final String name,
- @Nonnull final String namingContextName) {
- final InstanceIdentifier<Mappings> iid =
- mappingIid(name, namingContextName).firstIdentifierOf(Mappings.class);
- final List<Mapping> list = Common.getMappingList(mappingContext, iid);
-
- doReturn(Optional.of(new MappingsBuilder().setMapping(list).build())).when(mappingContext).read(iid);
- doReturn(Optional.absent()).when(mappingContext).read(mappingIid(name, namingContextName));
- }
-
- final class Common {
- private static List<Mapping> getMappingList(@Nonnull final MappingContext mappingContext,
- @Nonnull final InstanceIdentifier<Mappings> mappingsIid) {
- final Optional<Mappings> previousMappings = mappingContext.read(mappingsIid);
- final MappingsBuilder mappingsBuilder;
- if (previousMappings != null && previousMappings.isPresent()) {
- mappingsBuilder = new MappingsBuilder(previousMappings.get());
- } else {
- mappingsBuilder = new MappingsBuilder();
- mappingsBuilder.setMapping(Lists.newArrayList());
- }
- return mappingsBuilder.getMapping();
- }
- }
-
-}
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java
deleted file mode 100644
index 70d536135..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/util/EidMappingContextHelper.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.lisp.util;
-
-
-import static org.mockito.Mockito.doReturn;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.translate.MappingContext;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.Contexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.EidMappingContext;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.EidMappingContextKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.MappingsBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.MappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.MappingKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.MappingId;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-/**
- * Utility class to stub {@link EidMappingContext}
- *
- * TODO - HONEYCOMB-237 - generalize logic for naming context and eid mapping context helper utils if possible
- */
-public interface EidMappingContextHelper {
-
- /**
- * Creates {@link Mapping} for given data.
- *
- * @param eid to be mapped
- * @param id to be mapped @return eid to id mapping
- */
- default Optional<Mapping> mapping(@Nonnull final Eid eid, final MappingId id) {
- return Optional.of(new MappingBuilder().setEid(eid).setId(id).build());
- }
-
- /**
- * Creates {@link KeyedInstanceIdentifier} for {@link Mapping} in {@link EidMappingContext}.
- *
- * @param id identificator of the mapping
- * @param mappingContextName identificator of the mapping context
- * @return identifier for the mapping
- */
- default KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid(@Nonnull final MappingId id,
- @Nonnull final String mappingContextName) {
- return InstanceIdentifier.create(Contexts.class).child(EidMappingContext.class,
- new EidMappingContextKey(mappingContextName)).child(Mappings.class)
- .child(Mapping.class, new MappingKey(id));
- }
-
- /**
- * Stubs {@link MappingContext#read} to include given mapping in {@link EidMappingContext}.
- *
- * @param mappingContext mock instance of {@link MappingContext}
- * @param eid name of the mapping
- * @param mappingName index to be mapped
- * @param namingContextName name of the naming context
- */
- default void defineEidMapping(@Nonnull final MappingContext mappingContext, @Nonnull final Eid eid,
- final MappingId mappingName, @Nonnull final String namingContextName) {
- final KeyedInstanceIdentifier<Mapping, MappingKey> mappingIid = mappingIid(mappingName, namingContextName);
- final InstanceIdentifier<Mappings> mappingsIid = mappingIid.firstIdentifierOf(Mappings.class);
-
- final Optional<Mapping> singleMapping = mapping(eid, mappingName);
- final List<Mapping> list = Common.getMappingList(mappingContext, mappingsIid);
- list.add(singleMapping.get());
-
- doReturn(Optional.of(new MappingsBuilder().setMapping(list).build())).when(mappingContext).read(mappingsIid);
- doReturn(singleMapping).when(mappingContext).read(mappingIid);
- }
-
- default void noEidMappingDefined(@Nonnull final MappingContext mappingContext, @Nonnull final String name,
- @Nonnull final String namingContextName) {
- final InstanceIdentifier<Mappings> iid =
- mappingIid(new MappingId(name), namingContextName).firstIdentifierOf(Mappings.class);
- final List<Mapping> list = Common.getMappingList(mappingContext, iid);
-
- doReturn(Optional.of(new MappingsBuilder().setMapping(list).build())).when(mappingContext).read(iid);
- doReturn(Optional.absent()).when(mappingContext).read(mappingIid(new MappingId(name), namingContextName));
- }
-
- final class Common {
- private static List<Mapping> getMappingList(@Nonnull final MappingContext mappingContext,
- @Nonnull final InstanceIdentifier<Mappings> mappingsIid) {
- final Optional<Mappings> previousMappings = mappingContext.read(mappingsIid);
- final MappingsBuilder mappingsBuilder;
- if (previousMappings != null && previousMappings.isPresent()) {
- mappingsBuilder = new MappingsBuilder(previousMappings.get());
- } else {
- mappingsBuilder = new MappingsBuilder();
- mappingsBuilder.setMapping(Lists.newArrayList());
- }
- return mappingsBuilder.getMapping();
- }
- }
-}
diff --git a/lisp/lisp2vpp/src/test/resources/adjacencies-identification-context.json b/lisp/lisp2vpp/src/test/resources/adjacencies-identification-context.json
deleted file mode 100644
index 795b548a4..000000000
--- a/lisp/lisp2vpp/src/test/resources/adjacencies-identification-context.json
+++ /dev/null
@@ -1,29 +0,0 @@
-
-{
-
- "mappings": {
- "mapping": [
- {
- "id": "first",
- "eid-identificator-pair": {
- "local-eid-id": "local-eid-1",
- "remote-eid-id": "remote-eid-1"
- }
- },
- {
- "id": "second",
- "eid-identificator-pair": {
- "local-eid-id": "local-eid-2",
- "remote-eid-id": "remote-eid-2"
- }
- },
- {
- "id": "third",
- "eid-identificator-pair": {
- "local-eid-id": "local-eid-3",
- "remote-eid-id": "remote-eid-3"
- }
- }
- ]
- }
-} \ No newline at end of file