Components like switch manager need to see an ADDED event come in for Node and NodeConnector before
they accept changes for those elements. This commit first checks whether a Node/NodeConnector are
already known to the DataBrokerService. If they are not known then it notifies the listeners of an ADDED
event otherwise it notifies it of a CHANGED event
Also implemented node removal. NOTE: NodeConnector removed events do not seem to be coming through.
Change-Id: Idcbe7fdce37c16158614f62b56767bed624bc803
Signed-off-by: Moiz Raja <moraja@cisco.com>
}
override onNodeRemoved(NodeRemoved notification) {
}
override onNodeRemoved(NodeRemoved notification) {
+ val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
+ val org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> identifier = notification.nodeRef.value as org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>;
+
+ inventoryPublisher.updateNode(notification.nodeRef.toADNode, UpdateType.REMOVED, properties);
}
override onNodeConnectorUpdated(NodeConnectorUpdated update) {
}
override onNodeConnectorUpdated(NodeConnectorUpdated update) {
- val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
- inventoryPublisher.updateNodeConnector(update.nodeConnectorRef.toADNodeConnector, UpdateType.CHANGED, properties);
+ val properties = new java.util.HashSet<org.opendaylight.controller.sal.core.Property>();
+
+
+ val org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> identifier = update.nodeConnectorRef.value as org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>;
+ var updateType = UpdateType.CHANGED;
+ if ( this._dataService.readOperationalData(identifier) == null ){
+ updateType = UpdateType.ADDED;
+ }
+
+ var nodeConnector = update.nodeConnectorRef.toADNodeConnector
+
+
+ properties.add(new org.opendaylight.controller.sal.core.Name(nodeConnector.ID.toString()));
+
+ inventoryPublisher.updateNodeConnector(nodeConnector , updateType , properties);
}
override onNodeUpdated(NodeUpdated notification) {
val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
}
override onNodeUpdated(NodeUpdated notification) {
val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
- inventoryPublisher.updateNode(notification.nodeRef.toADNode, UpdateType.CHANGED, properties);
+ val org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> identifier = notification.nodeRef.value as org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>;
+
+ var updateType = UpdateType.CHANGED;
+ if ( this._dataService.readOperationalData(identifier) == null ){
+ updateType = UpdateType.ADDED;
+ }
+ inventoryPublisher.updateNode(notification.nodeRef.toADNode, updateType, properties);
}
override getNodeProps() {
}
override getNodeProps() {