Yuta HIGUCHI
Committed by Gerrit Code Review

[ONOS-4772] Avoid throwing NPE on optical resource queries.

Change-Id: I71ac76b7b456b19a8dabf78a0ef52366867cd230
......@@ -66,6 +66,10 @@ public class DefaultTributarySlotQuery extends AbstractHandlerBehaviour implemen
DeviceService deviceService = opticalView(this.handler().get(DeviceService.class));
Port p = deviceService.getPort(this.data().deviceId(), port);
if (p == null) {
return Collections.emptySet();
}
switch (p.type()) {
case OCH:
return queryOchTributarySlots(p);
......
......@@ -52,7 +52,7 @@ public class OFOpticalSwitch13LambdaQuery extends AbstractHandlerBehaviour imple
Port p = deviceService.getPort(this.data().deviceId(), port);
// Only OMS ports expose lambda resources
if (!p.type().equals(Port.Type.OMS)) {
if (p == null || !p.type().equals(Port.Type.OMS)) {
return Collections.emptySet();
}
......