- private void sendAllGroupStatisticsRequest(NodeRef targetNode){
-
- final GetAllGroupStatisticsInputBuilder input = new GetAllGroupStatisticsInputBuilder();
-
- 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();
- }
-
- private List<Short> getTablesFromNode(NodeKey nodeKey){
- InstanceIdentifier<FlowCapableNode> nodesIdentifier = InstanceIdentifier.builder(Nodes.class).child(Node.class,nodeKey).augmentation(FlowCapableNode.class).toInstance();
-
- FlowCapableNode node = (FlowCapableNode)dps.readConfigurationData(nodesIdentifier);
- List<Short> tablesId = new ArrayList<Short>();
- if(node != null && node.getTable()!=null){
- spLogger.info("Number of tables {} supported by node {}",node.getTable().size(),nodeKey);
- for(Table table: node.getTable()){
- tablesId.add(table.getId());
- }
+ /**
+ * Get the handler for a particular node.
+ *
+ * @param nodeId source node
+ * @return Node statistics handler for that node. Null if the statistics should
+ * not handled.
+ */
+ public final NodeStatisticsHandler getStatisticsHandler(final NodeId nodeId) {
+ Preconditions.checkNotNull(nodeId);
+ NodeStatisticsHandler handler = handlers.get(nodeId);
+ if (handler == null) {
+ spLogger.info("Attempted to get non-existing handler for {}", nodeId);