summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/lisp2vpp/src/test')
-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
36 files changed, 0 insertions, 4397 deletions
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