Now that we track all connected flow-capable nodes we do need to go and
read all nodes just to find them. Just look at which handlers are
currently created.
Change-Id: I1a33b53399d0de0e2cdbdbd90512a09933d127c8
Signed-off-by: Robert Varga <rovarga@cisco.com>
private static final Logger spLogger = LoggerFactory.getLogger(StatisticsProvider.class);
private final MultipartMessageManager multipartMessageManager = new MultipartMessageManager();
private static final Logger spLogger = LoggerFactory.getLogger(StatisticsProvider.class);
private final MultipartMessageManager multipartMessageManager = new MultipartMessageManager();
- private final InstanceIdentifier<Nodes> nodesIdentifier = InstanceIdentifier.builder(Nodes.class).toInstance();
private final DataProviderService dps;
//Local caching of stats
private final DataProviderService dps;
//Local caching of stats
- private final ConcurrentMap<NodeId,NodeStatisticsHandler> handlers = new ConcurrentHashMap<>();
+ private final ConcurrentMap<NodeId, NodeStatisticsHandler> handlers = new ConcurrentHashMap<>();
private OpendaylightGroupStatisticsService groupStatsService;
private OpendaylightGroupStatisticsService groupStatsService;
return dps.beginTransaction();
}
return dps.beginTransaction();
}
- private void statsRequestSender(){
-
- List<Node> targetNodes = getAllConnectedNodes();
-
- if(targetNodes == null)
- return;
-
-
- for (Node targetNode : targetNodes){
-
- if(targetNode.getAugmentation(FlowCapableNode.class) != null){
- sendStatisticsRequestsToNode(targetNode.getKey());
- }
+ private void statsRequestSender() {
+ for (NodeStatisticsHandler h : handlers.values()) {
+ sendStatisticsRequestsToNode(h.getTargetNodeKey());
- private List<Node> getAllConnectedNodes(){
- Nodes nodes = (Nodes) dps.readOperationalData(nodesIdentifier);
- if(nodes == null)
- return null;
-
- spLogger.debug("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();
private List<Short> getTablesFromNode(NodeKey nodeKey){
InstanceIdentifier<FlowCapableNode> nodesIdentifier = InstanceIdentifier.builder(Nodes.class).child(Node.class,nodeKey).augmentation(FlowCapableNode.class).toInstance();