Fix NPE when ControlPlaneConnectPoint config is added after interface config
Change-Id: I31ee1d2e646d4b4c88ac5bb3b661228c893292b9
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/ControlPlaneRedirectManager.java b/apps/routing/src/main/java/org/onosproject/routing/impl/ControlPlaneRedirectManager.java
index bedc798..9f889af 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/ControlPlaneRedirectManager.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/impl/ControlPlaneRedirectManager.java
@@ -609,12 +609,15 @@
}
private class InternalInterfaceListener implements InterfaceListener {
-
@Override
public void event(InterfaceEvent event) {
- Interface intf = event.subject();
- Interface prevIntf = event.prevSubject();
- switch (event.type()) {
+ if (controlPlaneConnectPoint == null) {
+ log.info("Control plane connect point is not configured. Abort InterfaceEvent.");
+ return;
+ }
+ Interface intf = event.subject();
+ Interface prevIntf = event.prevSubject();
+ switch (event.type()) {
case INTERFACE_ADDED:
if (intf != null && !intf.connectPoint().equals(controlPlaneConnectPoint)) {
provisionInterface(intf, true);
@@ -632,7 +635,7 @@
break;
default:
break;
- }
+ }
}
}
}