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());
}
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);
}
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());
}
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);
}
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());
}
Aggregations