- private void notifyExistingNodes(final EventSourceTopic eventSourceTopic){
-
- final ReadOnlyTransaction tx = dataBroker.newReadOnlyTransaction();
-
- final CheckedFuture<Optional<Topology>, ReadFailedException> future = tx.read(OPERATIONAL, EVENT_SOURCE_TOPOLOGY_PATH);
-
- Futures.addCallback(future, new FutureCallback<Optional<Topology>>(){
-
- @Override
- public void onSuccess(Optional<Topology> data) {
- if(data.isPresent()) {
- LOG.info("Topology data are present...");
- final List<Node> nodes = data.get().getNode();
- if(nodes != null){
- LOG.info("List of nodes is not null...");
- final Pattern nodeIdPatternRegex = eventSourceTopic.getNodeIdRegexPattern();
- for (final Node node : nodes) {
- if (nodeIdPatternRegex.matcher(node.getNodeId().getValue()).matches()) {
- eventSourceTopic.notifyNode(EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, node.getKey()));
- }
- }
- } else {
- LOG.info("List of nodes is NULL...");
- }
- }
- tx.close();
- }
-
- @Override
- public void onFailure(Throwable t) {
- LOG.error("Can not notify existing nodes {}", t);
- tx.close();
- }
-
- });
-
- }
-