From: Alessandro Boch Date: Mon, 5 Aug 2013 22:19:05 +0000 (-0700) Subject: OF plugin classes must have a strict dependency on Connection Service X-Git-Tag: releasepom-0.1.0~231^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=e55cbeebfe5bae130becc3facd7c6235a56529ee OF plugin classes must have a strict dependency on Connection Service 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 --- diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java index 16393fa21f..05736f779e 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java @@ -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)) { diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java index 1ab89b34cb..2c8708f20e 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java @@ -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) { diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java index a0f48100bd..028779d106 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java @@ -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 teuList = new ArrayList(); diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServices.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServices.java index d77e513f3b..68572fb650 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServices.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServices.java @@ -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; - } - } }