Search in sources :

Example 1 with GetNodeCountersInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeCountersInput in project netvirt by opendaylight.

the class StatisticsImpl method getNodeCounters.

@Override
@SuppressWarnings("checkstyle:illegalCatch")
public ListenableFuture<RpcResult<GetNodeCountersOutput>> getNodeCounters(GetNodeCountersInput input) {
    BigInteger dpId = input.getNodeId();
    LOG.trace("getting node counters for node {}", dpId);
    GetNodeCountersOutputBuilder gncob = new GetNodeCountersOutputBuilder();
    List<CounterResult> counterResults = new ArrayList<>();
    try {
        if (!getNodeResult(counterResults, dpId)) {
            statisticsCounters.failedGettingNodeCounters();
            return RpcResultBuilder.<GetNodeCountersOutput>failed().withError(ErrorType.APPLICATION, "failed to get node counters for node: " + dpId).buildFuture();
        }
    } catch (RuntimeException e) {
        LOG.warn("failed to get counter result for node {}", dpId, e);
        return RpcResultBuilder.<GetNodeCountersOutput>failed().withError(ErrorType.APPLICATION, "failed to get node counters for node: " + dpId).buildFuture();
    }
    gncob.setCounterResult(counterResults);
    return RpcResultBuilder.success(gncob.build()).buildFuture();
}
Also used : GetNodeCountersOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeCountersOutput) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) GetNodeCountersOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeCountersOutputBuilder) CounterResult(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.result.CounterResult)

Aggregations

BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 GetNodeCountersOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeCountersOutput)1 GetNodeCountersOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeCountersOutputBuilder)1 CounterResult (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.result.CounterResult)1