X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FActivator.java;h=05736f779e6111f2a7619dc7734aeca0362717ef;hb=dfa4383b0b5c9c6de340526a62aef731922fa29f;hp=a93a8b7243cede7e2d81d212160dbe7a97806539;hpb=1e9531138e44cd757ca27b0d86e98eccb22ccd82;p=controller.git 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 a93a8b7243..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 @@ -19,14 +19,17 @@ import org.opendaylight.controller.protocol_plugin.openflow.IFlowProgrammerNotif import org.opendaylight.controller.protocol_plugin.openflow.IInventoryProvider; import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimExternalListener; import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimInternalListener; +import org.opendaylight.controller.protocol_plugin.openflow.IOFStatisticsListener; import org.opendaylight.controller.protocol_plugin.openflow.IOFStatisticsManager; -import org.opendaylight.controller.protocol_plugin.openflow.IPluginReadServiceFilter; +import org.opendaylight.controller.protocol_plugin.openflow.IReadFilterInternalListener; +import org.opendaylight.controller.protocol_plugin.openflow.IReadServiceFilter; import org.opendaylight.controller.protocol_plugin.openflow.IRefreshInternalProvider; -import org.opendaylight.controller.protocol_plugin.openflow.IStatisticsListener; import org.opendaylight.controller.protocol_plugin.openflow.ITopologyServiceShimListener; import org.opendaylight.controller.protocol_plugin.openflow.core.IController; import org.opendaylight.controller.protocol_plugin.openflow.core.IMessageListener; import org.opendaylight.controller.protocol_plugin.openflow.core.internal.Controller; +import org.opendaylight.controller.sal.connection.IPluginInConnectionService; +import org.opendaylight.controller.sal.connection.IPluginOutConnectionService; import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase; import org.opendaylight.controller.sal.core.IContainerListener; import org.opendaylight.controller.sal.core.Node; @@ -37,6 +40,7 @@ import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService; import org.opendaylight.controller.sal.packet.IPluginInDataPacketService; import org.opendaylight.controller.sal.packet.IPluginOutDataPacketService; import org.opendaylight.controller.sal.reader.IPluginInReadService; +import org.opendaylight.controller.sal.reader.IPluginOutReadService; import org.opendaylight.controller.sal.topology.IPluginInTopologyService; import org.opendaylight.controller.sal.topology.IPluginOutTopologyService; import org.opendaylight.controller.sal.utils.GlobalConstants; @@ -57,6 +61,7 @@ public class Activator extends ComponentActivatorAbstractBase { * are done by the ComponentActivatorAbstractBase. * */ + @Override public void init() { } @@ -65,6 +70,7 @@ public class Activator extends ComponentActivatorAbstractBase { * ComponentActivatorAbstractBase * */ + @Override public void destroy() { } @@ -77,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, @@ -99,13 +106,13 @@ 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 c.setInterface( new String[] { IPluginInTopologyService.class.getName(), - ITopologyServiceShimListener.class.getName() }, - null); + ITopologyServiceShimListener.class.getName() }, null); // Hook the services coming in from SAL, as optional in // case SAL is not yet there, could happen c.add(createContainerServiceDependency(containerName) @@ -121,7 +128,8 @@ public class Activator extends ComponentActivatorAbstractBase { if (imp.equals(InventoryService.class)) { // export the service c.setInterface( - new String[] { IPluginInInventoryService.class.getName(), + new String[] { + IPluginInInventoryService.class.getName(), IInventoryShimInternalListener.class.getName(), IInventoryProvider.class.getName() }, null); @@ -143,7 +151,7 @@ public class Activator extends ComponentActivatorAbstractBase { Dictionary props = new Hashtable(); // Set the protocolPluginType property which will be used // by SAL - props.put("protocolPluginType", Node.NodeIDType.OPENFLOW); + props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), Node.NodeIDType.OPENFLOW); c.setInterface(IPluginInDataPacketService.class.getName(), props); // Hook the services coming in from SAL, as optional in // case SAL is not yet there, could happen @@ -160,6 +168,11 @@ public class Activator extends ComponentActivatorAbstractBase { .setCallbacks("setPluginOutDataPacketService", "unsetPluginOutDataPacketService") .setRequired(false)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } if (imp.equals(ReadService.class)) { @@ -167,12 +180,27 @@ public class Activator extends ComponentActivatorAbstractBase { Dictionary props = new Hashtable(); // Set the protocolPluginType property which will be used // by SAL - props.put("protocolPluginType", Node.NodeIDType.OPENFLOW); - c.setInterface(IPluginInReadService.class.getName(), props); + props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), Node.NodeIDType.OPENFLOW); + c.setInterface(new String[] { + IReadFilterInternalListener.class.getName(), + IPluginInReadService.class.getName() }, props); + c.add(createServiceDependency() - .setService(IPluginReadServiceFilter.class) + .setService(IReadServiceFilter.class) .setCallbacks("setService", "unsetService") .setRequired(true)); + + c.add(createContainerServiceDependency(containerName) + .setService(IPluginOutReadService.class) + .setCallbacks("setPluginOutReadServices", + "unsetPluginOutReadServices") + .setRequired(false)); + + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } if (imp.equals(FlowProgrammerNotifier.class)) { @@ -180,7 +208,7 @@ public class Activator extends ComponentActivatorAbstractBase { Dictionary props = new Hashtable(); // Set the protocolPluginType property which will be used // by SAL - props.put("protocolPluginType", Node.NodeIDType.OPENFLOW); + props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), Node.NodeIDType.OPENFLOW); c.setInterface(IFlowProgrammerNotifier.class.getName(), props); c.add(createContainerServiceDependency(containerName) @@ -188,6 +216,11 @@ public class Activator extends ComponentActivatorAbstractBase { .setCallbacks("setPluginOutFlowProgrammerService", "unsetPluginOutFlowProgrammerService") .setRequired(true)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } } @@ -200,10 +233,11 @@ 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, - DiscoveryService.class, DataPacketMuxDemux.class, + DiscoveryService.class, DataPacketMuxDemux.class, InventoryService.class, InventoryServiceShim.class, TopologyServiceShim.class }; return res; } @@ -219,13 +253,17 @@ 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)) { logger.debug("Activator configureGlobalInstance( ) is called"); Dictionary props = new Hashtable(); props.put("name", "Controller"); - c.setInterface(IController.class.getName(), props); + props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), Node.NodeIDType.OPENFLOW); + c.setInterface(new String[] { IController.class.getName(), + IPluginInConnectionService.class.getName()}, + props); } if (imp.equals(FlowProgrammerService.class)) { @@ -233,14 +271,14 @@ public class Activator extends ComponentActivatorAbstractBase { Dictionary props = new Hashtable(); // Set the protocolPluginType property which will be used // by SAL - props.put("protocolPluginType", Node.NodeIDType.OPENFLOW); + props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), Node.NodeIDType.OPENFLOW); c.setInterface( new String[] { IPluginInFlowProgrammerService.class.getName(), IMessageListener.class.getName(), IContainerListener.class.getName(), IInventoryShimExternalListener.class.getName() }, - props); + props); c.add(createServiceDependency() .setService(IController.class, "(name=Controller)") @@ -253,13 +291,19 @@ public class Activator extends ComponentActivatorAbstractBase { "unsetsetFlowProgrammerNotifier") .setRequired(false)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } if (imp.equals(ReadServiceFilter.class)) { - c.setInterface( - new String[] { IPluginReadServiceFilter.class.getName(), - IContainerListener.class.getName() }, null); + c.setInterface(new String[] { + IReadServiceFilter.class.getName(), + IContainerListener.class.getName(), + IOFStatisticsListener.class.getName() }, null); c.add(createServiceDependency() .setService(IController.class, "(name=Controller)") @@ -269,6 +313,11 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IOFStatisticsManager.class) .setCallbacks("setService", "unsetService") .setRequired(true)); + c.add(createServiceDependency() + .setService(IReadFilterInternalListener.class) + .setCallbacks("setReadFilterInternalListener", + "unsetReadFilterInternalListener") + .setRequired(false)); } if (imp.equals(OFStatisticsManager.class)) { @@ -281,7 +330,7 @@ public class Activator extends ComponentActivatorAbstractBase { .setCallbacks("setController", "unsetController") .setRequired(true)); c.add(createServiceDependency() - .setService(IStatisticsListener.class) + .setService(IOFStatisticsListener.class) .setCallbacks("setStatisticsListener", "unsetStatisticsListener").setRequired(false)); } @@ -310,6 +359,11 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IDiscoveryListener.class) .setCallbacks("setDiscoveryListener", "unsetDiscoveryListener").setRequired(true)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } // DataPacket mux/demux services, which is teh actual engine @@ -333,26 +387,64 @@ public class Activator extends ComponentActivatorAbstractBase { .setService(IDataPacketListen.class) .setCallbacks("setIDataPacketListen", "unsetIDataPacketListen").setRequired(false)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); + } + + if (imp.equals(InventoryService.class)) { + // export the service + Dictionary props = new Hashtable(); + props.put("scope", "Global"); + + c.setInterface( + new String[] { IPluginInInventoryService.class.getName(), + IInventoryShimInternalListener.class.getName(), + IInventoryProvider.class.getName() }, props); + + // Now lets add a service dependency to make sure the + // provider of service exists + c.add(createServiceDependency() + .setService(IController.class, "(name=Controller)") + .setCallbacks("setController", "unsetController") + .setRequired(true)); + c.add(createServiceDependency() + .setService(IPluginOutInventoryService.class, "(scope=Global)") + .setCallbacks("setPluginOutInventoryServices", + "unsetPluginOutInventoryServices") + .setRequired(true)); } if (imp.equals(InventoryServiceShim.class)) { c.setInterface(new String[] { IContainerListener.class.getName(), - IStatisticsListener.class.getName()}, null); + IOFStatisticsListener.class.getName()}, null); c.add(createServiceDependency() .setService(IController.class, "(name=Controller)") .setCallbacks("setController", "unsetController") .setRequired(true)); c.add(createServiceDependency() - .setService(IInventoryShimInternalListener.class) + .setService(IInventoryShimInternalListener.class, "(!(scope=Global))") .setCallbacks("setInventoryShimInternalListener", "unsetInventoryShimInternalListener") .setRequired(true)); + c.add(createServiceDependency() + .setService(IInventoryShimInternalListener.class, "(scope=Global)") + .setCallbacks("setInventoryShimGlobalInternalListener", + "unsetInventoryShimGlobalInternalListener") + .setRequired(true)); c.add(createServiceDependency() .setService(IInventoryShimExternalListener.class) .setCallbacks("setInventoryShimExternalListener", "unsetInventoryShimExternalListener") .setRequired(false)); + c.add(createServiceDependency() + .setService(IPluginOutConnectionService.class) + .setCallbacks("setIPluginOutConnectionService", + "unsetIPluginOutConnectionService") + .setRequired(true)); } if (imp.equals(TopologyServiceShim.class)) {