commit | d8c1da087295ce5c049f3c1cdb83ae0d8e29ace3 | [log] [tgz] |
---|---|---|
author | Ray Milkey <ray@opennetworking.org> | Thu May 10 15:41:16 2018 -0700 |
committer | Thomas Vachuska <tom@opennetworking.org> | Thu May 10 23:03:37 2018 +0000 |
tree | 0503456c8929a166cdbcca424aab4f0ba073f9fd | |
parent | 893a1d7d480cab4ff736c421e76f512438367f74 [diff] |
Fix NPE in DeviceManager for an offline device Change-Id: Ib105b029efd0519c6ed54abf8e89c7be6c905987
diff --git a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java index 5227665..08d6b1c 100644 --- a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java +++ b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
@@ -417,6 +417,12 @@ checkNotNull(deviceId, PORT_NUMBER_NULL); NodeId masterId = mastershipService.getMasterFor(deviceId); + if (masterId == null) { + // No master found; device is offline + log.info("No master found for port state change for {}", deviceId); + return; + } + if (!masterId.equals(localNodeId)) { //Send the request to the master node for the device log.info("Device {} is managed by {}, forwarding the request to the MASTER",