private void addDiscovery(Node node) {
Map<Long, ISwitch> switches = controller.getSwitches();
ISwitch sw = switches.get(node.getID());
- List<OFPhysicalPort> ports = sw.getEnabledPorts();
- if (ports == null) {
+ if (sw == null) {
+ //switch could be removed by now, stop propagation
return;
}
+ List<OFPhysicalPort> ports = sw.getEnabledPorts();
for (OFPhysicalPort port : ports) {
NodeConnector nodeConnector = NodeConnectorCreator.createOFNodeConnector(port.getPortNumber(), node);
if (!readyListHi.contains(nodeConnector)) {