use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNode in project bgpcep by opendaylight.
the class DetourObjectIpv6Parser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) {
final ByteBuf plrId = byteBuf.readSlice(byteBuf.capacity() / 2);
final Ipv6DetourObjectBuilder ipv6Case = new Ipv6DetourObjectBuilder();
final List<PlrId> plrIdList = new ArrayList<>();
while (plrId.isReadable()) {
final PlrIdBuilder plr = new PlrIdBuilder();
plr.setPlrId(Ipv6Util.addressForByteBuf(plrId));
plrIdList.add(plr.build());
}
final List<AvoidNode> avoidNodeList = new ArrayList<>();
while (byteBuf.isReadable()) {
final AvoidNodeBuilder plr = new AvoidNodeBuilder();
plr.setAvoidNode(Ipv6Util.addressForByteBuf(byteBuf));
avoidNodeList.add(plr.build());
}
return ipv6Case.setPlrId(plrIdList).setAvoidNode(avoidNodeList).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNode in project bgpcep by opendaylight.
the class DetourObjectIpv6Parser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf byteAggregator) {
Preconditions.checkArgument(teLspObject instanceof Ipv6DetourObject, "DetourObject is mandatory.");
final Ipv6DetourObject detourObject = (Ipv6DetourObject) teLspObject;
final List<PlrId> pList = detourObject.getPlrId();
final List<AvoidNode> aList = detourObject.getAvoidNode();
serializeAttributeHeader((pList.size() * Ipv6Util.IPV6_LENGTH) + (aList.size() * Ipv6Util.IPV6_LENGTH), CLASS_NUM, CTYPE, byteAggregator);
for (final PlrId plrId : pList) {
byteAggregator.writeBytes(Ipv6Util.byteBufForAddress(plrId.getPlrId()));
}
for (final AvoidNode avoidNode : aList) {
byteAggregator.writeBytes(Ipv6Util.byteBufForAddress(avoidNode.getAvoidNode()));
}
}
Aggregations