use of org.opendaylight.protocol.bgp.parser.spi.AttributeParser in project bgpcep by opendaylight.
the class SimpleAttributeRegistry method addAttribute.
private void addAttribute(final ByteBuf buffer, final Map<Integer, RawAttribute> attributes) throws BGPDocumentedException {
final BitArray flags = BitArray.valueOf(buffer.readByte());
final int type = buffer.readUnsignedByte();
final int len = (flags.get(EXTENDED_LENGTH_BIT)) ? buffer.readUnsignedShort() : buffer.readUnsignedByte();
if (!attributes.containsKey(type)) {
final AttributeParser parser = this.handlers.getParser(type);
if (parser == null) {
processUnrecognized(flags, type, buffer, len);
} else {
attributes.put(type, new RawAttribute(parser, buffer.readSlice(len)));
}
} else {
LOG.debug("Ignoring duplicate attribute type {}", type);
}
}
Aggregations