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 16393fa21f0518fed7691f0960fbd53c02b54ce0..05736f779e6111f2a7619dc7734aeca0362717ef 100644 (file)
@@ -61,6 +61,7 @@ public class Activator extends ComponentActivatorAbstractBase {
      * are done by the ComponentActivatorAbstractBase.
      *
      */
      * are done by the ComponentActivatorAbstractBase.
      *
      */
+    @Override
     public void init() {
     }
 
     public void init() {
     }
 
@@ -69,6 +70,7 @@ public class Activator extends ComponentActivatorAbstractBase {
      * ComponentActivatorAbstractBase
      *
      */
      * ComponentActivatorAbstractBase
      *
      */
+    @Override
     public void destroy() {
     }
 
     public void destroy() {
     }
 
@@ -81,6 +83,7 @@ public class Activator extends ComponentActivatorAbstractBase {
      *         instantiated in order to get an fully working implementation
      *         Object
      */
      *         instantiated in order to get an fully working implementation
      *         Object
      */
+    @Override
     public Object[] getImplementations() {
         Object[] res = { TopologyServices.class, DataPacketServices.class,
                 InventoryService.class, ReadService.class,
     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.
      */
      *            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
     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")
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(ReadService.class)) {
         }
 
         if (imp.equals(ReadService.class)) {
@@ -196,7 +200,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(FlowProgrammerNotifier.class)) {
         }
 
         if (imp.equals(FlowProgrammerNotifier.class)) {
@@ -216,7 +220,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
                     .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
      */
      *         instantiated in order to get an fully working implementation
      *         Object
      */
+    @Override
     public Object[] getGlobalImplementations() {
         Object[] res = { Controller.class, OFStatisticsManager.class,
                 FlowProgrammerService.class, ReadServiceFilter.class,
     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
      */
      *            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)) {
     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")
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(ReadServiceFilter.class)) {
         }
 
         if (imp.equals(ReadServiceFilter.class)) {
@@ -357,7 +363,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         // DataPacket mux/demux services, which is teh actual engine
         }
 
         // DataPacket mux/demux services, which is teh actual engine
@@ -385,7 +391,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(InventoryService.class)) {
         }
 
         if (imp.equals(InventoryService.class)) {
@@ -408,7 +414,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutInventoryService.class, "(scope=Global)")
                     .setCallbacks("setPluginOutInventoryServices",
                             "unsetPluginOutInventoryServices")
                     .setService(IPluginOutInventoryService.class, "(scope=Global)")
                     .setCallbacks("setPluginOutInventoryServices",
                             "unsetPluginOutInventoryServices")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(InventoryServiceShim.class)) {
         }
 
         if (imp.equals(InventoryServiceShim.class)) {
@@ -438,7 +444,7 @@ public class Activator extends ComponentActivatorAbstractBase {
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
                     .setService(IPluginOutConnectionService.class)
                     .setCallbacks("setIPluginOutConnectionService",
                             "unsetIPluginOutConnectionService")
-                    .setRequired(false));
+                    .setRequired(true));
         }
 
         if (imp.equals(TopologyServiceShim.class)) {
         }
 
         if (imp.equals(TopologyServiceShim.class)) {
index 1ab89b34cb7c875b65e1dee5be409ebbbc5e1378..2c8708f20ee46295972a6b18b280df436f009dfc 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.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;
 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;
     }
 
         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) {
 
     @Override
     public FlowOnNode readFlow(String container, Node node, Flow flow, boolean cached) {
 
index a0f48100bdc812e4d1cda33c482bfc51b2f63587..028779d10651936d4d77f3400a0f996026dcb3bf 100644 (file)
@@ -35,7 +35,6 @@ import org.osgi.framework.FrameworkUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 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;
 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;
         }
 
             this.notifyQ = notifyQ;
         }
 
+        @Override
         public void run() {
             while (true) {
                 try {
         public void run() {
             while (true) {
                 try {
@@ -165,6 +165,7 @@ public class TopologyServiceShim implements IDiscoveryListener,
             this.notifyQ = notifyQ;
         }
 
             this.notifyQ = notifyQ;
         }
 
+        @Override
         public void run() {
             while (true) {
                 try {
         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>();
     private void removeNodeConnector(String container,
             NodeConnector nodeConnector) {
         List<TopoEdgeUpdate> teuList = new ArrayList<TopoEdgeUpdate>();
index d77e513f3bd52f880b311a513705f88316a61c5a..68572fb65086ef4c7901dc4179caf03e57c12233 100644 (file)
@@ -16,7 +16,6 @@ import org.opendaylight.controller.protocol_plugin.openflow.ITopologyServiceShim
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 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;
 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;
             .getLogger(TopologyServices.class);
     private IPluginOutTopologyService salTopoService = null;
     private IRefreshInternalProvider topoRefreshService = null;
-    private IPluginOutConnectionService connectionOutService;
     private String containerName;
 
     /**
     private String containerName;
 
     /**
@@ -152,14 +150,4 @@ public class TopologyServices implements ITopologyServiceShimListener,
             this.salTopoService.edgeUtilBackToNormal(edge);
         }
     }
             this.salTopoService.edgeUtilBackToNormal(edge);
         }
     }
-
-    void setIPluginOutConnectionService(IPluginOutConnectionService s) {
-        connectionOutService = s;
-    }
-
-    void unsetIPluginOutConnectionService(IPluginOutConnectionService s) {
-        if (connectionOutService == s) {
-            connectionOutService = null;
-        }
-    }
 }
 }