2 * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowplugin.impl;
10 import java.util.List;
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
13 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
14 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
15 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
16 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
17 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
18 import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
19 import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
25 * Implementation of OpenFlowPluginProviderFactory.
27 * @author Thomas Pantelis
29 public class OpenFlowPluginProviderFactoryImpl implements OpenFlowPluginProviderFactory {
30 private static final Logger LOG = LoggerFactory.getLogger(OpenFlowPluginProviderFactoryImpl.class);
33 public OpenFlowPluginProvider newInstance(OpenflowProviderConfig providerConfig,
34 DataBroker dataBroker,
35 RpcProviderRegistry rpcRegistry,
36 NotificationService notificationService,
37 NotificationPublishService notificationPublishService,
38 EntityOwnershipService entityOwnershipService,
39 List<SwitchConnectionProvider> switchConnectionProviders,
40 ClusterSingletonServiceProvider singletonServiceProvider) {
42 LOG.info("Initializing new OFP southbound.");
44 OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(
45 providerConfig.getRpcRequestsQuota(),
46 providerConfig.getGlobalNotificationQuota(),
47 providerConfig.getThreadPoolMinThreads(),
48 providerConfig.getThreadPoolMaxThreads().getValue(),
49 providerConfig.getThreadPoolTimeout());
52 openflowPluginProvider.setSwitchConnectionProviders(switchConnectionProviders);
53 openflowPluginProvider.setDataBroker(dataBroker);
54 openflowPluginProvider.setRpcProviderRegistry(rpcRegistry);
55 openflowPluginProvider.setNotificationProviderService(notificationService);
56 openflowPluginProvider.setNotificationPublishService(notificationPublishService);
57 openflowPluginProvider.setEntityOwnershipServiceProvider(entityOwnershipService);
58 openflowPluginProvider.setClusteringSingletonServicesProvider(singletonServiceProvider);
60 //Set config parameters
61 openflowPluginProvider.setSwitchFeaturesMandatory(providerConfig.isSwitchFeaturesMandatory());
62 openflowPluginProvider.setFlowRemovedNotification(providerConfig.isEnableFlowRemovedNotification());
63 openflowPluginProvider.setIsStatisticsRpcEnabled(providerConfig.isIsStatisticsRpcEnabled());
64 openflowPluginProvider.setBarrierCountLimit(providerConfig.getBarrierCountLimit().getValue());
65 openflowPluginProvider.setBarrierInterval(providerConfig.getBarrierIntervalTimeoutLimit().getValue());
66 openflowPluginProvider.setEchoReplyTimeout(providerConfig.getEchoReplyTimeout().getValue());
67 openflowPluginProvider.setStatisticsPollingOn(providerConfig.isIsStatisticsPollingOn());
68 openflowPluginProvider.setSkipTableFeatures(providerConfig.isSkipTableFeatures());
69 openflowPluginProvider.setBasicTimerDelay(providerConfig.getBasicTimerDelay().getValue());
70 openflowPluginProvider.setMaximumTimerDelay(providerConfig.getMaximumTimerDelay().getValue());
72 openflowPluginProvider.initialize();
74 LOG.info("Configured values, " +
75 "StatisticsPollingOn:{}, " +
76 "SwitchFeaturesMandatory:{}, " +
77 "BarrierCountLimit:{}, " +
78 "BarrierTimeoutLimit:{}, " +
79 "EchoReplyTimeout:{}, " +
80 "ThreadPoolMinThreads:{}, " +
81 "ThreadPoolMaxThreads:{}, " +
82 "ThreadPoolTimeout:{}, " +
83 "NotificationFlowRemovedOff:{}, " +
84 "BasicTimerDelay:{}, "+
85 "MaximumTimerDelay:{} ",
86 providerConfig.isIsStatisticsPollingOn(),
87 providerConfig.isSwitchFeaturesMandatory(),
88 providerConfig.getBarrierCountLimit().getValue(),
89 providerConfig.getBarrierIntervalTimeoutLimit().getValue(),
90 providerConfig.getEchoReplyTimeout().getValue(),
91 providerConfig.getThreadPoolMinThreads(),
92 providerConfig.getThreadPoolMaxThreads().getValue(),
93 providerConfig.getThreadPoolTimeout(),
94 providerConfig.isEnableFlowRemovedNotification(),
95 providerConfig.getBasicTimerDelay().getValue(),
96 providerConfig.getMaximumTimerDelay().getValue());
98 return openflowPluginProvider;