use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress in project lispflowmapping by opendaylight.
the class AfiListSerializer method deserializeData.
private Address deserializeData(ByteBuffer buffer, short lcafLength, LispAddressSerializerContext ctx) {
List<SimpleAddress> addresses = new ArrayList<SimpleAddress>();
short length = lcafLength;
while (length > 0) {
SimpleAddress address = SimpleAddressSerializer.getInstance().deserialize(buffer, ctx);
length -= SimpleAddressSerializer.getInstance().getAddressSize(address);
addresses.add(address);
}
return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AfiListBuilder().setAfiList(new AfiListBuilder().setAddressList(addresses).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress in project lispflowmapping by opendaylight.
the class ApplicationDataSerializer method deserializeData.
private Address deserializeData(ByteBuffer buffer, LispAddressSerializerContext ctx) {
ApplicationDataBuilder builder = new ApplicationDataBuilder();
byte[] rawIPTos = new byte[3];
buffer.get(rawIPTos);
builder.setIpTos(ByteUtil.getPartialInt(rawIPTos));
builder.setProtocol((short) ByteUtil.getUnsignedByte(buffer));
builder.setLocalPortLow(new PortNumber(ByteUtil.asUnsignedShort(buffer.getShort())));
builder.setLocalPortHigh(new PortNumber(ByteUtil.asUnsignedShort(buffer.getShort())));
builder.setRemotePortLow(new PortNumber(ByteUtil.asUnsignedShort(buffer.getShort())));
builder.setRemotePortHigh(new PortNumber(ByteUtil.asUnsignedShort(buffer.getShort())));
SimpleAddress address = SimpleAddressSerializer.getInstance().deserialize(buffer, ctx);
builder.setAddress(address);
return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ApplicationDataBuilder().setApplicationData(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress in project lispflowmapping by opendaylight.
the class KeyValueAddressSerializer method deserializeData.
private Address deserializeData(ByteBuffer buffer, LispAddressSerializerContext ctx) {
SimpleAddress keyAddress = SimpleAddressSerializer.getInstance().deserialize(buffer, ctx);
SimpleAddress valueAddress = SimpleAddressSerializer.getInstance().deserialize(buffer, ctx);
KeyValueAddressBuilder kvab = new KeyValueAddressBuilder();
kvab.setKey(keyAddress);
kvab.setValue(valueAddress);
return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddressBuilder().setKeyValueAddress(kvab.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress in project lispflowmapping by opendaylight.
the class SourceDestKeySerializer method serializeData.
@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
SourceDestKey sdk = (SourceDestKey) lispAddress.getAddress();
buffer.putShort((short) 0);
short srcMaskLength = MaskUtil.getMaskForAddress(sdk.getSourceDestKey().getSource());
short dstMaskLength = MaskUtil.getMaskForAddress(sdk.getSourceDestKey().getDest());
// org.opendaylight.lispflowmammping.type.Constants
if (srcMaskLength == -1) {
srcMaskLength = 0;
}
if (dstMaskLength == -1) {
dstMaskLength = 0;
}
buffer.put((byte) srcMaskLength);
buffer.put((byte) dstMaskLength);
SimpleAddressSerializer.getInstance().serialize(buffer, new SimpleAddress(sdk.getSourceDestKey().getSource()));
SimpleAddressSerializer.getInstance().serialize(buffer, new SimpleAddress(sdk.getSourceDestKey().getDest()));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress in project lispflowmapping by opendaylight.
the class LispAddressUtil method asKeyValueAddressRloc.
public static Rloc asKeyValueAddressRloc(SimpleAddress key, SimpleAddress value) {
KeyValueAddressBuilder kvab = new KeyValueAddressBuilder();
kvab.setKey(key);
kvab.setValue(value);
KeyValueAddress address = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddressBuilder().setKeyValueAddress(kvab.build()).build();
RlocBuilder builder = new RlocBuilder();
builder.setAddressType(KeyValueAddressLcaf.class);
builder.setVirtualNetworkId(null);
builder.setAddress((Address) address);
return builder.build();
}
Aggregations