use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method asEid.
/**
* Tests {@link LispAddressUtil#asEid(SimpleAddress, InstanceIdType)} method.
*/
@Test
public void asEid() {
final Eid eid = LispAddressUtil.asEid(SIMPLE_ADDRESS_IPV4_TEST, INSTANCE_ID_TYPE_TEST);
assertNotNull(eid);
assertEquals(Ipv4BinaryAfi.class, eid.getAddressType());
final Ipv4Binary address = (Ipv4Binary) eid.getAddress();
assertArrayEquals(InetAddresses.forString(SIMPLE_ADDRESS_IPV4_TEST.getIpAddress().getIpv4Address().getValue()).getAddress(), address.getIpv4Binary().getValue());
assertEquals(INSTANCE_ID_TYPE_TEST, eid.getVirtualNetworkId());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary in project lispflowmapping by opendaylight.
the class Ipv4BinarySerializer method serializeData.
@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
Ipv4Binary address = (Ipv4Binary) lispAddress.getAddress();
buffer.put(address.getIpv4Binary().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary in project lispflowmapping by opendaylight.
the class LispAddressUtil method convertFromBinary.
private static Pair<Class<? extends LispAddressFamily>, Address> convertFromBinary(Address addr) {
Address convAddr = null;
Class<? extends LispAddressFamily> convType = null;
if (addr instanceof Ipv4PrefixBinary) {
convAddr = convertFromBinary((Ipv4PrefixBinary) addr);
convType = Ipv4PrefixAfi.class;
} else if (addr instanceof Ipv6PrefixBinary) {
convAddr = convertFromBinary((Ipv6PrefixBinary) addr);
convType = Ipv6PrefixAfi.class;
} else if (addr instanceof Ipv4Binary) {
convAddr = convertFromBinary((Ipv4Binary) addr);
convType = Ipv4Afi.class;
} else if (addr instanceof Ipv6Binary) {
convAddr = convertFromBinary((Ipv6Binary) addr);
convType = Ipv6Afi.class;
}
return new ImmutablePair<Class<? extends LispAddressFamily>, Address>(convType, convAddr);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary in project lispflowmapping by opendaylight.
the class MultiSiteScenario method verifyIpv4Address.
private Ipv4AddressBinary verifyIpv4Address(final LocatorRecord locatorRecord) {
assertNotNull(locatorRecord);
final Rloc rloc = locatorRecord.getRloc();
assertNotNull(rloc);
final Address address = rloc.getAddress();
assertTrue(address instanceof Ipv4Binary);
return ((Ipv4Binary) address).getIpv4Binary();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTestUtil method removePrefixIfNecessary.
static Eid removePrefixIfNecessary(Eid eid) {
EidBuilder eb = new EidBuilder(eid);
Address address = eid.getAddress();
if (address instanceof Ipv4PrefixBinary) {
Ipv4Binary convertedEid = new Ipv4BinaryBuilder().setIpv4Binary(((Ipv4PrefixBinary) address).getIpv4AddressBinary()).build();
return eb.setAddress(convertedEid).setAddressType(Ipv4BinaryAfi.class).build();
} else if (address instanceof Ipv6PrefixBinary) {
Ipv6Binary convertedEid = new Ipv6BinaryBuilder().setIpv6Binary(((Ipv6PrefixBinary) address).getIpv6AddressBinary()).build();
return eb.setAddress(convertedEid).setAddressType(Ipv6BinaryAfi.class).build();
}
return eid;
}
Aggregations