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_ipv4.
/**
* Tests {@link LispAddressUtil#addressFromIpAddress(IpAddress)} and {@link
* LispAddressUtil#addressTypeFromIpAddress(IpAddress)}
* methods with ipv4 address.
*/
@Test
public void addressFromIpAddress_ipv4() {
final IpAddress ipv4Address = new IpAddress(IPV4_ADDRESS_TEST);
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromIpAddress(ipv4Address);
assertEquals(Ipv4Afi.class, addressClass);
final Address address = LispAddressUtil.addressFromIpAddress(ipv4Address);
assertTrue(address instanceof Ipv4);
assertEquals(IPV4_ADDRESS_VALUE_TEST, ((Ipv4) address).getIpv4().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 binaryAddressFromInet_ipv4.
/**
* Tests {@link LispAddressUtil#binaryAddressFromInet(InetAddress)} and
* {@link LispAddressUtil#binaryAddressTypeFromInet(InetAddress)} methods with ipv4 address.
*/
@Test
public void binaryAddressFromInet_ipv4() throws UnknownHostException {
final InetAddress ipv4InetAddress = Inet4Address.getByAddress(IPV4_ADDRESS_BYTES_A_TEST);
Class<? extends LispAddressFamily> addressClass = LispAddressUtil.binaryAddressTypeFromInet(ipv4InetAddress);
assertEquals(Ipv4BinaryAfi.class, addressClass);
final Address address = LispAddressUtil.binaryAddressFromInet(ipv4InetAddress);
assertTrue(address instanceof Ipv4Binary);
assertArrayEquals(IPV4_ADDRESS_BYTES_A_TEST, ((Ipv4Binary) address).getIpv4Binary().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_Ipv6Binary.
/**
* Tests {@link LispAddressUtil#binaryAddressFromIpAddress(IpAddress)} and {@link
* LispAddressUtil#binaryAddressTypeFromIpAddress(IpAddress)}
* methods with Ipv6Binary address.
*/
@Test
public void binaryAddressFromIpAddress_Ipv6Binary() {
final IpAddress ipv6Address = new IpAddress(new Ipv6Address(IPV6_ADDRESS_VALUE_TEST));
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.binaryAddressTypeFromIpAddress(ipv6Address);
assertEquals(Ipv6BinaryAfi.class, addressClass);
final Address address = LispAddressUtil.binaryAddressFromIpAddress(ipv6Address);
assertEquals(IPV6_BINARY, 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 binaryAddressFromIpAddress_Ipv4Binary.
/**
* Tests {@link LispAddressUtil#binaryAddressFromIpAddress(IpAddress)} and {@link
* LispAddressUtil#binaryAddressTypeFromIpAddress(IpAddress)}
* methods with Ipv4Binary address.
*/
@Test
public void binaryAddressFromIpAddress_Ipv4Binary() {
final IpAddress ipv4Address = new IpAddress(new Ipv4Address(IPV4_ADDRESS_VALUE_TEST));
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.binaryAddressTypeFromIpAddress(ipv4Address);
assertEquals(Ipv4BinaryAfi.class, addressClass);
final Address address = LispAddressUtil.binaryAddressFromIpAddress(ipv4Address);
assertEquals(IPV4_BINARY, 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 addressFromIpPrefix_ipv4.
/**
* Tests {@link LispAddressUtil#addressFromIpPrefix(IpPrefix)} and {@link
* LispAddressUtil#addressTypeFromIpPrefix(IpPrefix)}
* methods with ipv4 address.
*/
@Test
public void addressFromIpPrefix_ipv4() {
IpPrefix ipv4Prefix = new IpPrefix(new Ipv4Prefix(IPV4_ADDRESS_PREFIX_VALUE_TEST));
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromIpPrefix(ipv4Prefix);
assertEquals(Ipv4PrefixAfi.class, addressClass);
final Address address = LispAddressUtil.addressFromIpPrefix(ipv4Prefix);
assertTrue(address instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix);
assertEquals(IPV4_ADDRESS_PREFIX_VALUE_TEST, ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix) address).getIpv4Prefix().getValue());
}
Aggregations