use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.
the class Ipv6PrefixSerializer method deserializeData.
private static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix deserializeData(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 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix(address.getHostAddress() + "/" + ctx.getMaskLen());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.
the class LispAddressStringifier method getAddrString.
private static String getAddrString(Destination dst, LispAddress lispAddress) {
if (lispAddress == null) {
return "null";
}
Address addr = lispAddress.getAddress();
Long vni = null;
if (lispAddress.getVirtualNetworkId() != null) {
vni = lispAddress.getVirtualNetworkId().getValue();
}
return getAddrString(dst, addr, vni);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.
the class LispAddressStringifier method getStringFromAfiList.
protected static String getStringFromAfiList(Destination dst, AfiList addr) {
// AFI 16387, LCAF Type 1; Address List
// Example rendering:
// {192.0.2.1,192.0.2.2,2001:db8::1}
List<SimpleAddress> addresses = addr.getAfiList().getAddressList();
StringBuilder sb = new StringBuilder("{");
boolean needComma = false;
for (SimpleAddress a : addresses) {
if (needComma) {
sb.append(",");
}
sb.append(a.getValue());
needComma = true;
}
sb.append("}");
return sb.toString();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.
the class LispAddressUtil method toEid.
public static Eid toEid(Ipv4Prefix prefix, InstanceIdType vni) {
EidBuilder builder = new EidBuilder();
builder.setAddressType(Ipv4PrefixAfi.class);
builder.setVirtualNetworkId(vni);
builder.setAddress((Address) new Ipv4PrefixBuilder().setIpv4Prefix(prefix).build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address in project lispflowmapping by opendaylight.
the class LispAddressUtil method asIpv4PrefixEid.
public static Eid asIpv4PrefixEid(Eid eid, Inet4Address address, short mask) {
EidBuilder builder = new EidBuilder();
builder.setAddressType(Ipv4PrefixAfi.class);
builder.setVirtualNetworkId(eid.getVirtualNetworkId());
builder.setAddress(new Ipv4PrefixBuilder().setIpv4Prefix(IetfInetUtil.INSTANCE.ipv4PrefixFor(address, mask)).build());
return builder.build();
}
Aggregations