use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.tspec.object.TspecObjectBuilder in project bgpcep by opendaylight.
the class SenderTspecObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final TspecObjectBuilder builder = new TspecObjectBuilder();
// skip version number, reserved, Overall length
byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
// skip Service header, reserved, Length of service
byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
// skip Parameter ID, Parameter 127 flags, Parameter 127 length
byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
builder.setTokenBucketRate(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
builder.setTokenBucketSize(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
builder.setPeakDataRate(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
builder.setMinimumPolicedUnit(byteBuf.readUnsignedInt());
builder.setMaximumPacketSize(byteBuf.readUnsignedInt());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.tspec.object.TspecObjectBuilder in project bgpcep by opendaylight.
the class FlowSpecObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final FlowSpecObjectBuilder builder = new FlowSpecObjectBuilder();
// skip version number, reserved, overall length
byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
builder.setServiceHeader(ServiceNumber.forValue(byteBuf.readUnsignedByte()));
// skip reserved
byteBuf.skipBytes(ByteBufWriteUtil.ONE_BYTE_LENGTH);
// skip Length of controlled-load data
byteBuf.skipBytes(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
// skip parameter ID 127 and 127 flags
byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
final TspecObjectBuilder tBuilder = new TspecObjectBuilder();
tBuilder.setTokenBucketRate(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
tBuilder.setTokenBucketSize(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
tBuilder.setPeakDataRate(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
tBuilder.setMinimumPolicedUnit(byteBuf.readUnsignedInt());
tBuilder.setMaximumPacketSize(byteBuf.readUnsignedInt());
builder.setTspecObject(tBuilder.build());
if (builder.getServiceHeader().getIntValue() == 2) {
// skip parameter ID 130, flags, lenght
byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
builder.setRate(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
builder.setSlackTerm(byteBuf.readUnsignedInt());
}
return builder.build();
}
Aggregations