use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class BandwidthObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final BasicBandwidthObjectBuilder builder = new BasicBandwidthObjectBuilder();
final ByteBuf v = byteBuf.readSlice(METRIC_VALUE_F_LENGTH);
builder.setBandwidth(new Bandwidth(ByteArray.readAllBytes(v)));
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 BandwidthObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof BasicBandwidthObject, "BandwidthObject is mandatory.");
final BasicBandwidthObject bandObject = (BasicBandwidthObject) teLspObject;
serializeAttributeHeader(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.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class DetourObjectIpv6Parser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) {
final ByteBuf plrId = byteBuf.readSlice(byteBuf.capacity() / 2);
final Ipv6DetourObjectBuilder ipv6Case = new Ipv6DetourObjectBuilder();
final List<PlrId> plrIdList = new ArrayList<>();
while (plrId.isReadable()) {
final PlrIdBuilder plr = new PlrIdBuilder();
plr.setPlrId(Ipv6Util.addressForByteBuf(plrId));
plrIdList.add(plr.build());
}
final List<AvoidNode> avoidNodeList = new ArrayList<>();
while (byteBuf.isReadable()) {
final AvoidNodeBuilder plr = new AvoidNodeBuilder();
plr.setAvoidNode(Ipv6Util.addressForByteBuf(byteBuf));
avoidNodeList.add(plr.build());
}
return ipv6Case.setPlrId(plrIdList).setAvoidNode(avoidNodeList).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class FastRerouteObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf byteAggregator) {
Preconditions.checkArgument(teLspObject instanceof BasicFastRerouteObject, "FastRerouteObject is mandatory.");
final BasicFastRerouteObject fastRerouteObject = (BasicFastRerouteObject) teLspObject;
serializeAttributeHeader(BODY_SIZE_C1, CLASS_NUM, CTYPE, byteAggregator);
byteAggregator.writeByte(fastRerouteObject.getSetupPriority());
byteAggregator.writeByte(fastRerouteObject.getHoldPriority());
byteAggregator.writeByte(fastRerouteObject.getHopLimit());
byteAggregator.writeByte(fastRerouteObject.getFlags().getIntValue());
byteAggregator.writeBytes(Unpooled.wrappedBuffer(fastRerouteObject.getBandwidth().getValue()));
writeAttributeFilter(fastRerouteObject.getIncludeAny(), byteAggregator);
writeAttributeFilter(fastRerouteObject.getExcludeAny(), byteAggregator);
writeAttributeFilter(fastRerouteObject.getIncludeAll(), byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject in project bgpcep by opendaylight.
the class FastRerouteObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) {
final BasicFastRerouteObjectBuilder builder = new BasicFastRerouteObjectBuilder();
builder.setSetupPriority(byteBuf.readUnsignedByte());
builder.setHoldPriority(byteBuf.readUnsignedByte());
builder.setHopLimit(byteBuf.readUnsignedByte());
builder.setFlags(FastRerouteFlags.forValue(byteBuf.readUnsignedByte()));
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()));
builder.setIncludeAll(new AttributeFilter(byteBuf.readUnsignedInt()));
return builder.build();
}
Aggregations