X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2FOpenFlowPluginProviderImpl.java;h=6890f037821ce374f1fce07547f2fc2e8c6336d1;hb=refs%2Fchanges%2F71%2F103171%2F4;hp=8a61ca1a5c954871e3fa388568ff56e0fbe2281d;hpb=42c4c675cc28b799da86426c665f517030159ed6;p=openflowplugin.git diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImpl.java index 8a61ca1a5c..6890f03782 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImpl.java @@ -11,7 +11,6 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; import io.netty.util.HashedWheelTimer; @@ -19,6 +18,7 @@ import io.netty.util.Timer; import java.lang.management.ManagementFactory; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -37,8 +37,6 @@ import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; -import org.apache.aries.blueprint.annotation.service.Reference; -import org.apache.aries.blueprint.annotation.service.Service; import org.opendaylight.infrautils.diagstatus.ServiceState; import org.opendaylight.infrautils.ready.SystemReadyListener; import org.opendaylight.infrautils.ready.SystemReadyMonitor; @@ -47,9 +45,10 @@ import org.opendaylight.mdsal.binding.api.NotificationPublishService; import org.opendaylight.mdsal.binding.api.RpcProviderService; import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService; import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; -import org.opendaylight.openflowjava.protocol.api.connection.OpenflowDiagStatusProvider; import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider; import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderList; +import org.opendaylight.openflowplugin.api.openflow.FlowGroupInfoHistories; +import org.opendaylight.openflowplugin.api.openflow.FlowGroupInfoHistory; import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider; import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService; import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionManager; @@ -82,15 +81,16 @@ import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionConve import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager; import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory; import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Singleton -@Service(classes = { OpenFlowPluginProvider.class, OpenFlowPluginExtensionRegistratorProvider.class }) public class OpenFlowPluginProviderImpl implements OpenFlowPluginProvider, OpenFlowPluginExtensionRegistratorProvider, + FlowGroupInfoHistories, SystemReadyListener { private static final Logger LOG = LoggerFactory.getLogger(OpenFlowPluginProviderImpl.class); @@ -123,9 +123,9 @@ public class OpenFlowPluginProviderImpl implements private StatisticsManager statisticsManager; private RoleManager roleManager; private ConnectionManager connectionManager; - private ListeningExecutorService executorService; + private ExecutorService executorService; private ContextChainHolderImpl contextChainHolder; - private final OpenflowDiagStatusProvider openflowDiagStatusProvider; + private final DiagStatusProvider diagStatusProvider; private final SystemReadyMonitor systemReadyMonitor; private final SettableFuture fullyStarted = SettableFuture.create(); private static final String OPENFLOW_SERVICE_NAME = "OPENFLOW"; @@ -138,25 +138,25 @@ public class OpenFlowPluginProviderImpl implements public OpenFlowPluginProviderImpl(final ConfigurationService configurationService, final SwitchConnectionProviderList switchConnectionProviders, final PingPongDataBroker pingPongDataBroker, - final @Reference RpcProviderService rpcProviderRegistry, - final @Reference NotificationPublishService notificationPublishService, - final @Reference ClusterSingletonServiceProvider singletonServiceProvider, - final @Reference EntityOwnershipService entityOwnershipService, + final RpcProviderService rpcProviderRegistry, + final NotificationPublishService notificationPublishService, + final ClusterSingletonServiceProvider singletonServiceProvider, + final EntityOwnershipService entityOwnershipService, final MastershipChangeServiceManager mastershipChangeServiceManager, - final @Reference OpenflowDiagStatusProvider openflowDiagStatusProvider, - final @Reference SystemReadyMonitor systemReadyMonitor) { + final DiagStatusProvider diagStatusProvider, + final SystemReadyMonitor systemReadyMonitor) { this.switchConnectionProviders = switchConnectionProviders; - this.dataBroker = pingPongDataBroker; + dataBroker = pingPongDataBroker; this.rpcProviderRegistry = rpcProviderRegistry; this.notificationPublishService = notificationPublishService; - this.singletonServicesProvider = singletonServiceProvider; + singletonServicesProvider = singletonServiceProvider; this.entityOwnershipService = entityOwnershipService; convertorManager = ConvertorManagerFactory.createDefaultManager(); extensionConverterManager = new ExtensionConverterManagerImpl(); deviceInitializerProvider = DeviceInitializerProviderFactory.createDefaultProvider(); config = new OpenFlowProviderConfigImpl(configurationService); this.mastershipChangeServiceManager = mastershipChangeServiceManager; - this.openflowDiagStatusProvider = openflowDiagStatusProvider; + this.diagStatusProvider = diagStatusProvider; this.systemReadyMonitor = systemReadyMonitor; } @@ -165,7 +165,7 @@ public class OpenFlowPluginProviderImpl implements LOG.info("onSystemBootReady() received, starting the switch connections"); Futures.addCallback(Futures.allAsList(switchConnectionProviders.stream().map(switchConnectionProvider -> { // Inject OpenFlowPlugin custom serializers and deserializers into OpenFlowJava - if (config.isUseSingleLayerSerialization()) { + if (config.getUseSingleLayerSerialization()) { SerializerInjector.injectSerializers(switchConnectionProvider, switchConnectionProvider.getConfiguration().isGroupAddModEnabled()); DeserializerInjector.injectDeserializers(switchConnectionProvider); @@ -180,14 +180,14 @@ public class OpenFlowPluginProviderImpl implements @Override public void onSuccess(final List result) { LOG.info("All switchConnectionProviders are up and running ({}).", result.size()); - openflowDiagStatusProvider.reportStatus(OPENFLOW_SERVICE_NAME, ServiceState.OPERATIONAL); + diagStatusProvider.reportStatus(ServiceState.OPERATIONAL); fullyStarted.set(null); } @Override public void onFailure(final Throwable throwable) { LOG.warn("Some switchConnectionProviders failed to start.", throwable); - openflowDiagStatusProvider.reportStatus(OPENFLOW_SERVICE_NAME, throwable); + diagStatusProvider.reportStatus(ServiceState.ERROR, throwable); fullyStarted.setException(throwable); } }, MoreExecutors.directExecutor()); @@ -202,7 +202,7 @@ public class OpenFlowPluginProviderImpl implements final ListenableFuture> listListenableFuture = Futures.allAsList(switchConnectionProviders.stream().map(switchConnectionProvider -> { // Revert deserializers to their original state - if (config.isUseSingleLayerSerialization()) { + if (config.getUseSingleLayerSerialization()) { DeserializerInjector.revertDeserializers(switchConnectionProvider); } @@ -237,11 +237,11 @@ public class OpenFlowPluginProviderImpl implements // Creates a thread pool that creates new threads as needed, but will reuse previously // constructed threads when they are available. // Threads that have not been used for x seconds are terminated and removed from the cache. - executorService = MoreExecutors.listeningDecorator(new ThreadPoolLoggingExecutor( + executorService = new ThreadPoolLoggingExecutor( config.getThreadPoolMinThreads().toJava(), config.getThreadPoolMaxThreads().getValue().toJava(), config.getThreadPoolTimeout().toJava(), - TimeUnit.SECONDS, new SynchronousQueue<>(), POOL_NAME)); + TimeUnit.SECONDS, new SynchronousQueue<>(), POOL_NAME); deviceManager = new DeviceManagerImpl( config, @@ -290,7 +290,7 @@ public class OpenFlowPluginProviderImpl implements deviceManager.setContextChainHolder(contextChainHolder); deviceManager.initialize(); systemReadyMonitor.registerListener(this); - LOG.info("registered onSystemBootReady() listener for deferred startSwitchConnections()"); + LOG.info("registered onSystemBootReady() listener for OpenFlowPluginProvider"); } @Override @@ -298,6 +298,16 @@ public class OpenFlowPluginProviderImpl implements return extensionConverterManager; } + @Override + public Map getAllFlowGroupHistories() { + return deviceManager.getAllFlowGroupHistories(); + } + + @Override + public FlowGroupInfoHistory getFlowGroupHistory(final NodeId nodeId) { + return deviceManager.getFlowGroupHistory(nodeId); + } + @Override @PreDestroy @SuppressWarnings("checkstyle:IllegalCatch") @@ -317,7 +327,7 @@ public class OpenFlowPluginProviderImpl implements gracefulShutdown(executorService); gracefulShutdown(hashedWheelTimer); unregisterMXBean(MESSAGE_INTELLIGENCE_AGENCY_MX_BEAN_NAME); - openflowDiagStatusProvider.reportStatus(ServiceState.UNREGISTERED); + diagStatusProvider.reportStatus(ServiceState.UNREGISTERED); try { if (connectionManager != null) { connectionManager.close();