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 java.util.Properties;
15 import org.apache.felix.dm.Component;
16 import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
17 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
18 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
19 import org.opendaylight.controller.switchmanager.ISwitchManager;
20 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
21 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
22 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
23 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
24 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow10.OF10Provider;
25 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
26 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.MdsalConsumer;
27 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.MdsalConsumerImpl;
28 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.OF13Provider;
29 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.PipelineOrchestrator;
30 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.PipelineOrchestratorImpl;
31 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
32 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.L2RewriteService;
33 import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
34 import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
37 * OSGi Bundle Activator for the Neutron providers
39 public class Activator extends ComponentActivatorAbstractBase {
41 * Function called when the activator starts just after some
42 * initializations are done by the
43 * ComponentActivatorAbstractBase.
50 * Function called when the activator stops just before the
51 * cleanup done by ComponentActivatorAbstractBase.
55 public void destroy() {
59 * Function that is used to communicate to dependency manager the
60 * list of known implementations for services inside a container.
62 * @return An array containing all the CLASS objects that will be
63 * instantiated in order to get an fully working implementation
67 public Object[] getImplementations() {
68 Object[] res = {MdsalConsumerImpl.class,
71 PipelineOrchestratorImpl.class,
72 L2RewriteService.class};
77 * Function that is called when configuration of the dependencies
80 * @param c dependency manager Component object, used for
81 * configuring the dependencies exported and imported
82 * @param imp Implementation class that is being configured,
83 * needed as long as the same routine can configure multiple
85 * @param containerName The containerName being configured, this allow
86 * also optional per-container different behavior if needed, usually
87 * should not be the case though.
90 public void configureInstance(Component c, Object imp,
91 String containerName) {
93 if (imp.equals(MdsalConsumerImpl.class)) {
94 c.setInterface(MdsalConsumer.class.getName(), null);
95 c.add(createServiceDependency().setService(BindingAwareBroker.class).setRequired(true));
98 if (imp.equals(OF10Provider.class)) {
99 Properties of10Properties = new Properties();
100 of10Properties.put(Constants.SOUTHBOUND_PROTOCOL_PROPERTY, "ovsdb");
101 of10Properties.put(Constants.OPENFLOW_VERSION_PROPERTY, Constants.OPENFLOW10);
103 c.setInterface(NetworkingProvider.class.getName(), of10Properties);
104 c.add(createServiceDependency()
105 .setService(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class)
107 c.add(createServiceDependency()
108 .setService(BridgeConfigurationManager.class)
110 c.add(createServiceDependency()
111 .setService(TenantNetworkManager.class)
113 c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
114 c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
115 c.add(createServiceDependency().
116 setService(IForwardingRulesManager.class).
118 c.add(createServiceDependency().
119 setService(ISwitchManager.class).
123 if (imp.equals(OF13Provider.class)) {
124 Properties of13Properties = new Properties();
125 of13Properties.put(Constants.SOUTHBOUND_PROTOCOL_PROPERTY, "ovsdb");
126 of13Properties.put(Constants.OPENFLOW_VERSION_PROPERTY, Constants.OPENFLOW13);
128 c.setInterface(NetworkingProvider.class.getName(), of13Properties);
129 c.add(createServiceDependency()
130 .setService(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class)
132 c.add(createServiceDependency()
133 .setService(BridgeConfigurationManager.class)
135 c.add(createServiceDependency()
136 .setService(TenantNetworkManager.class)
138 c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
139 c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
140 c.add(createServiceDependency().setService(MdsalConsumer.class).setRequired(true));
143 if (imp.equals(L2RewriteService.class)) {
144 Properties properties = new Properties();
145 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.L2_REWRITE);
146 c.setInterface(AbstractServiceInstance.class.getName(), properties);
148 c.add(createServiceDependency()
149 .setService(PipelineOrchestrator.class)
151 c.add(createServiceDependency().setService(MdsalConsumer.class).setRequired(true));
154 if (imp.equals(PipelineOrchestratorImpl.class)) {
155 c.setInterface(PipelineOrchestrator.class.getName(), null);
156 c.add(createServiceDependency()
157 .setService(AbstractServiceInstance.class)
158 .setCallbacks("registerService", "unregisterService"));