use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev181109.Bandwidth1 in project bgpcep by opendaylight.
the class PcRptMessageCodecTest method testReportMsgWithRro.
@Test
public void testReportMsgWithRro() throws PCEPDeserializerException {
final byte[] parseHexBinary = DatatypeConverter.parseHexBinary("2010003c0084a019001100106e79636e7932316372735f7432313231001200100a0" + "000d2004008490a0000d40a0000d4001f0006000005dd700000000710001401080a000706200001080a0000d420" + "000910001400000000000000000000000005050100051000084998968005500008513a43b70810002401080a000" + "0d42020030801010000000001080a00070620000308010100000000");
final Pcrpt msg = (Pcrpt) this.ctx.getMessageHandlerRegistry().parseMessage(10, Unpooled.wrappedBuffer(parseHexBinary), Collections.emptyList());
assertNotNull(msg.getPcrptMessage().getReports().get(0).getPath().getBandwidth().augmentation(Bandwidth1.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev181109.Bandwidth1 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev181109.Bandwidth1 in project bgpcep by opendaylight.
the class PcRptMessageCodecTest method testGetValidReportsPositive.
@Test
public void testGetValidReportsPositive() {
final PcRptMessageCodec codec = new PcRptMessageCodec(this.ctx.getObjectHandlerRegistry());
final BandwidthUsage bw = new BandwidthUsageBuilder().setBwSample(BW).build();
final Ipv4Builder builder = new Ipv4Builder();
builder.setIpv4TunnelSenderAddress(new Ipv4AddressNoZone("127.0.1.1"));
builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4AddressNoZone("127.0.1.2")));
builder.setIpv4TunnelEndpointAddress(new Ipv4AddressNoZone("127.0.1.3"));
final AddressFamily afiLsp = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
final LspId lspId = new LspId(Uint32.ONE);
final TunnelId tunnelId = new TunnelId(Uint16.ONE);
final LspIdentifiers identifier = new LspIdentifiersBuilder().setAddressFamily(afiLsp).setLspId(lspId).setTunnelId(tunnelId).build();
final Lsp lsp = new LspBuilder().setPlspId(new PlspId(Uint32.ONE)).setTlvs(new TlvsBuilder().setLspIdentifiers(identifier).build()).build();
final Ero ero = new EroBuilder().build();
final Queue<Object> objects = new ArrayDeque<>(List.of(lsp, ero, bw));
final Reports validReports = codec.getValidReports(objects, List.of());
assertNotNull(validReports.getPath().getBandwidth().augmentation(Bandwidth1.class));
assertTrue(objects.isEmpty());
}
Aggregations