Search in sources :

Example 6 with LispAddressSerializerContext

use of org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext in project lispflowmapping by opendaylight.

the class ServicePathTest method deserialize__Simple.

@Test
public void deserialize__Simple() throws Exception {
    Eid address = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer("40 03 00 00 " + "11 00 00 04 " + "AA BB CC FF"), new LispAddressSerializerContext(null));
    assertEquals(ServicePathLcaf.class, address.getAddressType());
    ServicePath sp = (ServicePath) address.getAddress();
    assertEquals(ByteUtil.getPartialInt(new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC }), sp.getServicePath().getServicePathId().getValue().intValue());
    assertEquals((byte) 0xFF, sp.getServicePath().getServiceIndex().byteValue());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) LispAddressSerializerContext(org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext) ServicePath(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ServicePath) Test(org.junit.Test)

Example 7 with LispAddressSerializerContext

use of org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext in project lispflowmapping by opendaylight.

the class SourceDestKeySerializerTest method deserialize__Ipv6.

@Test
public void deserialize__Ipv6() throws Exception {
    Eid srcAddress = LispAddressSerializer.getInstance().deserializeEid(hexToByteBuffer(// 
    "40 03 00 00 " + // 
    "0C 20 00 28 " + // reserved + masks
    "00 00 78 78 " + // AFI=2,
    "00 02 11 22 33 44 55 66 77 88 99 AA BB CC AA BB CC DD " + // AFI=2,
    "00 02 44 33 22 11 88 77 66 55 99 AA BB CC AA BB CC DD"), new LispAddressSerializerContext(null));
    // IPv6
    assertEquals("1122:3344:5566:7788:99aa:bbcc:aabb:ccdd/120", String.valueOf(((SourceDestKey) srcAddress.getAddress()).getSourceDestKey().getSource().getValue()));
    assertEquals("4433:2211:8877:6655:99aa:bbcc:aabb:ccdd/120", String.valueOf(((SourceDestKey) srcAddress.getAddress()).getSourceDestKey().getDest().getValue()));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) LispAddressSerializerContext(org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext) SourceDestKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey) Test(org.junit.Test)

Example 8 with LispAddressSerializerContext

use of org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext in project lispflowmapping by opendaylight.

the class EidRecordSerializer method deserialize.

public Eid deserialize(ByteBuffer requestBuffer) {
    /* byte reserved = */
    requestBuffer.get();
    short maskLength = (short) (ByteUtil.getUnsignedByte(requestBuffer));
    LispAddressSerializerContext ctx = new LispAddressSerializerContext(maskLength);
    return LispAddressSerializer.getInstance().deserializeEid(requestBuffer, ctx);
}
Also used : LispAddressSerializerContext(org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext)

Aggregations

LispAddressSerializerContext (org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializerContext)8 Test (org.junit.Test)5 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)5 SourceDestKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.SourceDestKey)2 LispSerializationException (org.opendaylight.lispflowmapping.lisp.serializer.exception.LispSerializationException)1 ServicePath (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ServicePath)1 Ipv4Binary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary)1 Ipv6Binary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6Binary)1 EidItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem)1 EidItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder)1 LocatorRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord.Action)1 MappingRecordBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder)1 ItrRloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc)1 ItrRlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder)1 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)1 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder)1