use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutputBuilder in project netvirt by opendaylight.
the class TestOdlDirectStatisticsService method getFlowStatistics.
@Override
public Future<RpcResult<GetFlowStatisticsOutput>> getFlowStatistics(GetFlowStatisticsInput input) {
LOG.info("getFlowStatistics rpc input = {}", input);
List<FlowAndStatisticsMapList> flowStatsList = new ArrayList<>();
FlowAndStatisticsMapList portIngressFlowStats1 = buildFlowStats(NwConstants.EGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE, AclConstants.ACL_PORT_SPECIFIC_DROP_PRIORITY, 1, 5, 5);
FlowAndStatisticsMapList portIngressFlowStats2 = buildFlowStats(NwConstants.EGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE, AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY, 1, 10, 10);
FlowAndStatisticsMapList portEgressFlowStats1 = buildFlowStats(NwConstants.INGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE, AclConstants.ACL_PORT_SPECIFIC_DROP_PRIORITY, 1, 15, 15);
FlowAndStatisticsMapList portEgressFlowStats2 = buildFlowStats(NwConstants.INGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE, AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY, 1, 20, 20);
if (input.getTableId() == null || input.getTableId() == NwConstants.EGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE) {
flowStatsList.add(portIngressFlowStats1);
flowStatsList.add(portIngressFlowStats2);
}
if (input.getTableId() == null || input.getTableId() == NwConstants.INGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE) {
flowStatsList.add(portEgressFlowStats1);
flowStatsList.add(portEgressFlowStats2);
}
GetFlowStatisticsOutput output = new GetFlowStatisticsOutputBuilder().setFlowAndStatisticsMapList(flowStatsList).build();
RpcResultBuilder<GetFlowStatisticsOutput> rpcResultBuilder = RpcResultBuilder.success();
rpcResultBuilder.withResult(output);
return Futures.immediateFuture(rpcResultBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutputBuilder in project openflowplugin by opendaylight.
the class FlowDirectStatisticsService method buildReply.
@Override
protected GetFlowStatisticsOutput buildReply(List<MultipartReply> input, boolean success) {
final List<FlowAndStatisticsMapList> statsList = new ArrayList<>();
if (success) {
for (final MultipartReply mpReply : input) {
final MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase) mpReply.getMultipartReplyBody();
final MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
final Optional<List<FlowAndStatisticsMapList>> statsListPart = getConvertorExecutor().convert(replyBody.getFlowStats(), data);
statsListPart.ifPresent(flowAndStatisticsMapLists -> {
for (final FlowAndStatisticsMapList part : flowAndStatisticsMapLists) {
final FlowId flowId = new FlowId(generateFlowId(part).getValue());
statsList.add(new FlowAndStatisticsMapListBuilder(part).setKey(new FlowAndStatisticsMapListKey(flowId)).setFlowId(flowId).build());
}
});
}
}
return new GetFlowStatisticsOutputBuilder().setFlowAndStatisticsMapList(statsList).build();
}
Aggregations