Search in sources :

Example 16 with LispAddressFamily

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

the class LispAddressUtilTest method addressFromInet_ipv6.

/**
 * Tests {@link LispAddressUtil#addressFromInet(InetAddress)} and {@link LispAddressUtil#addressTypeFromInet
 * (InetAddress)}
 * methods with ipv6 address.
 */
@Test
public void addressFromInet_ipv6() throws UnknownHostException {
    final InetAddress ipv6InetAddress = Inet6Address.getByAddress(IPV6_ADDRESS_BYTES_A_TEST);
    final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromInet(ipv6InetAddress);
    assertEquals(Ipv6Afi.class, addressClass);
    final Address address = LispAddressUtil.addressFromInet(ipv6InetAddress);
    assertTrue(address instanceof Ipv6);
    assertEquals(IPV6_ADDRESS_VALUE_TEST, ((Ipv6) address).getIpv6().getValue());
}
Also used : InetAddress(java.net.InetAddress) Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) LispAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress) NoAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress) Inet4Address(java.net.Inet4Address) Inet6Address(java.net.Inet6Address) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) Ipv6(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6) InetAddress(java.net.InetAddress) Test(org.junit.Test)

Example 17 with LispAddressFamily

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

the class LispAddressUtilTest method addressFromSimpleAddressTest_asAnyIpAddress.

/**
 * Tests {@link LispAddressUtil#addressTypeFromSimpleAddress} and {@link
 * LispAddressUtil#addressFromSimpleAddress} methods
 * with ipAddress.
 */
@Test
public void addressFromSimpleAddressTest_asAnyIpAddress() {
    final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromSimpleAddress(SIMPLE_ADDRESS_IPV4_TEST);
    assertEquals(Ipv4BinaryAfi.class, addressClass);
    final Address address = LispAddressUtil.addressFromSimpleAddress(SIMPLE_ADDRESS_IPV4_TEST);
    assertTrue(address instanceof Ipv4Binary);
}
Also used : InetAddress(java.net.InetAddress) Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) LispAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress) NoAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress) Inet4Address(java.net.Inet4Address) Inet6Address(java.net.Inet6Address) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) Ipv4Binary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary) Test(org.junit.Test)

Example 18 with LispAddressFamily

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

the class LispAddressUtilTest method binaryAddressFromInet_ipv6.

/**
 * Tests {@link LispAddressUtil#binaryAddressFromInet(InetAddress)} and
 * {@link LispAddressUtil#binaryAddressTypeFromInet(InetAddress)} methods with ipv6 address.
 */
@Test
public void binaryAddressFromInet_ipv6() throws UnknownHostException {
    final InetAddress ipv6InetAddress = Inet6Address.getByAddress(IPV6_ADDRESS_BYTES_A_TEST);
    Class<? extends LispAddressFamily> addressClass = LispAddressUtil.binaryAddressTypeFromInet(ipv6InetAddress);
    assertEquals(Ipv6BinaryAfi.class, addressClass);
    final Address address = LispAddressUtil.binaryAddressFromInet(ipv6InetAddress);
    assertTrue(address instanceof Ipv6Binary);
    assertArrayEquals(IPV6_ADDRESS_BYTES_A_TEST, ((Ipv6Binary) address).getIpv6Binary().getValue());
}
Also used : InetAddress(java.net.InetAddress) Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) LispAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress) NoAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress) Inet4Address(java.net.Inet4Address) Inet6Address(java.net.Inet6Address) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) InetAddress(java.net.InetAddress) Ipv6Binary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6Binary) Test(org.junit.Test)

Example 19 with LispAddressFamily

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

the class LispAddressUtilTest method binaryAddressFromIpAddress_null.

/**
 * Tests {@link LispAddressUtil#binaryAddressFromIpAddress(IpAddress)} and {@link
 * LispAddressUtil#binaryAddressTypeFromIpAddress(IpAddress)}
 * methods with Ipv6Binary address.
 */
@Test
public void binaryAddressFromIpAddress_null() {
    final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.binaryAddressTypeFromIpAddress(null);
    assertNull(addressClass);
    final Address address = LispAddressUtil.binaryAddressFromIpAddress(null);
    assertNull(address);
}
Also used : InetAddress(java.net.InetAddress) Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) LispAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress) NoAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress) Inet4Address(java.net.Inet4Address) Inet6Address(java.net.Inet6Address) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) Test(org.junit.Test)

Example 20 with LispAddressFamily

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

the class LispAddressUtilTest method addressFromIpAddress_ipv6.

/**
 * Tests {@link LispAddressUtil#addressFromIpAddress(IpAddress)} and {@link
 * LispAddressUtil#addressTypeFromIpAddress(IpAddress)}
 * methods with ipv6 address.
 */
@Test
public void addressFromIpAddress_ipv6() {
    final IpAddress ipv6Address = new IpAddress(new Ipv6Address(IPV6_ADDRESS_VALUE_TEST));
    final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromIpAddress(ipv6Address);
    assertEquals(Ipv6Afi.class, addressClass);
    final Address address = LispAddressUtil.addressFromIpAddress(ipv6Address);
    assertTrue(address instanceof Ipv6);
    assertEquals(IPV6_ADDRESS_VALUE_TEST, ((Ipv6) address).getIpv6().getValue());
}
Also used : InetAddress(java.net.InetAddress) Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) LispAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress) NoAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress) Inet4Address(java.net.Inet4Address) Inet6Address(java.net.Inet6Address) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) Ipv6(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) Test(org.junit.Test)

Aggregations

Inet4Address (java.net.Inet4Address)24 Inet6Address (java.net.Inet6Address)24 InetAddress (java.net.InetAddress)24 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)24 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)24 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)24 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)24 Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address)24 KeyValueAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress)24 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)24 Test (org.junit.Test)18 LispAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress)18 NoAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress)18 LispAddressFamily (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddressFamily)4 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)3 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)3 Ipv4 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4)3 Ipv6 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6)3 Ipv4Binary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary)3 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)2