use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress in project lispflowmapping by opendaylight.
the class KeyValueAddressSerializer method serializeData.
@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
KeyValueAddress kva = (KeyValueAddress) lispAddress.getAddress();
SimpleAddressSerializer.getInstance().serialize(buffer, kva.getKeyValueAddress().getKey());
SimpleAddressSerializer.getInstance().serialize(buffer, kva.getKeyValueAddress().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress in project lispflowmapping by opendaylight.
the class ServicePathSerializer method serializeData.
@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
ServicePath sp = (ServicePath) lispAddress.getAddress();
buffer.put(ByteUtil.partialIntToByteArray(NumberUtil.asInt(sp.getServicePath().getServicePathId().getValue().intValue()), Length.SPI));
buffer.put((byte) NumberUtil.asShort(sp.getServicePath().getServiceIndex()));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress in project lispflowmapping by opendaylight.
the class LispSouthboundHandlerTest method mapRequest__VerifyBasicFields.
@Test
public void mapRequest__VerifyBasicFields() throws Exception {
ArgumentCaptor<RequestMapping> captor = ArgumentCaptor.forClass(RequestMapping.class);
handleMapRequestAsByteArray(mapRequestPacket);
Mockito.verify(mockLispSouthboundPlugin).sendNotificationIfPossible(captor.capture());
List<EidItem> eids = captor.getValue().getMapRequest().getEidItem();
assertEquals(1, eids.size());
Eid lispAddress = eids.get(0).getEid();
assertEquals(Ipv4PrefixBinaryAfi.class, lispAddress.getAddressType());
assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("1.2.3.4/32"), lispAddress);
assertEquals(0x3d8d2acd39c8d608L, captor.getValue().getMapRequest().getNonce().longValue());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress in project lispflowmapping by opendaylight.
the class ExplicitLocatorPathSerializer method getLcafLength.
@Override
protected short getLcafLength(LispAddress lispAddress) {
short totalSize = 0;
ExplicitLocatorPath elp = (ExplicitLocatorPath) lispAddress.getAddress();
if (elp.getExplicitLocatorPath() != null) {
for (Hop hop : elp.getExplicitLocatorPath().getHop()) {
totalSize += SimpleAddressSerializer.getInstance().getAddressSize(hop.getAddress()) + 2;
}
}
return totalSize;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.LispAddress in project lispflowmapping by opendaylight.
the class ExplicitLocatorPathSerializer method serializeData.
@Override
protected void serializeData(ByteBuffer buffer, LispAddress lispAddress) {
ExplicitLocatorPath elp = (ExplicitLocatorPath) lispAddress.getAddress();
if (elp.getExplicitLocatorPath() != null) {
for (Hop hop : elp.getExplicitLocatorPath().getHop()) {
buffer.put((byte) 0);
if (hop.getLrsBits() != null) {
buffer.put((byte) (ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isLookup()), Flags.LOOKUP) | ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isRlocProbe()), Flags.RLOC_PROBE) | ByteUtil.boolToBit(BooleanUtils.isTrue(hop.getLrsBits().isStrict()), Flags.STRICT)));
} else {
buffer.put((byte) 0);
}
SimpleAddressSerializer.getInstance().serialize(buffer, hop.getAddress());
}
}
}
Aggregations