use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary in project lispflowmapping by opendaylight.
the class LispAddressUtil method toEid.
public static Eid toEid(Ipv4AddressBinary address, InstanceIdType vni) {
EidBuilder builder = new EidBuilder();
builder.setAddressType(Ipv4BinaryAfi.class);
builder.setVirtualNetworkId(vni);
builder.setAddress((Address) new Ipv4BinaryBuilder().setIpv4Binary(address).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary in project lispflowmapping by opendaylight.
the class LispAddressUtil method convertToBinary.
private static Ipv4PrefixBinary convertToBinary(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix prefix) {
Ipv4PrefixBinaryBuilder pb = new Ipv4PrefixBinaryBuilder();
byte[] address = InetAddresses.forString(MaskUtil.getAddressStringForIpv4Prefix(prefix)).getAddress();
pb.setIpv4AddressBinary(new Ipv4AddressBinary(address));
pb.setIpv4MaskLength(MaskUtil.getMaskForAddress(prefix));
return pb.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method toEid_ipv4.
/**
* Test
* - {@link LispAddressUtil#toEid(Ipv4Address, InstanceIdType)}
* - {@link LispAddressUtil#toEid(Ipv4AddressBinary, InstanceIdType)}
* - {@link LispAddressUtil#asIpv4Eid(String)}
* - {@link LispAddressUtil#asIpv4Eid(String, long)}
* methods.
*/
@Test
public void toEid_ipv4() {
Eid eidFromIpv4 = LispAddressUtil.toEid(IPV4_ADDRESS_TEST, INSTANCE_ID_TYPE_TEST);
verifyToEidWithIpv4(eidFromIpv4, true);
eidFromIpv4 = LispAddressUtil.toEid(IPV4_ADDRESS_BINARY_TEST, INSTANCE_ID_TYPE_TEST);
verifyToEidWithIpv4Binary(eidFromIpv4, true);
eidFromIpv4 = LispAddressUtil.asIpv4Eid(IPV4_ADDRESS_VALUE_TEST);
verifyToEidWithIpv4Binary(eidFromIpv4, false);
eidFromIpv4 = LispAddressUtil.asIpv4Eid(IPV4_ADDRESS_VALUE_TEST, INSTANCE_ID_TYPE_VALUE_TEST);
verifyToEidWithIpv4Binary(eidFromIpv4, true);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary in project lispflowmapping by opendaylight.
the class Ipv4PrefixBinarySerializer method deserializeEidData.
@Override
protected Eid deserializeEidData(ByteBuffer buffer, LispAddressSerializerContext ctx) {
byte[] ipBuffer = new byte[4];
buffer.get(ipBuffer);
Ipv4PrefixBinary prefix = new Ipv4PrefixBinaryBuilder().setIpv4AddressBinary(new Ipv4AddressBinary(ipBuffer)).setIpv4MaskLength(ctx.getMaskLen()).build();
EidBuilder eb = new EidBuilder();
eb.setAddressType(Ipv4PrefixBinaryAfi.class);
eb.setVirtualNetworkId(getVni(ctx));
eb.setAddress(prefix);
return eb.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary 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();
}
Aggregations