use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.attribute.UnreservedBandwidth in project bgpcep by opendaylight.
the class LinkAttributesParser method parseUnreservedBandwidth.
private static void parseUnreservedBandwidth(final ByteBuf value, final LinkAttributesBuilder builder) {
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.attribute.UnreservedBandwidth> unreservedBandwidth = new ArrayList<>(UNRESERVED_BW_COUNT);
for (int i = 0; i < UNRESERVED_BW_COUNT; i++) {
final ByteBuf v = value.readSlice(BANDWIDTH_LENGTH);
unreservedBandwidth.add(new UnreservedBandwidthBuilder().setBandwidth(new Bandwidth(ByteArray.readAllBytes(v))).setPriority((short) i).build());
}
builder.setUnreservedBandwidth(unreservedBandwidth);
LOG.debug("Parsed Unreserved Bandwidth {}", builder.getUnreservedBandwidth());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.attribute.UnreservedBandwidth in project bgpcep by opendaylight.
the class LinkAttributesParser method serializeUnreservedBw.
private static void serializeUnreservedBw(final List<UnreservedBandwidth> ubList, final ByteBuf byteAggregator) {
// this sub-TLV contains eight 32-bit IEEE floating point numbers
if (ubList != null) {
final ByteBuf unreservedBandwithBuf = Unpooled.buffer();
for (final UnreservedBandwidth unreservedBandwidth : ubList) {
unreservedBandwithBuf.writeBytes(unreservedBandwidth.getBandwidth().getValue());
}
TlvUtil.writeTLV(UNRESERVED_BANDWIDTH, unreservedBandwithBuf, byteAggregator);
}
}
Aggregations