diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2017-08-04 08:49:05 +0200 |
---|---|---|
committer | Jan Srnicek <jsrnicek@cisco.com> | 2017-08-07 10:34:01 +0200 |
commit | 941edc8b15e5f3fed701b5585ce7ad421991b16d (patch) | |
tree | 55a73bd261f181cd890da517f25aeed519033af9 /lisp/lisp2vpp/src | |
parent | 1eac992e90839c99337a80db4ff6b880787a3056 (diff) |
HC2VPP-162 - use composite key for locator pair
Removes need for custom mapping for locator pairs and their ids
Change-Id: Idaa6ee5ec74d8bf57a72bea95c0c0d408e6e940e
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp/src')
28 files changed, 250 insertions, 911 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/GpeModule.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/GpeModule.java index efdc99834..0c3d667dd 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/GpeModule.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/GpeModule.java @@ -21,8 +21,6 @@ import com.google.inject.Singleton; import com.google.inject.multibindings.Multibinder; import com.google.inject.name.Names; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.hc2vpp.lisp.gpe.translate.ctx.GpeLocatorPairMappingContext; -import io.fd.hc2vpp.lisp.gpe.translate.ctx.GpeLocatorPairMappingContextImpl; import io.fd.hc2vpp.lisp.gpe.translate.read.GpeReaderFactory; import io.fd.hc2vpp.lisp.gpe.translate.service.GpeStateCheckService; import io.fd.hc2vpp.lisp.gpe.translate.service.GpeStateCheckServiceImpl; @@ -33,16 +31,12 @@ import io.fd.honeycomb.translate.write.WriterFactory; public class GpeModule extends AbstractModule { public static final String GPE_ENTRY_MAPPING_CTX = "gpe-entry-mapping-ctx"; - public static final String GPE_TO_LOCATOR_PAIR_CTX = "gpe-to-locator-pair-ctx"; @Override protected void configure() { bind(NamingContext.class).annotatedWith(Names.named(GPE_ENTRY_MAPPING_CTX)) .toInstance(new NamingContext("gpe-entry-", GPE_ENTRY_MAPPING_CTX)); - bind(GpeLocatorPairMappingContext.class).annotatedWith(Names.named(GPE_TO_LOCATOR_PAIR_CTX)) - .toInstance(new GpeLocatorPairMappingContextImpl(GPE_TO_LOCATOR_PAIR_CTX)); - bind(GpeStateCheckService.class).to(GpeStateCheckServiceImpl.class).in(Singleton.class); Multibinder.newSetBinder(binder(), ReaderFactory.class).addBinding() diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPair.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPair.java deleted file mode 100644 index a5cf13191..000000000 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPair.java +++ /dev/null @@ -1,113 +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 io.fd.hc2vpp.common.translate.util.AddressTranslator; -import io.fd.vpp.jvpp.core.dto.GpeFwdEntryPathDetails; -import java.util.Arrays; -import javax.annotation.Nonnull; -import org.apache.commons.lang3.builder.EqualsBuilder; -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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocatorPairs; - -public final class GpeLocatorPair implements AddressTranslator { - - private final IpAddress localAddress; - private final IpAddress remoteAddress; - - private GpeLocatorPair(@Nonnull final IpAddress localAddress, @Nonnull final IpAddress remoteAddress) { - this.localAddress = localAddress; - this.remoteAddress = remoteAddress; - } - - public IpAddress getLocalAddress() { - return localAddress; - } - - public IpAddress getRemoteAddress() { - return remoteAddress; - } - - public boolean isSame(@Nonnull final Pair pair) { - return new EqualsBuilder() - .append(true, Arrays.equals(this.localAddress.getValue(), pair.getLocalAddress().getValue())) - .append(true, Arrays.equals(this.remoteAddress.getValue(), pair.getRemoteAddress().getValue())) - .isEquals(); - } - - public static GpeLocatorPair fromDumpDetail(final GpeFwdEntryPathDetails entry) { - return new GpeLocatorPair.GpeLocatorPairBuilder() - .setLocalAddress( - INSTANCE.arrayToIpAddress(!INSTANCE.byteToBoolean(entry.lclLoc.isIp4), - entry.lclLoc.addr)) - .setRemoteAddress( - INSTANCE.arrayToIpAddress(!INSTANCE.byteToBoolean(entry.rmtLoc.isIp4), - entry.rmtLoc.addr)) - .createGpeLocatorPairIdentifier(); - } - - public static GpeLocatorPair fromLocatorPair(final LocatorPairs locatorPair) { - return new GpeLocatorPair.GpeLocatorPairBuilder() - .setLocalAddress(locatorPair.getLocatorPair().getLocalLocator()) - .setRemoteAddress(locatorPair.getLocatorPair().getRemoteLocator()) - .createGpeLocatorPairIdentifier(); - } - - public static final class GpeLocatorPairBuilder { - private IpAddress localAddress; - private IpAddress remoteAddress; - - public GpeLocatorPairBuilder setLocalAddress(@Nonnull final IpAddress localAddress) { - this.localAddress = localAddress; - return this; - } - - public GpeLocatorPairBuilder setRemoteAddress(@Nonnull final IpAddress remoteAddress) { - this.remoteAddress = remoteAddress; - return this; - } - - public GpeLocatorPair createGpeLocatorPairIdentifier() { - return new GpeLocatorPair(localAddress, remoteAddress); - } - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - final GpeLocatorPair that = (GpeLocatorPair) o; - - if (!localAddress.equals(that.localAddress)) { - return false; - } - return remoteAddress.equals(that.remoteAddress); - } - - @Override - public int hashCode() { - int result = localAddress.hashCode(); - result = 31 * result + remoteAddress.hashCode(); - return result; - } -} diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContext.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContext.java deleted file mode 100644 index b2226a1b6..000000000 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContext.java +++ /dev/null @@ -1,55 +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 io.fd.honeycomb.translate.MappingContext; -import javax.annotation.Nonnull; -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; - -/** - * Context mapping of gpe entries to locator pairs - */ -public interface GpeLocatorPairMappingContext { - - /** - * Adds mapping for entry and specified locator - */ - void addMapping(@Nonnull String entryId, - @Nonnull String locatorId, - @Nonnull GpeLocatorPair pair, - @Nonnull MappingContext mappingContext); - - /** - * Remote all mappings for entry - */ - void removeMapping(@Nonnull String entryId, - @Nonnull MappingContext mappingContext); - - /** - * Returns mapping for specified entry and locator - */ - LocatorPairMapping getMapping(@Nonnull String entryId, - @Nonnull GpeLocatorPair pair, - @Nonnull MappingContext mappingContext); - - /** - * Returns mapping for specified entry and locator - */ - LocatorPairMapping getMapping(@Nonnull String entryId, - @Nonnull String locatorId, - @Nonnull MappingContext mappingContext); -} diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImpl.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImpl.java deleted file mode 100644 index 766478fd5..000000000 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImpl.java +++ /dev/null @@ -1,145 +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 java.lang.String.format; - -import io.fd.honeycomb.translate.MappingContext; -import io.fd.honeycomb.translate.util.RWUtils; -import java.util.Collections; -import javax.annotation.Nonnull; -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.PairBuilder; -import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.Contexts; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class GpeLocatorPairMappingContextImpl implements GpeLocatorPairMappingContext { - - private static final Logger LOG = LoggerFactory.getLogger(GpeLocatorPairMappingContextImpl.class); - - private final KeyedInstanceIdentifier<GpeLocatorPairIdentification, GpeLocatorPairIdentificationKey> - namingContextIid; - - public GpeLocatorPairMappingContextImpl(@Nonnull final String instanceName) { - namingContextIid = InstanceIdentifier.create(Contexts.class) - .augmentation(GpeLocatorPairIdentificationCtxAugmentation.class) - .child(GpeLocatorPairIdentificationContexts.class) - .child(GpeLocatorPairIdentification.class, new GpeLocatorPairIdentificationKey(instanceName)); - } - - - @Override - public void addMapping(@Nonnull final String entryId, - @Nonnull final String locatorId, - @Nonnull final GpeLocatorPair pair, - @Nonnull final MappingContext mappingContext) { - LOG.debug("Adding mapping for Gpe entry to locator id[entry-id={},locator-pair-id={}]", entryId, locatorId); - mappingContext.merge(getMappingId(entryId), getMappingData(entryId, locatorId, pair)); - LOG.debug("Mapping for Gpe entry to locator id[entry-id={},locator-pair-id={}] successfully added", entryId, - locatorId); - } - - @Override - public void removeMapping(@Nonnull final String entryId, - @Nonnull final MappingContext mappingContext) { - LOG.debug("Removing all mappings for Gpe entry[id={}]", entryId); - KeyedInstanceIdentifier<Mapping, MappingKey> mappingId = getMappingId(entryId); - // if no mapping present, no need to invoke delete(it would throw error because of non existing parent data) - if (mappingContext.read(mappingId).isPresent()) { - mappingContext.delete(mappingId); - } - LOG.debug("All mappings for Gpe entry[id={}] removed", entryId); - } - - @Override - public LocatorPairMapping getMapping(@Nonnull final String entryId, - @Nonnull final GpeLocatorPair pair, - @Nonnull final MappingContext mappingContext) { - - if (!contains(entryId, pair, mappingContext)) { - final String artificialLocatorId = artificialLocatorPairId(entryId, pair); - addMapping(entryId, artificialLocatorId, pair, mappingContext); - return getMapping(entryId, artificialLocatorId, mappingContext); - } - - return mappingContext.read(getMappingId(entryId)) - .or(new MappingBuilder().setLocatorPairMapping(Collections.emptyList()).build()) - .getLocatorPairMapping() - .stream() - .filter(mapping -> pair.isSame(mapping.getPair())) - .collect(RWUtils.singleItemCollector()); - } - - private boolean contains(final String entryId, - final GpeLocatorPair pair, - final MappingContext mappingContext) { - return mappingContext.read(getMappingId(entryId)) - .or(new MappingBuilder().setLocatorPairMapping(Collections.emptyList()).build()) - .getLocatorPairMapping() - .stream() - .anyMatch(mapping -> pair.isSame(mapping.getPair())); - } - - @Override - public LocatorPairMapping getMapping(@Nonnull final String entryId, - @Nonnull final String locatorId, - @Nonnull final MappingContext mappingContext) { - return mappingContext.read(getMappingId(entryId)) - .or(new MappingBuilder().setLocatorPairMapping(Collections.emptyList()).build()) - .getLocatorPairMapping() - .stream() - .filter(mapping -> mapping.getId().equals(locatorId)) - .findAny().orElseThrow(() -> new IllegalArgumentException( - format("No mapping for entry %s|locator %s", entryId, locatorId))); - } - - private String artificialLocatorPairId(final String entryId, final GpeLocatorPair pair) { - return format("%s_%s_%s", entryId, pair.getLocalAddress(), pair.getRemoteAddress()); - } - - private Mapping getMappingData(final String entryId, - final String locatorId, - final GpeLocatorPair identifier) { - return new MappingBuilder() - .setId(entryId) - .setLocatorPairMapping(Collections.singletonList(new LocatorPairMappingBuilder() - .setId(locatorId) - .setPair(new PairBuilder() - .setLocalAddress(identifier.getLocalAddress()) - .setRemoteAddress(identifier.getRemoteAddress()) - .build()) - .build())).build(); - } - - private KeyedInstanceIdentifier<Mapping, MappingKey> getMappingId(final String id) { - return namingContextIid.child(Mappings.class) - .child(Mapping.class, new MappingKey(id)); - } -} - diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeFeatureCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeFeatureCustomizer.java index d274d90dc..bfa6dc71a 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeFeatureCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeFeatureCustomizer.java @@ -28,10 +28,10 @@ import io.fd.vpp.jvpp.core.dto.ShowLispStatus; import io.fd.vpp.jvpp.core.dto.ShowLispStatusReply; import io.fd.vpp.jvpp.core.future.FutureJVppCore; import javax.annotation.Nonnull; -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.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.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.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizer.java index e6e4e4491..35e5566f2 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizer.java @@ -16,7 +16,6 @@ package io.fd.hc2vpp.lisp.gpe.translate.read; -import static io.fd.hc2vpp.lisp.gpe.translate.ctx.GpeLocatorPair.fromDumpDetail; import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS; import static java.lang.String.format; @@ -24,8 +23,6 @@ import com.google.common.base.Optional; import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; 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; import io.fd.hc2vpp.lisp.translate.util.EidTranslator; @@ -44,23 +41,22 @@ import io.fd.vpp.jvpp.core.dto.GpeFwdEntryVnisGet; import io.fd.vpp.jvpp.core.dto.GpeFwdEntryVnisGetReply; import io.fd.vpp.jvpp.core.future.FutureJVppCore; import io.fd.vpp.jvpp.core.types.GpeFwdEntry; +import io.fd.vpp.jvpp.core.types.GpeLocator; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nonnull; -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.opendaylight.params.xml.ns.yang.gpe.rev170518.Gpe; -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.entry.table.grouping.gpe.entry.table.gpe.entry.LocatorPairsBuilder; -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.LocatorPairBuilder; +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.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.gpe.rev170801.locator.pairs.grouping.LocatorPairBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.MapReplyAction; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; @@ -74,17 +70,14 @@ public class GpeForwardEntryCustomizer extends FutureJVppCustomizer private final DumpCacheManager<GpeFwdEntryPathDetailsReplyDump, Integer> entryDumpCacheManager; private final DumpCacheManager<GpeFwdEntryVnisGetReply, Void> activeVnisDumpManager; private final NamingContext gpeEntryMappingContext; - private final GpeLocatorPairMappingContext gpeLocatorsMappingContext; private final GpeStateCheckService gpeStateCheckService; public GpeForwardEntryCustomizer(@Nonnull final FutureJVppCore futureJVppCore, @Nonnull final GpeStateCheckService gpeStateCheckService, - @Nonnull final NamingContext gpeEntryMappingContext, - @Nonnull final GpeLocatorPairMappingContext gpeLocatorsMappingContext) { + @Nonnull final NamingContext gpeEntryMappingContext) { super(futureJVppCore); this.gpeStateCheckService = gpeStateCheckService; this.gpeEntryMappingContext = gpeEntryMappingContext; - this.gpeLocatorsMappingContext = gpeLocatorsMappingContext; this.entryDumpManager = new DumpCacheManager.DumpCacheManagerBuilder<GpeFwdEntriesGetReply, Integer>() .acceptOnly(GpeFwdEntriesGetReply.class) .withExecutor((identifier, vni) -> { @@ -185,17 +178,13 @@ public class GpeForwardEntryCustomizer extends FutureJVppCustomizer // if any locators exist,it is a positive mapping if (locatorsDump.isPresent() && locatorsDump.get().gpeFwdEntryPathDetails != null && !locatorsDump.get().gpeFwdEntryPathDetails.isEmpty()) { - final List<LocatorPairs> pairs = + final List<LocatorPair> pairs = java.util.Optional.ofNullable(locatorsDump.get().gpeFwdEntryPathDetails) .orElse(Collections.emptyList()) .stream() - .map(entry -> { - final GpeLocatorPair gpePair = fromDumpDetail(entry); - final LocatorPairMapping mapping = gpeLocatorsMappingContext - .getMapping(entryId, gpePair, ctx.getMappingContext()); - return buildLocatorPair(entry, gpePair, mapping); - }).collect(Collectors.toList()); - builder.setLocatorPairs(pairs); + .map(entry -> buildLocatorPair(entry)) + .collect(Collectors.toList()); + builder.setLocatorPair(pairs); } else { // negative otherwise builder.setAction(MapReplyAction.forValue(gpeFwdEntry.action)); @@ -245,16 +234,13 @@ public class GpeForwardEntryCustomizer extends FutureJVppCustomizer return dump; } - private LocatorPairs buildLocatorPair(final GpeFwdEntryPathDetails entry, final GpeLocatorPair gpePair, - final LocatorPairMapping mapping) { - return new LocatorPairsBuilder() - .setId(mapping.getId()) - .setLocatorPair(new LocatorPairBuilder() - .setLocalLocator(gpePair.getLocalAddress()) - .setRemoteLocator(gpePair.getRemoteAddress()) - .setWeight((short) entry.lclLoc.weight) - .build()) - .build(); + private LocatorPair buildLocatorPair(final GpeFwdEntryPathDetails entry) { + final GpeLocator lclLoc = entry.lclLoc; + final GpeLocator rmtLoc = entry.rmtLoc; + return new LocatorPairBuilder() + .setLocalLocator(arrayToIpAddress(!byteToBoolean(lclLoc.isIp4), lclLoc.addr)) + .setRemoteLocator(arrayToIpAddress(!byteToBoolean(rmtLoc.isIp4), rmtLoc.addr)) + .setWeight((short) lclLoc.weight).build(); } private Stream<Integer> activeVnis(final InstanceIdentifier<GpeEntry> id, diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeReaderFactory.java index 2c5da177e..9532dd960 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeReaderFactory.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeReaderFactory.java @@ -21,7 +21,6 @@ import com.google.inject.Inject; import com.google.inject.name.Named; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.hc2vpp.lisp.gpe.GpeModule; -import io.fd.hc2vpp.lisp.gpe.translate.ctx.GpeLocatorPairMappingContext; import io.fd.hc2vpp.lisp.gpe.translate.service.GpeStateCheckService; import io.fd.honeycomb.translate.impl.read.GenericInitListReader; import io.fd.honeycomb.translate.impl.read.GenericInitReader; @@ -29,20 +28,19 @@ import io.fd.honeycomb.translate.read.ReaderFactory; import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder; import io.fd.vpp.jvpp.core.future.FutureJVppCore; import javax.annotation.Nonnull; -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.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._native.forward.paths.table.NativeForwardPath; -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.gpe.entry.LocalEid; -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.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid; -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.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.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._native.forward.paths.table.NativeForwardPath; +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.gpe.entry.LocalEid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid; +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.yangtools.yang.binding.InstanceIdentifier; public class GpeReaderFactory implements ReaderFactory { @@ -67,10 +65,6 @@ public class GpeReaderFactory implements ReaderFactory { private NamingContext gpeEntryMappingContext; @Inject - @Named(GpeModule.GPE_TO_LOCATOR_PAIR_CTX) - private GpeLocatorPairMappingContext gpeLocatorPairMappingContext; - - @Inject @Named("interface-context") private NamingContext interfaceContext; @@ -84,11 +78,9 @@ public class GpeReaderFactory implements ReaderFactory { registry.subtreeAdd(ImmutableSet.of( entrySubtreeId.child(LocalEid.class), entrySubtreeId.child(RemoteEid.class), - entrySubtreeId.child(LocatorPairs.class), - entrySubtreeId.child(LocatorPairs.class).child(LocatorPair.class)), + entrySubtreeId.child(LocatorPair.class)), new GenericInitListReader<>(GPE_ENTRY_ID, - new GpeForwardEntryCustomizer(api, gpeStateCheckService, gpeEntryMappingContext, - gpeLocatorPairMappingContext))); + new GpeForwardEntryCustomizer(api, gpeStateCheckService, gpeEntryMappingContext))); final InstanceIdentifier<NativeForwardPathsTablesState> tablesId = InstanceIdentifier.create(NativeForwardPathsTablesState.class); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizer.java index b8a59a181..978d78648 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizer.java @@ -39,13 +39,13 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.NativeForwardPathsTables; -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.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._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.NativeForwardPathsTables; +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.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._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.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -80,18 +80,18 @@ public class NativeForwardPathCustomizer extends FutureJVppCustomizer @Nonnull final NativeForwardPath readValue, @Nonnull final ReadContext ctx) { final Long tableId = id.firstKeyOf(NativeForwardPathsTable.class).getTableId(); - final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables._native.forward.paths.table.NativeForwardPath, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathKey> + final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPath, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathKey> cfgId = InstanceIdentifier.create(NativeForwardPathsTables.class) - .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTable.class, + .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTable.class, new NativeForwardPathsTableKey( tableId)) - .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables._native.forward.paths.table.NativeForwardPath.class, - new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathKey( + .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPath.class, + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathKey( readValue.getNextHopAddress())); - final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables._native.forward.paths.table.NativeForwardPath + final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPath cfgValue = - new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathBuilder() + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathBuilder() .setNextHopAddress(readValue.getNextHopAddress()) .setNextHopInterface(readValue.getNextHopInterface()) .build(); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizer.java index 055f38ae8..d787592dd 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizer.java @@ -37,11 +37,11 @@ import java.util.OptionalLong; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nonnull; -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.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.NativeForwardPathsTables; +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.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -82,16 +82,16 @@ public class NativeForwardPathsTableCustomizer extends FutureJVppCustomizer impl public Initialized<? extends DataObject> init(@Nonnull final InstanceIdentifier<NativeForwardPathsTable> id, @Nonnull final NativeForwardPathsTable readValue, @Nonnull final ReadContext ctx) { - final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTable + final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTable cfgValue = - new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTableBuilder() + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTableBuilder() .setTableId(readValue.getTableId()) .build(); - final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTable, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTableKey> + final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTable, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTableKey> cfgKey = InstanceIdentifier.create(NativeForwardPathsTables.class) - .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTable.class, - new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518._native.forward.paths.tables.NativeForwardPathsTableKey( + .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTable.class, + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables.NativeForwardPathsTableKey( cfgValue.getKey())); return Initialized.create(cfgKey, cfgValue); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/service/GpeStateCheckServiceImpl.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/service/GpeStateCheckServiceImpl.java index b09b7ad98..8d45f2387 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/service/GpeStateCheckServiceImpl.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/service/GpeStateCheckServiceImpl.java @@ -31,10 +31,10 @@ import io.fd.vpp.jvpp.core.dto.ShowLispStatus; import io.fd.vpp.jvpp.core.dto.ShowLispStatusReply; import io.fd.vpp.jvpp.core.future.FutureJVppCore; import javax.annotation.Nonnull; -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.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.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 final class GpeStateCheckServiceImpl implements GpeStateCheckService, JvppReplyConsumer, ByteDataTranslator { diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeFeatureCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeFeatureCustomizer.java index d384af094..542928d42 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeFeatureCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeFeatureCustomizer.java @@ -27,7 +27,7 @@ import io.fd.vpp.jvpp.core.dto.GpeEnableDisableReply; import io.fd.vpp.jvpp.core.future.FutureJVppCore; import java.util.concurrent.CompletableFuture; import javax.annotation.Nonnull; -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.rev170801.gpe.feature.data.grouping.GpeFeatureData; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeForwardEntryCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeForwardEntryCustomizer.java index cdd388776..28a0e1a37 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeForwardEntryCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeForwardEntryCustomizer.java @@ -17,14 +17,11 @@ package io.fd.hc2vpp.lisp.gpe.translate.write; import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static io.fd.hc2vpp.lisp.gpe.translate.ctx.GpeLocatorPair.fromLocatorPair; import static java.util.Objects.nonNull; import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.common.translate.util.NamingContext; -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; @@ -37,19 +34,17 @@ import io.fd.vpp.jvpp.core.dto.GpeAddDelFwdEntryReply; import io.fd.vpp.jvpp.core.future.FutureJVppCore; import io.fd.vpp.jvpp.core.types.GpeLocator; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nonnull; -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.LocalEid; -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.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid; -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.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.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.locator.pairs.grouping.LocatorPair; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class GpeForwardEntryCustomizer extends FutureJVppCustomizer @@ -57,16 +52,13 @@ public class GpeForwardEntryCustomizer extends FutureJVppCustomizer private final GpeStateCheckService gpeStateCheckService; private final NamingContext entryMappingCtx; - private final GpeLocatorPairMappingContext locatorPairCtx; public GpeForwardEntryCustomizer(@Nonnull final FutureJVppCore futureJVppCore, @Nonnull final GpeStateCheckService gpeStateCheckService, - @Nonnull final NamingContext entryMappingCtx, - @Nonnull final GpeLocatorPairMappingContext locatorPairCtx) { + @Nonnull final NamingContext entryMappingCtx) { super(futureJVppCore); this.gpeStateCheckService = gpeStateCheckService; this.entryMappingCtx = entryMappingCtx; - this.locatorPairCtx = locatorPairCtx; } @Override @@ -115,20 +107,13 @@ public class GpeForwardEntryCustomizer extends FutureJVppCustomizer final GpeAddDelFwdEntryReply reply, final MappingContext mappingContext){ /* - * sync to disallow synchronization issues + * sync to prevent synchronization issues */ synchronized (entryMappingCtx) { - synchronized (locatorPairCtx) { - if (add) { - entryMappingCtx.addName(reply.fwdEntryIndex,data.getId(),mappingContext); - Optional.ofNullable(data.getLocatorPairs()).orElse(Collections.emptyList()).forEach( - locatorPair -> locatorPairCtx - .addMapping(data.getId(), locatorPair.getId(), fromLocatorPair(locatorPair), - mappingContext)); - } else { - entryMappingCtx.removeName(data.getId(),mappingContext); - locatorPairCtx.removeMapping(data.getId(), mappingContext); - } + if (add) { + entryMappingCtx.addName(reply.fwdEntryIndex, data.getId(), mappingContext); + } else { + entryMappingCtx.removeName(data.getId(), mappingContext); } } } @@ -162,8 +147,8 @@ public class GpeForwardEntryCustomizer extends FutureJVppCustomizer request.action = (byte) entry.getAction().getIntValue(); } - if (nonNull(entry.getLocatorPairs())) { - request.locs = toRequestLocators(entry.getLocatorPairs()); + if (nonNull(entry.getLocatorPair())) { + request.locs = toRequestLocators(entry.getLocatorPair()); request.locNum = request.locs.length; } @@ -174,12 +159,9 @@ public class GpeForwardEntryCustomizer extends FutureJVppCustomizer // Locators vector must be ordered in way that local locators are first ,then remote. // Pair is translated to two locators, one(local) with local address and weight, second one(remote) with remote // address - private GpeLocator[] toRequestLocators(final List<LocatorPairs> pairs) { + private GpeLocator[] toRequestLocators(final List<LocatorPair> pairs) { final List<GpeLocator> localLocators = pairs.stream() - .map(locatorPairContainer -> { - final LocatorPair locatorPair = - checkNotNull(locatorPairContainer.getLocatorPair(), "Locator pair cannot be null"); - + .map(locatorPair -> { final boolean isLocalIpv6 = isIpv6(locatorPair.getLocalLocator()); final boolean isRemoteIpv6 = isIpv6(locatorPair.getRemoteLocator()); @@ -195,18 +177,15 @@ public class GpeForwardEntryCustomizer extends FutureJVppCustomizer }).collect(Collectors.toList()); final List<GpeLocator> remoteLocators = pairs.stream() - .map(locatorPairContainer -> { - final LocatorPair locatorPair = locatorPairContainer.getLocatorPair(); - + .map(locatorPair -> { final boolean isRemoteIpv6 = isIpv6(locatorPair.getRemoteLocator()); - GpeLocator remoteLocator = new GpeLocator(); remoteLocator.addr = ipAddressToArray(locatorPair.getRemoteLocator()); remoteLocator.isIp4 = booleanToByte(!isRemoteIpv6); return remoteLocator; }).collect(Collectors.toList()); - return Stream.of(localLocators,remoteLocators).flatMap(Collection::stream).toArray(GpeLocator[]::new); + return Stream.of(localLocators, remoteLocators).flatMap(Collection::stream).toArray(GpeLocator[]::new); } } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeWriterFactory.java index 18bea7c9d..049f4acb4 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeWriterFactory.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/GpeWriterFactory.java @@ -21,7 +21,6 @@ import com.google.inject.Inject; import com.google.inject.name.Named; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.hc2vpp.lisp.gpe.GpeModule; -import io.fd.hc2vpp.lisp.gpe.translate.ctx.GpeLocatorPairMappingContext; import io.fd.hc2vpp.lisp.gpe.translate.service.GpeStateCheckService; import io.fd.honeycomb.translate.impl.write.GenericListWriter; import io.fd.honeycomb.translate.impl.write.GenericWriter; @@ -31,17 +30,16 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; -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.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._native.forward.paths.table.NativeForwardPath; -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.gpe.entry.LocalEid; -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.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid; -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.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._native.forward.paths.table.NativeForwardPath; +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.gpe.entry.LocalEid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid; +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.vpp.vlan.rev170607.SubinterfaceAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170607.interfaces._interface.SubInterfaces; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170607.interfaces._interface.sub.interfaces.SubInterface; @@ -69,10 +67,6 @@ public class GpeWriterFactory implements WriterFactory { private NamingContext gpeEntryMappingContext; @Inject - @Named(GpeModule.GPE_TO_LOCATOR_PAIR_CTX) - private GpeLocatorPairMappingContext gpeLocatorPairMappingContext; - - @Inject @Named("interface-context") private NamingContext interfaceContext; @@ -91,11 +85,9 @@ public class GpeWriterFactory implements WriterFactory { registry.subtreeAddBefore(ImmutableSet.of( entrySubtreeId.child(LocalEid.class), entrySubtreeId.child(RemoteEid.class), - entrySubtreeId.child(LocatorPairs.class), - entrySubtreeId.child(LocatorPairs.class).child(LocatorPair.class)), + entrySubtreeId.child(LocatorPair.class)), new GenericListWriter<>(GPE_ENTRY_ID, - new GpeForwardEntryCustomizer(api, gpeStateCheckService, gpeEntryMappingContext, - gpeLocatorPairMappingContext)), + new GpeForwardEntryCustomizer(api, gpeStateCheckService, gpeEntryMappingContext)), IFC_ID.augmentation(SubinterfaceAugmentation.class).child(SubInterfaces.class) .child(SubInterface.class)); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizer.java index 0dcb434e4..cbb4b2f97 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizer.java @@ -31,8 +31,8 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore; import java.util.Optional; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.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.NativeForwardPathKey; +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.NativeForwardPathKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class NativeForwardPathCustomizer extends FutureJVppCustomizer diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizer.java index a9030a7c4..6d2faf297 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizer.java @@ -25,8 +25,8 @@ import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.vpp.jvpp.core.dto.GpeAddDelIface; import io.fd.vpp.jvpp.core.future.FutureJVppCore; import javax.annotation.Nonnull; -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.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.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/util/EidTranslator.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/util/EidTranslator.java index 2b693fd60..ab0467024 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/util/EidTranslator.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/util/EidTranslator.java @@ -93,11 +93,11 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { return resolverPrefixLength(address.getAddress()); } - default byte getPrefixLength(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEid address){ + default byte getPrefixLength(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEid address){ return resolverPrefixLength(address.getAddress()); } - default byte getPrefixLength(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid address){ + default byte getPrefixLength(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid address){ return resolverPrefixLength(address.getAddress()); } @@ -123,22 +123,22 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { return Byte.valueOf(data.substring(data.indexOf('/') + 1)); } - default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEid getArrayAsGpeLocalEid( + default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEid getArrayAsGpeLocalEid( @Nonnull final EidType type, final byte[] address, final byte prefix, final int vni) { final Eid eid = getArrayAsEidLocal(type, address, prefix, vni); - return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEidBuilder() + return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEidBuilder() .setAddress(eid.getAddress()) .setAddressType(eid.getAddressType()) .setVirtualNetworkId(eid.getVirtualNetworkId()) .build(); } - default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid getArrayAsGpeRemoteEid( + default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid getArrayAsGpeRemoteEid( @Nonnull final EidType type, final byte[] address, final byte prefix, final int vni) { final Eid eid = getArrayAsEidLocal(type, address, prefix, vni); - return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEidBuilder() + return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEidBuilder() .setAddress(eid.getAddress()) .setAddressType(eid.getAddressType()) .setVirtualNetworkId(eid.getVirtualNetworkId()) @@ -358,14 +358,14 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { } default EidType getEidType( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid address) { + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid address) { checkNotNull(address, "Address cannot be null"); return resolveType(address.getAddress()); } default EidType getEidType( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEid address) { + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEid address) { checkNotNull(address, "Address cannot be null"); return resolveType(address.getAddress()); @@ -425,14 +425,14 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { } default byte[] getEidAsByteArray( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid address) { + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.RemoteEid address) { checkNotNull(address, "Eid cannot be null"); return resolveByteArray(getEidType(address), address.getAddress()); } default byte[] getEidAsByteArray( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170518.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEid address) { + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801.gpe.entry.table.grouping.gpe.entry.table.gpe.entry.LocalEid address) { checkNotNull(address, "Eid cannot be null"); return resolveByteArray(getEidType(address), address.getAddress()); 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 { diff --git a/lisp/lisp2vpp/src/test/resources/gpe/gpe-fwd-entry-full.json b/lisp/lisp2vpp/src/test/resources/gpe/gpe-fwd-entry-full.json index 8bc5cc41e..6168b9d36 100644 --- a/lisp/lisp2vpp/src/test/resources/gpe/gpe-fwd-entry-full.json +++ b/lisp/lisp2vpp/src/test/resources/gpe/gpe-fwd-entry-full.json @@ -14,22 +14,16 @@ "virtual-network-id": 12, "ipv4-prefix": "192.168.3.0/16" }, - "locator-pairs": [ + "locator-pair": [ { - "id": "gpe-fwd-entry-pair-1", - "locator-pair": { - "local-locator": "192.168.4.1", - "remote-locator": "192.168.4.2", - "weight": 3 - } + "local-locator": "192.168.4.1", + "remote-locator": "192.168.4.2", + "weight": 3 }, { - "id": "gpe-fwd-entry-pair-2", - "locator-pair": { - "local-locator": "192.168.5.1", - "remote-locator": "192.168.5.2", - "weight": 2 - } + "local-locator": "192.168.5.1", + "remote-locator": "192.168.5.2", + "weight": 2 } ], "action": "natively-forward" diff --git a/lisp/lisp2vpp/src/test/resources/gpe/invalid/invalid-gpe-fwd-entry-no-local-eid.json b/lisp/lisp2vpp/src/test/resources/gpe/invalid/invalid-gpe-fwd-entry-no-local-eid.json index 7322dadc6..a36a7403f 100644 --- a/lisp/lisp2vpp/src/test/resources/gpe/invalid/invalid-gpe-fwd-entry-no-local-eid.json +++ b/lisp/lisp2vpp/src/test/resources/gpe/invalid/invalid-gpe-fwd-entry-no-local-eid.json @@ -9,22 +9,16 @@ "virtual-network-id": 12, "ipv4-prefix": "192.168.3.0/16" }, - "locator-pairs": [ + "locator-pair": [ { - "id": "gpe-fwd-entry-pair-1", - "locator-pair": { - "local-locator": "192.168.4.1", - "remote-locator": "192.168.4.2", - "weight": 3 - } + "local-locator": "192.168.4.1", + "remote-locator": "192.168.4.2", + "weight": 3 }, { - "id": "gpe-fwd-entry-pair-2", - "locator-pair": { - "local-locator": "192.168.5.1", - "remote-locator": "192.168.5.2", - "weight": 2 - } + "local-locator": "192.168.5.1", + "remote-locator": "192.168.5.2", + "weight": 2 } ] } diff --git a/lisp/lisp2vpp/src/test/resources/gpe/invalid/invalid-gpe-fwd-entry-no-remote-eid.json b/lisp/lisp2vpp/src/test/resources/gpe/invalid/invalid-gpe-fwd-entry-no-remote-eid.json index e6d5cc7e5..d63d377b1 100644 --- a/lisp/lisp2vpp/src/test/resources/gpe/invalid/invalid-gpe-fwd-entry-no-remote-eid.json +++ b/lisp/lisp2vpp/src/test/resources/gpe/invalid/invalid-gpe-fwd-entry-no-remote-eid.json @@ -9,22 +9,16 @@ "virtual-network-id": 12, "ipv4-prefix": "192.168.2.0/24" }, - "locator-pairs": [ + "locator-pair": [ { - "id": "gpe-fwd-entry-pair-1", - "locator-pair": { - "local-locator": "192.168.4.1", - "remote-locator": "192.168.4.2", - "weight": 3 - } + "local-locator": "192.168.4.1", + "remote-locator": "192.168.4.2", + "weight": 3 }, { - "id": "gpe-fwd-entry-pair-2", - "locator-pair": { - "local-locator": "192.168.5.1", - "remote-locator": "192.168.5.2", - "weight": 2 - } + "local-locator": "192.168.5.1", + "remote-locator": "192.168.5.2", + "weight": 2 } ], "action": "natively-forward" |