use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader in project bgpcep by opendaylight.
the class PCEPGlobalConstraintsObjectParser method parseObject.
@Override
public Gc parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final GcBuilder builder = new GcBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
builder.setMaxHop(bytes.readUnsignedByte());
builder.setMaxUtilization(bytes.readUnsignedByte());
builder.setMinUtilization(bytes.readUnsignedByte());
builder.setOverBookingFactor(bytes.readUnsignedByte());
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
parseTlvs(tlvsBuilder, bytes.slice());
builder.setTlvs(tlvsBuilder.build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader in project bgpcep by opendaylight.
the class PCEPIncludeRouteObjectParser method parseObject.
@Override
public Iro parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final IroBuilder builder = new IroBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
final List<Subobject> subs = new ArrayList<>();
for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject s : parseSubobjects(bytes)) {
subs.add(new SubobjectBuilder().setLoose(s.isLoose()).setSubobjectType(s.getSubobjectType()).build());
}
builder.setSubobject(subs);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader in project bgpcep by opendaylight.
the class PCEPLspaObjectParser method parseObject.
@Override
public Lspa parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final LspaBuilder builder = new LspaBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
builder.setExcludeAny(new AttributeFilter(bytes.readUnsignedInt()));
builder.setIncludeAll(new AttributeFilter(bytes.readUnsignedInt()));
builder.setIncludeAny(new AttributeFilter(bytes.readUnsignedInt()));
builder.setSetupPriority(bytes.readUnsignedByte());
builder.setHoldPriority(bytes.readUnsignedByte());
final BitArray flags = BitArray.valueOf(bytes.readByte());
builder.setLocalProtectionDesired(flags.get(L_FLAG_OFFSET));
final TlvsBuilder tbuilder = new TlvsBuilder();
bytes.skipBytes(RESERVED);
parseTlvs(tbuilder, bytes.slice());
builder.setTlvs(tbuilder.build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader in project bgpcep by opendaylight.
the class PCEPMetricObjectParser method parseObject.
@Override
public Metric parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (bytes.readableBytes() != SIZE) {
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + bytes.readableBytes() + "; Expected: " + SIZE + ".");
}
bytes.skipBytes(RESERVED);
final BitArray flags = BitArray.valueOf(bytes.readByte());
final MetricBuilder builder = new MetricBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
builder.setBound(flags.get(B_FLAG_OFFSET));
builder.setComputed(flags.get(C_FLAG_OFFSET));
builder.setMetricType(bytes.readUnsignedByte());
builder.setValue(new Float32(ByteArray.readBytes(bytes, METRIC_VALUE_F_LENGTH)));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader in project bgpcep by opendaylight.
the class PCEPMonitoringObjectParser method parseObject.
@Override
public Object parseObject(final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final MonitoringBuilder builder = new MonitoringBuilder();
buffer.readBytes(RESERVED);
final BitArray flagBits = BitArray.valueOf(buffer, FLAGS_SIZE);
final Flags flags = new Flags(flagBits.get(G_FLAG_POS), flagBits.get(I_FLAG_POS), flagBits.get(L_FLAG_POS), flagBits.get(C_FLAG_POS), flagBits.get(P_FLAG_POS));
builder.setFlags(flags);
builder.setMonitoringId(buffer.readUnsignedInt());
final TlvsBuilder tbuilder = new TlvsBuilder();
parseTlvs(tbuilder, buffer.slice());
builder.setTlvs(tbuilder.build());
return builder.build();
}
Aggregations