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 LispAddressUtil method convertToBinary.
public static Rloc convertToBinary(Rloc rloc) {
Pair<Class<? extends LispAddressFamily>, Address> converted = convertToBinary(rloc.getAddress());
if (converted.getRight() == null) {
return rloc;
}
RlocBuilder rb = new RlocBuilder(rloc);
rb.setAddressType(converted.getLeft());
rb.setAddress(converted.getRight());
return rb.build();
}
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_null.
/**
* Tests {@link LispAddressUtil#addressFromIpAddress(IpAddress)} and {@link
* LispAddressUtil#addressTypeFromIpAddress(IpAddress)}
* methods with null value instead off address.
*/
@Test
public void addressFromIpAddress_null() {
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromIpAddress(null);
assertNull(addressClass);
final Address address = LispAddressUtil.addressFromIpAddress(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 addressFromInet_ipv4.
/**
* Tests {@link LispAddressUtil#addressFromInet(InetAddress)} and {@link LispAddressUtil#addressTypeFromInet
* (InetAddress)}
* methods with ipv4 address.
*/
@Test
public void addressFromInet_ipv4() throws UnknownHostException {
final InetAddress ipv4InetAddress = Inet4Address.getByAddress(IPV4_ADDRESS_BYTES_A_TEST);
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromInet(ipv4InetAddress);
assertEquals(Ipv4Afi.class, addressClass);
final Address address = LispAddressUtil.addressFromInet(ipv4InetAddress);
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 addressFromSimpleAddressTest_asIpPrefix.
/**
* Tests {@link LispAddressUtil#addressTypeFromSimpleAddress} and {@link
* LispAddressUtil#addressFromSimpleAddress} methods
* with ipPrefix.
*/
@Test
public void addressFromSimpleAddressTest_asIpPrefix() {
final SimpleAddress simpleAddress = new SimpleAddress(new IpPrefix(new Ipv4Prefix(IPV4_ADDRESS_PREFIX_VALUE_TEST)));
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromSimpleAddress(simpleAddress);
assertEquals(Ipv4PrefixAfi.class, addressClass);
final Address address = LispAddressUtil.addressFromSimpleAddress(simpleAddress);
assertTrue(address instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix);
}
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_asAddress.
/**
* Tests {@link LispAddressUtil#addressTypeFromSimpleAddress} and {@link
* LispAddressUtil#addressFromSimpleAddress} methods
* with general address.
*/
@Test
public void addressFromSimpleAddressTest_asAddress() {
final SimpleAddress simpleAddress = new SimpleAddress(DUMMY_CHARACTER_ARRAY_TEST);
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromSimpleAddress(simpleAddress);
assertEquals(DistinguishedNameAfi.class, addressClass);
final Address address = LispAddressUtil.addressFromSimpleAddress(simpleAddress);
assertTrue(address instanceof DistinguishedName);
}
Aggregations