Search in sources :

Example 36 with InstanceIdType

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType in project lispflowmapping by opendaylight.

the class LispAddressUtilTest method toEid_ipv4PrefixBinary.

/**
 * Test
 * - {@link LispAddressUtil#toEid(Ipv4PrefixBinary, InstanceIdType)}
 * - {@link LispAddressUtil#asIpv4PrefixBinaryEid(String)}
 * - {@link LispAddressUtil#asIpv4PrefixBinaryEid(String, InstanceIdType)}
 * - {@link LispAddressUtil#asIpv4PrefixBinaryEid(Eid, byte[], short)}
 * methods.
 */
@Test
public void toEid_ipv4PrefixBinary() {
    Eid eidFromIpv4PrefixBinary = LispAddressUtil.toEid(IPV4_ADDRESS_PREFIX_BINARY_1, INSTANCE_ID_TYPE_TEST);
    verifyToEidWithIpv4PrefixBinary(eidFromIpv4PrefixBinary, true, MASK_OK_TEST, Ipv4PrefixBinaryAfi.class);
    eidFromIpv4PrefixBinary = LispAddressUtil.asIpv4PrefixBinaryEid(IPV4_ADDRESS_PREFIX_VALUE_TEST);
    verifyToEidWithIpv4PrefixBinary(eidFromIpv4PrefixBinary, false, MASK_OK_TEST, Ipv4PrefixBinaryAfi.class);
    eidFromIpv4PrefixBinary = LispAddressUtil.asIpv4PrefixBinaryEid(IPV4_ADDRESS_PREFIX_VALUE_TEST, INSTANCE_ID_TYPE_TEST);
    verifyToEidWithIpv4PrefixBinary(eidFromIpv4PrefixBinary, true, MASK_OK_TEST, Ipv4PrefixBinaryAfi.class);
    eidFromIpv4PrefixBinary = LispAddressUtil.asIpv4PrefixBinaryEid(IPV4_ADDRESS_PREFIX_BINARY_EID_1, IPV4_ADDRESS_BYTES_A_TEST, MASK_OK_TEST);
    verifyToEidWithIpv4PrefixBinary(eidFromIpv4PrefixBinary, true, MASK_OK_TEST, Ipv4PrefixBinaryAfi.class);
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Test(org.junit.Test)

Example 37 with InstanceIdType

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType in project lispflowmapping by opendaylight.

the class LispAddressUtilTest method asBinaryEidTest_ipv4Prefix.

/**
 * Tests {@link LispAddressUtil#asBinaryEid(SimpleAddress, InstanceIdType)} method with ipv4Prefix.
 */
@Test
public void asBinaryEidTest_ipv4Prefix() {
    final Eid result = LispAddressUtil.asBinaryEid(SIMPLE_ADDRESS_IPV4_PREFIX_TEST, INSTANCE_ID_TYPE_TEST);
    assertEquals(IPV4_ADDRESS_PREFIX_BINARY_EID_1, result);
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Test(org.junit.Test)

Example 38 with InstanceIdType

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType in project lispflowmapping by opendaylight.

the class LispAddressUtilTest method toEid_ipv6PrefixBinary.

/**
 * Test
 * - {@link LispAddressUtil#toEid(Ipv6PrefixBinary, InstanceIdType)}
 * - {@link LispAddressUtil#asIpv6PrefixBinaryEid(String)}
 * - {@link LispAddressUtil#asIpv6PrefixBinaryEid(String, InstanceIdType)}
 * - {@link LispAddressUtil#asIpv6PrefixBinaryEid(Eid, byte[], short)}
 * method.
 */
@Test
public void toEid_ipv6PrefixBinary() {
    Eid eidFromIpv6PrefixBinary = LispAddressUtil.toEid(IPV6_ADDRESS_PREFIX_BINARY_1, INSTANCE_ID_TYPE_TEST);
    verifyToEidWithIpv6PrefixBinary(eidFromIpv6PrefixBinary, true, MASK_OK_TEST, Ipv6PrefixBinaryAfi.class);
    eidFromIpv6PrefixBinary = LispAddressUtil.asIpv6PrefixBinaryEid(IPV6_ADDRESS_PREFIX_VALUE_TEST);
    verifyToEidWithIpv6PrefixBinary(eidFromIpv6PrefixBinary, false, MASK_OK_TEST, Ipv6PrefixBinaryAfi.class);
    eidFromIpv6PrefixBinary = LispAddressUtil.asIpv6PrefixBinaryEid(IPV6_ADDRESS_PREFIX_VALUE_TEST, INSTANCE_ID_TYPE_TEST);
    verifyToEidWithIpv6PrefixBinary(eidFromIpv6PrefixBinary, true, MASK_OK_TEST, Ipv6PrefixBinaryAfi.class);
    eidFromIpv6PrefixBinary = LispAddressUtil.asIpv6PrefixBinaryEid(IPV6_ADDRESS_PREFIX_BINARY_EID_1, IPV6_ADDRESS_BYTES_A_TEST, MASK_OK_TEST);
    verifyToEidWithIpv6PrefixBinary(eidFromIpv6PrefixBinary, true, MASK_OK_TEST, Ipv6PrefixBinaryAfi.class);
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Test(org.junit.Test)

Example 39 with InstanceIdType

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType in project lispflowmapping by opendaylight.

the class LispAddressUtil method asIpv6PrefixBinaryEid.

public static Eid asIpv6PrefixBinaryEid(InstanceIdType vni, byte[] address, short mask) {
    Preconditions.checkArgument(address.length == 16, "asIpv6PrefixBinaryEid called with incorrect length byte array ({})", address.length);
    EidBuilder builder = new EidBuilder();
    builder.setAddressType(Ipv6PrefixBinaryAfi.class);
    builder.setVirtualNetworkId(vni);
    builder.setAddress(new Ipv6PrefixBinaryBuilder().setIpv6AddressBinary(new Ipv6AddressBinary(address)).setIpv6MaskLength(mask).build());
    return builder.build();
}
Also used : Ipv6AddressBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv6AddressBinary) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) Ipv6PrefixBinaryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6PrefixBinaryBuilder)

Example 40 with InstanceIdType

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType in project lispflowmapping by opendaylight.

the class LispAddressUtil method toEid.

public static Eid toEid(DistinguishedNameType dn, InstanceIdType vni) {
    EidBuilder builder = new EidBuilder();
    builder.setAddressType(DistinguishedNameAfi.class);
    builder.setVirtualNetworkId(vni);
    builder.setAddress((Address) new DistinguishedNameBuilder().setDistinguishedName(dn).build());
    return builder.build();
}
Also used : DistinguishedNameBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.DistinguishedNameBuilder) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)

Aggregations

Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)21 EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)18 Test (org.junit.Test)17 InstanceIdType (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.InstanceIdType)12 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)4 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)4 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)4 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)3 EidItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder)3 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)3 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder)3 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)2 Ipv4PrefixBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4PrefixBuilder)2 Ipv4AddressBinary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary)2 Ipv4PrefixBinaryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4PrefixBinaryBuilder)2 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)2 Preconditions (com.google.common.base.Preconditions)1 Inet4Address (java.net.Inet4Address)1 Inet6Address (java.net.Inet6Address)1 InetAddress (java.net.InetAddress)1