* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.openflowplugin.impl.diagstatus;
+package org.opendaylight.openflowplugin.api.diagstatus;
import org.opendaylight.infrautils.diagstatus.DiagStatusService;
import org.opendaylight.infrautils.diagstatus.ServiceDescriptor;
import org.opendaylight.infrautils.diagstatus.ServiceState;
import org.opendaylight.infrautils.diagstatus.ServiceStatusProvider;
-import org.ops4j.pax.cdi.api.OsgiServiceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@OsgiServiceProvider(classes = ServiceStatusProvider.class)
public class OpenflowPluginDiagStatusProvider implements ServiceStatusProvider {
private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginDiagStatusProvider.class);
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.infrautils.diagstatus.DiagStatusService;
+import org.opendaylight.infrautils.ready.SystemReadyMonitor;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.openflowplugin.api.diagstatus.OpenflowPluginDiagStatusProvider;
import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
List<SwitchConnectionProvider> switchConnectionProviders,
ClusterSingletonServiceProvider singletonServiceProvider,
MastershipChangeServiceManager mastershipChangeServiceManager,
- DiagStatusService diagStatusService);
+ OpenflowPluginDiagStatusProvider ofPluginDiagstatusProvider,
+ SystemReadyMonitor systemReadyMonitor);
}
<reference id="entityOwnershipService" interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService"/>
<reference id="clusterSingletonServiceProvider" interface="org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider"/>
<reference id="diagStatusService" interface="org.opendaylight.infrautils.diagstatus.DiagStatusService" />
+ <reference id="systemReadyMonitor" interface="org.opendaylight.infrautils.ready.SystemReadyMonitor" />
<reference id="defaultSwitchConnProvider" interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
odl:type="openflow-switch-connection-provider-default-impl"/>
update-method="update"/>
</bean>
+ <bean id="ofPluginDiagstatusProvider"
+ class="org.opendaylight.openflowplugin.api.diagstatus.OpenflowPluginDiagStatusProvider">
+ <argument ref="diagStatusService"/>
+ </bean>
+
+ <service ref="ofPluginDiagstatusProvider" interface="org.opendaylight.infrautils.diagstatus.ServiceStatusProvider"/>
+
<service ref="configurationService" interface="org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService"/>
<bean id="openflowPluginProvider"
</argument>
<argument ref="clusterSingletonServiceProvider"/>
<argument ref="mastershipChangeServiceManager"/>
- <argument ref="diagStatusService"/>
+ <argument ref="ofPluginDiagstatusProvider"/>
+ <argument ref="systemReadyMonitor"/>
</bean>
<service ref="openflowPluginProvider" odl:type="openflow-plugin-provider-impl">
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.infrautils.diagstatus.DiagStatusService;
+import org.opendaylight.infrautils.ready.SystemReadyMonitor;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.openflowplugin.api.diagstatus.OpenflowPluginDiagStatusProvider;
import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory;
import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
final List<SwitchConnectionProvider> switchConnectionProviders,
final ClusterSingletonServiceProvider singletonServiceProvider,
final MastershipChangeServiceManager mastershipChangeServiceManager,
- final DiagStatusService diagStatusService) {
+ final OpenflowPluginDiagStatusProvider ofPluginDiagstatusProvider,
+ final SystemReadyMonitor systemReadyMonitor) {
LOG.info("Initializing new OFP southbound.");
final OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(
configurationService,
singletonServiceProvider,
entityOwnershipService,
mastershipChangeServiceManager,
- diagStatusService);
+ ofPluginDiagstatusProvider,
+ systemReadyMonitor);
openflowPluginProvider.initialize();
return openflowPluginProvider;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.infrautils.diagstatus.DiagStatusService;
import org.opendaylight.infrautils.diagstatus.ServiceState;
+import org.opendaylight.infrautils.ready.SystemReadyListener;
+import org.opendaylight.infrautils.ready.SystemReadyMonitor;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.openflowplugin.api.diagstatus.OpenflowPluginDiagStatusProvider;
import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionManager;
import org.opendaylight.openflowplugin.impl.device.DeviceManagerImpl;
import org.opendaylight.openflowplugin.impl.device.initialization.DeviceInitializerProvider;
import org.opendaylight.openflowplugin.impl.device.initialization.DeviceInitializerProviderFactory;
-import org.opendaylight.openflowplugin.impl.diagstatus.OpenflowPluginDiagStatusProvider;
import org.opendaylight.openflowplugin.impl.lifecycle.ContextChainHolderImpl;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.DeserializerInjector;
import org.opendaylight.openflowplugin.impl.protocol.serialization.SerializerInjector;
public class OpenFlowPluginProviderImpl implements
OpenFlowPluginProvider,
- OpenFlowPluginExtensionRegistratorProvider {
+ OpenFlowPluginExtensionRegistratorProvider,
+ SystemReadyListener {
private static final Logger LOG = LoggerFactory.getLogger(OpenFlowPluginProviderImpl.class);
final ClusterSingletonServiceProvider singletonServiceProvider,
final EntityOwnershipService entityOwnershipService,
final MastershipChangeServiceManager mastershipChangeServiceManager,
- final DiagStatusService diagStatusService) {
+ final OpenflowPluginDiagStatusProvider openflowPluginStatusMonitor,
+ final SystemReadyMonitor systemReadyMonitor) {
this.switchConnectionProviders = switchConnectionProviders;
this.dataBroker = dataBroker;
this.rpcProviderRegistry = rpcProviderRegistry;
deviceInitializerProvider = DeviceInitializerProviderFactory.createDefaultProvider();
config = new OpenFlowProviderConfigImpl(configurationService);
this.mastershipChangeServiceManager = mastershipChangeServiceManager;
- openflowPluginStatusMonitor = new OpenflowPluginDiagStatusProvider(diagStatusService);
+ this.openflowPluginStatusMonitor = openflowPluginStatusMonitor;
+ systemReadyMonitor.registerListener(this);
+ LOG.debug("registered onSystemBootReady() listener for deferred startSwitchConnections()");
}
+ @Override
+ public void onSystemBootReady() {
+ LOG.debug("onSystemBootReady() received, starting the switch connections");
+ startSwitchConnections();
+ }
private void startSwitchConnections() {
Futures.addCallback(Futures.allAsList(switchConnectionProviders.stream().map(switchConnectionProvider -> {
connectionManager.setDeviceDisconnectedHandler(contextChainHolder);
deviceManager.initialize();
- startSwitchConnections();
}
@Override
import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.infrautils.diagstatus.DiagStatusService;
+import org.opendaylight.infrautils.ready.SystemReadyMonitor;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
-import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
+import org.opendaylight.openflowplugin.api.diagstatus.OpenflowPluginDiagStatusProvider;
import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationProperty;
import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
NotificationPublishService notificationPublishService;
@Mock
- DiagStatusService diagStatusService;
+ OpenflowPluginDiagStatusProvider ofPluginDiagstatusProvider;
+
+ @Mock
+ SystemReadyMonitor systemReadyMonitor;
@Mock
WriteTransaction writeTransaction;
@Test
public void testInitializeAndClose() throws Exception {
- final OpenFlowPluginProvider provider = new OpenFlowPluginProviderFactoryImpl().newInstance(
+ final OpenFlowPluginProviderImpl provider = new OpenFlowPluginProviderImpl(
configurationService,
+ Lists.newArrayList(switchConnectionProvider),
dataBroker,
rpcProviderRegistry,
notificationPublishService,
- entityOwnershipService,
- Lists.newArrayList(switchConnectionProvider),
clusterSingletonServiceProvider,
+ entityOwnershipService,
mastershipChangeServiceManager,
- diagStatusService);
+ ofPluginDiagstatusProvider,
+ systemReadyMonitor);
+ provider.initialize();
+ // Calling the onSystemBootReady() callback
+ provider.onSystemBootReady();
verify(switchConnectionProvider).startup();
provider.close();
verify(switchConnectionProvider).shutdown();