use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.bandwidth.object.Bandwidth in project bgpcep by opendaylight.
the class FastRerouteObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) {
final BasicFastRerouteObjectBuilder builder = new BasicFastRerouteObjectBuilder().setSetupPriority(readUint8(byteBuf)).setHoldPriority(readUint8(byteBuf)).setHopLimit(readUint8(byteBuf)).setFlags(FastRerouteFlags.forValue(byteBuf.readUnsignedByte()));
final ByteBuf v = byteBuf.readSlice(METRIC_VALUE_F_LENGTH);
return builder.setBandwidth(new Bandwidth(ByteArray.readAllBytes(v))).setIncludeAny(new AttributeFilter(readUint32(byteBuf))).setExcludeAny(new AttributeFilter(readUint32(byteBuf))).setIncludeAll(new AttributeFilter(readUint32(byteBuf))).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.bandwidth.object.Bandwidth in project bgpcep by opendaylight.
the class InformationalFastRerouteObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final LegacyFastRerouteObjectBuilder builder = new LegacyFastRerouteObjectBuilder().setSetupPriority(readUint8(byteBuf)).setHoldPriority(readUint8(byteBuf)).setHopLimit(readUint8(byteBuf));
// skip reserved
byteBuf.skipBytes(Byte.BYTES);
final ByteBuf v = byteBuf.readSlice(METRIC_VALUE_F_LENGTH);
builder.setBandwidth(new Bandwidth(ByteArray.readAllBytes(v)));
builder.setIncludeAny(new AttributeFilter(readUint32(byteBuf)));
builder.setExcludeAny(new AttributeFilter(readUint32(byteBuf)));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.bandwidth.object.Bandwidth in project bgpcep by opendaylight.
the class ReoptimizationBandwidthObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof ReoptimizationBandwidthObject, "BandwidthObject is mandatory.");
final ReoptimizationBandwidthObject bandObject = (ReoptimizationBandwidthObject) teLspObject;
serializeAttributeHeader(BandwidthObjectParser.BODY_SIZE, CLASS_NUM, CTYPE, output);
final Bandwidth band = bandObject.getBandwidth();
output.writeBytes(Unpooled.wrappedBuffer(band.getValue()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.bandwidth.object.Bandwidth in project bgpcep by opendaylight.
the class TrafficRateEcHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
final ShortAsNumber as = new ShortAsNumber((long) buffer.readUnsignedShort());
final Bandwidth value = new Bandwidth(ByteArray.readBytes(buffer, TRAFFIC_RATE_SIZE));
return new TrafficRateExtendedCommunityCaseBuilder().setTrafficRateExtendedCommunity(new TrafficRateExtendedCommunityBuilder().setInformativeAs(as).setLocalAdministrator(value).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.bandwidth.object.Bandwidth in project bgpcep by opendaylight.
the class PcRptMessageCodec method setBandwidthUsage.
private static Bandwidth setBandwidthUsage(final Bandwidth bandwidth, final BandwidthUsage bwUsage) {
final BandwidthBuilder bandwidthBuilder;
if (bandwidth != null) {
bandwidthBuilder = new BandwidthBuilder(bandwidth);
} else {
bandwidthBuilder = new BandwidthBuilder();
}
bandwidthBuilder.addAugmentation(Bandwidth1.class, new Bandwidth1Builder().setBwSample(bwUsage.getBwSample()).build()).build();
return bandwidthBuilder.build();
}
Aggregations