diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2017-05-16 12:48:47 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-05-18 09:32:02 +0000 |
commit | f1189488bce92471d6e5e5a666befa2340bd20ae (patch) | |
tree | 020200cab38d98cec1dd6f45db018b6bca44efe0 /lisp | |
parent | b4b8fba02e15dd061f0bc05fb87f121980893ca1 (diff) |
HC2VPP-90 - Ipv4/Ipv6 prefix based eid's support
- adds full support for prefix based eid's ,both in
non-normalized and normalized form
Change-Id: I22451d20e0f9b540da447c8f120b917e0b30a6b7
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp')
22 files changed, 1324 insertions, 263 deletions
diff --git a/lisp/lisp2vpp/pom.xml b/lisp/lisp2vpp/pom.xml index b7c4c4903..f9a366147 100755 --- a/lisp/lisp2vpp/pom.xml +++ b/lisp/lisp2vpp/pom.xml @@ -33,6 +33,7 @@ <properties> <project.vpp.groupId>io.fd.hc2vpp.common</project.vpp.groupId> <project.honeycomb.groupId>io.fd.honeycomb</project.honeycomb.groupId> + <ipaddress.version>2.0.0</ipaddress.version> </properties> <dependencies> @@ -80,6 +81,13 @@ <artifactId>guice-multibindings</artifactId> </dependency> + <!-- Prefix optimization --> + <dependency> + <groupId>com.github.seancfoley</groupId> + <artifactId>ipaddress</artifactId> + <version>${ipaddress.version}</version> + </dependency> + <!-- Testing Dependencies --> <dependency> <groupId>junit</groupId> diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/EidMappingContext.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/EidMappingContext.java index 5288a609d..9cb489940 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/EidMappingContext.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/EidMappingContext.java @@ -188,13 +188,13 @@ public class EidMappingContext implements EidTranslator { private Eid copyEid( org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.local.mapping.Eid eid) { - return new EidBuilder().setAddress(eid.getAddress()).setAddressType(eid.getAddressType()) + return new EidBuilder().setAddress(normalizeIfPrefixBased(eid.getAddress())).setAddressType(eid.getAddressType()) .setVirtualNetworkId(eid.getVirtualNetworkId()).build(); } private Eid copyEid( org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.remote.mappings.remote.mapping.Eid eid) { - return new EidBuilder().setAddress(eid.getAddress()).setAddressType(eid.getAddressType()) + return new EidBuilder().setAddress(normalizeIfPrefixBased(eid.getAddress())).setAddressType(eid.getAddressType()) .setVirtualNetworkId(eid.getVirtualNetworkId()).build(); } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizer.java index 72ed941f5..afbe2f3bf 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizer.java @@ -145,9 +145,11 @@ public class AdjacencyCustomizer extends FutureJVppCustomizer builder.setId(currentAdjacencyId) .setKey(new AdjacencyKey(currentAdjacencyId)) .setLocalEid(getArrayAsLocalEid( - MappingsDumpParams.EidType.valueOf(currentAdjacency.eidType), currentAdjacency.leid, vni)) + MappingsDumpParams.EidType.valueOf(currentAdjacency.eidType), currentAdjacency.leid, + currentAdjacency.leidPrefixLen, vni)) .setRemoteEid(getArrayAsRemoteEid( - MappingsDumpParams.EidType.valueOf(currentAdjacency.eidType), currentAdjacency.reid, vni)); + MappingsDumpParams.EidType.valueOf(currentAdjacency.eidType), currentAdjacency.reid, + currentAdjacency.reidPrefixLen, vni)); } private EntityDumpExecutor<OneAdjacenciesGetReply, AdjacencyDumpParams> createExecutor() { @@ -199,9 +201,11 @@ public class AdjacencyCustomizer extends FutureJVppCustomizer final MappingContext mappingContext) { return new EidIdentificatorPairBuilder() .setLocalEidId(new MappingId(localMappingContext.getId(getArrayAsEidLocal( - MappingsDumpParams.EidType.valueOf(data.eidType), data.leid, vni), mappingContext))) + MappingsDumpParams.EidType.valueOf(data.eidType), data.leid, data.leidPrefixLen, vni), + mappingContext))) .setRemoteEidId(new MappingId(remoteMappingContext.getId(getArrayAsEidLocal( - MappingsDumpParams.EidType.valueOf(data.eidType), data.reid, vni), mappingContext))) + MappingsDumpParams.EidType.valueOf(data.eidType), data.reid, data.reidPrefixLen, vni), + mappingContext))) .build(); } } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizer.java index ff71d9c00..81409296d 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizer.java @@ -105,7 +105,6 @@ public class LocalMappingCustomizer final long vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier(); - final String localMappingId = id.firstKeyOf(LocalMapping.class).getId().getValue(); final Eid eid = localMappingContext.getEid(mappingId, ctx.getMappingContext()); //Requesting for specific mapping dump,only from local mappings with specified eid/vni/eid type @@ -135,7 +134,7 @@ public class LocalMappingCustomizer "No Locator Set name found for index %s", details.locatorSetIndex); builder.setLocatorSet(locatorSetContext.getName(details.locatorSetIndex, ctx.getMappingContext())); builder.setKey(new LocalMappingKey(new MappingId(id.firstKeyOf(LocalMapping.class).getId()))); - builder.setEid(getArrayAsEidLocal(valueOf(details.eidType), details.eid, details.vni)); + builder.setEid(getArrayAsEidLocal(valueOf(details.eidType), details.eid, details.eidPrefixLen, details.vni)); if (details.key != null) { builder.setHmacKey( @@ -149,7 +148,7 @@ public class LocalMappingCustomizer } private Address getAddressFromDumpDetail(final OneEidTableDetails detail) { - return getArrayAsEidLocal(valueOf(detail.eidType), detail.eid, detail.vni).getAddress(); + return getArrayAsEidLocal(valueOf(detail.eidType), detail.eid, detail.eidPrefixLen, detail.vni).getAddress(); } @Override @@ -184,7 +183,7 @@ public class LocalMappingCustomizer return replyOptional.get().oneEidTableDetails.stream() .filter(a -> a.vni == vni) .filter(subtableFilterForLocalMappings(id)) - .map(detail -> getArrayAsEidLocal(valueOf(detail.eidType), detail.eid, detail.vni)) + .map(detail -> getArrayAsEidLocal(valueOf(detail.eidType), detail.eid, detail.eidPrefixLen, detail.vni)) .map(localEid -> localMappingContext.getId(localEid, context.getMappingContext())) .map(MappingId::new) .map(LocalMappingKey::new) diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java index 2ba9eb831..04b89a59f 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java @@ -148,7 +148,6 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer "No mapping stored for id %s", mappingId); final long vni = id.firstKeyOf(VniTable.class).getVirtualNetworkIdentifier(); - final String remoteMappingId = id.firstKeyOf(RemoteMapping.class).getId().getValue(); final Eid eid = copyEid(remoteMappingContext.getEid(mappingId, ctx.getMappingContext())); final MappingsDumpParams dumpParams = new MappingsDumpParamsBuilder() .setVni(Long.valueOf(vni).intValue()) @@ -172,11 +171,11 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer OneEidTableDetails details = replyOptional.get().oneEidTableDetails.stream() .filter(subtableFilterForRemoteMappings(id)) .filter(a -> compareAddresses(eid.getAddress(), - getArrayAsEidLocal(valueOf(a.eidType), a.eid, a.vni).getAddress())) + getArrayAsEidLocal(valueOf(a.eidType), a.eid, a.eidPrefixLen, a.vni).getAddress())) .collect( RWUtils.singleItemCollector()); - builder.setEid(getArrayAsEidRemote(valueOf(details.eidType), details.eid, details.vni)); + builder.setEid(getArrayAsEidRemote(valueOf(details.eidType), details.eid, details.eidPrefixLen, details.vni)); builder.setKey(new RemoteMappingKey(new MappingId(id.firstKeyOf(RemoteMapping.class).getId()))); builder.setTtl(resolveTtl(details.ttl)); builder.setAuthoritative( @@ -217,7 +216,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer .stream() .filter(a -> a.vni == vni) .filter(subtableFilterForRemoteMappings(id)) - .map(detail -> getArrayAsEidRemote(valueOf(detail.eidType), detail.eid, detail.vni)) + .map(detail -> getArrayAsEidRemote(valueOf(detail.eidType), detail.eid, detail.eidPrefixLen, detail.vni)) .map(remoteEid -> remoteMappingContext.getId(remoteEid, context.getMappingContext())) .map(MappingId::new) .map(RemoteMappingKey::new) diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/dump/executor/params/MappingsDumpParams.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/dump/executor/params/MappingsDumpParams.java index 6b422f503..3c440668d 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/dump/executor/params/MappingsDumpParams.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/dump/executor/params/MappingsDumpParams.java @@ -16,7 +16,9 @@ package io.fd.hc2vpp.lisp.translate.read.dump.executor.params; +import com.google.common.collect.ImmutableMap; import java.util.Arrays; +import java.util.Map; /** * Parameters for executing dump of mappings @@ -82,15 +84,27 @@ public final class MappingsDumpParams { public enum EidType { IPV4(0), IPV6(1), - MAC(2); - + MAC(2), + IPV4_PREFIX(3), + IPV6_PREFIX(4); + + /** + * From vpp api perspective, ipv4 is the same as ipv4-prefix, it differs just in prefix value. + * Respectively for ipv6/ipv6-prefix + */ + private static final Map<EidType, Integer> VPP_EID_TYPE_REGISTER = ImmutableMap.of( + IPV4, 0, IPV6, 1, MAC, 2, IPV4_PREFIX, 0, IPV6_PREFIX, 1); + + /** + * This value should be use just for our logic, do not use it to bind vpp requests + */ private final int value; private EidType(final int value) { this.value = value; } - public static final EidType valueOf(int value) { + public static EidType valueOf(int value) { switch (value) { case 0: return IPV4; @@ -98,13 +112,17 @@ public final class MappingsDumpParams { return IPV6; case 2: return MAC; + case 3: + return IPV4_PREFIX; + case 4: + return IPV6_PREFIX; default: throw new IllegalArgumentException("Illegal value"); } } - public final int getValue() { - return this.value; + public final int getVppTypeBinding() { + return VPP_EID_TYPE_REGISTER.get(this); } } @@ -150,10 +168,6 @@ public final class MappingsDumpParams { private byte[] eid; private byte filter; - public static final MappingsDumpParamsBuilder newInstance() { - return new MappingsDumpParamsBuilder(); - } - public MappingsDumpParamsBuilder setEidSet(final QuantityType quantityType) { this.eidSet = (byte) quantityType.getValue(); return this; @@ -170,7 +184,7 @@ public final class MappingsDumpParams { } public MappingsDumpParamsBuilder setEidType(final EidType eidType) { - this.eidType = (byte) eidType.getValue(); + this.eidType = (byte) eidType.getVppTypeBinding(); return this; } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/trait/MappingProducer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/trait/MappingProducer.java index c9694c7a6..bceae832e 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/trait/MappingProducer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/trait/MappingProducer.java @@ -16,10 +16,14 @@ package io.fd.hc2vpp.lisp.translate.read.trait; +import com.google.common.collect.ImmutableSet; import io.fd.honeycomb.translate.write.WriteFailedException; +import java.util.Set; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4PrefixAfi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6Afi; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6PrefixAfi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddressFamily; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.LocalMapping; @@ -33,15 +37,21 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; */ public interface MappingProducer { + Set<Class<? extends LispAddressFamily>> VRF_ALLOWED_ADDRESS_TYPES = ImmutableSet.of( + Ipv4Afi.class, + Ipv6Afi.class, + Ipv4PrefixAfi.class, + Ipv6PrefixAfi.class); + /** - * Checks whether provided {@link LocalMapping} can be written under subtree idenfied by {@link InstanceIdentifier} + * Checks whether provided {@link LocalMapping} can be written under subtree identified by {@link InstanceIdentifier} */ default void checkAllowedCombination(@Nonnull final InstanceIdentifier<LocalMapping> identifier, @Nonnull final LocalMapping data) throws WriteFailedException { final Class<? extends LispAddressFamily> eidAddressType = data.getEid().getAddressType(); if (identifier.firstIdentifierOf(VrfSubtable.class) != null) { - if (Ipv4Afi.class != eidAddressType && Ipv6Afi.class != eidAddressType) { + if (!VRF_ALLOWED_ADDRESS_TYPES.contains(eidAddressType)) { throw new WriteFailedException.CreateFailedException(identifier, data, new IllegalArgumentException("Only Ipv4/Ipv6 eid's are allowed for Vrf Subtable")); } @@ -58,7 +68,7 @@ public interface MappingProducer { final Class<? extends LispAddressFamily> eidAddressType = data.getEid().getAddressType(); if (identifier.firstIdentifierOf(VrfSubtable.class) != null) { - if (Ipv4Afi.class != eidAddressType && Ipv6Afi.class != eidAddressType) { + if (!VRF_ALLOWED_ADDRESS_TYPES.contains(eidAddressType)) { throw new WriteFailedException.CreateFailedException(identifier, data, new IllegalArgumentException("Only Ipv4/Ipv6 eid's are allowed for Vrf Subtable")); } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/trait/MappingReader.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/trait/MappingReader.java index bad719d01..993a6451c 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/trait/MappingReader.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/trait/MappingReader.java @@ -37,15 +37,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** - * Trait providing predicates to filter mappings to respective subtables + * Trait providing predicates to filter mappings to respective sub-tables */ public interface MappingReader extends JvppReplyConsumer { Predicate<OneEidTableDetails> BRIDGE_DOMAIN_MAPPINGS_ONLY = - (OneEidTableDetails detail) -> detail.eidType == MAC.getValue(); + (OneEidTableDetails detail) -> detail.eidType == MAC.getVppTypeBinding(); Predicate<OneEidTableDetails> VRF_MAPPINGS_ONLY = - (OneEidTableDetails detail) -> detail.eidType == IPV4.getValue() || detail.eidType == IPV6.getValue(); + (OneEidTableDetails detail) -> detail.eidType == IPV4.getVppTypeBinding() || detail.eidType == IPV6.getVppTypeBinding(); default Predicate<OneEidTableDetails> subtableFilterForLocalMappings( @Nonnull final InstanceIdentifier<LocalMapping> identifier) { 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 2c65c0c8f..deae3f5f6 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 @@ -16,40 +16,59 @@ package io.fd.hc2vpp.lisp.translate.util; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType; import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4; +import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4_PREFIX; import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6; +import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6_PREFIX; import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.MAC; +import static java.lang.Integer.parseInt; +import static java.lang.String.format; +import inet.ipaddr.IPAddress; import io.fd.hc2vpp.common.translate.util.AddressTranslator; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.Arrays; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4PrefixAfi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6Afi; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6PrefixAfi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix; +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.Mac; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.MacBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.adjacencies.grouping.adjacencies.adjacency.LocalEid; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.adjacencies.grouping.adjacencies.adjacency.RemoteEid; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.local.mapping.Eid; +import org.slf4j.Logger; /** * Trait providing converting logic for eid's */ +// TODO - HC2VPP-149 - restructuralize code public interface EidTranslator extends AddressTranslator, EidMetadataProvider { + byte DEFAULT_V4_PREFIX = 32; + byte DEFAULT_V6_PREFIX = (byte) 128; + default byte getPrefixLength(LocalEid address) { return resolverPrefixLength(address.getAddress()); } @@ -77,57 +96,103 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { switch (resolveType(address)) { case IPV4: - return 32; + return DEFAULT_V4_PREFIX; case IPV6: - return (byte) 128; + return DEFAULT_V6_PREFIX; case MAC: return 0; + case IPV4_PREFIX: + return extractPrefix(Ipv4Prefix.class.cast(address).getIpv4Prefix().getValue()); + case IPV6_PREFIX: + return extractPrefix(Ipv6Prefix.class.cast(address).getIpv6Prefix().getValue()); default: throw new IllegalArgumentException("Illegal type"); } } - default Eid getArrayAsEidLocal(@Nonnull final EidType type, final byte[] address, final int vni) { + static byte extractPrefix(final String data) { + return Byte.valueOf(data.substring(data.indexOf('/') + 1)); + } + + default Eid getArrayAsEidLocal(@Nonnull final EidType type, final byte[] address, final byte prefix, + final int vni) { switch (type) { case IPV4: { - return newLocalEidBuilder(Ipv4Afi.class, vni).setAddress( - new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address)).build()) - .build(); + // vpp does no have separate constant for prefix based ,so if prefix is different than + // default, map it to prefix type. Same in any other logic switched by eid type + return prefix != DEFAULT_V4_PREFIX + ? newLocalEidBuilder(Ipv4PrefixAfi.class, vni).setAddress( + new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix(address, prefix)).build()).build() + : newLocalEidBuilder(Ipv4Afi.class, vni).setAddress( + new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address)).build()) + .build(); } case IPV6: { - return newLocalEidBuilder(Ipv6Afi.class, vni).setAddress( - new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address)).build()) - .build(); + return prefix != DEFAULT_V6_PREFIX + ? newLocalEidBuilder(Ipv6PrefixAfi.class, vni).setAddress( + new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix(address, prefix)).build()).build() + : newLocalEidBuilder(Ipv6Afi.class, vni).setAddress( + new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address)).build()) + .build(); } case MAC: { return newLocalEidBuilder(MacAfi.class, vni).setAddress( new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address))) .build()).build(); } + case IPV4_PREFIX: { + return newLocalEidBuilder(Ipv4PrefixAfi.class, vni).setAddress( + new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix(address, prefix)).build()).build(); + } + case IPV6_PREFIX: { + return newLocalEidBuilder(Ipv6PrefixAfi.class, vni).setAddress( + new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix(address, prefix)).build()).build(); + } default: { throw new IllegalStateException("Unknown type detected"); } } } + static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix v4Prefix( + final byte[] address, final byte prefix) { + return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix( + prefixValue(INSTANCE.arrayToIpv4AddressNoZone(address).getValue(), String.valueOf(prefix))); + } + + static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix v6Prefix( + final byte[] address, final byte prefix) { + return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix( + prefixValue(INSTANCE.arrayToIpv6AddressNoZone(address).getValue(), String.valueOf(prefix))); + } + + static String prefixValue(final String prefix, final String suffix) { + // normalize prefix based address to prevent duplicates + IPAddress normalizedForm = IPAddress.from(getAddress(prefix)).toSubnet(parseInt(suffix)); + + return normalizedForm.toCompressedString(); + } + default org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.remote.mappings.remote.mapping.Eid getArrayAsEidRemote( - @Nonnull final EidType type, final byte[] address, final int vni) { + @Nonnull final EidType type, final byte[] address, final byte prefix, final int vni) { switch (type) { case IPV4: { - return newRemoteEidBuilder(Ipv4Afi.class, vni) - .setAddress( - new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address)) - .build()) - .build(); + return prefix != DEFAULT_V4_PREFIX + ? newRemoteEidBuilder(Ipv4PrefixAfi.class, vni).setAddress( + new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix(address, prefix)).build()).build() + : newRemoteEidBuilder(Ipv4Afi.class, vni) + .setAddress(new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address)).build()) + .build(); } case IPV6: { - return newRemoteEidBuilder(Ipv6Afi.class, vni) - .setAddress( - new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address)) - .build()) - .build(); + return prefix != DEFAULT_V6_PREFIX + ? newRemoteEidBuilder(Ipv6PrefixAfi.class, vni).setAddress( + new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix(address, prefix)).build()).build() + : newRemoteEidBuilder(Ipv6Afi.class, vni) + .setAddress(new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address)).build()) + .build(); } case MAC: { return newRemoteEidBuilder(MacAfi.class, vni) @@ -135,15 +200,28 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address))) .build()).build(); } + case IPV4_PREFIX: { + return newRemoteEidBuilder(Ipv4PrefixAfi.class, vni).setAddress( + new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix(address, prefix)).build()).build(); + } + case IPV6_PREFIX: { + return newRemoteEidBuilder(Ipv6PrefixAfi.class, vni).setAddress( + new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix(address, prefix)).build()).build(); + } default: { throw new IllegalStateException("Unknown type detected"); } } } - default LocalEid getArrayAsLocalEid(@Nonnull final EidType type, final byte[] address, final int vni) { + default LocalEid getArrayAsLocalEid(@Nonnull final EidType type, final byte[] address, final byte prefix, + final int vni) { switch (type) { case IPV4: { + if (prefix != DEFAULT_V4_PREFIX) { + return newEidBuilderLocal(Ipv4PrefixAfi.class, vni).setAddress( + new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix(address, prefix)).build()).build(); + } return newEidBuilderLocal(Ipv4Afi.class, vni) .setAddress( new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address)) @@ -151,6 +229,10 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { .build(); } case IPV6: { + if (prefix != DEFAULT_V6_PREFIX) { + return newEidBuilderLocal(Ipv6PrefixAfi.class, vni).setAddress( + new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix(address, prefix)).build()).build(); + } return newEidBuilderLocal(Ipv6Afi.class, vni) .setAddress( new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address)) @@ -163,27 +245,38 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address))) .build()).build(); } + case IPV4_PREFIX: { + return newEidBuilderLocal(Ipv4PrefixAfi.class, vni).setAddress( + new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix(address, prefix)).build()).build(); + } + case IPV6_PREFIX: { + return newEidBuilderLocal(Ipv6PrefixAfi.class, vni).setAddress( + new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix(address, prefix)).build()).build(); + } default: { throw new IllegalStateException("Unknown type detected"); } } } - default RemoteEid getArrayAsRemoteEid(@Nonnull final EidType type, final byte[] address, final int vni) { + default RemoteEid getArrayAsRemoteEid(@Nonnull final EidType type, final byte[] address, final byte prefix, + final int vni) { switch (type) { case IPV4: { - return newEidBuilderRemote(Ipv4Afi.class, vni) - .setAddress( - new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address)) - .build()) - .build(); + return (prefix != DEFAULT_V4_PREFIX) + ? newEidBuilderRemote(Ipv4PrefixAfi.class, vni).setAddress( + new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix(address, prefix)).build()).build() + : newEidBuilderRemote(Ipv4Afi.class, vni) + .setAddress(new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address)).build()) + .build(); } case IPV6: { - return newEidBuilderRemote(Ipv6Afi.class, vni) - .setAddress( - new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address)) - .build()) - .build(); + return prefix != DEFAULT_V6_PREFIX + ? newEidBuilderRemote(Ipv6PrefixAfi.class, vni) + .setAddress(new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix(address, prefix)).build()).build() + : newEidBuilderRemote(Ipv6Afi.class, vni) + .setAddress(new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address)).build()) + .build(); } case MAC: { return newEidBuilderRemote(MacAfi.class, vni) @@ -191,25 +284,42 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { new MacBuilder().setMac(new MacAddress(byteArrayToMacSeparated(address))) .build()).build(); } + case IPV4_PREFIX: { + return newEidBuilderRemote(Ipv4PrefixAfi.class, vni).setAddress( + new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix(address, prefix)).build()).build(); + } + case IPV6_PREFIX: { + return newEidBuilderRemote(Ipv6PrefixAfi.class, vni).setAddress( + new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix(address, prefix)).build()).build(); + } default: { throw new IllegalStateException("Unknown type detected"); } } } - default String getArrayAsEidString( - EidType type, byte[] address) { + default String getArrayAsEidString(final EidType type, final byte[] address, final byte prefix) { switch (type) { case IPV4: { - return arrayToIpv4AddressNoZone(address).getValue(); + return prefix != DEFAULT_V4_PREFIX + ? v4Prefix(address, prefix).getValue() + : arrayToIpv4AddressNoZone(address).getValue(); } case IPV6: { - return arrayToIpv6AddressNoZone(address).getValue(); + return prefix != DEFAULT_V6_PREFIX + ? v6Prefix(address, prefix).getValue() + : arrayToIpv6AddressNoZone(address).getValue(); } case MAC: { //as wrong as it looks ,its right(second param is not end index,but count) return byteArrayToMacSeparated(Arrays.copyOfRange(address, 0, 6)); } + case IPV4_PREFIX: { + return v4Prefix(address, prefix).getValue(); + } + case IPV6_PREFIX: { + return v6Prefix(address, prefix).getValue(); + } default: { throw new IllegalStateException("Unknown type detected"); } @@ -261,6 +371,10 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { return IPV6; } else if (address instanceof Mac) { return MAC; + } else if (address instanceof Ipv4Prefix) { + return IPV4_PREFIX; + } else if (address instanceof Ipv6Prefix) { + return IPV6_PREFIX; } else { throw new IllegalStateException("Unknown type detected"); } @@ -308,11 +422,49 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { return ipv6AddressNoZoneToArray(new Ipv6AddressNoZone(((Ipv6) address).getIpv6())); case MAC: return parseMac(((Mac) address).getMac().getValue()); + case IPV4_PREFIX: + return ipv4AddressPrefixToArray(v4LispPrefixToInetPrefix(Ipv4Prefix.class.cast(address))); + case IPV6_PREFIX: + return ipv6AddressPrefixToArray(v6LispPrefixToInetPrefix(Ipv6Prefix.class.cast(address))); default: throw new IllegalArgumentException("Unsupported type"); } } + default Address normalizeIfPrefixBased(Address address){ + if(address instanceof Ipv4Prefix){ + final String[] parts = ((Ipv4Prefix) address).getIpv4Prefix().getValue().split("/"); + + return new Ipv4PrefixBuilder().setIpv4Prefix( + new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix( + prefixValue(parts[0], parts[1]))) + .build(); + } + + if (address instanceof Ipv6Prefix){ + final String[] parts = ((Ipv6Prefix) address).getIpv6Prefix().getValue().split("/"); + + return new Ipv6PrefixBuilder().setIpv6Prefix( + new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix( + prefixValue(parts[0], parts[1]))).build(); + } + + // if not prefix based, does nothing + return address; + } + + static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix v4LispPrefixToInetPrefix( + final Ipv4Prefix prefix) { + return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix( + prefix.getIpv4Prefix().getValue()); + } + + static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix v6LispPrefixToInetPrefix( + final Ipv6Prefix prefix) { + return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix( + prefix.getIpv6Prefix().getValue()); + } + default boolean compareEids( LispAddress first, LispAddress second) { @@ -338,6 +490,77 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider { return ((Mac) firstAddress).getMac().getValue().equals(((Mac) secondAddress).getMac().getValue()); } + if (firstAddress instanceof Ipv4Prefix && secondAddress instanceof Ipv4Prefix) { + + final String firstPrefix = ((Ipv4Prefix) firstAddress).getIpv4Prefix().getValue(); + final String secondPrefix = ((Ipv4Prefix) secondAddress).getIpv4Prefix().getValue(); + + // for ex. 192.168.2.1/24 and 192.168.2.2/24 will be optimized to + // 192.168.2.0/24 + return isSameSubnet(firstPrefix, secondPrefix); + } + + if (firstAddress instanceof Ipv6Prefix && secondAddress instanceof Ipv6Prefix) { + final String firstPrefix = ((Ipv6Prefix) firstAddress).getIpv6Prefix().getValue(); + final String secondPrefix = ((Ipv6Prefix) secondAddress).getIpv6Prefix().getValue(); + + // same here + return isSameSubnet(firstPrefix, secondPrefix); + } + return false; } + + /** + * Configuration data store whatever value is put, so it can be non-normalized, but + * vpp optimize all eid prefix based values, returns true if such case + */ + default void checkIgnoredSubnetUpdate(@Nonnull final Address dataBefore, + @Nonnull final Address dataAfter, + @Nonnull Logger logger) { + boolean isSameSubnet = false; + if (dataBefore instanceof Ipv4Prefix && dataAfter instanceof Ipv4Prefix) { + isSameSubnet = isSameSubnet(((Ipv4Prefix) dataBefore).getIpv4Prefix().getValue(), + ((Ipv4Prefix) dataAfter).getIpv4Prefix().getValue()); + } + + if (dataBefore instanceof Ipv6Prefix && dataAfter instanceof Ipv6Prefix) { + isSameSubnet = isSameSubnet(((Ipv6Prefix) dataBefore).getIpv6Prefix().getValue(), + ((Ipv6Prefix) dataAfter).getIpv6Prefix().getValue()); + } + + if (isSameSubnet) { + logger.warn("Attempt to update address within same subnet detected, ignoring[{} vs {}]", dataBefore, + dataAfter); + return; + } + + throw new UnsupportedOperationException("Operation not supported"); + } + + static boolean isSameSubnet(final String firstPrefix, final String secondPrefix) { + final String[] firstPrefixParts = getPrefixParts(firstPrefix); + final String[] secondPrefixParts = getPrefixParts(secondPrefix); + + IPAddress firstAddress = + IPAddress.from(getAddress(firstPrefixParts[0])).toSubnet(parseInt(firstPrefixParts[1])); + IPAddress secondAddress = + IPAddress.from(getAddress(secondPrefixParts[0])).toSubnet(parseInt(secondPrefixParts[1])); + + return firstAddress.compareTo(secondAddress) == 0; + } + + static String[] getPrefixParts(final String prefixString) { + final String[] split = prefixString.split("/"); + checkArgument(split.length == 2, "%s is not a valid ip prefix", prefixString); + return split; + } + + static InetAddress getAddress(final String value) { + try { + return InetAddress.getByName(value); + } catch (UnknownHostException e) { + throw new IllegalArgumentException(format("Unable to convert %s", value), e); + } + } } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/AdjacencyCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/AdjacencyCustomizer.java index df5f431be..fc6de8653 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/AdjacencyCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/AdjacencyCustomizer.java @@ -41,11 +41,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.adjacencies.grouping.adjacencies.adjacency.RemoteEid; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.eid.table.grouping.eid.table.VniTable; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AdjacencyCustomizer extends FutureJVppCustomizer implements ListWriterCustomizer<Adjacency, AdjacencyKey>, ByteDataTranslator, EidTranslator, JvppReplyConsumer { + private static final Logger LOG = LoggerFactory.getLogger(AdjacencyCustomizer.class); + private final EidMappingContext localEidsMappingContext; private final EidMappingContext remoteEidsMappingContext; private final AdjacenciesMappingContext adjacenciesMappingContext; @@ -97,7 +101,9 @@ public class AdjacencyCustomizer extends FutureJVppCustomizer public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Adjacency> id, @Nonnull final Adjacency dataBefore, @Nonnull final Adjacency dataAfter, @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); + // case that happens during initialization + checkIgnoredSubnetUpdate(dataBefore.getLocalEid().getAddress(), dataAfter.getLocalEid().getAddress(), LOG); + checkIgnoredSubnetUpdate(dataBefore.getRemoteEid().getAddress(), dataAfter.getRemoteEid().getAddress(), LOG); } @Override @@ -145,7 +151,7 @@ public class AdjacencyCustomizer extends FutureJVppCustomizer request.leidLen = getPrefixLength(localEid); request.reid = getEidAsByteArray(remoteEid); request.reidLen = getPrefixLength(remoteEid); - request.eidType = (byte) localEidType.getValue(); + request.eidType = (byte) localEidType.getVppTypeBinding(); request.vni = vni; getReply(getFutureJVpp().oneAddDelAdjacency(request).toCompletableFuture()); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizer.java index 582a37756..d3a03b298 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizer.java @@ -18,8 +18,6 @@ package io.fd.hc2vpp.lisp.translate.write; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4; -import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6; import static java.nio.charset.StandardCharsets.UTF_8; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; @@ -44,6 +42,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.eid.table.grouping.eid.table.VniTable; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.hmac.key.grouping.HmacKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -53,6 +53,8 @@ public class LocalMappingCustomizer extends FutureJVppCustomizer implements ListWriterCustomizer<LocalMapping, LocalMappingKey>, ByteDataTranslator, EidTranslator, JvppReplyConsumer, MappingProducer { + private static final Logger LOG = LoggerFactory.getLogger(LocalMappingCustomizer.class); + private final EidMappingContext localMappingsContext; public LocalMappingCustomizer(@Nonnull FutureJVppCore futureJvpp, @Nonnull EidMappingContext localMappingsContext) { @@ -85,7 +87,8 @@ public class LocalMappingCustomizer extends FutureJVppCustomizer public void updateCurrentAttributes(InstanceIdentifier<LocalMapping> id, LocalMapping dataBefore, LocalMapping dataAfter, WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); + // case that happens during initialization + checkIgnoredSubnetUpdate(dataBefore.getEid().getAddress(), dataAfter.getEid().getAddress(), LOG); } @Override @@ -120,16 +123,12 @@ public class LocalMappingCustomizer extends FutureJVppCustomizer request.isAdd = booleanToByte(add); request.eid = getEidAsByteArray(data.getEid()); - request.eidType = (byte) getEidType(data.getEid()).getValue(); + request.eidType = (byte) getEidType(data.getEid()).getVppTypeBinding(); request.locatorSetName = data.getLocatorSet().getBytes(UTF_8); request.vni = vni; //default prefixes - if (request.eidType == IPV4.getValue()) { - request.prefixLen = 32; - } else if (request.eidType == IPV6.getValue()) { - request.prefixLen = (byte) 128; - } + request.prefixLen = getPrefixLength(data.getEid()); final HmacKey hmacKey = data.getHmacKey(); if (hmacKey != null) { diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizer.java index 056dcde1d..f6774890b 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizer.java @@ -51,6 +51,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.remote.mappings.remote.mapping.locator.list.positive.mapping.Rlocs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.eid.table.grouping.eid.table.VniTable; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -60,6 +62,8 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer implements ListWriterCustomizer<RemoteMapping, RemoteMappingKey>, EidTranslator, AddressTranslator, JvppReplyConsumer, MappingProducer { + private static final Logger LOG = LoggerFactory.getLogger(RemoteMappingCustomizer.class); + private final EidMappingContext remoteMappingContext; public RemoteMappingCustomizer(@Nonnull final FutureJVppCore futureJvpp, @@ -92,7 +96,8 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer public void updateCurrentAttributes(InstanceIdentifier<RemoteMapping> id, RemoteMapping dataBefore, RemoteMapping dataAfter, WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); + // case that happens during initialization + checkIgnoredSubnetUpdate(dataBefore.getEid().getAddress(), dataAfter.getEid().getAddress(), LOG); } @Override @@ -124,7 +129,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer request.isAdd = booleanToByte(add); request.vni = vni; - request.eidType = (byte) getEidType(data.getEid()).getValue(); + request.eidType = (byte) getEidType(data.getEid()).getVppTypeBinding(); request.eid = getEidAsByteArray(data.getEid()); //this is not length of eid array,but prefix length(bad naming by vpp) diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/context/util/EidMappingContextTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/context/util/EidMappingContextTest.java index f4325b00c..4dafb2176 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/context/util/EidMappingContextTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/context/util/EidMappingContextTest.java @@ -29,6 +29,8 @@ import org.mockito.MockitoAnnotations; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.MappingId; 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder; @@ -42,11 +44,20 @@ public class EidMappingContextTest implements EidMappingContextHelper { private EidMappingContext eidMappingContext; private Eid localEid; + private Eid localPrefixBasedEid; + private Eid localPrefixBasedEidNormalized; private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.remote.mappings.remote.mapping.Eid remoteEid; + private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.remote.mappings.remote.mapping.Eid + remoteEidPrefixBased; + private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.remote.mappings.remote.mapping.Eid + remoteEidPrefixBasedNormalized; private org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid mappingEid; + private org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid + mappingEidPrefixBased; private MappingId mappingId; + private MappingId mappingIdPrefixBased; @Before public void init() { @@ -55,11 +66,24 @@ public class EidMappingContextTest implements EidMappingContextHelper { localEid = new EidBuilder().setAddress(new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build()).build(); + + localPrefixBasedEid = new EidBuilder().setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix("192.168.2.2/24")) + .build()).build(); + + localPrefixBasedEidNormalized = new EidBuilder().setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix("192.168.2.0/24")) + .build()).build(); + remoteEid = fromLocalToRemoteEid(localEid); + remoteEidPrefixBased = fromLocalToRemoteEid(localPrefixBasedEid); + remoteEidPrefixBasedNormalized = fromLocalToRemoteEid(localPrefixBasedEidNormalized); + mappingEidPrefixBased = fromLocalToMappingEid(localPrefixBasedEidNormalized); mappingEid = fromLocalToMappingEid(localEid); mappingId = new MappingId("mapping"); - + mappingIdPrefixBased = new MappingId("mappingIdPrefixBased"); defineEidMapping(mappingContext, mappingEid, mappingId, EID_MAPPING_CONTEXT_NAME); + defineEidMapping(mappingContext, mappingEidPrefixBased, mappingIdPrefixBased, EID_MAPPING_CONTEXT_NAME); } @Test @@ -72,20 +96,36 @@ public class EidMappingContextTest implements EidMappingContextHelper { } @Test + public void testContainsEidPrefixBased() { + assertTrue(eidMappingContext.containsEid(mappingIdPrefixBased, mappingContext)); + org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid + loadedEid = eidMappingContext.getEid(mappingIdPrefixBased, mappingContext); + + assertEquals("192.168.2.0/24", ((Ipv4Prefix) (loadedEid.getAddress())).getIpv4Prefix().getValue()); + } + + @Test public void testContainsId() { assertTrue(eidMappingContext.containsId(localEid, mappingContext)); assertTrue(eidMappingContext.containsId(remoteEid, mappingContext)); + // detects both normalized and non-normalized form + assertTrue(eidMappingContext.containsId(localPrefixBasedEid, mappingContext)); + assertTrue(eidMappingContext.containsId(localPrefixBasedEidNormalized, mappingContext)); } @Test public void testGetEid() { assertEquals(mappingEid, eidMappingContext.getEid(mappingId, mappingContext)); + assertEquals(mappingEidPrefixBased, eidMappingContext.getEid(mappingIdPrefixBased, mappingContext)); } @Test public void testGetId() { assertEquals(mappingId, eidMappingContext.getId(localEid, mappingContext)); assertEquals(mappingId, eidMappingContext.getId(remoteEid, mappingContext)); + // detects both normalized and non-normalized form + assertEquals(mappingIdPrefixBased, eidMappingContext.getId(localPrefixBasedEid, mappingContext)); + assertEquals(mappingIdPrefixBased, eidMappingContext.getId(localPrefixBasedEidNormalized, mappingContext)); } @Test @@ -98,6 +138,17 @@ public class EidMappingContextTest implements EidMappingContextHelper { } @Test + public void testAddEidLocalPrefixBased() { + eidMappingContext.addEid(mappingIdPrefixBased, localPrefixBasedEid, mappingContext); + final org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid eid = eidMappingContext.getEid(mappingIdPrefixBased, mappingContext); + + // verify if normalized + assertEquals(localPrefixBasedEidNormalized.getAddress(), eid.getAddress()); + assertEquals(localEid.getAddressType(), eid.getAddressType()); + assertEquals(localEid.getVirtualNetworkId(), eid.getVirtualNetworkId()); + } + + @Test public void testAddEidRemote() { eidMappingContext.addEid(mappingId, remoteEid, mappingContext); final org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid eid = eidMappingContext.getEid(mappingId, mappingContext); @@ -106,6 +157,17 @@ public class EidMappingContextTest implements EidMappingContextHelper { assertEquals(remoteEid.getVirtualNetworkId(), eid.getVirtualNetworkId()); } + @Test + public void testAddEidRemotePrefixBased() { + eidMappingContext.addEid(mappingIdPrefixBased, remoteEidPrefixBased, mappingContext); + final org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid eid = eidMappingContext.getEid(mappingIdPrefixBased, mappingContext); + + // verify if normalized + assertEquals(remoteEidPrefixBasedNormalized.getAddress(), eid.getAddress()); + assertEquals(remoteEid.getAddressType(), eid.getAddressType()); + assertEquals(remoteEid.getVirtualNetworkId(), eid.getVirtualNetworkId()); + } + private org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.Eid fromLocalToMappingEid( Eid eid) { return new org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping.context.rev160801.contexts.eid.mapping.context.mappings.mapping.EidBuilder() diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/AdjacencyData.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/AdjacencyData.java index cc3581ae4..6e011fd48 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/AdjacencyData.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/AdjacencyData.java @@ -22,6 +22,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder; public class AdjacencyData { @@ -32,6 +33,11 @@ public class AdjacencyData { public static final Ipv4Address ADDRESS_THREE = new Ipv4Address("192.168.2.3"); public static final Ipv4Address ADDRESS_FOUR = new Ipv4Address("192.168.2.4"); + public static final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix PREFIX_ADDRESS_ONE = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix("192.168.2.1/24"); + public static final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix PREFIX_ADDRESS_TWO = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix("192.168.2.2/28"); + public static final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix PREFIX_ADDRESS_THREE = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix("192.168.2.3/16"); + public static final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix PREFIX_ADDRESS_FOUR = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix("192.168.2.4/8"); + public static final Eid LOCAL_EID_ONE = new EidBuilder() .setAddressType(Ipv4Afi.class) .setVirtualNetworkId(new InstanceIdType(VNI)) @@ -55,5 +61,26 @@ public class AdjacencyData { .setAddress(new Ipv4Builder().setIpv4(ADDRESS_FOUR).build()) .build(); + public static final Eid LOCAL_EID_PREFIX_ONE = new EidBuilder() + .setAddressType(Ipv4Afi.class) + .setVirtualNetworkId(new InstanceIdType(VNI)) + .setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(PREFIX_ADDRESS_ONE).build()) + .build(); + + public static final Eid LOCAL_EID_PREFIX_TWO = new EidBuilder() + .setAddressType(Ipv4Afi.class) + .setVirtualNetworkId(new InstanceIdType(VNI)) + .setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(PREFIX_ADDRESS_TWO).build()) + .build(); + public static final Eid REMOTE_EID_PREFIX_ONE = new EidBuilder() + .setAddressType(Ipv4Afi.class) + .setVirtualNetworkId(new InstanceIdType(VNI)) + .setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(PREFIX_ADDRESS_THREE).build()) + .build(); + public static final Eid REMOTE_EID_PREFIX_TWO = new EidBuilder() + .setAddressType(Ipv4Afi.class) + .setVirtualNetworkId(new InstanceIdType(VNI)) + .setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(PREFIX_ADDRESS_FOUR).build()) + .build(); } diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizerTest.java index ad65a7604..92c5abcfe 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizerTest.java @@ -19,8 +19,12 @@ package io.fd.hc2vpp.lisp.translate.read; import static io.fd.hc2vpp.lisp.translate.AdjacencyData.ADDRESS_ONE; import static io.fd.hc2vpp.lisp.translate.AdjacencyData.ADDRESS_THREE; import static io.fd.hc2vpp.lisp.translate.AdjacencyData.LOCAL_EID_ONE; +import static io.fd.hc2vpp.lisp.translate.AdjacencyData.LOCAL_EID_PREFIX_ONE; +import static io.fd.hc2vpp.lisp.translate.AdjacencyData.LOCAL_EID_PREFIX_TWO; import static io.fd.hc2vpp.lisp.translate.AdjacencyData.LOCAL_EID_TWO; import static io.fd.hc2vpp.lisp.translate.AdjacencyData.REMOTE_EID_ONE; +import static io.fd.hc2vpp.lisp.translate.AdjacencyData.REMOTE_EID_PREFIX_ONE; +import static io.fd.hc2vpp.lisp.translate.AdjacencyData.REMOTE_EID_PREFIX_TWO; import static io.fd.hc2vpp.lisp.translate.AdjacencyData.REMOTE_EID_TWO; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; @@ -43,6 +47,7 @@ import java.util.List; import org.junit.Before; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.MappingId; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.adjacencies.grouping.Adjacencies; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.adjacencies.grouping.AdjacenciesBuilder; @@ -63,6 +68,8 @@ public class AdjacencyCustomizerTest extends ListReaderCustomizerTest<Adjacency, AdjacencyKey, AdjacencyBuilder> implements ByteDataTranslator, EidMetadataProvider, EidMappingContextHelper, AdjacencyMappingContextTestHelper { + public static final String NORMALIZED_PREFIX_ONE = "192.168.2.0/24"; + public static final String NORMALIZED_PREFIX_THREE = "192.168.0.0/16"; private InstanceIdentifier<Adjacency> identifier; public AdjacencyCustomizerTest() { @@ -78,23 +85,30 @@ public class AdjacencyCustomizerTest .child(RemoteMapping.class, new RemoteMappingKey(new MappingId("remote-mapping"))) .child(Adjacencies.class) .child(Adjacency.class, new AdjacencyKey("adj-one")); + defineAdjacencyMapping(mappingContext, "local-eid-one", "remote-eid-one", "adj-one", + "adjacencies-mapping-context"); + defineAdjacencyMapping(mappingContext, "local-eid-two", "remote-eid-two", "adj-two", + "adjacencies-mapping-context"); + } - - mockApi(); + private void defineEidAddressMapping() { defineEidMapping(mappingContext, LOCAL_EID_ONE, new MappingId("local-eid-one"), "local-mapping-context"); defineEidMapping(mappingContext, LOCAL_EID_TWO, new MappingId("local-eid-two"), "local-mapping-context"); defineEidMapping(mappingContext, REMOTE_EID_ONE, new MappingId("remote-eid-one"), "remote-mapping-context"); defineEidMapping(mappingContext, REMOTE_EID_TWO, new MappingId("remote-eid-two"), "remote-mapping-context"); + } - defineAdjacencyMapping(mappingContext, "local-eid-one", "remote-eid-one", "adj-one", - "adjacencies-mapping-context"); - defineAdjacencyMapping(mappingContext, "local-eid-two", "remote-eid-two", "adj-two", - "adjacencies-mapping-context"); - mockApi(); + private void defineEidPrefixMapping() { + defineEidMapping(mappingContext, LOCAL_EID_PREFIX_ONE, new MappingId("local-eid-one"), "local-mapping-context"); + defineEidMapping(mappingContext, LOCAL_EID_PREFIX_TWO, new MappingId("local-eid-two"), "local-mapping-context"); + defineEidMapping(mappingContext, REMOTE_EID_PREFIX_ONE, new MappingId("remote-eid-one"), "remote-mapping-context"); + defineEidMapping(mappingContext, REMOTE_EID_PREFIX_TWO, new MappingId("remote-eid-two"), "remote-mapping-context"); } @Test public void getAllIds() throws Exception { + mockAddressDump(); + defineEidAddressMapping(); final List<AdjacencyKey> keys = getCustomizer().getAllIds(identifier, ctx); assertThat(keys, hasSize(2)); @@ -103,6 +117,8 @@ public class AdjacencyCustomizerTest @Test public void readCurrentAttributes() throws Exception { + mockAddressDump(); + defineEidAddressMapping(); final AdjacencyBuilder builder = new AdjacencyBuilder(); getCustomizer().readCurrentAttributes(identifier, builder, ctx); @@ -113,6 +129,21 @@ public class AdjacencyCustomizerTest Ipv4.class.cast(builder.getRemoteEid().getAddress()).getIpv4().getValue()); } + @Test + public void readCurrentAttributesPrefixBased() throws Exception { + mockPrefixDump(); + defineEidPrefixMapping(); + final AdjacencyBuilder builder = new AdjacencyBuilder(); + getCustomizer().readCurrentAttributes(identifier, builder, ctx); + + assertEquals("adj-one", builder.getId()); + assertEquals(new AdjacencyKey("adj-one"), builder.getKey()); + assertEquals(NORMALIZED_PREFIX_ONE, + Ipv4Prefix.class.cast(builder.getLocalEid().getAddress()).getIpv4Prefix().getValue()); + assertEquals(NORMALIZED_PREFIX_THREE, + Ipv4Prefix.class.cast(builder.getRemoteEid().getAddress()).getIpv4Prefix().getValue()); + } + @Override protected ReaderCustomizer<Adjacency, AdjacencyBuilder> initCustomizer() { return new AdjacencyCustomizer(api, new EidMappingContext("local-mapping-context", "local-mapping-"), @@ -121,7 +152,7 @@ public class AdjacencyCustomizerTest } - private void mockApi() { + private void mockAddressDump() { OneAdjacency adjacencyOne = new OneAdjacency(); adjacencyOne.eidType = 0; adjacencyOne.leid = new byte[]{-64, -88, 2, 1}; @@ -142,4 +173,26 @@ public class AdjacencyCustomizerTest when(api.oneAdjacenciesGet(any())).thenReturn(future(reply)); } + + private void mockPrefixDump() { + OneAdjacency adjacencyOne = new OneAdjacency(); + adjacencyOne.eidType = 0; + adjacencyOne.leid = new byte[]{-64, -88, 2, 1}; + adjacencyOne.leidPrefixLen = 24; + adjacencyOne.reid = new byte[]{-64, -88, 2, 3}; + adjacencyOne.reidPrefixLen = 16; + + + OneAdjacency adjacencyTwo = new OneAdjacency(); + adjacencyTwo.eidType = 0; + adjacencyTwo.leid = new byte[]{-64, -88, 2, 2}; + adjacencyTwo.leidPrefixLen = 28; + adjacencyTwo.reid = new byte[]{-64, -88, 2, 4}; + adjacencyTwo.reidPrefixLen = 8; + + OneAdjacenciesGetReply reply = new OneAdjacenciesGetReply(); + reply.adjacencies = new OneAdjacency[]{adjacencyOne, adjacencyTwo}; + + when(api.oneAdjacenciesGet(any())).thenReturn(future(reply)); + } }
\ No newline at end of file diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizerTest.java index 53fbc568b..11fe30dc5 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizerTest.java @@ -17,6 +17,7 @@ package io.fd.hc2vpp.lisp.translate.read; import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4; +import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4_PREFIX; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.Matchers.any; @@ -40,6 +41,8 @@ import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.HmacKeyType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.MappingId; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.LocalMappings; @@ -61,6 +64,9 @@ public class LocalMappingCustomizerTest extends private static final Ipv4 EID_ADDRESS = new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build(); + private static final Ipv4Prefix + EID_V4_PREFIX_ADDRESS = new Ipv4PrefixBuilder().setIpv4Prefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix("192.168.2.1/28")).build(); + @Mock private EidMappingContext localMappingContext; @@ -84,11 +90,9 @@ public class LocalMappingCustomizerTest extends .child(VrfSubtable.class) .child(LocalMappings.class) .child(LocalMapping.class, new LocalMappingKey(new MappingId("local-mapping"))); - - defineMappings(); } - private void defineDumpData() { + private void defineV4AddressDumpData() { OneEidTableDetailsReplyDump replyDump = new OneEidTableDetailsReplyDump(); OneEidTableDetails detail = new OneEidTableDetails(); detail.action = 0; @@ -96,7 +100,27 @@ public class LocalMappingCustomizerTest extends detail.context = 4; detail.eid = new byte[]{-64, -88, 2, 1}; detail.eidPrefixLen = 32; - detail.eidType = (byte) IPV4.getValue(); + detail.eidType = (byte) IPV4.getVppTypeBinding(); + detail.isLocal = 1; + detail.locatorSetIndex = 1; + detail.ttl = 7; + detail.vni = 12; + detail.key = "abcdefgh".getBytes(StandardCharsets.UTF_8); + detail.keyId = 1; + + replyDump.oneEidTableDetails = ImmutableList.of(detail); + when(api.oneEidTableDump(any())).thenReturn(future(replyDump)); + } + + private void defineV4PrefixDumpData() { + OneEidTableDetailsReplyDump replyDump = new OneEidTableDetailsReplyDump(); + OneEidTableDetails detail = new OneEidTableDetails(); + detail.action = 0; + detail.authoritative = 1; + detail.context = 4; + detail.eid = new byte[]{-64, -88, 2, 1}; + detail.eidPrefixLen = 28; + detail.eidType = (byte) IPV4_PREFIX.getVppTypeBinding(); detail.isLocal = 1; detail.locatorSetIndex = 1; detail.ttl = 7; @@ -116,7 +140,7 @@ public class LocalMappingCustomizerTest extends detail.context = 4; detail.eid = new byte[]{-64, -88, 2, 1}; detail.eidPrefixLen = 32; - detail.eidType = (byte) IPV4.getValue(); + detail.eidType = (byte) IPV4.getVppTypeBinding(); detail.isLocal = 1; detail.locatorSetIndex = 1; detail.ttl = 7; @@ -126,7 +150,7 @@ public class LocalMappingCustomizerTest extends when(api.oneEidTableDump(any())).thenReturn(future(replyDump)); } - private void defineMappings() { + private void defineAddressMappings() { //eid mapping when(localMappingContext.getId(any(Eid.class), any(MappingContext.class))) @@ -138,8 +162,21 @@ public class LocalMappingCustomizerTest extends defineMapping(mappingContext, "loc-set", 1, "locator-set-context"); } + private void definePrefixMappings() { + //eid mapping + + when(localMappingContext.getId(any(Eid.class), any(MappingContext.class))) + .thenReturn(new MappingId("local-mapping")); + when(localMappingContext.containsEid(new MappingId("local-mapping"), mappingContext)).thenReturn(true); + when(localMappingContext.getEid(new MappingId("local-mapping"), mappingContext)).thenReturn(new EidBuilder() + .setAddress(EID_V4_PREFIX_ADDRESS).build()); + //naming context for locator + defineMapping(mappingContext, "loc-set", 1, "locator-set-context"); + } + @Test public void readCurrentAttributesNoHmacKey() throws ReadFailedException { + defineAddressMappings(); defineDumpDataNoHmacKey(); LocalMappingBuilder builder = new LocalMappingBuilder(); @@ -155,7 +192,8 @@ public class LocalMappingCustomizerTest extends @Test public void readCurrentAttributes() throws Exception { - defineDumpData(); + defineAddressMappings(); + defineV4AddressDumpData(); LocalMappingBuilder builder = new LocalMappingBuilder(); getCustomizer().readCurrentAttributes(validIdentifier, builder, ctx); @@ -171,8 +209,27 @@ public class LocalMappingCustomizerTest extends } @Test + public void readCurrentAttributesPrefixBased() throws Exception { + definePrefixMappings(); + defineV4PrefixDumpData(); + LocalMappingBuilder builder = new LocalMappingBuilder(); + getCustomizer().readCurrentAttributes(validIdentifier, builder, ctx); + + final LocalMapping mapping = builder.build(); + + assertNotNull(mapping); + assertEquals(true, compareAddresses(EID_V4_PREFIX_ADDRESS, mapping.getEid().getAddress())); + assertEquals("loc-set", mapping.getLocatorSet()); + + final HmacKey hmacKey = mapping.getHmacKey(); + assertEquals("abcdefgh", hmacKey.getKey()); + assertEquals(HmacKeyType.Sha196Key, hmacKey.getKeyType()); + } + + @Test public void getAllIds() throws Exception { - defineDumpData(); + defineAddressMappings(); + defineV4AddressDumpData(); final List<LocalMappingKey> keys = getCustomizer().getAllIds(emptyIdentifier, ctx); assertEquals(1, keys.size()); diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizerTest.java index 59caeb03a..d239f379b 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizerTest.java @@ -42,6 +42,8 @@ import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.eid.mapping import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder; 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.MappingId; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.RemoteMappings; @@ -66,6 +68,9 @@ public class RemoteMappingCustomizerTest private static final Ipv4 EID_ADDRESS = new Ipv4Builder().setIpv4(new Ipv4Address("192.168.2.1")).build(); + private static final Ipv4Prefix + EID_V4_PREFIX_ADDRESS = new Ipv4PrefixBuilder().setIpv4Prefix(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix("192.168.2.1/24")).build(); + @Mock private EidMappingContext eidMappingContext; @@ -83,12 +88,11 @@ public class RemoteMappingCustomizerTest .child(VrfSubtable.class) .child(RemoteMappings.class) .child(RemoteMapping.class, new RemoteMappingKey(new MappingId("remote-mapping"))); - mockMappings(); defineMapping(mappingContext,"loc-set",1,"loc-set-context"); } - private void mockDumpDataActionZero() { + private void mockDumpDataAddressActionZero() { OneEidTableDetailsReplyDump replyDump = new OneEidTableDetailsReplyDump(); OneEidTableDetails detail = new OneEidTableDetails(); detail.action = 0; @@ -110,7 +114,29 @@ public class RemoteMappingCustomizerTest when(api.oneLocatorDump(any())).thenReturn(future(rlocs)); } - private void mockDumpDataActionOne() { + private void mockDumpDataPrefixActionZero() { + OneEidTableDetailsReplyDump replyDump = new OneEidTableDetailsReplyDump(); + OneEidTableDetails detail = new OneEidTableDetails(); + detail.action = 0; + detail.authoritative = 1; + detail.context = 4; + detail.eid = new byte[]{-64, -88, 2, 1}; + detail.eidPrefixLen = 24; + detail.isLocal = 0; + detail.locatorSetIndex = -1; + detail.ttl = 7; + detail.vni = 12; + + replyDump.oneEidTableDetails = ImmutableList.of(detail); + + when(api.oneEidTableDump(any())).thenReturn(future(replyDump)); + + OneLocatorDetailsReplyDump rlocs = new OneLocatorDetailsReplyDump(); + rlocs.oneLocatorDetails = Collections.emptyList(); + when(api.oneLocatorDump(any())).thenReturn(future(rlocs)); + } + + private void mockDumpDataAddressActionOne() { OneEidTableDetailsReplyDump replyDump = new OneEidTableDetailsReplyDump(); OneEidTableDetails detail = new OneEidTableDetails(); detail.action = 1; @@ -158,19 +184,28 @@ public class RemoteMappingCustomizerTest } - private void mockMappings() { + private void mockAddressMappings() { when(eidMappingContext.getId(any(Eid.class), any(MappingContext.class))) .thenReturn(new MappingId("remote-mapping")); when(eidMappingContext.containsEid(new MappingId("remote-mapping"), mappingContext)).thenReturn(true); when(eidMappingContext.getEid(new MappingId("remote-mapping"), mappingContext)) .thenReturn(new EidBuilder().setAddress(EID_ADDRESS).build()); + } + + private void mockPrefixMappings() { + when(eidMappingContext.getId(any(Eid.class), any(MappingContext.class))) + .thenReturn(new MappingId("remote-mapping")); + when(eidMappingContext.containsEid(new MappingId("remote-mapping"), mappingContext)).thenReturn(true); + when(eidMappingContext.getEid(new MappingId("remote-mapping"), mappingContext)) + .thenReturn(new EidBuilder().setAddress(EID_V4_PREFIX_ADDRESS).build()); } @Test public void readCurrentAttributesNegativeMappingOne() throws Exception { - mockDumpDataActionOne(); + mockAddressMappings(); + mockDumpDataAddressActionOne(); RemoteMappingBuilder builder = new RemoteMappingBuilder(); getCustomizer().readCurrentAttributes(validId, builder, ctx); @@ -187,7 +222,8 @@ public class RemoteMappingCustomizerTest @Test public void readCurrentAttributesNegativeMappingZero() throws Exception { - mockDumpDataActionZero(); + mockAddressMappings(); + mockDumpDataAddressActionZero(); RemoteMappingBuilder builder = new RemoteMappingBuilder(); getCustomizer().readCurrentAttributes(validId, builder, ctx); @@ -202,7 +238,25 @@ public class RemoteMappingCustomizerTest } @Test + public void readCurrentAttributesPrefixBasedNegativeMappingZero() throws Exception { + mockPrefixMappings(); + mockDumpDataPrefixActionZero(); + RemoteMappingBuilder builder = new RemoteMappingBuilder(); + getCustomizer().readCurrentAttributes(validId, builder, ctx); + + RemoteMapping mapping = builder.build(); + + assertNotNull(mapping); + assertEquals(true, compareAddresses(EID_V4_PREFIX_ADDRESS, mapping.getEid().getAddress())); + assertEquals(true, mapping.getAuthoritative().isA()); + assertEquals(7L, mapping.getTtl().longValue()); + assertEquals(MapReplyAction.NoAction, + ((NegativeMapping) mapping.getLocatorList()).getMapReply().getMapReplyAction()); + } + + @Test public void readCurrentAttributesPositiveMapping() throws Exception { + mockAddressMappings(); mockDumpDataActionZeroWithRemotes(); RemoteMappingBuilder builder = new RemoteMappingBuilder(); getCustomizer().readCurrentAttributes(validId, builder, ctx); @@ -223,10 +277,10 @@ public class RemoteMappingCustomizerTest assertEquals(2, locator.getWeight().shortValue()); } - @Test public void getAllIds() throws Exception { - mockDumpDataActionOne(); + mockAddressMappings(); + mockDumpDataAddressActionOne(); final List<RemoteMappingKey> keys = getCustomizer().getAllIds(validId, ctx); assertNotNull(keys); diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/util/EidTranslatorTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/util/EidTranslatorTest.java index 096eca7fd..6e09f2faa 100755 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/util/EidTranslatorTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/util/EidTranslatorTest.java @@ -16,23 +16,39 @@ package io.fd.hc2vpp.lisp.translate.util; +import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4; +import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4_PREFIX; +import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6; +import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV6_PREFIX; +import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.MAC; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4PrefixAfi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6Afi; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6PrefixAfi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.*; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix; +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.Mac; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.MacBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.adjacencies.grouping.adjacencies.adjacency.LocalEid; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.adjacencies.grouping.adjacencies.adjacency.RemoteEid; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.remote.mappings.remote.mapping.Eid; -import java.util.Arrays; - -import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.*; -import static org.junit.Assert.*; - public class EidTranslatorTest implements EidTranslator { private static final String MAC_STRING = "bf:bf:bf:bf:bf:bf"; @@ -50,6 +66,8 @@ public class EidTranslatorTest implements EidTranslator { new Ipv4Address(IPV4_STRING)) .build(); private static final byte[] IPV_ADDRESS_BYTES = {-64, -88, 2, 1}; + private static final String NORMALIZED_V6_PREFIX = "2001:db8:a0b:12f0::/64"; + private static final String NORMALIZED_V4_PREFIX = "192.168.2.0/24"; @Test public void testGetEidType() { @@ -68,33 +86,53 @@ public class EidTranslatorTest implements EidTranslator { @Test public void testGetPrefixLength() { - assertEquals(32, getPrefixLength(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder() - .setAddress(IPV4_ADDRESS).build())); - assertEquals(-128, getPrefixLength(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder() - .setAddress(IPV6_ADDRESS).build())); - assertEquals(0, getPrefixLength(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder() - .setAddress(MAC_ADDRES).build())); + assertEquals(32, getPrefixLength( + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder() + .setAddress(IPV4_ADDRESS).build())); + assertEquals(-128, getPrefixLength( + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder() + .setAddress(IPV6_ADDRESS).build())); + assertEquals(0, getPrefixLength( + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.dp.subtable.grouping.local.mappings.local.mapping.EidBuilder() + .setAddress(MAC_ADDRES).build())); } @Test public void testGetArrayAsEidRemoteIpv4() { - final Eid eid = getArrayAsEidRemote(IPV4, IPV_ADDRESS_BYTES, 10); + final Eid eid = getArrayAsEidRemote(IPV4, IPV_ADDRESS_BYTES, DEFAULT_V4_PREFIX, 10); assertEquals(IPV4_STRING, ((Ipv4) eid.getAddress()).getIpv4().getValue()); assertEquals(10, eid.getVirtualNetworkId().getValue().intValue()); assertEquals(Ipv4Afi.class, eid.getAddressType()); } @Test + public void testGetArrayAsEidRemoteIpv4Prefix() { + final Eid eid = getArrayAsEidRemote(IPV4_PREFIX, IPV_ADDRESS_BYTES, (byte) 24, 10); + assertEquals(NORMALIZED_V4_PREFIX, ((Ipv4Prefix) eid.getAddress()).getIpv4Prefix().getValue()); + assertEquals(10, eid.getVirtualNetworkId().getValue().intValue()); + assertEquals(Ipv4PrefixAfi.class, eid.getAddressType()); + } + + @Test public void testGetArrayAsEidRemoteIpv6() { - final Eid eid = getArrayAsEidRemote(IPV6, IPV6_ADDRESS_BYTES, 12); + final Eid eid = getArrayAsEidRemote(IPV6, IPV6_ADDRESS_BYTES, DEFAULT_V6_PREFIX, 12); assertEquals(IPV6_STRING, ((Ipv6) eid.getAddress()).getIpv6().getValue()); assertEquals(12, eid.getVirtualNetworkId().getValue().intValue()); assertEquals(Ipv6Afi.class, eid.getAddressType()); } @Test + public void testGetArrayAsEidRemoteIpv6Prefix() { + final Eid eid = getArrayAsEidRemote(IPV6_PREFIX, IPV6_ADDRESS_BYTES, (byte) 64, 12); + assertEquals(NORMALIZED_V6_PREFIX, ((Ipv6Prefix) eid.getAddress()).getIpv6Prefix().getValue()); + assertEquals(12, eid.getVirtualNetworkId().getValue().intValue()); + assertEquals(Ipv6PrefixAfi.class, eid.getAddressType()); + } + + + @Test public void testGetArrayAsEidRemoteMac() { - final Eid eid = getArrayAsEidRemote(MAC, MAC_ADDRESS_BYTES, 13); + final Eid eid = getArrayAsEidRemote(MAC, MAC_ADDRESS_BYTES, (byte) 0, 13); assertEquals(MAC_STRING, ((Mac) eid.getAddress()).getMac().getValue()); assertEquals(13, eid.getVirtualNetworkId().getValue().intValue()); assertEquals(MacAfi.class, eid.getAddressType()); @@ -102,23 +140,39 @@ public class EidTranslatorTest implements EidTranslator { @Test public void testGetArrayAsLocalEidIpv4() { - final LocalEid eid = getArrayAsLocalEid(IPV4, IPV_ADDRESS_BYTES, 10); + final LocalEid eid = getArrayAsLocalEid(IPV4, IPV_ADDRESS_BYTES, DEFAULT_V4_PREFIX, 10); assertEquals(IPV4_STRING, ((Ipv4) eid.getAddress()).getIpv4().getValue()); assertEquals(10, eid.getVirtualNetworkId().getValue().intValue()); assertEquals(Ipv4Afi.class, eid.getAddressType()); } @Test + public void testGetArrayAsLocalEidIpv4Prefix() { + final LocalEid eid = getArrayAsLocalEid(IPV4_PREFIX, IPV_ADDRESS_BYTES, (byte) 24, 10); + assertEquals(NORMALIZED_V4_PREFIX, ((Ipv4Prefix) eid.getAddress()).getIpv4Prefix().getValue()); + assertEquals(10, eid.getVirtualNetworkId().getValue().intValue()); + assertEquals(Ipv4PrefixAfi.class, eid.getAddressType()); + } + + @Test public void testGetArrayAsLocalEidIpv6() { - final LocalEid eid = getArrayAsLocalEid(IPV6, IPV6_ADDRESS_BYTES, 12); + final LocalEid eid = getArrayAsLocalEid(IPV6, IPV6_ADDRESS_BYTES, DEFAULT_V6_PREFIX, 12); assertEquals(IPV6_STRING, ((Ipv6) eid.getAddress()).getIpv6().getValue()); assertEquals(12, eid.getVirtualNetworkId().getValue().intValue()); assertEquals(Ipv6Afi.class, eid.getAddressType()); } @Test + public void testGetArrayAsLocalEidIpv6Prefix() { + final LocalEid eid = getArrayAsLocalEid(IPV6_PREFIX, IPV6_ADDRESS_BYTES, (byte) 64, 12); + assertEquals(NORMALIZED_V6_PREFIX, ((Ipv6Prefix) eid.getAddress()).getIpv6Prefix().getValue()); + assertEquals(12, eid.getVirtualNetworkId().getValue().intValue()); + assertEquals(Ipv6PrefixAfi.class, eid.getAddressType()); + } + + @Test public void testGetArrayAsLocalEidMac() { - final LocalEid eid = getArrayAsLocalEid(MAC, MAC_ADDRESS_BYTES, 13); + final LocalEid eid = getArrayAsLocalEid(MAC, MAC_ADDRESS_BYTES, (byte) 0, 13); assertEquals(MAC_STRING, ((Mac) eid.getAddress()).getMac().getValue()); assertEquals(13, eid.getVirtualNetworkId().getValue().intValue()); assertEquals(MacAfi.class, eid.getAddressType()); @@ -126,23 +180,39 @@ public class EidTranslatorTest implements EidTranslator { @Test public void testGetArrayAsRemoteEidIpv4() { - final RemoteEid eid = getArrayAsRemoteEid(IPV4, IPV_ADDRESS_BYTES, 10); + final RemoteEid eid = getArrayAsRemoteEid(IPV4, IPV_ADDRESS_BYTES, DEFAULT_V4_PREFIX, 10); assertEquals(IPV4_STRING, ((Ipv4) eid.getAddress()).getIpv4().getValue()); assertEquals(10, eid.getVirtualNetworkId().getValue().intValue()); assertEquals(Ipv4Afi.class, eid.getAddressType()); } @Test + public void testGetArrayAsRemoteEidIpv4Prefix() { + final RemoteEid eid = getArrayAsRemoteEid(IPV4_PREFIX, IPV_ADDRESS_BYTES, (byte) 24, 10); + assertEquals(NORMALIZED_V4_PREFIX, ((Ipv4Prefix) eid.getAddress()).getIpv4Prefix().getValue()); + assertEquals(10, eid.getVirtualNetworkId().getValue().intValue()); + assertEquals(Ipv4PrefixAfi.class, eid.getAddressType()); + } + + @Test public void testGetArrayAsRemoteEidIpv6() { - final RemoteEid eid = getArrayAsRemoteEid(IPV6, IPV6_ADDRESS_BYTES, 12); + final RemoteEid eid = getArrayAsRemoteEid(IPV6, IPV6_ADDRESS_BYTES, DEFAULT_V6_PREFIX, 12); assertEquals(IPV6_STRING, ((Ipv6) eid.getAddress()).getIpv6().getValue()); assertEquals(12, eid.getVirtualNetworkId().getValue().intValue()); assertEquals(Ipv6Afi.class, eid.getAddressType()); } @Test + public void testGetArrayAsRemoteEidIpv6Prefix() { + final RemoteEid eid = getArrayAsRemoteEid(IPV6_PREFIX, IPV6_ADDRESS_BYTES, (byte) 64, 12); + assertEquals(NORMALIZED_V6_PREFIX, ((Ipv6Prefix) eid.getAddress()).getIpv6Prefix().getValue()); + assertEquals(12, eid.getVirtualNetworkId().getValue().intValue()); + assertEquals(Ipv6PrefixAfi.class, eid.getAddressType()); + } + + @Test public void testGetArrayAsRemoteEidMac() { - final RemoteEid eid = getArrayAsRemoteEid(MAC, MAC_ADDRESS_BYTES, 13); + final RemoteEid eid = getArrayAsRemoteEid(MAC, MAC_ADDRESS_BYTES, (byte) 0, 13); assertEquals(MAC_STRING, ((Mac) eid.getAddress()).getMac().getValue()); assertEquals(13, eid.getVirtualNetworkId().getValue().intValue()); assertEquals(MacAfi.class, eid.getAddressType()); @@ -150,17 +220,27 @@ public class EidTranslatorTest implements EidTranslator { @Test public void testGetArrayAsEidStringIpv4() { - assertEquals(IPV4_STRING, getArrayAsEidString(IPV4, IPV_ADDRESS_BYTES)); + assertEquals(IPV4_STRING, getArrayAsEidString(IPV4, IPV_ADDRESS_BYTES, DEFAULT_V4_PREFIX)); + } + + @Test + public void testGetArrayAsEidStringIpv4Prefix() { + assertEquals(NORMALIZED_V4_PREFIX, getArrayAsEidString(IPV4, IPV_ADDRESS_BYTES, (byte) 24)); } @Test public void testGetArrayAsEidStringIpv6() { - assertEquals(IPV6_STRING, getArrayAsEidString(IPV6, IPV6_ADDRESS_BYTES)); + assertEquals(IPV6_STRING, getArrayAsEidString(IPV6, IPV6_ADDRESS_BYTES, DEFAULT_V6_PREFIX)); + } + + @Test + public void testGetArrayAsEidStringIpv6Prefix() { + assertEquals(NORMALIZED_V6_PREFIX, getArrayAsEidString(IPV6, IPV6_ADDRESS_BYTES, (byte) 64)); } @Test public void testGetArrayAsEidStringMac() { - assertEquals(MAC_STRING, getArrayAsEidString(MAC, MAC_ADDRESS_BYTES)); + assertEquals(MAC_STRING, getArrayAsEidString(MAC, MAC_ADDRESS_BYTES, (byte) 0)); } @Test @@ -191,4 +271,48 @@ public class EidTranslatorTest implements EidTranslator { assertFalse(compareAddresses(IPV4_ADDRESS, IPV6_ADDRESS)); assertFalse(compareAddresses(IPV4_ADDRESS, MAC_ADDRES)); } + + @Test + public void testCompareV4AddressFromSameSubnetPositive() { + final Ipv4Prefix firstV4 = new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix("192.168.2.1/24")).build(); + final Ipv4Prefix secondV4 = new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix("192.168.2.2/24")).build(); + + assertTrue(compareAddresses(firstV4, secondV4)); + } + + @Test + public void testCompareV4AddressFromSameSubnetNegative() { + final Ipv4Prefix firstV4 = new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix("192.168.2.1/24")).build(); + final Ipv4Prefix secondV4 = new Ipv4PrefixBuilder().setIpv4Prefix(v4Prefix("192.168.2.1/16")).build(); + + assertFalse(compareAddresses(firstV4, secondV4)); + } + + @Test + public void testCompareV6AddressesFromSameSubnetPositive() { + final Ipv6Prefix firstV6 = new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix("2001:db8:a0b:12f0::1/64")).build(); + final Ipv6Prefix secondV6 = new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix("2001:db8:a0b:12f0::4/64")).build(); + + assertTrue(compareAddresses(firstV6, secondV6)); + } + + @Test + public void testCompareV6AddressesFromSameSubnetNegative() { + final Ipv6Prefix firstV6 = new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix("2001:0db8:85a3:0000:0000:8a2e:0370:7334/64")).build(); + final Ipv6Prefix secondV6 = new Ipv6PrefixBuilder().setIpv6Prefix(v6Prefix("2001:0db8:85a3:0000:0000:8a2e:0370:7334/48")).build(); + + assertFalse(compareAddresses(firstV6, secondV6)); + } + + private static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix v6Prefix( + String v6Prefix) { + return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix( + v6Prefix); + } + + private static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix v4Prefix( + String v4Prefix) { + return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix( + v4Prefix); + } } diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/AdjacencyCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/AdjacencyCustomizerTest.java index bf19ae581..1c487e3ae 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/AdjacencyCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/AdjacencyCustomizerTest.java @@ -19,7 +19,9 @@ package io.fd.hc2vpp.lisp.translate.write; import static io.fd.hc2vpp.lisp.translate.AdjacencyData.ADDRESS_ONE; import static io.fd.hc2vpp.lisp.translate.AdjacencyData.ADDRESS_THREE; import static io.fd.hc2vpp.lisp.translate.AdjacencyData.LOCAL_EID_ONE; +import static io.fd.hc2vpp.lisp.translate.AdjacencyData.LOCAL_EID_PREFIX_ONE; import static io.fd.hc2vpp.lisp.translate.AdjacencyData.REMOTE_EID_ONE; +import static io.fd.hc2vpp.lisp.translate.AdjacencyData.REMOTE_EID_PREFIX_ONE; import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.EidType.IPV4; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -28,6 +30,7 @@ import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; @@ -42,10 +45,12 @@ import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.MacAfi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.MacBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.MappingId; @@ -81,9 +86,13 @@ public class AdjacencyCustomizerTest extends WriterCustomizerTest implements Eid private InstanceIdentifier<Adjacency> emptyId; private InstanceIdentifier<Adjacency> validId; - private Adjacency emptyData; + private Adjacency failDataBefore; + private Adjacency failDataAfter; + private Adjacency ignoreDataBefore; + private Adjacency ignoreDataAfter; private Adjacency invalidData; private Adjacency validData; + private Adjacency validDataPrefixBased; @Before public void init() { @@ -100,7 +109,41 @@ public class AdjacencyCustomizerTest extends WriterCustomizerTest implements Eid .child(Adjacencies.class) .child(Adjacency.class, new AdjacencyKey("adj-one")); - emptyData = new AdjacencyBuilder().build(); + failDataBefore = new AdjacencyBuilder().setLocalEid(new LocalEidBuilder() + .setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new Ipv4Prefix("192.168.2.1/24")) + .build()) + .build()).build(); + + failDataAfter = new AdjacencyBuilder().setLocalEid(new LocalEidBuilder() + .setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new Ipv4Prefix("192.168.2.1/16")) + .build()) + .build()).build(); + + ignoreDataBefore = new AdjacencyBuilder().setLocalEid(new LocalEidBuilder() + .setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new Ipv4Prefix("192.168.2.1/24")) + .build()) + .build()) + .setRemoteEid(new RemoteEidBuilder() + .setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new Ipv4Prefix("192.168.3.1/24")) + .build()) + .build()) + .build(); + + ignoreDataAfter = new AdjacencyBuilder().setLocalEid(new LocalEidBuilder() + .setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new Ipv4Prefix("192.168.2.0/24")) + .build()) + .build()) + .setRemoteEid(new RemoteEidBuilder() + .setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new Ipv4Prefix("192.168.3.4/24")) + .build()) + .build()) + .build(); invalidData = new AdjacencyBuilder().setId("ID").setLocalEid( new LocalEidBuilder() @@ -126,13 +169,25 @@ public class AdjacencyCustomizerTest extends WriterCustomizerTest implements Eid .setAddressType(Ipv4Afi.class) .setAddress(new Ipv4Builder().setIpv4(ADDRESS_THREE).build()).build()).build(); + validDataPrefixBased = new AdjacencyBuilder() + .setLocalEid(new LocalEidBuilder() + .setAddressType(LOCAL_EID_PREFIX_ONE.getAddressType()) + .setVirtualNetworkId(LOCAL_EID_PREFIX_ONE.getVirtualNetworkId()) + .setAddress(LOCAL_EID_PREFIX_ONE.getAddress()).build()) + .setRemoteEid(new RemoteEidBuilder() + .setVirtualNetworkId(REMOTE_EID_PREFIX_ONE.getVirtualNetworkId()) + .setAddressType(REMOTE_EID_PREFIX_ONE.getAddressType()) + .setAddress(REMOTE_EID_PREFIX_ONE.getAddress()) + .build()) + .build(); + when(api.oneAddDelAdjacency(any())).thenReturn(future(new OneAddDelAdjacencyReply())); } @Test public void writeCurrentAttributesNoKey() throws Exception { try { - customizer.writeCurrentAttributes(emptyId, emptyData, writeContext); + customizer.writeCurrentAttributes(emptyId, failDataBefore, writeContext); } catch (NullPointerException e) { verify(api, times(0)).oneAddDelAdjacency(any()); return; @@ -161,7 +216,19 @@ public class AdjacencyCustomizerTest extends WriterCustomizerTest implements Eid customizer.writeCurrentAttributes(validId, validData, writeContext); verify(api, times(1)).oneAddDelAdjacency(requestCaptor.capture()); verifyRequest(requestCaptor.getValue(), 1, new byte[]{-64, -88, 2, 1}, 32, new byte[]{-64, -88, 2, 3}, - 32, IPV4.getValue(), 2); + 32, IPV4.getVppTypeBinding(), 2); + verify(adjacenciesMappingContext, times(1)) + .addEidPair("adj-one", "local-eid-one", "remote-eid-one", mappingContext); + } + + @Test + public void writeCurrentAttributesPrefixBased() throws Exception { + defineEidMapping(mappingContext, LOCAL_EID_PREFIX_ONE, new MappingId("local-eid-one"), "local-mapping-context"); + defineEidMapping(mappingContext, REMOTE_EID_PREFIX_ONE, new MappingId("remote-eid-one"), "remote-mapping-context"); + customizer.writeCurrentAttributes(validId, validDataPrefixBased, writeContext); + verify(api, times(1)).oneAddDelAdjacency(requestCaptor.capture()); + verifyRequest(requestCaptor.getValue(), 1, new byte[]{-64, -88, 2, 1}, 24, new byte[]{-64, -88, 2, 3}, + 16, IPV4.getVppTypeBinding(), 2); verify(adjacenciesMappingContext, times(1)) .addEidPair("adj-one", "local-eid-one", "remote-eid-one", mappingContext); } @@ -196,14 +263,21 @@ public class AdjacencyCustomizerTest extends WriterCustomizerTest implements Eid } @Test(expected = UnsupportedOperationException.class) - public void updateCurrentAttributes() throws Exception { - customizer.updateCurrentAttributes(emptyId, emptyData, emptyData, writeContext); + public void updateCurrentAttributesFail() throws Exception { + customizer.updateCurrentAttributes(emptyId, failDataBefore, failDataAfter, writeContext); + } + + @Test + public void updateCurrentAttributesIgnore() throws Exception { + // should not throw in this case + customizer.updateCurrentAttributes(emptyId, ignoreDataBefore, ignoreDataAfter, writeContext); + verifyZeroInteractions(api); } @Test public void deleteCurrentAttributesNoKey() throws Exception { try { - customizer.deleteCurrentAttributes(emptyId, emptyData, writeContext); + customizer.deleteCurrentAttributes(emptyId, failDataBefore, writeContext); } catch (NullPointerException e) { verify(api, times(0)).oneAddDelAdjacency(any()); return; @@ -222,7 +296,7 @@ public class AdjacencyCustomizerTest extends WriterCustomizerTest implements Eid customizer.deleteCurrentAttributes(validId, validData, writeContext); verify(api, times(1)).oneAddDelAdjacency(requestCaptor.capture()); verifyRequest(requestCaptor.getValue(), 0, new byte[]{-64, -88, 2, 1}, 32, new byte[]{-64, -88, 2, 3}, - 32, IPV4.getValue(), 2); + 32, IPV4.getVppTypeBinding(), 2); verify(adjacenciesMappingContext, times(1)).removeForIndex("adj-one", mappingContext); } diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizerTest.java index f945415a1..c49823f7a 100755 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocalMappingCustomizerTest.java @@ -24,6 +24,7 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; @@ -41,8 +42,10 @@ import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.HmacKeyType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.Lisp; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.MappingId; @@ -70,6 +73,12 @@ public class LocalMappingCustomizerTest extends WriterCustomizerTest implements private InstanceIdentifier<LocalMapping> id; private LocalMapping mapping; private LocalMapping mappingWithHmacKey; + + private LocalMapping failUpdateBefore; + private LocalMapping failUpdateAfter; + private LocalMapping ignoreUpdateBefore; + private LocalMapping ignoreUpdateAfter; + private LocalMappingCustomizer customizer; @Override @@ -95,6 +104,28 @@ public class LocalMappingCustomizerTest extends WriterCustomizerTest implements .build()) .build(); + failUpdateBefore = new LocalMappingBuilder() + .setEid(new EidBuilder().setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new Ipv4Prefix("192.168.2.1/24")) + .build()).build()) + .build(); + failUpdateAfter = new LocalMappingBuilder() + .setEid(new EidBuilder().setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new Ipv4Prefix("192.168.2.1/16")) + .build()).build()) + .build(); + + ignoreUpdateBefore = new LocalMappingBuilder() + .setEid(new EidBuilder().setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new Ipv4Prefix("192.168.2.1/24")) + .build()).build()) + .build(); + ignoreUpdateAfter = new LocalMappingBuilder() + .setEid(new EidBuilder().setAddress(new Ipv4PrefixBuilder() + .setIpv4Prefix(new Ipv4Prefix("192.168.2.4/24")) + .build()).build()) + .build(); + id = InstanceIdentifier.builder(Lisp.class) .child(LispFeatureData.class) .child(EidTable.class) @@ -171,8 +202,14 @@ public class LocalMappingCustomizerTest extends WriterCustomizerTest implements } @Test(expected = UnsupportedOperationException.class) - public void testUpdateCurrentAttributes() throws WriteFailedException { - customizer.updateCurrentAttributes(null, null, null, writeContext); + public void testUpdateCurrentAttributesFail() throws WriteFailedException { + customizer.updateCurrentAttributes(null, failUpdateBefore, failUpdateAfter, writeContext); + } + + @Test + public void testUpdateCurrentAttributesIgnore() throws WriteFailedException { + customizer.updateCurrentAttributes(null, ignoreUpdateBefore, ignoreUpdateAfter, writeContext); + verifyZeroInteractions(api); } @Test @@ -194,7 +231,8 @@ public class LocalMappingCustomizerTest extends WriterCustomizerTest implements } @Test - public void testDeleteCurrentAttributesWithHmacKey() throws WriteFailedException, InterruptedException, ExecutionException { + public void testDeleteCurrentAttributesWithHmacKey() + throws WriteFailedException, InterruptedException, ExecutionException { when(eidMappingContext.containsEid(any(), eq(mappingContext))).thenReturn(true); customizer.deleteCurrentAttributes(id, mappingWithHmacKey, writeContext); diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizerTest.java index 35cc87689..62823df73 100755 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/RemoteMappingCustomizerTest.java @@ -26,6 +26,7 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; @@ -44,8 +45,10 @@ import org.mockito.Captor; import org.mockito.Mock; 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.Ipv6Prefix; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv4Afi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6PrefixBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev170315.Lisp; 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.MappingId; @@ -77,6 +80,12 @@ public class RemoteMappingCustomizerTest extends WriterCustomizerTest implements private RemoteMapping negativeMapping; private RemoteMapping positiveMappingNoPrioNoWeight; private RemoteMapping positiveMappingPrioWeight; + + private RemoteMapping failUpdateBefore; + private RemoteMapping failUpdateAfter; + private RemoteMapping ignoreUpdateBefore; + private RemoteMapping ignoreUpdateAfter; + private InstanceIdentifier<RemoteMapping> id; @Mock @@ -95,6 +104,28 @@ public class RemoteMappingCustomizerTest extends WriterCustomizerTest implements mappingId = new MappingId("REMOTE"); final RemoteMappingKey key = new RemoteMappingKey(mappingId); + failUpdateBefore = new RemoteMappingBuilder() + .setEid(new EidBuilder().setAddress(new Ipv6PrefixBuilder() + .setIpv6Prefix(new Ipv6Prefix("2001:0db8:85a3:0000:0000:8a2e:0370:7334/64")) + .build()).build()) + .build(); + failUpdateAfter = new RemoteMappingBuilder() + .setEid(new EidBuilder().setAddress(new Ipv6PrefixBuilder() + .setIpv6Prefix(new Ipv6Prefix("2001:0db8:85a3:0000:0000:8a2e:0370:7334/48")) + .build()).build()) + .build(); + + ignoreUpdateBefore = new RemoteMappingBuilder() + .setEid(new EidBuilder().setAddress(new Ipv6PrefixBuilder() + .setIpv6Prefix(new Ipv6Prefix("2001:0db8:85a3:0000:0000:8a2e:0370:7334/64")) + .build()).build()) + .build(); + ignoreUpdateAfter = new RemoteMappingBuilder() + .setEid(new EidBuilder().setAddress(new Ipv6PrefixBuilder() + .setIpv6Prefix(new Ipv6Prefix("2001:0db8:85a3:0000:0000:8a2e:0370:7348/64")) + .build()).build()) + .build(); + negativeMapping = new RemoteMappingBuilder() .setEid(eid) .setLocatorList(new NegativeMappingBuilder() @@ -205,8 +236,14 @@ public class RemoteMappingCustomizerTest extends WriterCustomizerTest implements } @Test(expected = UnsupportedOperationException.class) - public void testUpdateCurrentAttributes() throws WriteFailedException { - customizer.updateCurrentAttributes(null, null, null, writeContext); + public void testUpdateCurrentAttributesFail() throws WriteFailedException { + customizer.updateCurrentAttributes(null, failUpdateBefore, failUpdateAfter, writeContext); + } + + @Test + public void testUpdateCurrentAttributesIgnore() throws WriteFailedException { + customizer.updateCurrentAttributes(null, ignoreUpdateBefore, ignoreUpdateAfter, writeContext); + verifyZeroInteractions(api); } @Test(expected = NullPointerException.class) diff --git a/lisp/lisp_postman_collection.json b/lisp/lisp_postman_collection.json index 336ee1594..71b4f39eb 100644 --- a/lisp/lisp_postman_collection.json +++ b/lisp/lisp_postman_collection.json @@ -3,73 +3,194 @@ "name": "Lisp Postman Collection L2 copy", "description": "", "order": [ - "c99e6e24-5d9c-040a-68f3-5a0dbed98cc1", - "da8d61ce-1f0d-8ab8-e1de-50d094a266e2", - "e5b786a5-cab9-9fd7-4a23-20840e00098a", - "b1c9fcf9-89bf-86c5-a350-60535b748ee9", - "0ce07f8f-0e45-ea05-4c62-76d7076a444f", - "c0611a78-1410-52b6-a886-ca84e4dacb8e", - "14239ebd-752b-e2f6-ba5f-4fdb79819b92", - "3fe6bbb8-eca4-8b49-9092-1300aeac51e0", - "4b606776-aa33-ff85-9784-f76d2e457dea", - "385ab15d-6e4e-9fe9-9f4a-244a64f90c21", - "61af7f4c-6071-e881-cfbc-548abab4ba9f", - "7beac5a7-38d0-dd68-2e65-352418c285fd", - "44c349c4-c0ca-f5d9-53e1-8bf92eca5c73", - "b19d4109-d47a-c368-a7d4-1e5baad88d6d", - "4ceea4ca-a442-edc1-30d4-4e28e1d15ac3", - "3c3d5346-fd09-0c1b-31dc-5e549c1a4adb", - "bad5a024-ed9f-93d6-da06-1686d675dc50", - "32cdac07-fe1b-ae10-1e3d-9c5e64c8fbe7", - "7eaaefcc-784b-897f-dde1-0d47741dfe56", - "2506fe37-668b-7d0b-a76e-a592263dee65", - "1e18c440-3841-2cdd-9a88-cd4bde729a17", - "a517428f-a35e-5e75-5e5b-7f560d42332b", - "d106d7bf-ff65-6c13-397d-7cb765c71124", - "8f3ede8b-aab7-ac3b-3041-9cdb7bc0e6ec", - "eef057eb-f4a5-4903-1e31-06082511d677", - "0b807adc-2277-db3f-8e3e-c6b74888018d", - "5462a723-5b0c-34f0-1359-5e53a77e3a52", - "cd18d003-6bc9-cfff-46e8-7dffcd1f8497", - "1493eeb4-7306-9770-a2ed-4a59763240d1", - "523f68fe-ee0f-8e28-2a8a-87f6a459e03b", - "7a748095-2530-5bbd-7e5d-6d1cbd225c65", - "749351c9-3d31-cd54-500f-a628c7e134cd", - "54de6ea7-94a6-e8f2-1ed5-c209d8e3c25f", - "49cc1e34-af2a-0ccc-3beb-dab09c4a7869", - "fceee914-148f-c74e-3ad5-c2dbb988edf2", - "ad739651-3137-a535-5066-28a313cf7aa2", - "d01b27de-fef9-a333-3075-f431412a56d8", - "0ce2444e-3779-c247-6f0a-e9aabc7536eb", - "e6c236d4-96f6-b999-5e4e-9e8c93be6090", - "f18a7c8a-1c04-18b8-75d8-e2d8d08c3ef0", - "70790149-793f-242a-ebb8-032188d5bce5", - "32abc7d1-bdcf-26f3-c726-a385b3b86ec5", - "11cf57b3-d985-6dc2-805a-8d408679b35b", - "f6c1d4a8-9e5a-bac2-7476-c5ded4a545cc", - "c52b0be2-67d4-642b-fd7b-43598f2c4e3f", - "5ac994f5-18e3-5101-23c1-32995dae6ec9", - "f8d1b8a6-7a79-8be1-dbf3-fc02c5688df4", - "c50bc4c0-1a64-7130-4b8b-e1f12f55d4d7", - "65167fb8-0d64-d13e-27ad-0f7d3e8c7fe4", - "2ab426c2-1c94-fe0b-08a4-c2579f6fea3d", - "459bacc9-b049-b78f-5d50-7f2a0f8a182e", - "d547003e-cb16-6971-a5f9-66c400a921a1", - "1a65220c-e906-c56c-9d32-4ee27e30cfbd", - "080a7c73-3ffc-86f9-8d67-fc9a64bd2f46", - "531ac705-5ed0-04bc-fb4b-43e729b7c4e4", - "29c9a114-5552-701b-787d-895a8b03f2a6", - "1a6bbb6d-467d-dba6-0fc9-230cbcd85c47", - "ac4e4f66-fab7-fbbc-ca89-00bafd242361", - "1d0a2f13-a4d5-69da-2960-e368a67e9129", - "a0babf59-f72b-3412-3146-52e6312e063f", - "b1746c42-9991-7992-b8da-80c025981e9d", - "1d1c7d25-94af-2dfa-97ec-33710f47d04d", - "7a314526-67d0-d126-009a-656e6cf99f1e", - "8c8ee757-8bac-5e86-d5d6-3cb8c89ccac5", - "36a847e5-e3b8-ff07-4e88-f5a841fcaca6" + "c99e6e24-5d9c-040a-68f3-5a0dbed98cc1" + ], + "folders": [ + { + "id": "7e8099bb-e5d7-4e89-cc42-45b186b76c3c", + "name": "Adjacency", + "description": "", + "order": [ + "32abc7d1-bdcf-26f3-c726-a385b3b86ec5", + "929f03e4-aeba-3599-1bf2-1730913bdea6", + "11cf57b3-d985-6dc2-805a-8d408679b35b", + "f6c1d4a8-9e5a-bac2-7476-c5ded4a545cc" + ], + "owner": "658985" + }, + { + "id": "9b1be7a6-e7ca-88c3-d32d-151815ee3c57", + "name": "Bridge domain", + "description": "", + "order": [ + "bad5a024-ed9f-93d6-da06-1686d675dc50", + "32cdac07-fe1b-ae10-1e3d-9c5e64c8fbe7", + "7eaaefcc-784b-897f-dde1-0d47741dfe56", + "2506fe37-668b-7d0b-a76e-a592263dee65", + "1e18c440-3841-2cdd-9a88-cd4bde729a17" + ], + "owner": "658985" + }, + { + "id": "3a00485d-a0bf-98ca-c2fa-9cb14f4c3082", + "name": "Lisp", + "description": "", + "order": [ + "da8d61ce-1f0d-8ab8-e1de-50d094a266e2", + "e5b786a5-cab9-9fd7-4a23-20840e00098a", + "b1c9fcf9-89bf-86c5-a350-60535b748ee9", + "36a847e5-e3b8-ff07-4e88-f5a841fcaca6" + ], + "owner": "658985" + }, + { + "id": "5b5a13db-f0e7-f944-e779-905c7f8561e7", + "name": "Local mapping", + "description": "", + "order": [ + "8f3ede8b-aab7-ac3b-3041-9cdb7bc0e6ec", + "368c6c84-05ac-217f-32ed-0225db44f1cd", + "3bd39b05-9986-ffc0-6977-c41d41c98060", + "eef057eb-f4a5-4903-1e31-06082511d677", + "0b807adc-2277-db3f-8e3e-c6b74888018d", + "0b756f48-88b5-c015-a271-01b69a9ab2a4", + "5462a723-5b0c-34f0-1359-5e53a77e3a52", + "cd18d003-6bc9-cfff-46e8-7dffcd1f8497", + "1493eeb4-7306-9770-a2ed-4a59763240d1" + ], + "owner": "658985" + }, + { + "id": "a48c17bb-504b-f843-5098-b9d550a67301", + "name": "Locator Set", + "description": "", + "order": [ + "0ce07f8f-0e45-ea05-4c62-76d7076a444f", + "c0611a78-1410-52b6-a886-ca84e4dacb8e", + "14239ebd-752b-e2f6-ba5f-4fdb79819b92", + "3fe6bbb8-eca4-8b49-9092-1300aeac51e0", + "4b606776-aa33-ff85-9784-f76d2e457dea", + "385ab15d-6e4e-9fe9-9f4a-244a64f90c21", + "61af7f4c-6071-e881-cfbc-548abab4ba9f" + ], + "owner": "658985" + }, + { + "id": "ec468419-e334-7311-2b34-2b6ddde851f0", + "name": "Map Server", + "description": "", + "order": [ + "1d1c7d25-94af-2dfa-97ec-33710f47d04d", + "7a314526-67d0-d126-009a-656e6cf99f1e", + "8c8ee757-8bac-5e86-d5d6-3cb8c89ccac5" + ], + "owner": "658985" + }, + { + "id": "48325084-4625-703e-d6fd-3f11351ded23", + "name": "Map register", + "description": "", + "order": [ + "1a65220c-e906-c56c-9d32-4ee27e30cfbd", + "080a7c73-3ffc-86f9-8d67-fc9a64bd2f46", + "531ac705-5ed0-04bc-fb4b-43e729b7c4e4" + ], + "owner": "658985" + }, + { + "id": "829d2e08-2373-756e-8a7d-1451610f45b3", + "name": "Map request mode", + "description": "", + "order": [ + "1d0a2f13-a4d5-69da-2960-e368a67e9129", + "a0babf59-f72b-3412-3146-52e6312e063f", + "b1746c42-9991-7992-b8da-80c025981e9d" + ], + "owner": "658985" + }, + { + "id": "383c8da3-cd29-79aa-e0d1-36e3b7bd3e9c", + "name": "Map resolver", + "description": "", + "order": [ + "c52b0be2-67d4-642b-fd7b-43598f2c4e3f", + "5ac994f5-18e3-5101-23c1-32995dae6ec9", + "f8d1b8a6-7a79-8be1-dbf3-fc02c5688df4" + ], + "owner": "658985" + }, + { + "id": "fa3ffa80-51de-1e69-1f1e-4f77e69876b1", + "name": "Petr use", + "description": "", + "order": [ + "2ab426c2-1c94-fe0b-08a4-c2579f6fea3d", + "459bacc9-b049-b78f-5d50-7f2a0f8a182e", + "d547003e-cb16-6971-a5f9-66c400a921a1" + ], + "owner": "658985" + }, + { + "id": "da8bf0a1-22cf-8f24-0673-531e1a82de9b", + "name": "Pitr cfg", + "description": "", + "order": [ + "c50bc4c0-1a64-7130-4b8b-e1f12f55d4d7", + "65167fb8-0d64-d13e-27ad-0f7d3e8c7fe4" + ], + "owner": "658985" + }, + { + "id": "3e31c5d9-746a-da3c-79aa-681beedf8d25", + "name": "Remote mapping", + "description": "", + "order": [ + "523f68fe-ee0f-8e28-2a8a-87f6a459e03b", + "6a13d31b-937d-0f94-cc96-fe5b152fad52", + "cf99137e-694d-8a9c-45f0-9361840f4c25", + "7a748095-2530-5bbd-7e5d-6d1cbd225c65", + "749351c9-3d31-cd54-500f-a628c7e134cd", + "27ee8b67-7986-d169-bb89-ad147c7fb57c", + "54de6ea7-94a6-e8f2-1ed5-c209d8e3c25f", + "49cc1e34-af2a-0ccc-3beb-dab09c4a7869", + "fceee914-148f-c74e-3ad5-c2dbb988edf2", + "ad739651-3137-a535-5066-28a313cf7aa2", + "d01b27de-fef9-a333-3075-f431412a56d8", + "0ce2444e-3779-c247-6f0a-e9aabc7536eb", + "e6c236d4-96f6-b999-5e4e-9e8c93be6090", + "f18a7c8a-1c04-18b8-75d8-e2d8d08c3ef0", + "70790149-793f-242a-ebb8-032188d5bce5" + ], + "owner": "658985", + "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075" + }, + { + "id": "113ca8db-2c5a-398e-7a97-cbcecae624de", + "name": "Rloc probe", + "description": "", + "order": [ + "29c9a114-5552-701b-787d-895a8b03f2a6", + "1a6bbb6d-467d-dba6-0fc9-230cbcd85c47", + "ac4e4f66-fab7-fbbc-ca89-00bafd242361" + ], + "owner": "658985" + }, + { + "id": "e9d9c898-2a90-945e-34a8-106d16062ba8", + "name": "Vrf", + "description": "", + "order": [ + "44c349c4-c0ca-f5d9-53e1-8bf92eca5c73", + "b19d4109-d47a-c368-a7d4-1e5baad88d6d", + "4ceea4ca-a442-edc1-30d4-4e28e1d15ac3", + "3c3d5346-fd09-0c1b-31dc-5e549c1a4adb", + "7beac5a7-38d0-dd68-2e65-352418c285fd", + "a517428f-a35e-5e75-5e5b-7f560d42332b", + "d106d7bf-ff65-6c13-397d-7cb765c71124" + ], + "owner": "658985" + } ], - "folders": [], "timestamp": 0, "owner": "658985", "public": false, @@ -91,10 +212,30 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "48325084-4625-703e-d6fd-3f11351ded23", "rawModeData": "{\n\t\"map-register\":{\n\t\t\"enabled\":true\t\n\t}\n}" }, { - "folder": null, + "id": "0b756f48-88b5-c015-a271-01b69a9ab2a4", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/local-mappings/local-mapping/loc_map_10", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1494599860466, + "name": "Get local mapping loc_map_10 Operational ", + "description": "Get details about local mapping\n\nequivalent of\n \n lisp_eid_table_dump eid_set 1 prefix_length 32 vni 12 eid_type 0 eid 192.168.2.1 filter 1", + "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "folder": "5b5a13db-f0e7-f944-e779-905c7f8561e7", + "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"00:11:22:00:11:22\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}" + }, + { + "folder": "5b5a13db-f0e7-f944-e779-905c7f8561e7", "id": "0b807adc-2277-db3f-8e3e-c6b74888018d", "name": "Get local mapping loc_map_1 Operational", "dataMode": "raw", @@ -113,7 +254,7 @@ "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"00:11:22:00:11:22\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}" }, { - "folder": null, + "folder": "a48c17bb-504b-f843-5098-b9d550a67301", "id": "0ce07f8f-0e45-ea05-4c62-76d7076a444f", "name": "Negative Case - Locator set loc_1 as empty", "dataMode": "raw", @@ -132,7 +273,7 @@ "rawModeData": "{ \n \"locator-set\":{ \n \"name\":\"loc_1\"\n }\n}" }, { - "folder": null, + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "0ce2444e-3779-c247-6f0a-e9aabc7536eb", "name": "Get remote positive mapping - Operational - Vrf", "dataMode": "raw", @@ -151,7 +292,7 @@ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"negative-mapping\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}" }, { - "folder": null, + "folder": "7e8099bb-e5d7-4e89-cc42-45b186b76c3c", "id": "11cf57b3-d985-6dc2-805a-8d408679b35b", "name": "Get adjacency - Config", "dataMode": "raw", @@ -170,7 +311,7 @@ "rawModeData": "{\r\n \"adjacency\":{\r\n \"id\":\"adj_1\",\r\n \"local-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \"remote-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.5\"\r\n }\r\n }\r\n}" }, { - "folder": null, + "folder": "a48c17bb-504b-f843-5098-b9d550a67301", "id": "14239ebd-752b-e2f6-ba5f-4fdb79819b92", "name": "Add Locator set loc_1 with locator for local0 copy", "dataMode": "raw", @@ -189,7 +330,7 @@ "rawModeData": "{ \n \"locator-set\":{ \n \"name\":\"loc_1\",\n \"interface\":{ \n \"interface-ref\":\"local0\",\n \"priority\":\"2\",\n \"weight\":\"3\"\n }\n }\n}" }, { - "folder": null, + "folder": "5b5a13db-f0e7-f944-e779-905c7f8561e7", "id": "1493eeb4-7306-9770-a2ed-4a59763240d1", "name": "Add local mapping loc_map_2 Operational", "dataMode": "raw", @@ -224,6 +365,7 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "48325084-4625-703e-d6fd-3f11351ded23", "rawModeData": "{\n\t\"map-register\":{\n\t\t\"enabled\":true\t\n\t}\n}" }, { @@ -243,6 +385,7 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "113ca8db-2c5a-398e-7a97-cbcecae624de", "rawModeData": "{\n\t\"rloc-probe\":{\n\t\t\"enabled\":true\t\n\t}\n}" }, { @@ -262,6 +405,7 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "829d2e08-2373-756e-8a7d-1451610f45b3", "rawModeData": "{\n\t\"map-request-mode\":{\n\t\t\"mode\":\"source-destination\"\t\n\t}\n}" }, { @@ -281,10 +425,11 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "ec468419-e334-7311-2b34-2b6ddde851f0", "rawModeData": "{\n\t\"map-servers\":{\n\t\t\"map-server\":\n\t\t[\n\t\t\t{\n\t\t\t\t\"ip-address\":\"192.168.2.1\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"ip-address\":\"192.168.2.5\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"ip-address\":\"2001:db8:a0b:12f0::1\"\n\t\t\t}\n\t\t]\n\t}\n}" }, { - "folder": null, + "folder": "9b1be7a6-e7ca-88c3-d32d-151815ee3c57", "id": "1e18c440-3841-2cdd-9a88-cd4bde729a17", "name": "Get Bridge Domain Subtable 10 Operational", "dataMode": "raw", @@ -303,7 +448,7 @@ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\",\r\n \"vrf-subtable\":{\r\n \"table-id\":10\r\n }\r\n }\r\n}" }, { - "folder": null, + "folder": "9b1be7a6-e7ca-88c3-d32d-151815ee3c57", "id": "2506fe37-668b-7d0b-a76e-a592263dee65", "name": "Get Bridge Domain Subtable 10 Config", "dataMode": "raw", @@ -322,6 +467,25 @@ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\",\r\n \"vrf-subtable\":{\r\n \"table-id\":10\r\n }\r\n }\r\n}" }, { + "id": "27ee8b67-7986-d169-bb89-ad147c7fb57c", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8183/restconf/operational/lisp:lisp-state/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_10", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1494600878314, + "name": "Get remote negative mapping 10 - Vrf - Prefix based", + "description": "Adds new remote mapping with negative mapping\n\nequivalent of \n\n lisp_add_del_remote_mapping is_add 1 vni 12 action 0 eid_type 0 eid 192.168.2.1 eid_len 32\n\ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.1 filter 2", + "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", + "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_10\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv6-prefix-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv6-prefix\":\"2001:0db8:85a3:0000:0000:8a2e:0370:7334/64\"\r\n },\r\n \"map-reply\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}" + }, + { "id": "29c9a114-5552-701b-787d-895a8b03f2a6", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/rloc-probe", @@ -338,6 +502,7 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "113ca8db-2c5a-398e-7a97-cbcecae624de", "rawModeData": "{\n\t\"rloc-probe\":{\n\t\t\"enabled\":true\t\n\t}\n}" }, { @@ -356,10 +521,11 @@ "name": "Add Petr use", "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "folder": "fa3ffa80-51de-1e69-1f1e-4f77e69876b1", "rawModeData": "{\n \"petr-cfg\": {\n \"petr-address\":\"2001:db8:a0b:12f0::2\"\n } \n}" }, { - "folder": null, + "folder": "7e8099bb-e5d7-4e89-cc42-45b186b76c3c", "id": "32abc7d1-bdcf-26f3-c726-a385b3b86ec5", "name": "Add adjacency", "dataMode": "raw", @@ -378,7 +544,7 @@ "rawModeData": "{\r\n \"adjacency\":{\r\n \"id\":\"adj_1\",\r\n \"local-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \"remote-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.5\"\r\n }\r\n }\r\n}" }, { - "folder": null, + "folder": "9b1be7a6-e7ca-88c3-d32d-151815ee3c57", "id": "32cdac07-fe1b-ae10-1e3d-9c5e64c8fbe7", "name": "Delete bridge testBD", "dataMode": "raw", @@ -397,7 +563,26 @@ "rawModeData": "{\r\n \"bridge-domain\": [\r\n {\r\n \"name\": \"testBD\",\r\n \"flood\": \"true\",\r\n \"forward\": \"false\",\r\n \"learn\": \"false\",\r\n \"unknown-unicast-flood\": \"false\",\r\n \"arp-termination\": \"false\"\r\n }\r\n ]\r\n}" }, { - "folder": null, + "id": "368c6c84-05ac-217f-32ed-0225db44f1cd", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/local-mappings/local-mapping/loc_map_10", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1494833563002, + "name": "Add local mapping loc_map_10 - prefix based", + "description": "Adds new local mapping\n\nequivalent of \n\n lisp_add_del_local_eid is_add 1 eid_type 0 eid 192.168.3.8 prefix_len 24 vni 12 locator_set_name loc_1\n \ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_length 24 vni 12 eid_type 0 eid 192.168.3.8 filter 1\n \n", + "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "folder": "5b5a13db-f0e7-f944-e779-905c7f8561e7", + "rawModeData": "{ \n \n \n \"local-mapping\":{ \n \"id\":\"loc_map_10\",\n \"eid\":{ \n \"address-type\":\"ietf-lisp-address-types:ipv4-prefix-afi\",\n \"virtual-network-id\":\"12\",\n \"ipv4-prefix\":\"192.168.3.8/8\"\n },\n \"locator-set\":\"loc_1\"\n }\n\n}" + }, + { + "folder": "3a00485d-a0bf-98ca-c2fa-9cb14f4c3082", "id": "36a847e5-e3b8-ff07-4e88-f5a841fcaca6", "name": "Delete Lisp", "dataMode": "raw", @@ -416,7 +601,7 @@ "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\",\r\n \"eid-table\": {\r\n \"vni-table\": [\r\n {\r\n \"virtual-network-identifier\": 0,\r\n \"remote-mappings\": {},\r\n \"table-id\": 0,\r\n \"local-mappings\": {},\r\n \"adjacencies\": {}\r\n }\r\n ]\r\n },\r\n \"pitr-cfg\":{\r\n \"locator-set\":\"N/A\"\r\n }\r\n } \r\n}" }, { - "folder": null, + "folder": "a48c17bb-504b-f843-5098-b9d550a67301", "id": "385ab15d-6e4e-9fe9-9f4a-244a64f90c21", "name": "Add Locator for GigabitEthernet0/8/0", "dataMode": "raw", @@ -435,7 +620,26 @@ "rawModeData": "{\r\n \"interface\":{\r\n \"interface-ref\":\"GigabitEthernet0/8/0\",\r\n \"priority\":\"2\",\r\n \"weight\":\"3\"\r\n }\r\n}" }, { - "folder": null, + "id": "3bd39b05-9986-ffc0-6977-c41d41c98060", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/local-mappings/local-mapping/loc_map_1", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1491553886750, + "name": "Add local mapping with hmac key", + "description": "Adds new local mapping\n\nequivalent of \n\n lisp_add_del_local_eid is_add 1 eid_type 0 eid 192.168.2.1 prefix_len 32 vni 12 locator_set_name loc_1\n \ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_length 32 vni 12 eid_type 0 eid 192.168.2.1 filter 1\n \n", + "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "folder": "5b5a13db-f0e7-f944-e779-905c7f8561e7", + "rawModeData": "{ \n \n \n \"local-mapping\":{ \n \"id\":\"loc_map_1\",\n \"eid\":{ \n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\n \"virtual-network-id\":\"12\",\n \"ipv4\":\"192.168.2.1\"\n },\n \"locator-set\":\"loc_1\",\n \"hmac-key\":{\n \t\"key-type\":\"sha-1-96-key\",\n \t\"key\":\"abcd1234\"\n }\n }\n\n}" + }, + { + "folder": "e9d9c898-2a90-945e-34a8-106d16062ba8", "id": "3c3d5346-fd09-0c1b-31dc-5e549c1a4adb", "name": "Get Vrf Subtable 10 Operational", "dataMode": "raw", @@ -454,7 +658,7 @@ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\",\r\n \"vrf-subtable\":{\r\n \"table-id\":10\r\n }\r\n }\r\n}" }, { - "folder": null, + "folder": "a48c17bb-504b-f843-5098-b9d550a67301", "id": "3fe6bbb8-eca4-8b49-9092-1300aeac51e0", "name": "Get Locator set loc_1 Config", "dataMode": "raw", @@ -473,7 +677,7 @@ "rawModeData": "{ \n \"locator-set\":{ \n \"name\":\"loc_1\",\n \"interface\":{ \n \"interface-ref\":\"local0\",\n \"priority\":\"2\",\n \"weight\":\"3\"\n }\n }\n}" }, { - "folder": null, + "folder": "e9d9c898-2a90-945e-34a8-106d16062ba8", "id": "44c349c4-c0ca-f5d9-53e1-8bf92eca5c73", "name": "Add subtable subtree", "dataMode": "raw", @@ -507,10 +711,11 @@ "name": "Get Petr Config", "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "folder": "fa3ffa80-51de-1e69-1f1e-4f77e69876b1", "rawModeData": "{\n \"petr-cfg\": {\n \"petr-address\":\"192.168.2.1\"\n } \n}" }, { - "folder": null, + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "49cc1e34-af2a-0ccc-3beb-dab09c4a7869", "name": "Get remote negative mapping Config - Bridge Domain", "dataMode": "raw", @@ -529,7 +734,7 @@ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"aa:bb:aa:aa:aa:aa\"\r\n },\r\n \"map-reply-action\":\"no-action\"\r\n \r\n }\r\n}" }, { - "folder": null, + "folder": "a48c17bb-504b-f843-5098-b9d550a67301", "id": "4b606776-aa33-ff85-9784-f76d2e457dea", "name": "Get Locator set loc_1 Operational", "dataMode": "raw", @@ -548,7 +753,7 @@ "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}" }, { - "folder": null, + "folder": "e9d9c898-2a90-945e-34a8-106d16062ba8", "id": "4ceea4ca-a442-edc1-30d4-4e28e1d15ac3", "name": "Get Vrf Subtable 10 Config", "dataMode": "raw", @@ -567,7 +772,7 @@ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\",\r\n \"vrf-subtable\":{\r\n \"table-id\":10\r\n }\r\n }\r\n}" }, { - "folder": null, + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "523f68fe-ee0f-8e28-2a8a-87f6a459e03b", "name": "Add remote negative mapping - Vrf", "dataMode": "raw", @@ -602,10 +807,11 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "48325084-4625-703e-d6fd-3f11351ded23", "rawModeData": "{\n\t\"map-register\":{\n\t\t\"enabled\":true\t\n\t}\n}" }, { - "folder": null, + "folder": "5b5a13db-f0e7-f944-e779-905c7f8561e7", "id": "5462a723-5b0c-34f0-1359-5e53a77e3a52", "name": "Add local mapping loc_map_2 - Bridge Domain", "dataMode": "raw", @@ -624,7 +830,7 @@ "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"aa:aa:aa:aa:aa:aa\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}" }, { - "folder": null, + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "54de6ea7-94a6-e8f2-1ed5-c209d8e3c25f", "name": "Add remote negative mapping - Bridge Domain", "dataMode": "raw", @@ -643,7 +849,7 @@ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"aa:bb:aa:aa:aa:aa\"\r\n },\r\n \"map-reply\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n }\r\n}" }, { - "folder": null, + "folder": "383c8da3-cd29-79aa-e0d1-36e3b7bd3e9c", "id": "5ac994f5-18e3-5101-23c1-32995dae6ec9", "name": "Get map resolver - Config", "dataMode": "raw", @@ -662,7 +868,7 @@ "rawModeData": "{\r\n \"map-resolver\":{\r\n \"ip-address\":\"192.168.2.1\"\r\n }\r\n}" }, { - "folder": null, + "folder": "a48c17bb-504b-f843-5098-b9d550a67301", "id": "61af7f4c-6071-e881-cfbc-548abab4ba9f", "name": "Get Locator for GigabitEthernet0/8/0", "dataMode": "raw", @@ -681,7 +887,7 @@ "rawModeData": "{\r\n \"locator-set\":{\r\n \"name\":\"loc_1\"\r\n }\r\n}" }, { - "folder": null, + "folder": "da8bf0a1-22cf-8f24-0673-531e1a82de9b", "id": "65167fb8-0d64-d13e-27ad-0f7d3e8c7fe4", "name": "Get Pitr-cfg ", "dataMode": "raw", @@ -700,7 +906,26 @@ "rawModeData": "{\n \"pitr-cfg\": {\n \"locator-set\": \"N/A\"\n } \n}" }, { - "folder": null, + "id": "6a13d31b-937d-0f94-cc96-fe5b152fad52", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_10", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1494600828746, + "name": "Add remote negative mapping 10 - Vrf - Prefix based", + "description": "Adds new remote mapping with negative mapping\n\nequivalent of \n\n lisp_add_del_remote_mapping is_add 1 vni 12 action 0 eid_type 0 eid 192.168.2.1 eid_len 32\n\ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.1 filter 2", + "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", + "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_10\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv6-prefix-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv6-prefix\":\"2001:0db8:85a3:0000:0000:8a2e:0370:7334/64\"\r\n },\r\n \"map-reply\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}" + }, + { + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "70790149-793f-242a-ebb8-032188d5bce5", "name": "Get remote positive mapping - Operational - Bridge Domain", "dataMode": "raw", @@ -719,7 +944,7 @@ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"negative-mapping\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}" }, { - "folder": null, + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "749351c9-3d31-cd54-500f-a628c7e134cd", "name": "Get remote negative mapping Operational - Vrf", "dataMode": "raw", @@ -754,10 +979,11 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "ec468419-e334-7311-2b34-2b6ddde851f0", "rawModeData": "{\n\t\"map-servers\":{\n\t\t\"map-server\":\n\t\t[\n\t\t\t{\n\t\t\t\t\"ip-address\":\"192.168.2.1\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"ip-address\":\"192.168.2.5\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"ip-address\":\"2001:0db8:0a0b:12f0:0000:0000:0000:0001\"\n\t\t\t}\n\t\t]\n\t}\n}" }, { - "folder": null, + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "7a748095-2530-5bbd-7e5d-6d1cbd225c65", "name": "Get remote negative mapping Config - Vrf", "dataMode": "raw", @@ -776,7 +1002,7 @@ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_2\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"rlocs\":{\r\n \"locator\":{\r\n \"address\":\"192.168.2.2\",\r\n \"priority\":1,\r\n \"weight\":1\r\n }\r\n }\r\n \r\n }\r\n}" }, { - "folder": null, + "folder": "e9d9c898-2a90-945e-34a8-106d16062ba8", "id": "7beac5a7-38d0-dd68-2e65-352418c285fd", "name": "Negative Case - Add VNI Table 12", "dataMode": "raw", @@ -795,7 +1021,7 @@ "rawModeData": "{\r\n \"vni-table\":{\r\n \"virtual-network-identifier\":\"12\"\r\n }\r\n}" }, { - "folder": null, + "folder": "9b1be7a6-e7ca-88c3-d32d-151815ee3c57", "id": "7eaaefcc-784b-897f-dde1-0d47741dfe56", "name": "Add Bridge Domain Subtable 10", "dataMode": "raw", @@ -830,10 +1056,11 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "ec468419-e334-7311-2b34-2b6ddde851f0", "rawModeData": "{\n\t\"map-servers\":{\n\t\t\"map-server\":\n\t\t[\n\t\t\t{\n\t\t\t\t\"ip-address\":\"192.168.2.1\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"ip-address\":\"192.168.2.5\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"ip-address\":\"2001:0db8:0a0b:12f0:0000:0000:0000:0001\"\n\t\t\t}\n\t\t]\n\t}\n}" }, { - "folder": null, + "folder": "5b5a13db-f0e7-f944-e779-905c7f8561e7", "id": "8f3ede8b-aab7-ac3b-3041-9cdb7bc0e6ec", "name": "Add local mapping loc_map_1 - Vrf ", "dataMode": "raw", @@ -852,6 +1079,24 @@ "rawModeData": "{ \n \n \n \"local-mapping\":{ \n \"id\":\"loc_map_1\",\n \"eid\":{ \n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\n \"virtual-network-id\":\"12\",\n \"ipv4\":\"192.168.2.1\"\n },\n \"locator-set\":\"loc_1\"\n }\n\n}" }, { + "id": "929f03e4-aeba-3599-1bf2-1730913bdea6", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_11/adjacencies/adjacency/adj_10", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1494844965761, + "name": "Add adjacency prefix based", + "description": "Add new adjacency\nThere must be existing local/remote mappings to specified eid's\n\nequivalent of \n\n lisp_add_del_adjacency is_add 1 vni 12 eid_type 0 deid 192.168.2.1 seid 192.168.2.3 deid_len 32 seid_len 32\n\nright now no dump variant is existing in api", + "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "rawModeData": "{\r\n \"adjacency\":{\r\n \"id\":\"adj_10\",\r\n \"local-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-prefix-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4-prefix\":\"192.168.3.8/8\"\r\n },\r\n \"remote-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-prefix-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4-prefix\":\"192.168.2.4/24\"\r\n }\r\n }\r\n}" + }, + { "id": "a0babf59-f72b-3412-3146-52e6312e063f", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/map-request-mode", @@ -868,10 +1113,11 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "829d2e08-2373-756e-8a7d-1451610f45b3", "rawModeData": "{\n\t\"map-request-mode\":{\n\t\t\"mode\":\"source-destination\"\t\n\t}\n}" }, { - "folder": null, + "folder": "e9d9c898-2a90-945e-34a8-106d16062ba8", "id": "a517428f-a35e-5e75-5e5b-7f560d42332b", "name": "Get VNI Table 12 Config", "dataMode": "raw", @@ -906,10 +1152,11 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "113ca8db-2c5a-398e-7a97-cbcecae624de", "rawModeData": "{\n\t\"rloc-probe\":{\n\t\t\"enabled\":true\t\n\t}\n}" }, { - "folder": null, + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "ad739651-3137-a535-5066-28a313cf7aa2", "name": "Add remote positive mapping - VrfSubtable", "dataMode": "raw", @@ -944,10 +1191,11 @@ "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", "responses": [], + "folder": "829d2e08-2373-756e-8a7d-1451610f45b3", "rawModeData": "{\n\t\"map-request-mode\":{\n\t\t\"mode\":\"source-destination\"\t\n\t}\n}" }, { - "folder": null, + "folder": "e9d9c898-2a90-945e-34a8-106d16062ba8", "id": "b19d4109-d47a-c368-a7d4-1e5baad88d6d", "name": "Add Vrf Subtable 10", "dataMode": "raw", @@ -966,7 +1214,7 @@ "rawModeData": "{\r\n \"vrf-subtable\":{\r\n \"table-id\":10\r\n }\r\n}" }, { - "folder": null, + "folder": "3a00485d-a0bf-98ca-c2fa-9cb14f4c3082", "id": "b1c9fcf9-89bf-86c5-a350-60535b748ee9", "name": "Get Lisp Operational", "dataMode": "raw", @@ -985,26 +1233,26 @@ "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}" }, { - "folder": null, "id": "bad5a024-ed9f-93d6-da06-1686d675dc50", - "name": "Create bridge testBD", - "dataMode": "raw", - "data": [], - "descriptionFormat": "html", - "description": "Creates bridgfe domain. Corresponds to invoking:\n\nvat# bridge_domain_add_del bd_id [bd_id] learn 0 forward 0 uu-flood 0 flood 1 arp-term 0\n\nTo verify run:\n\nvppctl show bridge-domain [bd_id] detail", "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", - "method": "PUT", - "pathVariables": {}, - "url": "http://localhost:8183/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD", + "url": "http://localhost:8183/restconf/config/v3po:bridge-domains/bridge-domain/testBD", "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", "tests": "", "currentHelper": "normal", "helperAttributes": {}, + "time": 1494593326359, + "name": "Create bridge testBD", + "description": "Creates bridgfe domain. Corresponds to invoking:\n\nvat# bridge_domain_add_del bd_id [bd_id] learn 0 forward 0 uu-flood 0 flood 1 arp-term 0\n\nTo verify run:\n\nvppctl show bridge-domain [bd_id] detail", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "folder": "9b1be7a6-e7ca-88c3-d32d-151815ee3c57", "rawModeData": "{\r\n \"bridge-domain\": [\r\n {\r\n \"name\": \"testBD\",\r\n \"flood\": \"true\",\r\n \"forward\": \"false\",\r\n \"learn\": \"false\",\r\n \"unknown-unicast-flood\": \"false\",\r\n \"arp-termination\": \"false\"\r\n }\r\n ]\r\n}" }, { - "folder": null, + "folder": "a48c17bb-504b-f843-5098-b9d550a67301", "id": "c0611a78-1410-52b6-a886-ca84e4dacb8e", "name": "Add Locator set loc_1 with locator for local0", "dataMode": "raw", @@ -1023,7 +1271,7 @@ "rawModeData": "{ \n \"locator-set\":{ \n \"name\":\"loc_1\",\n \"interface\":{ \n \"interface-ref\":\"local0\",\n \"priority\":\"2\",\n \"weight\":\"3\"\n }\n }\n}" }, { - "folder": null, + "folder": "da8bf0a1-22cf-8f24-0673-531e1a82de9b", "id": "c50bc4c0-1a64-7130-4b8b-e1f12f55d4d7", "name": "Add Pitr-cfg", "dataMode": "raw", @@ -1042,7 +1290,7 @@ "rawModeData": "{\n \"pitr-cfg\": {\n \"locator-set\": \"loc_1\"\n } \n}" }, { - "folder": null, + "folder": "383c8da3-cd29-79aa-e0d1-36e3b7bd3e9c", "id": "c52b0be2-67d4-642b-fd7b-43598f2c4e3f", "name": "Add map resolver", "dataMode": "raw", @@ -1080,7 +1328,7 @@ "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "folder": null, + "folder": "5b5a13db-f0e7-f944-e779-905c7f8561e7", "id": "cd18d003-6bc9-cfff-46e8-7dffcd1f8497", "name": "Add local mapping loc_map_2 Config", "dataMode": "raw", @@ -1099,7 +1347,25 @@ "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}" }, { - "folder": null, + "id": "cf99137e-694d-8a9c-45f0-9361840f4c25", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8183/restconf/config/lisp:lisp/lisp-feature-data/eid-table/vni-table/12/vrf-subtable/remote-mappings/remote-mapping/remote_map_11", + "preRequestScript": null, + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "tests": null, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1494844942341, + "name": "Add remote negative mapping 11 - Vrf - Prefix based", + "description": "Adds new remote mapping with negative mapping\n\nequivalent of \n\n lisp_add_del_remote_mapping is_add 1 vni 12 action 0 eid_type 0 eid 192.168.2.1 eid_len 32\n\ncan be verified with\n\n lisp_eid_table_dump eid_set 1 prefix_len 32 vni 12 eid_type 0 eid 192.168.2.1 filter 2", + "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_11\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv6-prefix-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4-prefix\":\"192.168.2.4/24\"\r\n },\r\n \"map-reply\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}" + }, + { + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "d01b27de-fef9-a333-3075-f431412a56d8", "name": "Get remote positive mapping - Config - Vrf", "dataMode": "raw", @@ -1118,7 +1384,7 @@ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"negative-mapping\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}" }, { - "folder": null, + "folder": "e9d9c898-2a90-945e-34a8-106d16062ba8", "id": "d106d7bf-ff65-6c13-397d-7cb765c71124", "name": "Get VNI Table 12 Operational", "dataMode": "raw", @@ -1152,6 +1418,7 @@ "name": "Get Petr Operational", "description": "", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "folder": "fa3ffa80-51de-1e69-1f1e-4f77e69876b1", "rawModeData": "{\n \"petr-cfg\": {\n \"petr-address\":\"192.168.2.1\"\n } \n}" }, { @@ -1170,10 +1437,11 @@ "name": "Enable Lisp", "description": "Enables Lisp feature\n\nequivalent of \n\n lisp_enable_disable is_en 1\n\ncan be verified with \n\n show_lisp_status", "collectionId": "6d0c6545-0c6c-6ba3-0c28-d213ebef7075", + "folder": "3a00485d-a0bf-98ca-c2fa-9cb14f4c3082", "rawModeData": "{\n \"lisp\": {\n \"enable\": true,\n \"lisp-feature-data\": {\n \"pitr-cfg\": {\n \"locator-set\": \"N/A\"\n },\n \"rloc-probe\": {\n \"enabled\": false\n },\n \"map-register\": {\n \"enabled\": false\n },\n \"map-request-mode\": {\n \"mode\": \"destination-only\"\n },\n \"eid-table\": {\n \"vni-table\": [\n {\n \"virtual-network-identifier\": 0,\n \"vrf-subtable\": {\n \"table-id\": 0\n }\n }\n ]\n }\n }\n }\n}" }, { - "folder": null, + "folder": "3a00485d-a0bf-98ca-c2fa-9cb14f4c3082", "id": "e5b786a5-cab9-9fd7-4a23-20840e00098a", "name": "Get Lisp Config", "dataMode": "raw", @@ -1192,7 +1460,7 @@ "rawModeData": "{\r\n \"lisp\":{\r\n \"enable\":\"true\"\r\n } \r\n}" }, { - "folder": null, + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "e6c236d4-96f6-b999-5e4e-9e8c93be6090", "name": "Add remote positive mapping - Bridge Domain", "dataMode": "raw", @@ -1211,7 +1479,7 @@ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_4\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"aa:bb:cc:aa:bb:cc\"\r\n },\r\n \r\n \"rlocs\":{\r\n \"locator\":{\r\n \"address\":\"192.168.2.3\",\r\n \"priority\":1,\r\n \"weight\":2\r\n }\r\n }\r\n \r\n }\r\n}" }, { - "folder": null, + "folder": "5b5a13db-f0e7-f944-e779-905c7f8561e7", "id": "eef057eb-f4a5-4903-1e31-06082511d677", "name": "Get local mapping loc_map_1 Config", "dataMode": "raw", @@ -1230,7 +1498,7 @@ "rawModeData": "{\r\n \"local-mapping\":{\r\n \"id\":\"loc_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:mac-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"mac\":\"00:11:22:00:11:22\"\r\n },\r\n \"locator-set\":\"loc_1\"\r\n }\r\n}" }, { - "folder": null, + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "f18a7c8a-1c04-18b8-75d8-e2d8d08c3ef0", "name": "Get remote positive mapping - Config - Bridge Domain", "dataMode": "raw", @@ -1249,7 +1517,7 @@ "rawModeData": "{\r\n \"remote-mapping\":{\r\n \"id\":\"remote_map_1\",\r\n \"eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \r\n \"negative-mapping\":{\r\n \"map-reply-action\":\"no-action\"\r\n }\r\n \r\n }\r\n}" }, { - "folder": null, + "folder": "7e8099bb-e5d7-4e89-cc42-45b186b76c3c", "id": "f6c1d4a8-9e5a-bac2-7476-c5ded4a545cc", "name": "Get adjacency - Operational", "dataMode": "raw", @@ -1268,7 +1536,7 @@ "rawModeData": "{\r\n \"adjacency\":{\r\n \"id\":\"adj_1\",\r\n \"local-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.1\"\r\n },\r\n \"remote-eid\":{\r\n \"address-type\":\"ietf-lisp-address-types:ipv4-afi\",\r\n \"virtual-network-id\":\"12\",\r\n \"ipv4\":\"192.168.2.5\"\r\n }\r\n }\r\n}" }, { - "folder": null, + "folder": "383c8da3-cd29-79aa-e0d1-36e3b7bd3e9c", "id": "f8d1b8a6-7a79-8be1-dbf3-fc02c5688df4", "name": "Get map resolver - Operational", "dataMode": "raw", @@ -1287,7 +1555,7 @@ "rawModeData": "{\r\n \"map-resolver\":{\r\n \"ip-address\":\"192.168.2.1\"\r\n }\r\n}" }, { - "folder": null, + "folder": "3e31c5d9-746a-da3c-79aa-681beedf8d25", "id": "fceee914-148f-c74e-3ad5-c2dbb988edf2", "name": "Get remote negative mapping Operational - Bridge Domain", "dataMode": "raw", |