X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fmessagebus-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmessagebus%2Fapp%2Fimpl%2FEventSourceTopology.java;h=279528907c049d3f5cc172dac57e53658331b95a;hp=6140a78ba586a7beaa89a92ae0ab9cc5fb109016;hb=6c9c88f85589d635e3742cb2557044bf3a006d29;hpb=69c1fa1f26d6c9130696e7916c6ebe9a9e9d635c diff --git a/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java b/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java index 6140a78ba5..279528907c 100644 --- a/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java +++ b/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java @@ -129,7 +129,7 @@ public class EventSourceTopology implements EventAggregatorService, EventSourceR deleteData(OPERATIONAL, augmentPath); } - private void notifyExistingNodes(final Pattern nodeIdPatternRegex, final EventSourceTopic eventSourceTopic){ + private void notifyExistingNodes(final EventSourceTopic eventSourceTopic){ final ReadOnlyTransaction tx = dataBroker.newReadOnlyTransaction(); @@ -140,12 +140,19 @@ public class EventSourceTopology implements EventAggregatorService, EventSourceR @Override public void onSuccess(Optional data) { if(data.isPresent()) { + LOG.info("Topology data are present..."); final List 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(); } @@ -168,12 +175,11 @@ public class EventSourceTopology implements EventAggregatorService, EventSourceR final NotificationPattern notificationPattern = new NotificationPattern(input.getNotificationPattern()); final String nodeIdPattern = input.getNodeIdPattern().getValue(); - final Pattern nodeIdPatternRegex = Pattern.compile(nodeIdPattern); final EventSourceTopic eventSourceTopic = new EventSourceTopic(notificationPattern, nodeIdPattern, eventSourceService); registerTopic(eventSourceTopic); - notifyExistingNodes(nodeIdPatternRegex, eventSourceTopic); + notifyExistingNodes(eventSourceTopic); final CreateTopicOutput cto = new CreateTopicOutputBuilder() .setTopicId(eventSourceTopic.getTopicId()) @@ -213,7 +219,9 @@ public class EventSourceTopology implements EventAggregatorService, EventSourceR insert(sourcePath); for(EventSourceTopic est : topicListenerRegistrations.keySet()){ - est.notifyNode(EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, nodeKey)); + if(est.getNodeIdRegexPattern().matcher(nodeKey.getNodeId().getValue()).matches()){ + est.notifyNode(EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, nodeKey)); + } } }