use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.AddPrefixInput in project bgpcep by opendaylight.
the class AppPeerBenchmark method addPrefix.
@Override
public ListenableFuture<RpcResult<AddPrefixOutput>> addPrefix(final AddPrefixInput input) {
final long duration = addRoute(input.getPrefix(), input.getNexthop(), input.getCount(), input.getBatchsize());
final long rate = countRate(duration, input.getCount());
final AddPrefixOutputBuilder outputbuilder = new AddPrefixOutputBuilder();
outputbuilder.setResult(createResult(input.getCount(), duration, rate));
final AddPrefixOutput output = outputbuilder.build();
return RpcResultBuilder.success(output).buildFuture();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.AddPrefixInput in project bgpcep by opendaylight.
the class AppPeerBenchmarkTest method testRpcs.
@Test
public void testRpcs() throws Exception {
final AppPeerBenchmark appPeerBenchmark = new AppPeerBenchmark(getDataBroker(), this.rpcRegistry, PEER_RIB_ID);
appPeerBenchmark.start();
final InstanceIdentifier<Ipv4Routes> routesIID = appPeerBenchmark.getIpv4RoutesIID();
final AddPrefixInput addPrefix = new AddPrefixInputBuilder().setBatchsize(Uint32.ONE).setCount(Uint32.ONE).setNexthop(new Ipv4AddressNoZone(NH)).setPrefix(new Ipv4Prefix(PREFIX)).build();
final RpcResult<AddPrefixOutput> addRpcResult = appPeerBenchmark.addPrefix(addPrefix).get();
final Result addResult = addRpcResult.getResult().getResult();
checkEquals(() -> assertEquals(1, addResult.getCount().intValue()));
checkEquals(() -> assertEquals(1, addResult.getRate().intValue()));
readDataConfiguration(getDataBroker(), routesIID, routes -> {
assertNotNull(routes.getIpv4Route());
assertEquals(1, routes.getIpv4Route().size());
return routes;
});
final DeletePrefixInput deletePrefix = new DeletePrefixInputBuilder().setBatchsize(Uint32.ONE).setCount(Uint32.ONE).setPrefix(new Ipv4Prefix(PREFIX)).build();
final RpcResult<DeletePrefixOutput> deleteRpcResult = appPeerBenchmark.deletePrefix(deletePrefix).get();
final Result deleteResult = deleteRpcResult.getResult().getResult();
checkEquals(() -> assertEquals(1, deleteResult.getCount().intValue()));
checkEquals(() -> assertEquals(1, deleteResult.getRate().intValue()));
checkNotPresentConfiguration(getDataBroker(), appPeerBenchmark.getIpv4RoutesIID());
appPeerBenchmark.close();
}
Aggregations