OF plugin classes must have a strict dependency on Connection Service 95/795/1
authorAlessandro Boch <aboch@cisco.com>
Mon, 5 Aug 2013 22:19:05 +0000 (15:19 -0700)
committerAlessandro Boch <aboch@cisco.com>
Mon, 5 Aug 2013 22:29:50 +0000 (15:29 -0700)
ISSUE:
In scaled setup we see NPE in OF protocol plugin code as switches connect before the IPluginOUConnectionService reference is set
CHANGE:
- Have OF proto plugin Activator express a required dependency on IPluginOUConnectionService for the interested classes
- Removed stale unused conenction mgr related code from OF plugin classes

Change-Id: If8aa7239d5be0c1c206c3b4d42bfcbbe029b4588
Signed-off-by: Alessandro Boch <aboch@cisco.com>
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServices.java

index 16393fa..05736f7 100644 (file)
@@ -61,6 +61,7 @@ public class Activator extends ComponentActivatorAbstractBase {
      * are done by the ComponentActivatorAbstractBase.
      *
      */
+    @Override
     public void init() {
     }
 
@@ -69,6 +70,7 @@ public class Activator extends ComponentActivatorAbstractBase {
      * ComponentActivatorAbstractBase
      *
      */
+    @Override
     public void destroy() {
     }
 
@@ -81,6 +83,7 @@ public class Activator extends ComponentActivatorAbstractBase {
      *         instantiated in order to get an fully working implementation
      *         Object
      */
+    @Override
     public Object[] getImplementations() {
         Object[] res = { TopologyServices.class, DataPacketServices.class,
                 InventoryService.class, ReadService.class,
@@ -103,6 +106,7 @@ public class Activator extends ComponentActivatorAbstractBase {
      *            per-container different behavior if needed, usually should not
      *            be the case though.
      */
+    @Override
     public void configureInstance(Component c, Object imp, String containerName) {
         if (imp.equals(TopologyServices.class)) {
             // export the service to be used by SAL
@@ -168,7 +172,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(ReadService.class)) {
@@ -196,7 +200,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(FlowProgrammerNotifier.class)) {
@@ -216,7 +220,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
     }
 
@@ -229,6 +233,7 @@ public class Activator extends ComponentActivatorAbstractBase {
      *         instantiated in order to get an fully working implementation
      *         Object
      */
+    @Override
     public Object[] getGlobalImplementations() {
         Object[] res = { Controller.class, OFStatisticsManager.class,
                 FlowProgrammerService.class, ReadServiceFilter.class,
@@ -248,6 +253,7 @@ public class Activator extends ComponentActivatorAbstractBase {
      *            Implementation class that is being configured, needed as long
      *            as the same routine can configure multiple implementations
      */
+    @Override
     public void configureGlobalInstance(Component c, Object imp) {
 
         if (imp.equals(Controller.class)) {
@@ -289,7 +295,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(ReadServiceFilter.class)) {
@@ -357,7 +363,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         // DataPacket mux/demux services, which is teh actual engine
@@ -385,7 +391,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(InventoryService.class)) {
@@ -408,7 +414,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutInventoryService.class, "(scope=Global)")
                     .setCallbacks("setPluginOutInventoryServices",
                             "unsetPluginOutInventoryServices")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(InventoryServiceShim.class)) {
@@ -438,7 +444,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(TopologyServiceShim.class)) {
index 1ab89b3..2c8708f 100644 (file)
@@ -26,7 +26,6 @@ import org.opendaylight.controller.protocol_plugin.openflow.core.IController;
 import org.opendaylight.controller.sal.action.Action;
 import org.opendaylight.controller.sal.action.ActionType;
 import org.opendaylight.controller.sal.action.Output;
-import org.opendaylight.controller.sal.connection.IPluginOutConnectionService;
 import org.opendaylight.controller.sal.core.ContainerFlow;
 import org.opendaylight.controller.sal.core.IContainerListener;
 import org.opendaylight.controller.sal.core.Node;
@@ -158,17 +157,6 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
         this.statsMgr = null;
     }
 
-    IPluginOutConnectionService connectionPluginOutService;
-    void setIPluginOutConnectionService(IPluginOutConnectionService s) {
-        connectionPluginOutService = s;
-    }
-
-    void unsetIPluginOutConnectionService(IPluginOutConnectionService s) {
-        if (connectionPluginOutService == s) {
-            connectionPluginOutService = null;
-        }
-    }
-
     @Override
     public FlowOnNode readFlow(String container, Node node, Flow flow, boolean cached) {
 
index a0f4810..028779d 100644 (file)
@@ -35,7 +35,6 @@ import org.osgi.framework.FrameworkUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.opendaylight.controller.sal.connection.IPluginOutConnectionService;
 import org.opendaylight.controller.sal.core.Bandwidth;
 import org.opendaylight.controller.sal.core.Config;
 import org.opendaylight.controller.sal.core.ContainerFlow;
@@ -109,6 +108,7 @@ public class TopologyServiceShim implements IDiscoveryListener,
             this.notifyQ = notifyQ;
         }
 
+        @Override
         public void run() {
             while (true) {
                 try {
@@ -165,6 +165,7 @@ public class TopologyServiceShim implements IDiscoveryListener,
             this.notifyQ = notifyQ;
         }
 
+        @Override
         public void run() {
             while (true) {
                 try {
@@ -399,17 +400,6 @@ public class TopologyServiceShim implements IDiscoveryListener,
         }
     }
 
-    IPluginOutConnectionService connectionPluginOutService;
-    void setIPluginOutConnectionService(IPluginOutConnectionService s) {
-        connectionPluginOutService = s;
-    }
-
-    void unsetIPluginOutConnectionService(IPluginOutConnectionService s) {
-        if (connectionPluginOutService == s) {
-            connectionPluginOutService = null;
-        }
-    }
-
     private void removeNodeConnector(String container,
             NodeConnector nodeConnector) {
         List<TopoEdgeUpdate> teuList = new ArrayList<TopoEdgeUpdate>();
index d77e513..68572fb 100644 (file)
@@ -16,7 +16,6 @@ import org.opendaylight.controller.protocol_plugin.openflow.ITopologyServiceShim
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.opendaylight.controller.sal.connection.IPluginOutConnectionService;
 import org.opendaylight.controller.sal.core.Edge;
 import org.opendaylight.controller.sal.topology.IPluginInTopologyService;
 import org.opendaylight.controller.sal.topology.IPluginOutTopologyService;
@@ -28,7 +27,6 @@ public class TopologyServices implements ITopologyServiceShimListener,
             .getLogger(TopologyServices.class);
     private IPluginOutTopologyService salTopoService = null;
     private IRefreshInternalProvider topoRefreshService = null;
-    private IPluginOutConnectionService connectionOutService;
     private String containerName;
 
     /**
@@ -152,14 +150,4 @@ public class TopologyServices implements ITopologyServiceShimListener,
             this.salTopoService.edgeUtilBackToNormal(edge);
         }
     }
-
-    void setIPluginOutConnectionService(IPluginOutConnectionService s) {
-        connectionOutService = s;
-    }
-
-    void unsetIPluginOutConnectionService(IPluginOutConnectionService s) {
-        if (connectionOutService == s) {
-            connectionOutService = null;
-        }
-    }
 }