-
- public void start() {
-
- NotificationProviderService nps = this.getNotificationService();
- Registration<NotificationListener> registerNotificationListener = nps.registerNotificationListener(this.updateCommiter);
- this.listenerRegistration = registerNotificationListener;
-
- // Get Group/Meter statistics service instance
- groupStatsService = StatisticsManagerActivator.getProviderContext().
- getRpcService(OpendaylightGroupStatisticsService.class);
-
- meterStatsService = StatisticsManagerActivator.getProviderContext().
- getRpcService(OpendaylightMeterStatisticsService.class);
-
- statisticsRequesterThread = new Thread( new Runnable(){
-
- @Override
- public void run() {
- while(true){
- try {
- statsRequestSender();
-
- Thread.sleep(STATS_THREAD_EXECUTION_TIME);
- }catch (Exception e){
- spLogger.error("Exception occurred while sending stats request : {}",e);
- }
- }
- }
- });
-
- spLogger.debug("Statistics requester thread started with timer interval : {}",STATS_THREAD_EXECUTION_TIME);
-
- statisticsRequesterThread.start();
-
- spLogger.info("Statistics Provider started.");
- }
-
- protected DataModificationTransaction startChange() {
-
- DataProviderService dps = this.getDataService();
- return dps.beginTransaction();
- }
-
- 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){
-
- if(targetNode.getAugmentation(FlowCapableNode.class) != null){
-
- 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);