@Override public void serializeObject(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof Bandwidth, "Wrong instance of PCEPObject. Passed %s. Needed BandwidthObject.", object.getClass()); final ByteBuf body = Unpooled.buffer(); writeFloat32(((Bandwidth) object).getBandwidth(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); } }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof Ero, "Wrong instance of PCEPObject. Passed %s. Needed EroObject.", object.getClass()); final Ero ero = ((Ero) object); final ByteBuf body = Unpooled.buffer(); serializeSubobject(ero.getSubobject(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); } }
@Override public void serializeObject(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof ReoptimizationBandwidth, "Wrong instance of PCEPObject. Passed " + "%s. Needed ReoptimizationBandwidthObject.", object.getClass()); final ByteBuf body = Unpooled.buffer(); writeFloat32(((ReoptimizationBandwidth) object).getBandwidth(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); } }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof Rro, "Wrong instance of PCEPObject. Passed %s. Needed RroObject.", object.getClass()); final Rro obj = (Rro) object; final ByteBuf body = Unpooled.buffer(); serializeSubobject(obj.getSubobject(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); } }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof BandwidthUsage, "Wrong instance of PCEPObject. Passed %s. Needed BandwidthUsage.", object.getClass()); final List<Bandwidth> bwSample = ((BandwidthUsage) object).getBwSample(); final ByteBuf body = Unpooled.buffer(bwSample.size() * BW_LENGTH); for (final Bandwidth bw : bwSample) { writeFloat32(bw, body); } ObjectUtil.formatSubobject(getType(), CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof Overload, "Wrong instance of PCEPObject. Passed %s. Needed OverloadObject.", object.getClass()); final Overload overload = (Overload) object; final ByteBuf body = Unpooled.buffer(BODY_SIZE); body.writeZero(RESERVED + FLAGS); ByteBufWriteUtil.writeUnsignedShort(overload.getDuration(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof ClassType, "Wrong instance of PCEPObject. Passed %s. Needed ClassTypeObject.", object.getClass()); final ByteBuf body = Unpooled.buffer(SIZE); body.writeZero(SIZE -1); final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ClassType classType = ((ClassType) object).getClassType(); Preconditions.checkArgument(classType != null, "ClassType is mandatory."); writeUnsignedByte(classType.getValue(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); } }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof CClose, "Wrong instance of PCEPObject. Passed %s. Needed CCloseObject.", object.getClass()); final CClose obj = (CClose) object; final ByteBuf body = Unpooled.buffer(); body.writeZero(RESERVED + FLAGS_F_LENGTH); Preconditions.checkArgument(obj.getReason() != null, "Reason is mandatory."); writeUnsignedByte(obj.getReason(), body); serializeTlvs(obj.getTlvs(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }
@Override public final void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof VendorInformationObject, "Wrong instance of PCEPObject. Passed %s. Needed VendorInformationObject.", object.getClass()); final ByteBuf body = Unpooled.buffer(); writeUnsignedInt(getEnterpriseNumber().getValue(), body); serializeEnterpriseSpecificInformation(((VendorInformationObject) object).getEnterpriseSpecificInformation(), body); ObjectUtil.formatSubobject(VENDOR_INFORMATION_OBJECT_TYPE, VENDOR_INFORMATION_OBJECT_CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof LoadBalancing, "Wrong instance of PCEPObject. Passed %s. Needed LoadBalancingObject.", object.getClass()); final LoadBalancing specObj = (LoadBalancing) object; final ByteBuf body = Unpooled.buffer(SIZE); body.writeZero(RESERVED + FLAGS_F_LENGTH); writeUnsignedByte(specObj.getMaxLsp(), body); writeFloat32(specObj.getMinBandwidth(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); } }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof Of, "Wrong instance of PCEPObject. Passed %s. Needed OfObject.", object.getClass()); final Of specObj = (Of) object; final ByteBuf body = Unpooled.buffer(); Preconditions.checkArgument(specObj.getCode() != null, "Code is mandatory"); writeUnsignedShort(specObj.getCode().getValue(), body); body.writeZero(RESERVED); serializeTlvs(specObj.getTlvs(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof Iro, "Wrong instance of PCEPObject. Passed %s. Needed IroObject.", object.getClass()); final Iro iro = ((Iro) object); final ByteBuf body = Unpooled.buffer(); final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject> subs = new ArrayList<>(); for (final Subobject s : iro.getSubobject()) { subs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.SubobjectBuilder().setLoose( s.isLoose()).setSubobjectType(s.getSubobjectType()).build()); } serializeSubobject(subs, body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); } }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof CNotification, "Wrong instance of PCEPObject. Passed %s. Needed CNotificationObject.", object.getClass()); final CNotification notObj = (CNotification) object; final ByteBuf body = Unpooled.buffer(); body.writeZero(NT_F_OFFSET); Preconditions.checkArgument(notObj.getType() != null, "Type is mandatory."); writeUnsignedByte(notObj.getType(), body); Preconditions.checkArgument(notObj.getValue() != null, "Value is mandatory."); writeUnsignedByte(notObj.getValue(), body); serializeTlvs(notObj.getTlvs(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof ErrorObject, "Wrong instance of PCEPObject. Passed %s. Needed ErrorObject.", object.getClass()); final ErrorObject errObj = (ErrorObject) object; final ByteBuf body = Unpooled.buffer(); body.writeZero(FLAGS_F_LENGTH + RESERVED); Preconditions.checkArgument(errObj.getType() != null, "Type is mandatory."); writeUnsignedByte(errObj.getType(), body); Preconditions.checkArgument(errObj.getValue() != null, "Value is mandatory."); writeUnsignedByte(errObj.getValue(), body); serializeTlvs(errObj.getTlvs(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof Xro, "Wrong instance of PCEPObject. Passed %s. Needed XroObject.", object.getClass()); final Xro obj = (Xro) object; final ByteBuf body = Unpooled.buffer(); body.writeZero(FLAGS_OFFSET); writeBoolean(obj.getFlags() != null ? obj.getFlags().isFail() : null, body); serializeSubobject(obj.getSubobject(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); } }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof Open, "Wrong instance of PCEPObject. Passed %s. Needed OpenObject.", object.getClass()); final Open open = (Open) object; final ByteBuf body = Unpooled.buffer(); writeUnsignedByte((short) (PCEP_VERSION << (Byte.SIZE - VERSION_SF_LENGTH)), body); writeUnsignedByte(open.getKeepalive(), body); writeUnsignedByte(open.getDeadTimer(), body); Preconditions.checkArgument(open.getSessionId() != null, "SessionId is mandatory."); writeUnsignedByte(open.getSessionId(), body); serializeTlvs(open.getTlvs(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof NoPath, "Wrong instance of PCEPObject. Passed %s. Needed NoPathObject.", object.getClass()); final NoPath nPObj = (NoPath) object; final ByteBuf body = Unpooled.buffer(); Preconditions.checkArgument(nPObj.getNatureOfIssue() != null, "NatureOfIssue is mandatory."); writeUnsignedByte(nPObj.getNatureOfIssue(), body); final BitArray flags = new BitArray(FLAGS_SIZE); flags.set(C_FLAG_OFFSET, nPObj.isUnsatisfiedConstraints()); flags.toByteBuf(body); body.writeZero(RESERVED_F_LENGTH); serializeTlvs(nPObj.getTlvs(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof Gc, "Wrong instance of PCEPObject. Passed %s. Needed GcObject.", object.getClass()); final Gc specObj = (Gc) object; final ByteBuf body = Unpooled.buffer(); writeUnsignedByte(specObj.getMaxHop(), body); writeUnsignedByte(specObj.getMaxUtilization(), body); writeUnsignedByte(specObj.getMinUtilization(), body); writeUnsignedByte(specObj.getOverBookingFactor(), body); serializeTlvs(specObj.getTlvs(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof Metric, "Wrong instance of PCEPObject. Passed %s. Needed MetricObject.", object.getClass()); final Metric mObj = (Metric) object; final ByteBuf body = Unpooled.buffer(SIZE); body.writeZero(RESERVED); final BitArray flags = new BitArray(FLAGS_SIZE); flags.set(C_FLAG_OFFSET, mObj.isComputed()); flags.set(B_FLAG_OFFSET, mObj.isBound()); flags.toByteBuf(body); Preconditions.checkArgument(mObj.getMetricType() != null, "MetricType is mandatory."); writeUnsignedByte(mObj.getMetricType(), body); writeFloat32(mObj.getValue(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); } }
@Override public void serializeObject(final Object object, final ByteBuf buffer) { Preconditions.checkArgument(object instanceof ProcTime, "Wrong instance of PCEPObject. Passed %s. Needed ProcTimeObject.", object.getClass()); final ProcTime procTime = (ProcTime) object; final ByteBuf body = Unpooled.buffer(BODY_SIZE); body.writeZero(RESERVED); final BitArray flagBits = new BitArray(FLAGS); flagBits.set(E_FLAG_POSITION, procTime.isEstimated()); flagBits.toByteBuf(body); ByteBufWriteUtil.writeUnsignedInt(procTime.getCurrentProcTime(), body); ByteBufWriteUtil.writeUnsignedInt(procTime.getMinProcTime(), body); ByteBufWriteUtil.writeUnsignedInt(procTime.getMaxProcTime(), body); ByteBufWriteUtil.writeUnsignedInt(procTime.getAverageProcTime(), body); ByteBufWriteUtil.writeUnsignedInt(procTime.getVarianceProcTime(), body); ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer); }