use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method asBinaryEidTest_ipv6Prefix.
/**
* Tests {@link LispAddressUtil#asBinaryEid(SimpleAddress, InstanceIdType)} method with ipv6Prefix.
*/
@Test
public void asBinaryEidTest_ipv6Prefix() {
final Eid result = LispAddressUtil.asBinaryEid(SIMPLE_ADDRESS_IPV6_PREFIX_TEST, INSTANCE_ID_TYPE_TEST);
assertEquals(IPV6_ADDRESS_PREFIX_BINARY_EID_1, result);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix 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);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix 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);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix 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);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix in project lispflowmapping by opendaylight.
the class Ipv6PrefixBinarySerializer method deserializeSimpleAddressData.
@Override
protected SimpleAddress deserializeSimpleAddressData(ByteBuffer buffer, LispAddressSerializerContext ctx) {
byte[] ipBuffer = new byte[16];
InetAddress address = null;
buffer.get(ipBuffer);
try {
address = InetAddress.getByAddress(ipBuffer);
} catch (UnknownHostException e) {
LOG.debug("Unknown host {}", ipBuffer, e);
}
return new SimpleAddress(new IpPrefix(new Ipv6Prefix(address.getHostAddress() + "/" + ctx.getMaskLen())));
}
Aggregations