Search in sources :

Example 1 with LspAttributesObjectBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.LspAttributesObjectBuilder in project bgpcep by opendaylight.

the class RequiredAttributesObjectParser method localParseObject.

@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
    final LspRequiredAttributesObjectBuilder builder = new LspRequiredAttributesObjectBuilder();
    final List<SubobjectContainer> subObjectList = new ArrayList<>();
    while (byteBuf.isReadable()) {
        final int type = byteBuf.readUnsignedShort();
        final int length = byteBuf.readUnsignedShort();
        final ByteBuf value = byteBuf.readSlice(length);
        final SubobjectContainerBuilder subObj = new SubobjectContainerBuilder();
        if (type == AttributesObjectParser.FLAG_TLV_TYPE) {
            subObj.setLspSubobject(new FlagsTlvBuilder().setFlagContainer(AttributesObjectParser.parseFlag(value)).build());
        } else {
            LOG.warn("Lsp Attributes Subobject type {} not supported", type);
        }
        subObjectList.add(subObj.build());
    }
    return builder.setLspAttributesObject(new LspAttributesObjectBuilder().setSubobjectContainer(subObjectList).build()).build();
}
Also used : SubobjectContainer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.lsp.attributes.object.SubobjectContainer) SubobjectContainerBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.lsp.attributes.object.SubobjectContainerBuilder) ArrayList(java.util.ArrayList) LspAttributesObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.LspAttributesObjectBuilder) LspRequiredAttributesObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.required.attributes.object.LspRequiredAttributesObjectBuilder) ByteBuf(io.netty.buffer.ByteBuf) FlagsTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.att.subobject.lsp.subobject.FlagsTlvBuilder)

Example 2 with LspAttributesObjectBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.LspAttributesObjectBuilder in project bgpcep by opendaylight.

the class AttributesObjectParser method localParseObject.

@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
    final LspAttributesObjectBuilder builder = new LspAttributesObjectBuilder();
    final List<SubobjectContainer> subObjectList = new ArrayList<>();
    while (byteBuf.isReadable()) {
        final int type = byteBuf.readUnsignedShort();
        final int length = byteBuf.readUnsignedShort();
        final ByteBuf value = byteBuf.readSlice(length);
        final SubobjectContainerBuilder subObj = new SubobjectContainerBuilder();
        if (type == FLAG_TLV_TYPE) {
            subObj.setLspSubobject(new FlagsTlvBuilder().setFlagContainer(parseFlag(value)).build());
        } else {
            LOG.warn("Lsp Attributes Subobject type {} not supported", type);
        }
        subObjectList.add(subObj.build());
    }
    return builder.setSubobjectContainer(subObjectList).build();
}
Also used : SubobjectContainer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.lsp.attributes.object.SubobjectContainer) SubobjectContainerBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.lsp.attributes.object.SubobjectContainerBuilder) ArrayList(java.util.ArrayList) LspAttributesObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.LspAttributesObjectBuilder) ByteBuf(io.netty.buffer.ByteBuf) FlagsTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.att.subobject.lsp.subobject.FlagsTlvBuilder)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)2 ArrayList (java.util.ArrayList)2 FlagsTlvBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.att.subobject.lsp.subobject.FlagsTlvBuilder)2 LspAttributesObjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.LspAttributesObjectBuilder)2 SubobjectContainer (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.lsp.attributes.object.SubobjectContainer)2 SubobjectContainerBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.lsp.attributes.object.SubobjectContainerBuilder)2 LspRequiredAttributesObjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.required.attributes.object.LspRequiredAttributesObjectBuilder)1