Search in sources :

Example 1 with BindingSubTlvsParser

use of org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser in project bgpcep by opendaylight.

the class SimpleBindingSubTlvsRegistry method parseBindingSubTlvs.

public List<BindingSubTlvs> parseBindingSubTlvs(final ByteBuf buffer, final ProtocolId protocolId) {
    final List<BindingSubTlvs> subTlvs = new ArrayList<>();
    if (buffer != null) {
        while (buffer.isReadable()) {
            final int type = buffer.readUnsignedShort();
            final int length = buffer.readUnsignedShort();
            final ByteBuf slice = buffer.readSlice(length);
            final BindingSubTlvsParser parser = this.handlers.getParser(type);
            if (parser == null) {
                return null;
            }
            subTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(parser.parseSubTlv(slice, protocolId)).build());
        }
    }
    return subTlvs;
}
Also used : ArrayList(java.util.ArrayList) BindingSubTlvsParser(org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser) ByteBuf(io.netty.buffer.ByteBuf) BindingSubTlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sid.tlv.BindingSubTlvs) BindingSubTlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sid.tlv.BindingSubTlvsBuilder)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 ArrayList (java.util.ArrayList)1 BindingSubTlvsParser (org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser)1 BindingSubTlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sid.tlv.BindingSubTlvs)1 BindingSubTlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sid.tlv.BindingSubTlvsBuilder)1