Search in sources :

Example 56 with SimpleAddress

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();
}
Also used : ArrayList(java.util.ArrayList) AfiListBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.afi.list.AfiListBuilder) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)

Example 57 with SimpleAddress

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();
}
Also used : ApplicationDataBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.application.data.ApplicationDataBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)

Example 58 with SimpleAddress

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();
}
Also used : KeyValueAddressBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.key.value.address.KeyValueAddressBuilder) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)

Example 59 with SimpleAddress

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()));
}
Also used : SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)

Example 60 with SimpleAddress

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();
}
Also used : RlocBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder) Preconditions(com.google.common.base.Preconditions) KeyValueAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress) KeyValueAddressBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.key.value.address.KeyValueAddressBuilder)

Aggregations

SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)46 Test (org.junit.Test)29 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)16 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)14 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)13 Rloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc)11 EidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.EidBuilder)9 InetAddress (java.net.InetAddress)8 KeyValueAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.KeyValueAddress)8 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)8 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)7 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)7 ArrayList (java.util.ArrayList)6 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)6 Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address)6 SourceDestKeyBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.source.dest.key.SourceDestKeyBuilder)6 ItrRloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc)6 ByteBuffer (java.nio.ByteBuffer)5 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)5 NoAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.NoAddress)5