Search in sources :

Example 1 with Bandwidth1Builder

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);
}
Also used : Bandwidth1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.Bandwidth1Builder) ByteBuf(io.netty.buffer.ByteBuf) BandwidthBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.BandwidthBuilder) Test(org.junit.Test)

Example 2 with Bandwidth1Builder

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();
}
Also used : Bandwidth1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.Bandwidth1Builder) Bandwidth1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.Bandwidth1) BandwidthBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.BandwidthBuilder)

Aggregations

Bandwidth1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.Bandwidth1Builder)2 BandwidthBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.BandwidthBuilder)2 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 Bandwidth1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.Bandwidth1)1