use of org.opendaylight.protocol.bgp.parser.spi.ParameterLengthOverflowException in project bgpcep by opendaylight.
the class BGPOpenMessageParser method normalSerializeParameters.
private ByteBuf normalSerializeParameters(final List<BgpParameters> params) {
final ByteBuf buffer = Unpooled.buffer();
for (final BgpParameters param : params) {
final Optional<ParameterSerializer> optSer = reg.findSerializer(param);
if (optSer.isPresent()) {
try {
optSer.get().serializeParameter(param, buffer);
} catch (ParameterLengthOverflowException e) {
LOG.debug("Forcing extended parameter serialization", e);
return null;
}
} else {
LOG.debug("Ingnoring unregistered parameter {}", param);
}
}
final int length = buffer.writerIndex();
if (length > Values.UNSIGNED_BYTE_MAX_VALUE) {
LOG.debug("Final parameter size is {}, forcing extended serialization", length);
return null;
}
return buffer;
}
Aggregations