Search in sources :

Example 1 with FlowAndStatisticsMapListKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey 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();
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId) FlowAndStatisticsMapListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) ArrayList(java.util.ArrayList) MultipartReplyFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow) FlowAndStatisticsMapListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey) ArrayList(java.util.ArrayList) FlowAndStatisticsMapList(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList) List(java.util.List) FlowAndStatisticsMapList(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList) MultipartReplyFlowCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase) GetFlowStatisticsOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutputBuilder)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 GetFlowStatisticsOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutputBuilder)1 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId)1 FlowAndStatisticsMapList (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList)1 FlowAndStatisticsMapListBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder)1 FlowAndStatisticsMapListKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey)1 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)1 MultipartReplyFlowCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase)1 MultipartReplyFlow (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow)1