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.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
17 import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
18 import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory;
19 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
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, DataBroker dataBroker,
34 RpcProviderRegistry rpcRegistry, NotificationService notificationService,
35 NotificationPublishService notificationPublishService,
36 EntityOwnershipService entityOwnershipService,
37 List<SwitchConnectionProvider> switchConnectionProviders) {
39 LOG.info("Initializing new OFP southbound.");
41 OpenflowPortsUtil.init();
42 OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(
43 providerConfig.getRpcRequestsQuota(),
44 providerConfig.getGlobalNotificationQuota(),
45 providerConfig.getThreadPoolMinThreads(),
46 providerConfig.getThreadPoolMaxThreads().getValue(),
47 providerConfig.getThreadPoolTimeout());
49 openflowPluginProvider.setSwitchConnectionProviders(switchConnectionProviders);
50 openflowPluginProvider.setDataBroker(dataBroker);
51 openflowPluginProvider.setRpcProviderRegistry(rpcRegistry);
52 openflowPluginProvider.setNotificationProviderService(notificationService);
53 openflowPluginProvider.setNotificationPublishService(notificationPublishService);
54 openflowPluginProvider.setEntityOwnershipService(entityOwnershipService);
55 openflowPluginProvider.setSwitchFeaturesMandatory(providerConfig.isSwitchFeaturesMandatory());
56 openflowPluginProvider.setIsStatisticsPollingOff(providerConfig.isIsStatisticsPollingOff());
57 openflowPluginProvider.setIsStatisticsRpcEnabled(providerConfig.isIsStatisticsRpcEnabled());
58 openflowPluginProvider.setBarrierCountLimit(providerConfig.getBarrierCountLimit().getValue());
59 openflowPluginProvider.setBarrierInterval(providerConfig.getBarrierIntervalTimeoutLimit().getValue());
60 openflowPluginProvider.setEchoReplyTimeout(providerConfig.getEchoReplyTimeout().getValue());
62 openflowPluginProvider.initialize();
64 LOG.info("Configured values, " +
65 "StatisticsPollingOff:{}, " +
66 "SwitchFeaturesMandatory:{}, " +
67 "BarrierCountLimit:{}, " +
68 "BarrierTimeoutLimit:{}, " +
69 "EchoReplyTimeout:{}, " +
70 "ThreadPoolMinThreads:{}, " +
71 "ThreadPoolMaxThreads:{}, " +
72 "ThreadPoolTimeout:{}",
73 providerConfig.isIsStatisticsPollingOff(),
74 providerConfig.isSwitchFeaturesMandatory(),
75 providerConfig.getBarrierCountLimit().getValue(),
76 providerConfig.getBarrierIntervalTimeoutLimit().getValue(),
77 providerConfig.getEchoReplyTimeout().getValue(),
78 providerConfig.getThreadPoolMinThreads(),
79 providerConfig.getThreadPoolMaxThreads().getValue(),
80 providerConfig.getThreadPoolTimeout());
82 return openflowPluginProvider;