Extract mastership blueprint service
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / OpenFlowPluginProviderFactoryImpl.java
index bc770118636e9759ac67ec2a909aef052e702b41..309ef486f82d051b773ff65cc28e3bdaa1a8f3eb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016, 2017 Brocade Communications Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -10,14 +10,14 @@ package org.opendaylight.openflowplugin.impl;
 import java.util.List;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 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.openflow.OpenFlowPluginProviderFactory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig;
+import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
+import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -30,67 +30,26 @@ public class OpenFlowPluginProviderFactoryImpl implements OpenFlowPluginProvider
     private static final Logger LOG = LoggerFactory.getLogger(OpenFlowPluginProviderFactoryImpl.class);
 
     @Override
-    public OpenFlowPluginProvider newInstance(OpenflowProviderConfig providerConfig,
-                                              DataBroker dataBroker,
-                                              RpcProviderRegistry rpcRegistry,
-                                              NotificationService notificationService,
-                                              NotificationPublishService notificationPublishService,
-                                              EntityOwnershipService entityOwnershipService,
-                                              List<SwitchConnectionProvider> switchConnectionProviders,
-                                              ClusterSingletonServiceProvider singletonServiceProvider) {
-
+    public OpenFlowPluginProvider newInstance(final ConfigurationService configurationService,
+                                              final DataBroker dataBroker,
+                                              final RpcProviderRegistry rpcRegistry,
+                                              final NotificationPublishService notificationPublishService,
+                                              final EntityOwnershipService entityOwnershipService,
+                                              final List<SwitchConnectionProvider> switchConnectionProviders,
+                                              final ClusterSingletonServiceProvider singletonServiceProvider,
+                                              final MastershipChangeServiceManager mastershipChangeServiceManager) {
         LOG.info("Initializing new OFP southbound.");
-
-        OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(
-                providerConfig.getRpcRequestsQuota(),
-                providerConfig.getGlobalNotificationQuota(),
-                providerConfig.getThreadPoolMinThreads(),
-                providerConfig.getThreadPoolMaxThreads().getValue(),
-                providerConfig.getThreadPoolTimeout());
-
-        openflowPluginProvider.setSwitchConnectionProviders(switchConnectionProviders);
-        openflowPluginProvider.setDataBroker(dataBroker);
-        openflowPluginProvider.setRpcProviderRegistry(rpcRegistry);
-        openflowPluginProvider.setNotificationProviderService(notificationService);
-        openflowPluginProvider.setNotificationPublishService(notificationPublishService);
-        openflowPluginProvider.setSwitchFeaturesMandatory(providerConfig.isSwitchFeaturesMandatory());
-        openflowPluginProvider.setFlowRemovedNotification(providerConfig.isEnableFlowRemovedNotification());
-        openflowPluginProvider.setIsStatisticsRpcEnabled(providerConfig.isIsStatisticsRpcEnabled());
-        openflowPluginProvider.setBarrierCountLimit(providerConfig.getBarrierCountLimit().getValue());
-        openflowPluginProvider.setBarrierInterval(providerConfig.getBarrierIntervalTimeoutLimit().getValue());
-        openflowPluginProvider.setEchoReplyTimeout(providerConfig.getEchoReplyTimeout().getValue());
-        openflowPluginProvider.setStatisticsPollingOn(providerConfig.isIsStatisticsPollingOn());
-        openflowPluginProvider.setClusteringSingletonServicesProvider(singletonServiceProvider);
-        openflowPluginProvider.setSkipTableFeatures(providerConfig.isSkipTableFeatures());
-        openflowPluginProvider.setBasicTimerDelay(providerConfig.getBasicTimerDelay().getValue());
-        openflowPluginProvider.setMaximumTimerDelay(providerConfig.getMaximumTimerDelay().getValue());
+        final OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(
+                configurationService,
+                switchConnectionProviders,
+                dataBroker,
+                rpcRegistry,
+                notificationPublishService,
+                singletonServiceProvider,
+                entityOwnershipService,
+                mastershipChangeServiceManager);
 
         openflowPluginProvider.initialize();
-
-        LOG.info("Configured values, " +
-                "StatisticsPollingOn:{}, " +
-                "SwitchFeaturesMandatory:{}, " +
-                "BarrierCountLimit:{}, " +
-                "BarrierTimeoutLimit:{}, " +
-                "EchoReplyTimeout:{}, " +
-                "ThreadPoolMinThreads:{}, " +
-                "ThreadPoolMaxThreads:{}, " +
-                "ThreadPoolTimeout:{}, " +
-                "NotificationFlowRemovedOff:{}, " +
-                "BasicTimerDelay:{}, "+
-                "MaximumTimerDelay:{} ",
-                providerConfig.isIsStatisticsPollingOn(),
-                providerConfig.isSwitchFeaturesMandatory(),
-                providerConfig.getBarrierCountLimit().getValue(),
-                providerConfig.getBarrierIntervalTimeoutLimit().getValue(),
-                providerConfig.getEchoReplyTimeout().getValue(),
-                providerConfig.getThreadPoolMinThreads(),
-                providerConfig.getThreadPoolMaxThreads().getValue(),
-                providerConfig.getThreadPoolTimeout(),
-                providerConfig.isEnableFlowRemovedNotification(),
-                providerConfig.getBasicTimerDelay().getValue(),
-                providerConfig.getMaximumTimerDelay().getValue());
-
         return openflowPluginProvider;
     }
 }