use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class SenderTspecObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof TspecObject, "SenderTspecObject is mandatory.");
final TspecObject tspecObj = (TspecObject) teLspObject;
serializeAttributeHeader(BODY_SIZE, CLASS_NUM, CTYPE, output);
output.writeZero(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
output.writeShort(OVERALL_LENGTH);
output.writeByte(ByteBufWriteUtil.ONE_BYTE_LENGTH);
output.writeZero(ByteBufWriteUtil.ONE_BYTE_LENGTH);
output.writeShort(SERVICE_LENGHT);
output.writeByte(TOKEN_BUCKET_TSPEC);
output.writeZero(ByteBufWriteUtil.ONE_BYTE_LENGTH);
output.writeShort(PARAMETER_127_LENGTH);
writeFloat32(tspecObj.getTokenBucketRate(), output);
writeFloat32(tspecObj.getTokenBucketSize(), output);
writeFloat32(tspecObj.getPeakDataRate(), output);
writeUnsignedInt(tspecObj.getMinimumPolicedUnit(), output);
writeUnsignedInt(tspecObj.getMaximumPacketSize(), output);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject 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.RsvpTeObject in project bgpcep by opendaylight.
the class SessionAttributeLspObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final BasicSessionAttributeObjectBuilder builder = new BasicSessionAttributeObjectBuilder();
builder.setSetupPriority(byteBuf.readUnsignedByte());
builder.setHoldPriority(byteBuf.readUnsignedByte());
final BitArray bs = BitArray.valueOf(byteBuf.readByte());
builder.setLocalProtectionDesired(bs.get(LOCAL_PROTECTION));
builder.setLabelRecordingDesired(bs.get(LABEL_RECORDING));
builder.setSeStyleDesired(bs.get(SE_STYLE));
final short nameLenght = byteBuf.readUnsignedByte();
final ByteBuf auxBuf = byteBuf.readSlice(nameLenght);
final String name = new String(ByteArray.readAllBytes(auxBuf), StandardCharsets.US_ASCII);
builder.setSessionName(name);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class SessionAttributeLspObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof BasicSessionAttributeObject, "SessionAttributeObject is mandatory.");
final BasicSessionAttributeObject sessionObject = (BasicSessionAttributeObject) teLspObject;
final ByteBuf sessionName = Unpooled.wrappedBuffer(StandardCharsets.US_ASCII.encode(sessionObject.getSessionName()));
final int pad = getPadding(sessionName.readableBytes());
serializeAttributeHeader(BODY_SIZE_C7 + pad + sessionName.readableBytes(), CLASS_NUM, CTYPE, output);
output.writeByte(sessionObject.getSetupPriority());
output.writeByte(sessionObject.getHoldPriority());
final BitArray bs = new BitArray(FLAGS_SIZE);
bs.set(LOCAL_PROTECTION, sessionObject.isLocalProtectionDesired());
bs.set(LABEL_RECORDING, sessionObject.isLabelRecordingDesired());
bs.set(SE_STYLE, sessionObject.isSeStyleDesired());
bs.toByteBuf(output);
output.writeByte(sessionName.readableBytes());
output.writeBytes(sessionName);
output.writeZero(pad);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class SessionAttributeLspRaObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof SessionAttributeObjectWithResourcesAffinities, "SessionAttributeObject is mandatory.");
final SessionAttributeObjectWithResourcesAffinities sessionObject = (SessionAttributeObjectWithResourcesAffinities) teLspObject;
final ByteBuf sessionName = Unpooled.wrappedBuffer(StandardCharsets.US_ASCII.encode(sessionObject.getSessionName()));
final int pad = SessionAttributeLspObjectParser.getPadding(sessionName.readableBytes());
serializeAttributeHeader(BODY_SIZE_C1 + pad + sessionName.readableBytes(), CLASS_NUM, CTYPE, output);
writeAttributeFilter(sessionObject.getIncludeAny(), output);
writeAttributeFilter(sessionObject.getExcludeAny(), output);
writeAttributeFilter(sessionObject.getIncludeAll(), output);
output.writeByte(sessionObject.getSetupPriority());
output.writeByte(sessionObject.getHoldPriority());
final BitArray bs = new BitArray(FLAGS_SIZE);
bs.set(SessionAttributeLspObjectParser.LOCAL_PROTECTION, sessionObject.isLocalProtectionDesired());
bs.set(SessionAttributeLspObjectParser.LABEL_RECORDING, sessionObject.isLabelRecordingDesired());
bs.set(SessionAttributeLspObjectParser.SE_STYLE, sessionObject.isSeStyleDesired());
bs.toByteBuf(output);
output.writeByte(sessionName.readableBytes());
output.writeBytes(Unpooled.wrappedBuffer(StandardCharsets.US_ASCII.encode(sessionObject.getSessionName())));
output.writeZero(pad);
}
Aggregations