use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class MetricObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final MetricObjectBuilder builder = new MetricObjectBuilder();
byteBuf.skipBytes(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
final BitArray flags = BitArray.valueOf(byteBuf.readByte());
builder.setBound(flags.get(BOUND));
builder.setComputed(flags.get(COMPUTED));
builder.setMetricType(byteBuf.readUnsignedByte());
builder.setValue(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
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 MetricObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof MetricObject, "BandwidthObject is mandatory.");
final MetricObject metric = (MetricObject) teLspObject;
serializeAttributeHeader(BODY_SIZE, CLASS_NUM, CTYPE, output);
output.writeZero(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
final BitArray reflect = new BitArray(FLAGS_SIZE);
reflect.set(BOUND, metric.isBound());
reflect.set(COMPUTED, metric.isComputed());
reflect.toByteBuf(output);
output.writeByte(metric.getMetricType());
writeFloat32(metric.getValue(), output);
}
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 localParseObject.
@Override
protected final RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final AssociationObjectBuilder asso = new AssociationObjectBuilder();
asso.setAssociationType(AssociationType.forValue(byteBuf.readUnsignedShort()));
asso.setAssociationId(byteBuf.readUnsignedShort());
asso.setIpAddress(parseAssociationIpAddress(byteBuf));
return asso.build();
}
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 localSerializeObject.
@Override
protected void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof AdminStatusObject, "AssociationObject is mandatory.");
final AdminStatusObject addObject = (AdminStatusObject) teLspObject;
serializeAttributeHeader(BODY_SIZE, CLASS_NUM, CTYPE, output);
final BitArray reflect = new BitArray(FLAGS_SIZE);
reflect.set(REFLECT, addObject.isReflect());
reflect.toByteBuf(output);
output.writeZero(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
final BitArray flags = new BitArray(FLAGS_SIZE);
flags.set(TESTING, addObject.isTesting());
flags.set(DOWN, addObject.isAdministrativelyDown());
flags.set(DELETION, addObject.isDeletionInProgress());
flags.toByteBuf(output);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class AttributesObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final LspAttributesObjectBuilder builder = new LspAttributesObjectBuilder();
final List<SubobjectContainer> subObjectList = new ArrayList<>();
while (byteBuf.isReadable()) {
final int type = byteBuf.readUnsignedShort();
final int length = byteBuf.readUnsignedShort();
final ByteBuf value = byteBuf.readSlice(length);
final SubobjectContainerBuilder subObj = new SubobjectContainerBuilder();
if (type == FLAG_TLV_TYPE) {
subObj.setLspSubobject(new FlagsTlvBuilder().setFlagContainer(parseFlag(value)).build());
} else {
LOG.warn("Lsp Attributes Subobject type {} not supported", type);
}
subObjectList.add(subObj.build());
}
return builder.setSubobjectContainer(subObjectList).build();
}
Aggregations