Search in sources :

Example 51 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project lispflowmapping by opendaylight.

the class LispAddressUtilTest method convertToBinaryTest_eid.

/**
 * Tests {@link LispAddressUtil#convertToBinary(Eid)} method with ipv4Prefix, ipv6Prefix, ipv4, ipv6.
 */
@Test
public void convertToBinaryTest_eid() {
    final Eid ipv4PrefixEid = new EidBuilder().setAddress(IPV4_PREFIX).build();
    final Eid ipv6PrefixEid = new EidBuilder().setAddress(IPV6_PREFIX).build();
    final Eid ipv4 = new EidBuilder().setAddress(IPV4).build();
    final Eid ipv6 = new EidBuilder().setAddress(IPV6).build();
    Eid resultIpv4PrefixBinary = LispAddressUtil.convertToBinary(ipv4PrefixEid);
    verifyToEidWithIpv4PrefixBinary(resultIpv4PrefixBinary, false, MASK_OK_TEST, Ipv4PrefixBinaryAfi.class);
    Eid resultIpv6PrefixBinary = LispAddressUtil.convertToBinary(ipv6PrefixEid);
    verifyToEidWithIpv6PrefixBinary(resultIpv6PrefixBinary, false, MASK_OK_TEST, Ipv6PrefixBinaryAfi.class);
    Eid resultIpv4Binary = LispAddressUtil.convertToBinary(ipv4);
    verifyToEidWithIpv4Binary(resultIpv4Binary, false);
    Eid resultIpv6Binary = LispAddressUtil.convertToBinary(ipv6);
    verifyToEidWithIpv6Binary(resultIpv6Binary, false);
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) EidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder) Test(org.junit.Test)

Example 52 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project lispflowmapping by opendaylight.

the class LispAddressUtilTest method asIpPrefix_ipv6.

/**
 * Tests {@link LispAddressUtil#asIpPrefix(String, int)} with ipv6 address and correct mask.
 */
@Test
public void asIpPrefix_ipv6() {
    final IpPrefix ipPrefix = LispAddressUtil.asIpPrefix(IPV6_ADDRESS_VALUE_TEST, MASK_OK_TEST);
    assertNotNull(ipPrefix);
    final Ipv6Prefix ipv6Prefix = ipPrefix.getIpv6Prefix();
    assertNotNull(ipv6Prefix);
    assertEquals(IPV6_ADDRESS_PREFIX_TEST, ipv6Prefix);
}
Also used : IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Test(org.junit.Test)

Example 53 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project lispflowmapping by opendaylight.

the class LispAddressUtilTest method asBinaryEidTest_ipv6.

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

Example 54 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project lispflowmapping by opendaylight.

the class LispAddressUtilTest method toRloc.

/**
 * Tests:
 * - {@link LispAddressUtil#toRloc(InetAddress)}
 * - {@link LispAddressUtil#toRloc(Ipv4Address)}
 * - {@link LispAddressUtil#toRloc(Ipv6Address)}
 * - {@link LispAddressUtil#toRloc(SimpleAddress)}
 * methods.
 */
@Test
public void toRloc() throws UnknownHostException {
    InetAddress ipv4AddressInet = Inet4Address.getByAddress(IPV4_ADDRESS_BYTES_A_TEST);
    final Rloc rlocFromInetAddress = LispAddressUtil.toRloc(ipv4AddressInet);
    assertEquals(Ipv4BinaryAfi.class, rlocFromInetAddress.getAddressType());
    assertEquals(IPV4_ADDRESS_BINARY_TEST, ((Ipv4Binary) rlocFromInetAddress.getAddress()).getIpv4Binary());
    final Rloc rlocFromIpv4Address = LispAddressUtil.toRloc(IPV4_ADDRESS_TEST);
    assertEquals(Ipv4Afi.class, rlocFromIpv4Address.getAddressType());
    assertEquals(IPV4_ADDRESS_VALUE_TEST, ((Ipv4) rlocFromIpv4Address.getAddress()).getIpv4().getValue());
    final Rloc rlocFromIpv6Address = LispAddressUtil.toRloc(IPV6_ADDRESS_TEST);
    assertEquals(Ipv6Afi.class, rlocFromIpv6Address.getAddressType());
    assertEquals(IPV6_ADDRESS_VALUE_TEST, ((Ipv6) rlocFromIpv6Address.getAddress()).getIpv6().getValue());
    final Rloc rlocFromSimpleAddress = LispAddressUtil.toRloc(SIMPLE_ADDRESS_IPV4_TEST);
    assertEquals(Ipv4BinaryAfi.class, rlocFromSimpleAddress.getAddressType());
    assertEquals(IPV4_ADDRESS_BINARY_TEST, ((Ipv4Binary) rlocFromSimpleAddress.getAddress()).getIpv4Binary());
}
Also used : Ipv6(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6) Ipv4(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4) Rloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc) InetAddress(java.net.InetAddress) Test(org.junit.Test)

Example 55 with Ipv6

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project lispflowmapping by opendaylight.

the class LispAddressUtilTest method convertFromBinaryTest_eid.

/**
 * Tests {@link LispAddressUtil#convertToBinary(Eid)} method with ipv4Prefix, ipv6Prefix, ipv4, ipv6.
 */
@Test
public void convertFromBinaryTest_eid() {
    final Eid resultIpv4Prefix = LispAddressUtil.convertFromBinary(IPV4_ADDRESS_PREFIX_BINARY_EID_1);
    verifyToEidWithIpv4Prefix(resultIpv4Prefix, false, MASK_OK_TEST, Ipv4PrefixAfi.class);
    final Eid resultIpv6Prefix = LispAddressUtil.convertFromBinary(IPV6_ADDRESS_PREFIX_BINARY_EID_1);
    verifyToEidWithIpv6Prefix(resultIpv6Prefix, false, MASK_OK_TEST, Ipv6PrefixAfi.class);
    final Eid resultIpv4 = LispAddressUtil.convertFromBinary(IPV4_ADDRESS_BINARY_EID);
    verifyToEidWithIpv4(resultIpv4, false);
    final Eid resultIpv6 = LispAddressUtil.convertFromBinary(IPV6_ADDRESS_BINARY_EID);
    verifyToEidWithIpv6(resultIpv6, false);
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)71 ArrayList (java.util.ArrayList)44 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)38 ByteBuf (io.netty.buffer.ByteBuf)27 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)24 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)21 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)20 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)19 InetAddress (java.net.InetAddress)17 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)17 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)16 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)13 List (java.util.List)12 Inet6Address (java.net.Inet6Address)10 UnknownHostException (java.net.UnknownHostException)10 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)10 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)10 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)10 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)9 Ipv6AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone)8