Search in sources :

Example 1 with AvoidNode

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();
}
Also used : PlrIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.PlrIdBuilder) AvoidNode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNode) ArrayList(java.util.ArrayList) Ipv6DetourObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv6DetourObjectBuilder) AvoidNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNodeBuilder) PlrId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.PlrId) ByteBuf(io.netty.buffer.ByteBuf)

Example 2 with AvoidNode

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()));
    }
}
Also used : AvoidNode(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNode) Ipv6DetourObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv6DetourObject) PlrId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.PlrId)

Aggregations

AvoidNode (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNode)2 PlrId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.PlrId)2 ByteBuf (io.netty.buffer.ByteBuf)1 ArrayList (java.util.ArrayList)1 Ipv6DetourObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv6DetourObject)1 Ipv6DetourObjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv6DetourObjectBuilder)1 AvoidNodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.AvoidNodeBuilder)1 PlrIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.ipv6.detour.object.PlrIdBuilder)1