X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fstatistics-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fstatistics%2Fmanager%2FStatisticsProvider.java;h=325b342cd88bdb71d6d2138169f2f7ae36c83785;hp=b925ebdc99738b72aa98e2a3186cc6d57f9578cb;hb=558c0b7fc4c22e6ecacd86cf31016d355d9a7ee3;hpb=07c30f447bd1366ba18e6f0f41ac768a16dbc901 diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java index b925ebdc99..325b342cd8 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java @@ -293,23 +293,27 @@ public class StatisticsProvider implements AutoCloseable { NodeRef targetNodeRef = new NodeRef(targetInstanceId); try{ - sendAggregateFlowsStatsFromAllTablesRequest(targetNode.getKey()); - - sendAllFlowsStatsFromAllTablesRequest(targetNodeRef); - - sendAllNodeConnectorsStatisticsRequest(targetNodeRef); - - sendAllFlowTablesStatisticsRequest(targetNodeRef); - - sendAllQueueStatsFromAllNodeConnector (targetNodeRef); - - sendAllGroupStatisticsRequest(targetNodeRef); - - sendAllMeterStatisticsRequest(targetNodeRef); - - sendGroupDescriptionRequest(targetNodeRef); - - sendMeterConfigStatisticsRequest(targetNodeRef); + if(flowStatsService != null){ + sendAggregateFlowsStatsFromAllTablesRequest(targetNode.getKey()); + sendAllFlowsStatsFromAllTablesRequest(targetNodeRef); + } + if(flowTableStatsService != null){ + sendAllFlowTablesStatisticsRequest(targetNodeRef); + } + if(portStatsService != null){ + sendAllNodeConnectorsStatisticsRequest(targetNodeRef); + } + if(groupStatsService != null){ + sendAllGroupStatisticsRequest(targetNodeRef); + sendGroupDescriptionRequest(targetNodeRef); + } + if(meterStatsService != null){ + sendAllMeterStatisticsRequest(targetNodeRef); + sendMeterConfigStatisticsRequest(targetNodeRef); + } + if(queueStatsService != null){ + sendAllQueueStatsFromAllNodeConnector (targetNodeRef); + } }catch(Exception e){ spLogger.error("Exception occured while sending statistics requests : {}", e); } @@ -366,23 +370,28 @@ public class StatisticsProvider implements AutoCloseable { if(tablesId.size() != 0){ for(Short id : tablesId){ - spLogger.debug("Send aggregate stats request for flow table {} to node {}",id,targetNodeKey); - GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input = - new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder(); - - input.setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey).toInstance())); - input.setTableId(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId(id)); - Future> response = - flowStatsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build()); - - multipartMessageManager.setTxIdAndTableIdMapEntry(targetNodeKey.getId(), response.get().getResult().getTransactionId(), id); - this.multipartMessageManager.addTxIdToRequestTypeEntry(targetNodeKey.getId(), response.get().getResult().getTransactionId() - , StatsRequestType.AGGR_FLOW); + sendAggregateFlowsStatsFromTableRequest(targetNodeKey,id); } }else{ spLogger.debug("No details found in data store for flow tables associated with Node {}",targetNodeKey); } } + + public void sendAggregateFlowsStatsFromTableRequest(NodeKey targetNodeKey,Short tableId) throws InterruptedException, ExecutionException{ + + spLogger.debug("Send aggregate stats request for flow table {} to node {}",tableId,targetNodeKey); + GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input = + new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder(); + + input.setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, targetNodeKey).toInstance())); + input.setTableId(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId(tableId)); + Future> response = + flowStatsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build()); + + multipartMessageManager.setTxIdAndTableIdMapEntry(targetNodeKey.getId(), response.get().getResult().getTransactionId(), tableId); + this.multipartMessageManager.addTxIdToRequestTypeEntry(targetNodeKey.getId(), response.get().getResult().getTransactionId() + , StatsRequestType.AGGR_FLOW); + } public void sendAllNodeConnectorsStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{