Graph is deleted twice when stopping ODL which cause a NPE.
When ODL stops, AbstractTopologyBuilder() calls
LinkStateGraphBuilder.clearTopology() which call
ConnectedGraphImpl.clear(). Then ConnectedGraphServer() stops by
calling destroyOperationalGraphModel() which browse all stored graphs
and call again ConnectedGraphImpl.clear() which cause the NPE.
Fix removes graph from ConnectedGraphServer graphs Map in
clearGraph() method instead of deleteGraph() method.
JIRA: BGPCEP-977
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Change-Id: I55209e77ffa2c317ea85ca29cc794016f338c488
public void clearGraph(final Graph graph) {
Preconditions.checkArgument(graph != null, "Provided Graph is a null object");
removeFromDataStore(getGraphInstanceIdentifier(graph.getName()), "Graph(" + graph.getName() + ")");
+ graphs.remove(graph.key());
}
/**
@Override
public void deleteGraph(final GraphKey key) {
Preconditions.checkArgument(key != null, "Provided Graph Key is a null object");
- ConnectedGraphImpl cgraph = graphs.remove(key);
+ ConnectedGraphImpl cgraph = graphs.get(key);
/*
* Remove the corresponding Connected Graph which will delete the graph
* by calling clearGraph() method (see above)