+ private void statsRequestSender(){
+
+ //Need to call API to receive all the nodes connected to controller.
+ List<Node> targetNodes = getAllConnectedNodes();
+
+ if(targetNodes == null)
+ return;
+
+ for (Node targetNode : targetNodes){
+
+
+ //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:")){
+ spLogger.info("Send request for stats collection to node : {})",targetNode.getId());
+ InstanceIdentifier<Node> targetInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class,targetNode.getKey()).toInstance();
+ NodeRef targetNodeRef = new NodeRef(targetInstanceId);
+
+ try{
+ sendAllGroupStatisticsRequest(targetNodeRef);
+ Thread.sleep(1000);
+ sendAllMeterStatisticsRequest(targetNodeRef);
+ Thread.sleep(1000);
+ sendGroupDescriptionRequest(targetNodeRef);
+ Thread.sleep(1000);
+ sendMeterConfigStatisticsRequest(targetNodeRef);
+ Thread.sleep(1000);
+ }catch(Exception e){
+ spLogger.error("Exception occured while sending statistics request : {}", e);
+ }
+ }
+ }
+ }
+
+ private void sendAllGroupStatisticsRequest(NodeRef targetNode){
+
+ final GetAllGroupStatisticsInputBuilder input = new GetAllGroupStatisticsInputBuilder();
+
+ input.setNode(targetNode);
+ input.setNode(targetNode);
+
+ @SuppressWarnings("unused")
+ Future<RpcResult<GetAllGroupStatisticsOutput>> response =
+ groupStatsService.getAllGroupStatistics(input.build());
+ }
+
+ private void sendGroupDescriptionRequest(NodeRef targetNode){
+ final GetGroupDescriptionInputBuilder input = new GetGroupDescriptionInputBuilder();
+
+ input.setNode(targetNode);
+
+ @SuppressWarnings("unused")
+ Future<RpcResult<GetGroupDescriptionOutput>> response =
+ groupStatsService.getGroupDescription(input.build());
+ }
+
+ private void sendAllMeterStatisticsRequest(NodeRef targetNode){
+
+ GetAllMeterStatisticsInputBuilder input = new GetAllMeterStatisticsInputBuilder();
+
+ input.setNode(targetNode);
+
+ @SuppressWarnings("unused")
+ Future<RpcResult<GetAllMeterStatisticsOutput>> response =
+ meterStatsService.getAllMeterStatistics(input.build());
+ }
+
+ private void sendMeterConfigStatisticsRequest(NodeRef targetNode){
+
+ GetAllMeterConfigStatisticsInputBuilder input = new GetAllMeterConfigStatisticsInputBuilder();
+
+ input.setNode(targetNode);
+
+ @SuppressWarnings("unused")
+ Future<RpcResult<GetAllMeterConfigStatisticsOutput>> response =
+ meterStatsService.getAllMeterConfigStatistics(input.build());
+
+ }
+
+ public ConcurrentMap<NodeId, NodeStatistics> getStatisticsCache() {
+ return statisticsCache;
+ }
+
+ private List<Node> getAllConnectedNodes(){
+
+ Nodes nodes = (Nodes) dps.readOperationalData(nodesIdentifier);
+ if(nodes == null)
+ return null;
+
+ spLogger.info("Number of connected nodes : {}",nodes.getNode().size());
+ return nodes.getNode();
+ }
+
+ @SuppressWarnings("deprecation")