use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class FlowSpecObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof FlowSpecObject, "SenderTspecObject is mandatory.");
final FlowSpecObject flowObj = (FlowSpecObject) teLspObject;
final int sHeader = flowObj.getServiceHeader().getIntValue();
if (sHeader == 2) {
serializeAttributeHeader(BODY_SIZE_REQUESTING, CLASS_NUM, CTYPE, output);
output.writeZero(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
output.writeShort(REQUESTING_OVERALL_LENGTH);
} else {
serializeAttributeHeader(BODY_SIZE_CONTROLLED, CLASS_NUM, CTYPE, output);
output.writeZero(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
output.writeShort(CONTROLLER_OVERALL_LENGHT);
}
output.writeByte(sHeader);
output.writeZero(ByteBufWriteUtil.ONE_BYTE_LENGTH);
if (sHeader == 2) {
output.writeShort(SERVICE_LENGHT);
} else {
output.writeShort(CONTROLLED_LENGHT);
}
output.writeByte(TOKEN_BUCKET_TSPEC);
output.writeZero(ByteBufWriteUtil.ONE_BYTE_LENGTH);
output.writeShort(PARAMETER_127_LENGTH);
final TspecObject tSpec = flowObj.getTspecObject();
writeFloat32(tSpec.getTokenBucketRate(), output);
writeFloat32(tSpec.getTokenBucketSize(), output);
writeFloat32(tSpec.getPeakDataRate(), output);
writeUnsignedInt(tSpec.getMinimumPolicedUnit(), output);
writeUnsignedInt(tSpec.getMaximumPacketSize(), output);
if (sHeader != 2) {
return;
}
output.writeByte(GUARANTEED_SERVICE_RSPEC);
output.writeZero(ByteBufWriteUtil.ONE_BYTE_LENGTH);
output.writeShort(PARAMETER_130_LENGTH);
writeFloat32(flowObj.getRate(), output);
writeUnsignedInt(flowObj.getSlackTerm(), output);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class InformationalFastRerouteObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf byteAggregator) {
Preconditions.checkArgument(teLspObject instanceof LegacyFastRerouteObject, "FastRerouteObject is mandatory.");
final LegacyFastRerouteObject fastRerouteObject = (LegacyFastRerouteObject) teLspObject;
serializeAttributeHeader(BODY_SIZE_C7, CLASS_NUM, CTYPE, byteAggregator);
byteAggregator.writeByte(fastRerouteObject.getSetupPriority());
byteAggregator.writeByte(fastRerouteObject.getHoldPriority());
byteAggregator.writeByte(fastRerouteObject.getHopLimit());
byteAggregator.writeZero(ByteBufWriteUtil.ONE_BYTE_LENGTH);
byteAggregator.writeBytes(Unpooled.wrappedBuffer(fastRerouteObject.getBandwidth().getValue()));
writeAttributeFilter(fastRerouteObject.getIncludeAny(), byteAggregator);
writeAttributeFilter(fastRerouteObject.getExcludeAny(), byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class InformationalFastRerouteObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final LegacyFastRerouteObjectBuilder builder = new LegacyFastRerouteObjectBuilder();
builder.setSetupPriority(byteBuf.readUnsignedByte());
builder.setHoldPriority(byteBuf.readUnsignedByte());
builder.setHopLimit(byteBuf.readUnsignedByte());
// skip reserved
byteBuf.skipBytes(ByteBufWriteUtil.ONE_BYTE_LENGTH);
final ByteBuf v = byteBuf.readSlice(METRIC_VALUE_F_LENGTH);
builder.setBandwidth(new Bandwidth(ByteArray.readAllBytes(v)));
builder.setIncludeAny(new AttributeFilter(byteBuf.readUnsignedInt()));
builder.setExcludeAny(new AttributeFilter(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 AbstractAssociationParser method localSerializeObject.
@Override
protected final void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof AssociationObject, "AssociationObject is mandatory.");
final AssociationObject assObject = (AssociationObject) teLspObject;
if (assObject.getIpAddress().getIpv4Address() != null) {
serializeAttributeHeader(BODY_SIZE_IPV4, CLASS_NUM, CTYPE_IPV4, output);
output.writeShort(assObject.getAssociationType().getIntValue());
output.writeShort(assObject.getAssociationId());
output.writeBytes(Ipv4Util.byteBufForAddress(assObject.getIpAddress().getIpv4Address()));
} else {
serializeAttributeHeader(BODY_SIZE_IPV6, CLASS_NUM, CTYPE_IPV6, output);
output.writeShort(assObject.getAssociationType().getIntValue());
output.writeShort(assObject.getAssociationId());
output.writeBytes(Ipv6Util.byteBufForAddress(assObject.getIpAddress().getIpv6Address()));
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class AdminStatusObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final AdminStatusObjectBuilder adm = new AdminStatusObjectBuilder();
final BitArray reflect = BitArray.valueOf(byteBuf, FLAGS_SIZE);
adm.setReflect(reflect.get(REFLECT));
byteBuf.skipBytes(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
final BitArray flags = BitArray.valueOf(byteBuf, FLAGS_SIZE);
adm.setTesting(flags.get(TESTING));
adm.setAdministrativelyDown(flags.get(DOWN));
adm.setDeletionInProgress(flags.get(DELETION));
return adm.build();
}
Aggregations