Search in sources :

Example 1 with PrefixAttributesCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.path.attribute.link.state.attribute.PrefixAttributesCaseBuilder in project bgpcep by opendaylight.

the class PrefixAttributesParser method parsePrefixAttributes.

/**
 * Parse prefix attributes.
 *
 * @param attributes key is the tlv type and value are the value bytes of the tlv
 * @param protocolId to differentiate parsing methods
 * @return {@link LinkStateAttribute}
 */
static LinkStateAttribute parsePrefixAttributes(final Multimap<Integer, ByteBuf> attributes, final ProtocolId protocolId) {
    final PrefixAttributesBuilder builder = new PrefixAttributesBuilder();
    final List<RouteTag> routeTags = new ArrayList<>();
    final List<ExtendedRouteTag> exRouteTags = new ArrayList<>();
    for (final Entry<Integer, ByteBuf> entry : attributes.entries()) {
        final int key = entry.getKey();
        final ByteBuf value = entry.getValue();
        LOG.trace("Prefix attribute TLV {}", key);
        parseAttribute(key, value, protocolId, builder, routeTags, exRouteTags);
    }
    LOG.trace("Finished parsing Prefix Attributes.");
    builder.setRouteTags(routeTags);
    builder.setExtendedTags(exRouteTags);
    return new PrefixAttributesCaseBuilder().setPrefixAttributes(builder.build()).build();
}
Also used : ExtendedRouteTag(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.ExtendedRouteTag) ArrayList(java.util.ArrayList) PrefixAttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.path.attribute.link.state.attribute.prefix.attributes._case.PrefixAttributesBuilder) ByteBuf(io.netty.buffer.ByteBuf) ExtendedRouteTag(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.ExtendedRouteTag) RouteTag(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.RouteTag) PrefixAttributesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.path.attribute.link.state.attribute.PrefixAttributesCaseBuilder)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 ArrayList (java.util.ArrayList)1 ExtendedRouteTag (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.ExtendedRouteTag)1 RouteTag (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.RouteTag)1 PrefixAttributesCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.path.attribute.link.state.attribute.PrefixAttributesCaseBuilder)1 PrefixAttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.path.attribute.link.state.attribute.prefix.attributes._case.PrefixAttributesBuilder)1