use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.link.bandwidth._case.LinkBandwidthExtendedCommunity in project bgpcep by opendaylight.
the class LinkBandwidthEC method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf body) {
Preconditions.checkArgument(extendedCommunity instanceof LinkBandwidthCase, "The extended community %s is not LinkBandwidthCase type.", extendedCommunity);
final LinkBandwidthExtendedCommunity lb = ((LinkBandwidthCase) extendedCommunity).getLinkBandwidthExtendedCommunity();
body.writeShort(AS_TRANS);
ByteBufWriteUtil.writeFloat32(lb.getBandwidth(), body);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.link.bandwidth._case.LinkBandwidthExtendedCommunity in project bgpcep by opendaylight.
the class LinkBandwidthEC method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
buffer.skipBytes(AS_TRANS_LENGTH);
final LinkBandwidthExtendedCommunity lb = new LinkBandwidthExtendedCommunityBuilder().setBandwidth(new Bandwidth(ByteArray.readBytes(buffer, BANDWIDTH_SIZE))).build();
return new LinkBandwidthCaseBuilder().setLinkBandwidthExtendedCommunity(lb).build();
}
Aggregations