use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project lispflowmapping by opendaylight.
the class InstanceIdSerializerTest method deserialize__Simple.
@Test
public void deserialize__Simple() throws Exception {
Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer(//
"40 03 00 00 " + //
"02 20 00 0A " + // instance ID
"00 BB CC DD " + // AFI=1, IP=0x11223344
"00 01 11 22 33 44"), new LispAddressSerializerContext(null));
assertEquals(Ipv4BinaryAfi.class, address.getAddressType());
Ipv4Binary ipv4 = (Ipv4Binary) address.getAddress();
assertArrayEquals(new byte[] { 0x11, 0x22, 0x33, 0x44 }, ipv4.getIpv4Binary().getValue());
assertEquals(0x00BBCCDD, address.getVirtualNetworkId().getValue().longValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 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.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 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.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 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.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 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());
}
Aggregations