Search in sources :

Example 1 with RoutedRpcBenchInput

use of org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInput in project controller by opendaylight.

the class GlobalBindingRTCServer method routedRpcBench.

@Override
public Future<RpcResult<RoutedRpcBenchOutput>> routedRpcBench(final RoutedRpcBenchInput input) {
    RoutedRpcBenchOutput output = new RoutedRpcBenchOutputBuilder(input).build();
    RpcResult<RoutedRpcBenchOutput> result = RpcResultBuilder.success(output).build();
    numRpcs++;
    return Futures.immediateFuture(result);
}
Also used : RoutedRpcBenchOutputBuilder(org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchOutputBuilder) RoutedRpcBenchOutput(org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchOutput)

Example 2 with RoutedRpcBenchInput

use of org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInput in project controller by opendaylight.

the class RoutedBindingRTClient method runTest.

public void runTest(final int iterations) {
    int rpcOk = 0;
    int rpcError = 0;
    int rpcServerCnt = inVal.size();
    for (int i = 0; i < iterations; i++) {
        RoutedRpcBenchInput input = inVal.get(ThreadLocalRandom.current().nextInt(rpcServerCnt));
        Future<RpcResult<RoutedRpcBenchOutput>> output = service.routedRpcBench(input);
        try {
            RpcResult<RoutedRpcBenchOutput> rpcResult = output.get();
            if (rpcResult.isSuccessful()) {
                List<Payload> retVal = rpcResult.getResult().getPayload();
                if (retVal.size() == inSize) {
                    rpcOk++;
                } else {
                    rpcError++;
                }
            }
        } catch (InterruptedException | ExecutionException e) {
            rpcError++;
            LOG.error("Execution failed: ", e);
        }
    }
    this.rpcOk.addAndGet(rpcOk);
    this.rpcError.addAndGet(rpcError);
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) RoutedRpcBenchInput(org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInput) Payload(org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.payload.Payload) ExecutionException(java.util.concurrent.ExecutionException) RoutedRpcBenchOutput(org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchOutput)

Aggregations

RoutedRpcBenchOutput (org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchOutput)2 ExecutionException (java.util.concurrent.ExecutionException)1 RoutedRpcBenchInput (org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInput)1 RoutedRpcBenchOutputBuilder (org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchOutputBuilder)1 Payload (org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.payload.Payload)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1