use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.Bandwidth1Builder in project bgpcep by opendaylight.
the class PcRptMessageCodecTest method testserializeObject.
@Test
public void testserializeObject() {
final PcRptMessageCodec codec = new PcRptMessageCodec(this.ctx.getObjectHandlerRegistry());
final BandwidthBuilder bwBuilder = new BandwidthBuilder();
bwBuilder.addAugmentation(Bandwidth1.class, new Bandwidth1Builder().setBwSample(BW).build());
final ByteBuf buffer = Unpooled.buffer();
codec.serializeObject(bwBuilder.build(), buffer);
Assert.assertTrue(buffer.readableBytes() > 0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.Bandwidth1Builder 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