2 * Copyright (C) 2013 Red Hat, Inc.
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 * Authors : Madhu Venugopal, Brent Salisbury, Dave Tucker
11 package org.opendaylight.ovsdb.openstack.netvirt.providers;
13 import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
15 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
16 import org.opendaylight.controller.switchmanager.ISwitchManager;
17 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
18 import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
19 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
20 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
21 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
22 import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
23 import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
25 import org.apache.felix.dm.Component;
27 import java.util.Properties;
30 * OSGi Bundle Activator for the Neutron providers
32 public class Activator extends ComponentActivatorAbstractBase {
34 * Function called when the activator starts just after some
35 * initializations are done by the
36 * ComponentActivatorAbstractBase.
43 * Function called when the activator stops just before the
44 * cleanup done by ComponentActivatorAbstractBase.
48 public void destroy() {
52 * Function that is used to communicate to dependency manager the
53 * list of known implementations for services inside a container.
55 * @return An array containing all the CLASS objects that will be
56 * instantiated in order to get an fully working implementation
60 public Object[] getImplementations() {
61 Object[] res = {MdsalConsumerImpl.class,
68 * Function that is called when configuration of the dependencies
71 * @param c dependency manager Component object, used for
72 * configuring the dependencies exported and imported
73 * @param imp Implementation class that is being configured,
74 * needed as long as the same routine can configure multiple
76 * @param containerName The containerName being configured, this allow
77 * also optional per-container different behavior if needed, usually
78 * should not be the case though.
81 public void configureInstance(Component c, Object imp,
82 String containerName) {
84 if (imp.equals(MdsalConsumerImpl.class)) {
85 c.setInterface(MdsalConsumer.class.getName(), null);
86 c.add(createServiceDependency().setService(BindingAwareBroker.class).setRequired(true));
89 if (imp.equals(OF10Provider.class)) {
90 Properties of10Properties = new Properties();
91 of10Properties.put(Constants.SOUTHBOUND_PROTOCOL_PROPERTY, "ovsdb");
92 of10Properties.put(Constants.OPENFLOW_VERSION_PROPERTY, Constants.OPENFLOW10);
94 c.setInterface(NetworkingProvider.class.getName(), of10Properties);
95 c.add(createServiceDependency()
96 .setService(ConfigurationService.class)
98 c.add(createServiceDependency()
99 .setService(BridgeConfigurationManager.class)
101 c.add(createServiceDependency()
102 .setService(TenantNetworkManager.class)
104 c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
105 c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
106 c.add(createServiceDependency().
107 setService(IForwardingRulesManager.class).
109 c.add(createServiceDependency().
110 setService(ISwitchManager.class).
114 if (imp.equals(OF13Provider.class)) {
115 Properties of13Properties = new Properties();
116 of13Properties.put(Constants.SOUTHBOUND_PROTOCOL_PROPERTY, "ovsdb");
117 of13Properties.put(Constants.OPENFLOW_VERSION_PROPERTY, Constants.OPENFLOW13);
119 c.setInterface(NetworkingProvider.class.getName(), of13Properties);
120 c.add(createServiceDependency()
121 .setService(ConfigurationService.class)
123 c.add(createServiceDependency()
124 .setService(BridgeConfigurationManager.class)
126 c.add(createServiceDependency()
127 .setService(TenantNetworkManager.class)
129 c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
130 c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
131 c.add(createServiceDependency().setService(MdsalConsumer.class).setRequired(true));