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.openflowplugin.openflow.md.util.OpenflowPortsUtil;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
26 * Implementation of OpenFlowPluginProviderFactory.
28 * @author Thomas Pantelis
30 public class OpenFlowPluginProviderFactoryImpl implements OpenFlowPluginProviderFactory {
31 private static final Logger LOG = LoggerFactory.getLogger(OpenFlowPluginProviderFactoryImpl.class);
34 public OpenFlowPluginProvider newInstance(OpenflowProviderConfig providerConfig,
35 DataBroker dataBroker,
36 RpcProviderRegistry rpcRegistry,
37 NotificationService notificationService,
38 NotificationPublishService notificationPublishService,
39 EntityOwnershipService entityOwnershipService,
40 List<SwitchConnectionProvider> switchConnectionProviders,
41 ClusterSingletonServiceProvider singletonServiceProvider) {
43 LOG.info("Initializing new OFP southbound.");
45 OpenflowPortsUtil.init();
46 OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(
47 providerConfig.getRpcRequestsQuota(),
48 providerConfig.getGlobalNotificationQuota(),
49 providerConfig.getThreadPoolMinThreads(),
50 providerConfig.getThreadPoolMaxThreads().getValue(),
51 providerConfig.getThreadPoolTimeout());
53 openflowPluginProvider.setSwitchConnectionProviders(switchConnectionProviders);
54 openflowPluginProvider.setDataBroker(dataBroker);
55 openflowPluginProvider.setRpcProviderRegistry(rpcRegistry);
56 openflowPluginProvider.setNotificationProviderService(notificationService);
57 openflowPluginProvider.setNotificationPublishService(notificationPublishService);
58 openflowPluginProvider.setSwitchFeaturesMandatory(providerConfig.isSwitchFeaturesMandatory());
59 openflowPluginProvider.setIsStatisticsPollingOn(providerConfig.isIsStatisticsPollingOn());
60 openflowPluginProvider.setIsStatisticsRpcEnabled(providerConfig.isIsStatisticsRpcEnabled());
61 openflowPluginProvider.setBarrierCountLimit(providerConfig.getBarrierCountLimit().getValue());
62 openflowPluginProvider.setBarrierInterval(providerConfig.getBarrierIntervalTimeoutLimit().getValue());
63 openflowPluginProvider.setEchoReplyTimeout(providerConfig.getEchoReplyTimeout().getValue());
64 openflowPluginProvider.setNotificationFlowRemovedOff(providerConfig.isNotificationFlowRemovedOff());
65 openflowPluginProvider.setClusteringSingletonServicesProvider(singletonServiceProvider);
66 openflowPluginProvider.setSkipTableFeatures(providerConfig.isSkipTableFeatures());
68 openflowPluginProvider.initialize();
70 LOG.info("Configured values, " +
71 "StatisticsPollingOn:{}, " +
72 "SwitchFeaturesMandatory:{}, " +
73 "BarrierCountLimit:{}, " +
74 "BarrierTimeoutLimit:{}, " +
75 "EchoReplyTimeout:{}, " +
76 "ThreadPoolMinThreads:{}, " +
77 "ThreadPoolMaxThreads:{}, " +
78 "ThreadPoolTimeout:{}, " +
79 "NotificationFlowRemovedOff:{}",
80 providerConfig.isIsStatisticsPollingOn(),
81 providerConfig.isSwitchFeaturesMandatory(),
82 providerConfig.getBarrierCountLimit().getValue(),
83 providerConfig.getBarrierIntervalTimeoutLimit().getValue(),
84 providerConfig.getEchoReplyTimeout().getValue(),
85 providerConfig.getThreadPoolMinThreads(),
86 providerConfig.getThreadPoolMaxThreads().getValue(),
87 providerConfig.getThreadPoolTimeout(),
88 providerConfig.isNotificationFlowRemovedOff());
90 return openflowPluginProvider;