summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/test/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/lisp2vpp/src/test/java/io')
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImplTest.java152
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeFeatureCustomizerTest.java10
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizerTest.java108
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizerTest.java14
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizerTest.java10
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeFeatureCustomizerTest.java4
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeForwardEntryCustomizerTest.java189
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizerTest.java12
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java8
9 files changed, 117 insertions, 390 deletions
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImplTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImplTest.java
deleted file mode 100644
index ed1d2d7d6..000000000
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImplTest.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2017 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.hc2vpp.lisp.gpe.translate.ctx;
-
-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.verifyNoMoreInteractions;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.MappingContext;
-import java.util.Collections;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.GpeLocatorPairIdentificationCtxAugmentation;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.GpeLocatorPairIdentificationContexts;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.GpeLocatorPairIdentification;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.GpeLocatorPairIdentificationKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.Mappings;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.mappings.Mapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.mappings.MappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.mappings.MappingKey;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.mappings.mapping.LocatorPairMapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.mappings.mapping.LocatorPairMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.mappings.mapping.locator.pair.mapping.Pair;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.mappings.mapping.locator.pair.mapping.PairBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.Contexts;
-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.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-public class GpeLocatorPairMappingContextImplTest {
-
- private static final String INSTANCE = "instance";
-
- @Mock
- private MappingContext mappingContext;
-
- private GpeLocatorPairMappingContextImpl mapping;
- private IpAddress localAddress;
- private IpAddress remoteAddress;
- private String entryId;
- private String locatorId;
-
- @Before
- public void setUp() throws Exception {
- initMocks(this);
- mapping = new GpeLocatorPairMappingContextImpl(INSTANCE);
- localAddress = new IpAddress(new Ipv4Address("192.168.2.1"));
- remoteAddress = new IpAddress(new Ipv4Address("192.168.2.1"));
- entryId = "entry";
- locatorId = "locator";
- }
-
- @Test
- public void addMapping() throws Exception {
- mapping.addMapping(entryId, locatorId, gpeLocatorPair(localAddress, remoteAddress), mappingContext);
- verify(mappingContext, times(1)).merge(mappingId(entryId),
- mapingData(entryId, locatorId, localAddress, remoteAddress));
- verifyNoMoreInteractions(mappingContext);
- }
-
- @Test
- public void removeMappingPresent() throws Exception {
- KeyedInstanceIdentifier<Mapping, MappingKey> instanceIdentifier = mappingId(entryId);
- when(mappingContext.read(instanceIdentifier)).thenReturn(Optional.of(new MappingBuilder().build()));
- mapping.removeMapping(entryId, mappingContext);
- verify(mappingContext, times(1)).read(instanceIdentifier);
- verify(mappingContext, times(1)).delete(instanceIdentifier);
- verifyNoMoreInteractions(mappingContext);
- }
-
- @Test
- public void removeMappingNotPresent() throws Exception {
- when(mappingContext.read(mappingId(entryId))).thenReturn(Optional.absent());
- mapping.removeMapping(entryId, mappingContext);
- verify(mappingContext, times(1)).read(mappingId(entryId));
- verifyNoMoreInteractions(mappingContext);
- }
-
-
- @Test
- public void getMappingTextLocatorId() throws Exception {
- when(mappingContext.read(mappingId(entryId)))
- .thenReturn(Optional.of(mapingData(entryId, locatorId, localAddress, remoteAddress)));
- final LocatorPairMapping mapping = this.mapping.getMapping(entryId, locatorId, mappingContext);
- assertNotNull(mapping);
- assertEquals(locatorId, mapping.getId());
- final Pair pair = mapping.getPair();
- assertEquals(localAddress, pair.getLocalAddress());
- assertEquals(remoteAddress, pair.getRemoteAddress());
- }
-
- @Test
- public void getMappingObjectLocatorId() throws Exception {
- when(mappingContext.read(mappingId(entryId)))
- .thenReturn(Optional.of(mapingData(entryId, locatorId, localAddress, remoteAddress)));
- final LocatorPairMapping mapping =
- this.mapping.getMapping(entryId, gpeLocatorPair(localAddress, remoteAddress), mappingContext);
- assertNotNull(mapping);
- assertEquals(locatorId, mapping.getId());
- final Pair pair = mapping.getPair();
- assertEquals(localAddress, pair.getLocalAddress());
- assertEquals(remoteAddress, pair.getRemoteAddress());
- }
-
- private static GpeLocatorPair gpeLocatorPair(final IpAddress localAddress, final IpAddress remoteAddress) {
- return new GpeLocatorPair.GpeLocatorPairBuilder().setLocalAddress(localAddress).setRemoteAddress(remoteAddress)
- .createGpeLocatorPairIdentifier();
- }
-
- private static KeyedInstanceIdentifier<Mapping, MappingKey> mappingId(String entryId) {
- return InstanceIdentifier.create(Contexts.class)
- .augmentation(GpeLocatorPairIdentificationCtxAugmentation.class)
- .child(GpeLocatorPairIdentificationContexts.class)
- .child(GpeLocatorPairIdentification.class, new GpeLocatorPairIdentificationKey(INSTANCE))
- .child(Mappings.class)
- .child(Mapping.class, new MappingKey(entryId));
- }
-
- private static Mapping mapingData(String entryId, String locatorId, IpAddress localAddress,
- IpAddress remoteAddress) {
- return new MappingBuilder()
- .setId(entryId)
- .setLocatorPairMapping(Collections.singletonList(new LocatorPairMappingBuilder()
- .setId(locatorId)
- .setPair(new PairBuilder()
- .setLocalAddress(localAddress)
- .setRemoteAddress(remoteAddress)
- .build())
- .build())).build();
- }
-} \ No newline at end of file
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeFeatureCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeFeatureCustomizerTest.java
index 965906abd..cb8dcfca7 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeFeatureCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeFeatureCustomizerTest.java
@@ -25,11 +25,11 @@ import io.fd.hc2vpp.common.test.read.InitializingReaderCustomizerTest;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.vpp.jvpp.core.dto.ShowLispStatusReply;
import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.Gpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.GpeState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.GpeStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.feature.data.grouping.GpeFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.feature.data.grouping.GpeFeatureDataBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.Gpe;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.GpeState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.GpeStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.feature.data.grouping.GpeFeatureData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.feature.data.grouping.GpeFeatureDataBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class GpeFeatureCustomizerTest extends InitializingReaderCustomizerTest<GpeFeatureData, GpeFeatureDataBuilder> {
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizerTest.java
index 475fe2d3e..d97cff7ed 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizerTest.java
@@ -26,10 +26,7 @@ import static org.mockito.Mockito.when;
import io.fd.hc2vpp.common.test.read.InitializingListReaderCustomizerTest;
import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.lisp.gpe.translate.ctx.GpeLocatorPair;
-import io.fd.hc2vpp.lisp.gpe.translate.ctx.GpeLocatorPairMappingContext;
import io.fd.hc2vpp.lisp.gpe.translate.service.GpeStateCheckService;
-import io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType;
import io.fd.hc2vpp.lisp.translate.util.EidTranslator;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.vpp.jvpp.core.dto.GpeFwdEntriesGet;
@@ -45,13 +42,6 @@ import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.entry.identification.context.rev170517.gpe.entry.identification.context.attributes.gpe.entry.identification.contexts.gpe.entry.identification.mappings.mapping.GpeEntryIdentificator;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.entry.identification.context.rev170517.gpe.entry.identification.context.attributes.gpe.entry.identification.contexts.gpe.entry.identification.mappings.mapping.GpeEntryIdentificatorBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.entry.identification.context.rev170517.gpe.entry.identification.context.attributes.gpe.entry.identification.contexts.gpe.entry.identification.mappings.mapping.gpe.entry.identificator.LocalEidBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.entry.identification.context.rev170517.gpe.entry.identification.context.attributes.gpe.entry.identification.contexts.gpe.entry.identification.mappings.mapping.gpe.entry.identificator.RemoteEidBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.mappings.mapping.LocatorPairMapping;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.mappings.mapping.LocatorPairMappingBuilder;
-import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.gpe.locator.pair.identification.context.rev170517.gpe.locator.pair.identification.context.attributes.gpe.locator.pair.identification.contexts.gpe.locator.pair.identification.mappings.mapping.locator.pair.mapping.PairBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
@@ -63,18 +53,16 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.addres
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6PrefixBuilder;
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.gpe.rev170518.Gpe;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.GpeState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.GpeEntryTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.GpeEntryTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.GpeEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.GpeEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.GpeEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocatorPairs;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.feature.data.grouping.GpeFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.locator.pair.LocatorPair;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.Gpe;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.GpeState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.GpeEntryTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.GpeEntryTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.GpeEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.GpeEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.GpeEntryKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.feature.data.grouping.GpeFeatureData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.locator.pairs.grouping.LocatorPair;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.MapReplyAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.local.mapping.Eid;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
@@ -84,7 +72,6 @@ public class GpeForwardEntryCustomizerTest
private static final String V4_ENTRY_ID = "v4-entry";
private static final String V4_ENTRY_NO_LEID_ID = "v4-entry-no-leid-id";
- private static final String V4_ENTRY_LOCATOR = "v4-entry-locator";
private static final int V4_ENTRY_DP_TABLE = 10;
private static final int V4_ENTRY_FWD_INDEX = 4;
private static final int V4_ENTRY_VNI = 45;
@@ -105,7 +92,6 @@ public class GpeForwardEntryCustomizerTest
private static final String V6_ENTRY_ID = "v6-entry";
- private static final String V6_ENTRY_LOCATOR = "v6-entry-locator";
private static final int V6_ENTRY_DP_TABLE = 11;
private static final int V6_ENTRY_VNI = 22;
private static final int V6_ENTRY_FWD_INDEX = 5;
@@ -124,7 +110,6 @@ public class GpeForwardEntryCustomizerTest
private static final String MAC_ENTRY_ID = "mac-entry";
private static final int MAC_ENTRY_FWD_INDEX = 7;
private static final int MAC_ENTRY_VNI = 18;
- private static final String MAC_ENTRY_LOCATOR = "mac-entry-locator";
private static final int MAC_ENTRY_DP_TABLE = 12;
private static final KeyedInstanceIdentifier<GpeEntry, GpeEntryKey> MAC_IDENTIFIER =
InstanceIdentifier.create(GpeEntryTable.class)
@@ -146,9 +131,6 @@ public class GpeForwardEntryCustomizerTest
private NamingContext gpeEntryMappingContext;
@Mock
- private GpeLocatorPairMappingContext gpeLocatorPairMappingContext;
-
- @Mock
private GpeStateCheckService gpeStateCheckService;
public GpeForwardEntryCustomizerTest() {
@@ -157,8 +139,7 @@ public class GpeForwardEntryCustomizerTest
@Override
protected GpeForwardEntryCustomizer initCustomizer() {
- return new GpeForwardEntryCustomizer(api, gpeStateCheckService, gpeEntryMappingContext,
- gpeLocatorPairMappingContext);
+ return new GpeForwardEntryCustomizer(api, gpeStateCheckService, gpeEntryMappingContext);
}
@Override
@@ -173,7 +154,6 @@ public class GpeForwardEntryCustomizerTest
.thenReturn(future(getGpeEntryDumpReply(getMacGpeEntry())));
when(api.gpeFwdEntryVnisGet(any())).thenReturn(future(activeVnisDump()));
defineMappingsForGpeEntries();
- mockMappingsForLocators();
}
@Test
@@ -204,12 +184,10 @@ public class GpeForwardEntryCustomizerTest
assertEquals(Ipv4PrefixAfi.class, builder.getRemoteEid().getAddressType());
assertEquals(V4_ENTRY_VNI, builder.getRemoteEid().getVirtualNetworkId().getValue().intValue());
assertTrue(V4_ENTRY_VNI == builder.getVni());
- assertEquals(1, builder.getLocatorPairs().size());
+ assertEquals(1, builder.getLocatorPair().size());
- final LocatorPairs locatorPair = builder.getLocatorPairs().get(0);
- assertEquals(V4_ENTRY_LOCATOR, locatorPair.getId());
+ final LocatorPair pair = builder.getLocatorPair().get(0);
- final LocatorPair pair = locatorPair.getLocatorPair();
assertEquals(V4_LOCATOR_LOCAL_ADDRESS, pair.getLocalLocator().getIpv4Address());
assertEquals(V4_LOCATOR_REMOTE_ADDRESS, pair.getRemoteLocator().getIpv4Address());
assertEquals(V4_LOCATOR_LOCAL_WEIGHT, pair.getWeight().byteValue());
@@ -232,12 +210,10 @@ public class GpeForwardEntryCustomizerTest
assertEquals(Ipv4PrefixAfi.class, builder.getRemoteEid().getAddressType());
assertEquals(V4_ENTRY_VNI, builder.getRemoteEid().getVirtualNetworkId().getValue().intValue());
assertTrue(V4_ENTRY_VNI == builder.getVni());
- assertEquals(1, builder.getLocatorPairs().size());
+ assertEquals(1, builder.getLocatorPair().size());
- final LocatorPairs locatorPair = builder.getLocatorPairs().get(0);
- assertEquals(V4_ENTRY_LOCATOR, locatorPair.getId());
+ final LocatorPair pair = builder.getLocatorPair().get(0);
- final LocatorPair pair = locatorPair.getLocatorPair();
assertEquals(V4_LOCATOR_LOCAL_ADDRESS, pair.getLocalLocator().getIpv4Address());
assertEquals(V4_LOCATOR_REMOTE_ADDRESS, pair.getRemoteLocator().getIpv4Address());
assertEquals(V4_LOCATOR_LOCAL_WEIGHT, pair.getWeight().byteValue());
@@ -263,12 +239,10 @@ public class GpeForwardEntryCustomizerTest
assertEquals(V6_ENTRY_VNI, builder.getRemoteEid().getVirtualNetworkId().getValue().intValue());
assertTrue(V6_ENTRY_VNI == builder.getVni());
- assertEquals(1, builder.getLocatorPairs().size());
+ assertEquals(1, builder.getLocatorPair().size());
- final LocatorPairs locatorPair = builder.getLocatorPairs().get(0);
- assertEquals(V6_ENTRY_LOCATOR, locatorPair.getId());
+ final LocatorPair pair = builder.getLocatorPair().get(0);
- final LocatorPair pair = locatorPair.getLocatorPair();
assertEquals(V6_LOCATOR_LOCAL_ADDRESS, pair.getLocalLocator().getIpv6Address());
assertEquals(V6_LOCATOR_REMOTE_ADDRESS, pair.getRemoteLocator().getIpv6Address());
assertEquals(V6_LOCATOR_LOCAL_WEIGHT, pair.getWeight().byteValue());
@@ -294,12 +268,10 @@ public class GpeForwardEntryCustomizerTest
assertEquals(MAC_ENTRY_VNI, builder.getRemoteEid().getVirtualNetworkId().getValue().intValue());
assertTrue(MAC_ENTRY_VNI == builder.getVni());
- assertEquals(1, builder.getLocatorPairs().size());
+ assertEquals(1, builder.getLocatorPair().size());
- final LocatorPairs locatorPair = builder.getLocatorPairs().get(0);
- assertEquals(MAC_ENTRY_LOCATOR, locatorPair.getId());
+ final LocatorPair pair = builder.getLocatorPair().get(0);
- final LocatorPair pair = locatorPair.getLocatorPair();
assertEquals(MAC_LOCATOR_LOCAL_ADDRESS, pair.getLocalLocator().getIpv4Address());
assertEquals(MAC_LOCATOR_REMOTE_ADDRESS, pair.getRemoteLocator().getIpv4Address());
assertEquals(MAC_LOCATOR_LOCAL_WEIGHT, pair.getWeight().byteValue());
@@ -366,50 +338,6 @@ public class GpeForwardEntryCustomizerTest
defineMapping(mappingContext, MAC_ENTRY_ID, MAC_ENTRY_FWD_INDEX, GPE_ENTRY_CTX);
}
- private void mockMappingsForLocators() {
- mockV4LocatorMapping();
- mockV6LocatorMapping();
- mockMacLocatorMapping();
- }
-
- private void mockV4LocatorMapping() {
- final GpeFwdEntryPathDetailsReplyDump forV4EntryReply = locatorDumpForV4EntryReply();
- final GpeFwdEntryPathDetails v4LocatorOne = forV4EntryReply.gpeFwdEntryPathDetails.get(0);
- final GpeLocatorPair v4LocatorPairOne = GpeLocatorPair.fromDumpDetail(v4LocatorOne);
- when(gpeLocatorPairMappingContext.getMapping(V4_ENTRY_ID, v4LocatorPairOne, mappingContext))
- .thenReturn(fromDump(V4_ENTRY_LOCATOR, v4LocatorOne));
- when(gpeLocatorPairMappingContext.getMapping(V4_ENTRY_NO_LEID_ID, v4LocatorPairOne, mappingContext))
- .thenReturn(fromDump(V4_ENTRY_LOCATOR, v4LocatorOne));
- }
-
- private void mockV6LocatorMapping() {
- final GpeFwdEntryPathDetailsReplyDump forV6EntryReply = locatorDumpForV6EntryReply();
- final GpeFwdEntryPathDetails v6LocatorOne = forV6EntryReply.gpeFwdEntryPathDetails.get(0);
- final GpeLocatorPair v6LocatorPairOne = GpeLocatorPair.fromDumpDetail(v6LocatorOne);
- when(gpeLocatorPairMappingContext.getMapping(V6_ENTRY_ID, v6LocatorPairOne, mappingContext))
- .thenReturn(fromDump(V6_ENTRY_LOCATOR, v6LocatorOne));
- }
-
- private void mockMacLocatorMapping() {
- final GpeFwdEntryPathDetails macLocator = locatorDumpForMacEntryReply().gpeFwdEntryPathDetails.get(0);
- final GpeLocatorPair macLocatorPair = GpeLocatorPair.fromDumpDetail(macLocator);
- when(gpeLocatorPairMappingContext.getMapping(MAC_ENTRY_ID, macLocatorPair, mappingContext))
- .thenReturn(fromDump(MAC_ENTRY_LOCATOR, macLocator));
- }
-
- private LocatorPairMapping fromDump(final String id, final GpeFwdEntryPathDetails dump) {
-
- final boolean localV4 = byteToBoolean(dump.lclLoc.isIp4);
- final boolean remoteV4 = byteToBoolean(dump.rmtLoc.isIp4);
- return new LocatorPairMappingBuilder()
- .setId(id)
- .setPair(new PairBuilder()
- .setLocalAddress(arrayToIpAddress(!localV4, dump.lclLoc.addr))
- .setRemoteAddress(arrayToIpAddress(!remoteV4, dump.rmtLoc.addr))
- .build())
- .build();
- }
-
private GpeFwdEntriesGetReply getGpeEntryDumpReply(final GpeFwdEntry entry) {
GpeFwdEntriesGetReply reply = new GpeFwdEntriesGetReply();
reply.entries = new GpeFwdEntry[]{entry};
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizerTest.java
index 6dfe3883f..f96942be1 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizerTest.java
@@ -33,13 +33,13 @@ import java.util.List;
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.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.NativeForwardPathsTablesState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.state.NativeForwardPathsTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.state.NativeForwardPathsTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.state.NativeForwardPathsTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.state._native.forward.paths.table.NativeForwardPath;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.state._native.forward.paths.table.NativeForwardPathBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.state._native.forward.paths.table.NativeForwardPathKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.NativeForwardPathsTablesState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.state.NativeForwardPathsTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.state.NativeForwardPathsTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.state.NativeForwardPathsTableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.state._native.forward.paths.table.NativeForwardPath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.state._native.forward.paths.table.NativeForwardPathBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.state._native.forward.paths.table.NativeForwardPathKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizerTest.java
index 33ebee7f1..58e417661 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizerTest.java
@@ -32,11 +32,11 @@ import io.fd.vpp.jvpp.core.dto.IpFibDetailsReplyDump;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.NativeForwardPathsTablesState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.NativeForwardPathsTablesStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.state.NativeForwardPathsTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.state.NativeForwardPathsTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.state.NativeForwardPathsTableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.NativeForwardPathsTablesState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.NativeForwardPathsTablesStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.state.NativeForwardPathsTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.state.NativeForwardPathsTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.state.NativeForwardPathsTableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class NativeForwardPathsTableCustomizerTest extends
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeFeatureCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeFeatureCustomizerTest.java
index c7f0ae816..127ed8b52 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeFeatureCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeFeatureCustomizerTest.java
@@ -29,8 +29,8 @@ import io.fd.vpp.jvpp.core.dto.GpeEnableDisableReply;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.feature.data.grouping.GpeFeatureData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.feature.data.grouping.GpeFeatureDataBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.feature.data.grouping.GpeFeatureData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.feature.data.grouping.GpeFeatureDataBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class GpeFeatureCustomizerTest extends WriterCustomizerTest {
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeForwardEntryCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeForwardEntryCustomizerTest.java
index c54206270..fe5c09b6b 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeForwardEntryCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeForwardEntryCustomizerTest.java
@@ -29,8 +29,6 @@ import com.google.common.collect.ImmutableSet;
import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.lisp.gpe.translate.ctx.GpeLocatorPair;
-import io.fd.hc2vpp.lisp.gpe.translate.ctx.GpeLocatorPairMappingContext;
import io.fd.hc2vpp.lisp.gpe.translate.service.GpeStateCheckService;
import io.fd.honeycomb.test.tools.HoneycombTestRunner;
import io.fd.honeycomb.test.tools.annotations.InjectTestData;
@@ -39,15 +37,15 @@ import io.fd.honeycomb.test.tools.annotations.SchemaContextProvider;
import io.fd.vpp.jvpp.core.dto.GpeAddDelFwdEntry;
import io.fd.vpp.jvpp.core.dto.GpeAddDelFwdEntryReply;
import io.fd.vpp.jvpp.core.types.GpeLocator;
+import java.util.Arrays;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.GpeEntryTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.GpeEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.GpeEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocatorPairs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.GpeEntryTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.GpeEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.GpeEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.$YangModuleInfoImpl;
import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -66,10 +64,20 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
private static final byte[] PAIR_1_LOCAL_ADDRESS = {-64, -88, 4, 1};
private static final byte[] PAIR_2_REMOTE_ADDRESS = {-64, -88, 5, 2};
private static final byte[] PAIR_1_REMOTE_ADDRESS = {-64, -88, 4, 2};
+
+ private static final GpeLocator[] ABAB_LOCATORS = {
+ gpeLocator(PAIR_1_LOCAL_ADDRESS, 1, 3),
+ gpeLocator(PAIR_2_LOCAL_ADDRESS, 1, 2),
+ gpeLocator(PAIR_1_REMOTE_ADDRESS, 1, 0),
+ gpeLocator(PAIR_2_REMOTE_ADDRESS, 1, 0)};
+
+ private static final GpeLocator[] BABA_LOCATORS = {
+ ABAB_LOCATORS[1], ABAB_LOCATORS[0], ABAB_LOCATORS[3], ABAB_LOCATORS[2]};
+
private static final int LOCAL_EID_PREFIX = 24;
private static final int REMOTE_EID_PREFIX = 16;
- public static final String GPE_ENTRY_CTX = "gpe-entry-ctx";
- public static final int GPE_FWD_ENTRY_INDEX = 4;
+ private static final String GPE_ENTRY_CTX = "gpe-entry-ctx";
+ private static final int GPE_FWD_ENTRY_INDEX = 4;
private NamingContext gpeEntryMappingContext;
@@ -77,9 +85,6 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
private ArgumentCaptor<GpeAddDelFwdEntry> requestCaptor;
@Mock
- private GpeLocatorPairMappingContext gpeLocatorPairMappingContext;
-
- @Mock
private GpeStateCheckService gpeStateCheckService;
private InstanceIdentifier<GpeEntry> id;
@@ -90,8 +95,7 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
gpeEntryMappingContext = new NamingContext("gpe-entry-", GPE_ENTRY_CTX);
id = InstanceIdentifier.create(GpeEntryTable.class)
.child(GpeEntry.class, new GpeEntryKey(GPE_ENTRY_ID));
- customizer = new GpeForwardEntryCustomizer(api, gpeStateCheckService, gpeEntryMappingContext,
- gpeLocatorPairMappingContext);
+ customizer = new GpeForwardEntryCustomizer(api, gpeStateCheckService, gpeEntryMappingContext);
}
@SchemaContextProvider
@@ -99,7 +103,7 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
return provideSchemaContextFor(ImmutableSet.of($YangModuleInfoImpl.getInstance(),
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.$YangModuleInfoImpl
.getInstance(),
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.$YangModuleInfoImpl
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.$YangModuleInfoImpl
.getInstance()));
}
@@ -110,18 +114,9 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
final GpeEntry entry = entryTable.getGpeEntry().get(0);
customizer.writeCurrentAttributes(id, entry, writeContext);
verify(api, times(1)).gpeAddDelFwdEntry(requestCaptor.capture());
- assertEquals(expectedFullRequest(true), requestCaptor.getValue());
+ assertFullRequest(true, requestCaptor.getValue());
verify(mappingContext, times(1))
.put(mappingIid(entry.getId(), GPE_ENTRY_CTX), mapping(entry.getId(), GPE_FWD_ENTRY_INDEX).get());
-
- final LocatorPairs locatorPairFirst = entry.getLocatorPairs().get(0);
- final LocatorPairs locatorPairSecond = entry.getLocatorPairs().get(1);
- verify(gpeLocatorPairMappingContext, times(1))
- .addMapping(entry.getId(), locatorPairFirst.getId(),
- GpeLocatorPair.fromLocatorPair(locatorPairFirst), mappingContext);
- verify(gpeLocatorPairMappingContext, times(1))
- .addMapping(entry.getId(), locatorPairSecond.getId(),
- GpeLocatorPair.fromLocatorPair(locatorPairSecond), mappingContext);
}
private static GpeAddDelFwdEntryReply entryReply() {
@@ -138,10 +133,9 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
final GpeEntry entry = entryTable.getGpeEntry().get(0);
customizer.writeCurrentAttributes(id, entry, writeContext);
verify(api, times(1)).gpeAddDelFwdEntry(requestCaptor.capture());
- assertEquals(expectedLocatorLessRequest(true), requestCaptor.getValue());
+ assertLocatorLessRequest(true, requestCaptor.getValue());
verify(mappingContext, times(1))
.put(mappingIid(entry.getId(), GPE_ENTRY_CTX), mapping(entry.getId(), GPE_FWD_ENTRY_INDEX).get());
- verifyZeroInteractions(gpeLocatorPairMappingContext);
}
@Test
@@ -152,15 +146,14 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
final GpeEntry entry = entryTable.getGpeEntry().get(0);
customizer.writeCurrentAttributes(id, entry, writeContext);
verify(api, times(1)).gpeAddDelFwdEntry(requestCaptor.capture());
- assertEquals(expectedActionLessRequest(true), requestCaptor.getValue());
+ assertActionLessRequest(true, requestCaptor.getValue());
verify(mappingContext, times(1))
.put(mappingIid(entry.getId(), GPE_ENTRY_CTX), mapping(entry.getId(), GPE_FWD_ENTRY_INDEX).get());
- verifyZeroInteractions(gpeLocatorPairMappingContext);
}
/**
* Gpe entry allows no local eid
- * */
+ */
@Test
public void testWriteCurrentAttributesNoLocalEid(
@InjectTestData(resourcePath = "/gpe/invalid/invalid-gpe-fwd-entry-no-local-eid.json",
@@ -169,18 +162,9 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
final GpeEntry entry = entryTable.getGpeEntry().get(0);
customizer.writeCurrentAttributes(id, entry, writeContext);
verify(api, times(1)).gpeAddDelFwdEntry(requestCaptor.capture());
- assertEquals(expectedActionLessNoLeidRequest(true), requestCaptor.getValue());
+ assertActionLessNoLeidRequest(true, requestCaptor.getValue());
verify(mappingContext, times(1))
.put(mappingIid(entry.getId(), GPE_ENTRY_CTX), mapping(entry.getId(), GPE_FWD_ENTRY_INDEX).get());
-
- final LocatorPairs locatorPairFirst = entry.getLocatorPairs().get(0);
- final LocatorPairs locatorPairSecond = entry.getLocatorPairs().get(1);
- verify(gpeLocatorPairMappingContext, times(1))
- .addMapping(entry.getId(), locatorPairFirst.getId(),
- GpeLocatorPair.fromLocatorPair(locatorPairFirst), mappingContext);
- verify(gpeLocatorPairMappingContext, times(1))
- .addMapping(entry.getId(), locatorPairSecond.getId(),
- GpeLocatorPair.fromLocatorPair(locatorPairSecond), mappingContext);
}
@Test
@@ -203,10 +187,8 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
final GpeEntry entry = entryTable.getGpeEntry().get(0);
customizer.deleteCurrentAttributes(id, entry, writeContext);
verify(api, times(1)).gpeAddDelFwdEntry(requestCaptor.capture());
- assertEquals(expectedFullRequest(false), requestCaptor.getValue());
+ assertFullRequest(false, requestCaptor.getValue());
verify(mappingContext, times(1)).delete(mappingIid(entry.getId(), GPE_ENTRY_CTX));
- verify(gpeLocatorPairMappingContext, times(1))
- .removeMapping(entry.getId(), mappingContext);
}
@Test
@@ -217,10 +199,8 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
final GpeEntry entry = entryTable.getGpeEntry().get(0);
customizer.deleteCurrentAttributes(id, entry, writeContext);
verify(api, times(1)).gpeAddDelFwdEntry(requestCaptor.capture());
- assertEquals(expectedLocatorLessRequest(false), requestCaptor.getValue());
+ assertLocatorLessRequest(false, requestCaptor.getValue());
verify(mappingContext, times(1)).delete(mappingIid(entry.getId(), GPE_ENTRY_CTX));
- verify(gpeLocatorPairMappingContext, times(1))
- .removeMapping(entry.getId(), mappingContext);
}
@Test
@@ -231,10 +211,8 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
final GpeEntry entry = entryTable.getGpeEntry().get(0);
customizer.deleteCurrentAttributes(id, entry, writeContext);
verify(api, times(1)).gpeAddDelFwdEntry(requestCaptor.capture());
- assertEquals(expectedActionLessRequest(false), requestCaptor.getValue());
+ assertActionLessRequest(false, requestCaptor.getValue());
verify(mappingContext, times(1)).delete(mappingIid(entry.getId(), GPE_ENTRY_CTX));
- verify(gpeLocatorPairMappingContext, times(1))
- .removeMapping(entry.getId(), mappingContext);
}
@Test
@@ -245,10 +223,8 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
final GpeEntry entry = entryTable.getGpeEntry().get(0);
customizer.deleteCurrentAttributes(id, entry, writeContext);
verify(api, times(1)).gpeAddDelFwdEntry(requestCaptor.capture());
- assertEquals(expectedActionLessNoLeidRequest(false), requestCaptor.getValue());
+ assertActionLessNoLeidRequest(false, requestCaptor.getValue());
verify(mappingContext, times(1)).delete(mappingIid(entry.getId(), GPE_ENTRY_CTX));
- verify(gpeLocatorPairMappingContext, times(1))
- .removeMapping(entry.getId(), mappingContext);
}
@Test
@@ -264,83 +240,58 @@ public class GpeForwardEntryCustomizerTest extends WriterCustomizerTest
fail("Test should have failed");
}
- private GpeAddDelFwdEntry expectedActionLessNoLeidRequest(final boolean add) {
- final GpeAddDelFwdEntry request = new GpeAddDelFwdEntry();
-
- request.isAdd = booleanToByte(add);
- request.dpTable = 10;
- request.vni = 12;
- request.eidType = 0;
- request.action = 0;
- request.rmtEid = REMOTE_EID_ADDRESS;
- request.rmtLen = REMOTE_EID_PREFIX;
- request.locNum = 4;
- request.locs = new GpeLocator[]{
- gpeLocator(PAIR_1_LOCAL_ADDRESS, 1, 3),
- gpeLocator(PAIR_2_LOCAL_ADDRESS, 1, 2),
- gpeLocator(PAIR_1_REMOTE_ADDRESS, 1, 0),
- gpeLocator(PAIR_2_REMOTE_ADDRESS, 1, 0)
- };
- return request;
+ private void assertActionLessNoLeidRequest(final boolean add, final GpeAddDelFwdEntry actual) {
+
+ assertEquals(booleanToByte(add), actual.isAdd);
+ assertEquals(10, actual.dpTable);
+ assertEquals(12, actual.vni);
+ assertEquals(0, actual.eidType);
+ assertEquals(4, actual.locNum);
+ assertTrue(Arrays.equals(REMOTE_EID_ADDRESS, actual.rmtEid));
+ assertEquals(REMOTE_EID_PREFIX, actual.rmtLen);
+ assertTrue(Arrays.equals(ABAB_LOCATORS, actual.locs) || Arrays.equals(BABA_LOCATORS, actual.locs));
}
- private GpeAddDelFwdEntry expectedActionLessRequest(final boolean add) {
- final GpeAddDelFwdEntry request = new GpeAddDelFwdEntry();
-
- request.isAdd = booleanToByte(add);
- request.dpTable = 10;
- request.vni = 12;
- request.eidType = 0;
- request.action = 0;
- request.lclEid = LOCAL_EID_ADDRESS;
- request.lclLen = LOCAL_EID_PREFIX;
- request.rmtEid = REMOTE_EID_ADDRESS;
- request.rmtLen = REMOTE_EID_PREFIX;
- request.locNum = 0;
- return request;
+ private void assertActionLessRequest(final boolean add, final GpeAddDelFwdEntry actual) {
+
+ assertEquals(booleanToByte(add), actual.isAdd);
+ assertEquals(10, actual.dpTable);
+ assertEquals(12, actual.vni);
+ assertEquals(0, actual.eidType);
+ assertEquals(0, actual.action);
+ assertEquals(0, actual.locNum);
}
- private GpeAddDelFwdEntry expectedLocatorLessRequest(final boolean add) {
- final GpeAddDelFwdEntry request = new GpeAddDelFwdEntry();
-
- request.isAdd = booleanToByte(add);
- request.dpTable = 10;
- request.vni = 12;
- request.eidType = 0;
- request.action = 1;
- request.lclEid = LOCAL_EID_ADDRESS;
- request.lclLen = LOCAL_EID_PREFIX;
- request.rmtEid = REMOTE_EID_ADDRESS;
- request.rmtLen = REMOTE_EID_PREFIX;
- request.locNum = 0;
- return request;
+ private void assertLocatorLessRequest(final boolean add, final GpeAddDelFwdEntry actual) {
+
+ assertEquals(booleanToByte(add), actual.isAdd);
+ assertEquals(10, actual.dpTable);
+ assertEquals(12, actual.vni);
+ assertEquals(0, actual.eidType);
+ assertEquals(1, actual.action);
+ assertEquals(0, actual.locNum);
+ assertTrue(Arrays.equals(LOCAL_EID_ADDRESS, actual.lclEid));
+ assertEquals(LOCAL_EID_PREFIX, actual.lclLen);
+ assertTrue(Arrays.equals(REMOTE_EID_ADDRESS, actual.rmtEid));
+ assertEquals(REMOTE_EID_PREFIX, actual.rmtLen);
}
- private GpeAddDelFwdEntry expectedFullRequest(final boolean add) {
- final GpeAddDelFwdEntry request = new GpeAddDelFwdEntry();
-
- request.isAdd = booleanToByte(add);
- request.dpTable = 10;
- request.vni = 12;
- request.eidType = 0;
- request.action = 1;
- request.lclEid = LOCAL_EID_ADDRESS;
- request.lclLen = LOCAL_EID_PREFIX;
- request.rmtEid = REMOTE_EID_ADDRESS;
- request.rmtLen = REMOTE_EID_PREFIX;
- request.locNum = 4;
- request.locs = new GpeLocator[]{
- gpeLocator(PAIR_1_LOCAL_ADDRESS, 1, 3),
- gpeLocator(PAIR_2_LOCAL_ADDRESS, 1, 2),
- gpeLocator(PAIR_1_REMOTE_ADDRESS, 1, 0),
- gpeLocator(PAIR_2_REMOTE_ADDRESS, 1, 0)
- };
-
- return request;
+ private void assertFullRequest(final boolean add, final GpeAddDelFwdEntry actual) {
+
+ assertEquals(booleanToByte(add), actual.isAdd);
+ assertEquals(10, actual.dpTable);
+ assertEquals(12, actual.vni);
+ assertEquals(0, actual.eidType);
+ assertEquals(4, actual.locNum);
+ assertTrue(Arrays.equals(LOCAL_EID_ADDRESS, actual.lclEid));
+ assertEquals(LOCAL_EID_PREFIX, actual.lclLen);
+ assertTrue(Arrays.equals(REMOTE_EID_ADDRESS, actual.rmtEid));
+ assertEquals(REMOTE_EID_PREFIX, actual.rmtLen);
+ assertTrue(Arrays.equals(ABAB_LOCATORS, actual.locs) || Arrays.equals(BABA_LOCATORS, actual.locs));
}
- private GpeLocator gpeLocator(final byte[] address, final int isIpv4, final int weight) {
+ private static GpeLocator gpeLocator(final byte[] address, final int isIpv4, final int weight) {
GpeLocator locator = new GpeLocator();
locator.isIp4 = (byte) isIpv4;
locator.weight = (byte) weight;
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizerTest.java
index 2ce9789cd..26010ba17 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizerTest.java
@@ -33,12 +33,12 @@ import org.mockito.Captor;
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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.NativeForwardPathsTables;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables._native.forward.paths.table.NativeForwardPath;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.NativeForwardPathsTables;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class NativeForwardPathCustomizerTest extends WriterCustomizerTest {
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java
index 923aaad44..80bb2c600 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java
@@ -31,10 +31,10 @@ import java.util.List;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.NativeForwardPathsTables;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.NativeForwardPathsTables;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class NativeForwardPathsTableCustomizerTest extends WriterCustomizerTest {