use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.GraphKey in project bgpcep by opendaylight.
the class GraphListener method onDataTreeChanged.
@Override
public void onDataTreeChanged(final Collection<DataTreeModification<Graph>> changes) {
for (DataTreeModification<Graph> change : changes) {
DataObjectModification<Graph> root = change.getRootNode();
GraphKey key = change.getRootPath().getRootIdentifier().firstKeyOf(Graph.class);
switch(root.getModificationType()) {
case DELETE:
graphProvider.deleteGraph(key);
break;
case SUBTREE_MODIFIED:
/* getModificationType() returns SUBTREE_MODIFIED only when Data Object is already present in the
* Data Store, thus, only for deletion. Thus, to insert children, we must used parseSubTree()
* method (See above). This method is called only when the graph already exists.
*/
case WRITE:
/* First look if the Graph was not already configured */
ConnectedGraph cgraph = this.graphProvider.getConnectedGraph(key);
if (cgraph == null) {
graphProvider.addGraph(root.getDataAfter());
} else {
/* Graph exist, process Children */
parseSubTree(cgraph, root.getModifiedChildren());
}
break;
default:
break;
}
}
}
Aggregations