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());
}
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()));
}
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);
}
Aggregations