- spLogger.info("Send request for stats collection to node : {})",targetNode.getId());
-
- //We need to add check, so see if groups/meters are supported
- //by the target node. Below check doesn't look good.
- if(targetNode.getId().getValue().contains("openflow:")){
- sendAllGroupStatisticsRequest(targetNode);
-
- sendAllMeterStatisticsRequest(targetNode);
-
- sendGroupDescriptionRequest(targetNode);
-
- sendGroupFeaturesRequest(targetNode);
-
- sendMeterConfigStatisticsRequest(targetNode);
-
- sendMeterFeaturesRequest(targetNode);
+
+ if(targetNode.getAugmentation(FlowCapableNode.class) != null){
+ sendStatisticsRequestsToNode(targetNode);
+ }
+ }
+ }
+
+ public void sendStatisticsRequestsToNode(Node targetNode){
+
+ spLogger.debug("Send requests for statistics collection to node : {})",targetNode.getId());
+
+ InstanceIdentifier<Node> targetInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class,targetNode.getKey()).toInstance();
+
+ NodeRef targetNodeRef = new NodeRef(targetInstanceId);
+
+ try{
+ 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);
+ }
+ }
+
+
+ public void sendAllFlowTablesStatisticsRequest(NodeRef targetNodeRef) throws InterruptedException, ExecutionException {
+ final GetFlowTablesStatisticsInputBuilder input =
+ new GetFlowTablesStatisticsInputBuilder();
+
+ input.setNode(targetNodeRef);
+
+ Future<RpcResult<GetFlowTablesStatisticsOutput>> response =
+ flowTableStatsService.getFlowTablesStatistics(input.build());
+
+ this.multipartMessageManager.addTxIdToRequestTypeEntry(getNodeId(targetNodeRef),response.get().getResult().getTransactionId()
+ , StatsRequestType.ALL_FLOW_TABLE);
+
+ }
+
+ public void sendAllFlowsStatsFromAllTablesRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
+ final GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input =
+ new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder();
+
+ input.setNode(targetNode);
+
+ Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> response =
+ flowStatsService.getAllFlowsStatisticsFromAllFlowTables(input.build());
+
+ this.multipartMessageManager.addTxIdToRequestTypeEntry(getNodeId(targetNode), response.get().getResult().getTransactionId()
+ , StatsRequestType.ALL_FLOW);
+
+ }
+
+ public void sendFlowStatsFromTableRequest(NodeRef targetNode,Flow flow) throws InterruptedException, ExecutionException{
+ final GetFlowStatisticsFromFlowTableInputBuilder input =
+ new GetFlowStatisticsFromFlowTableInputBuilder();
+
+ input.setNode(targetNode);
+ input.fieldsFrom(flow);
+
+ Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> response =
+ flowStatsService.getFlowStatisticsFromFlowTable(input.build());
+
+ this.multipartMessageManager.addTxIdToRequestTypeEntry(getNodeId(targetNode), response.get().getResult().getTransactionId()
+ , StatsRequestType.ALL_FLOW);
+
+ }
+
+ public void sendAggregateFlowsStatsFromAllTablesRequest(NodeKey targetNodeKey) throws InterruptedException, ExecutionException{
+
+ List<Short> tablesId = getTablesFromNode(targetNodeKey);
+
+ if(tablesId.size() != 0){
+ for(Short id : tablesId){
+
+ sendAggregateFlowsStatsFromTableRequest(targetNodeKey,id);