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.ArpResponderService;
33 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.ClassifierService;
34 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.EgressAclService;
35 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.InboundNatService;
36 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.IngressAclService;
37 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.L2ForwardingService;
38 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.L2RewriteService;
39 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.LoadBalancerService;
40 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.OutboundNatService;
41 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.RoutingService;
42 import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
43 import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
46 * OSGi Bundle Activator for the Neutron providers
48 public class Activator extends ComponentActivatorAbstractBase {
50 * Function called when the activator starts just after some
51 * initializations are done by the
52 * ComponentActivatorAbstractBase.
59 * Function called when the activator stops just before the
60 * cleanup done by ComponentActivatorAbstractBase.
64 public void destroy() {
68 * Function that is used to communicate to dependency manager the
69 * list of known implementations for services inside a container.
71 * @return An array containing all the CLASS objects that will be
72 * instantiated in order to get an fully working implementation
76 public Object[] getImplementations() {
77 Object[] res = {MdsalConsumerImpl.class,
80 PipelineOrchestratorImpl.class,
81 ClassifierService.class,
82 ArpResponderService.class,
83 InboundNatService.class,
84 IngressAclService.class,
85 LoadBalancerService.class,
87 L2RewriteService.class,
88 L2ForwardingService.class,
89 EgressAclService.class,
90 OutboundNatService.class};
95 * Function that is called when configuration of the dependencies
98 * @param c dependency manager Component object, used for
99 * configuring the dependencies exported and imported
100 * @param imp Implementation class that is being configured,
101 * needed as long as the same routine can configure multiple
103 * @param containerName The containerName being configured, this allow
104 * also optional per-container different behavior if needed, usually
105 * should not be the case though.
108 public void configureInstance(Component c, Object imp,
109 String containerName) {
111 if (imp.equals(MdsalConsumerImpl.class)) {
112 c.setInterface(MdsalConsumer.class.getName(), null);
113 c.add(createServiceDependency().setService(BindingAwareBroker.class).setRequired(true));
116 if (imp.equals(OF10Provider.class)) {
117 Properties of10Properties = new Properties();
118 of10Properties.put(Constants.SOUTHBOUND_PROTOCOL_PROPERTY, "ovsdb");
119 of10Properties.put(Constants.OPENFLOW_VERSION_PROPERTY, Constants.OPENFLOW10);
121 c.setInterface(NetworkingProvider.class.getName(), of10Properties);
122 c.add(createServiceDependency()
123 .setService(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class)
125 c.add(createServiceDependency()
126 .setService(BridgeConfigurationManager.class)
128 c.add(createServiceDependency()
129 .setService(TenantNetworkManager.class)
131 c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
132 c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
133 c.add(createServiceDependency().
134 setService(IForwardingRulesManager.class).
136 c.add(createServiceDependency().
137 setService(ISwitchManager.class).
141 if (imp.equals(OF13Provider.class)) {
142 Properties of13Properties = new Properties();
143 of13Properties.put(Constants.SOUTHBOUND_PROTOCOL_PROPERTY, "ovsdb");
144 of13Properties.put(Constants.OPENFLOW_VERSION_PROPERTY, Constants.OPENFLOW13);
146 c.setInterface(NetworkingProvider.class.getName(), of13Properties);
147 c.add(createServiceDependency()
148 .setService(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class)
150 c.add(createServiceDependency()
151 .setService(BridgeConfigurationManager.class)
153 c.add(createServiceDependency()
154 .setService(TenantNetworkManager.class)
156 c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
157 c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
158 c.add(createServiceDependency().setService(MdsalConsumer.class).setRequired(true));
161 if (imp.equals(PipelineOrchestratorImpl.class)) {
162 c.setInterface(PipelineOrchestrator.class.getName(), null);
163 c.add(createServiceDependency()
164 .setService(AbstractServiceInstance.class)
165 .setCallbacks("registerService", "unregisterService"));
168 if (AbstractServiceInstance.class.isAssignableFrom((Class)imp)) {
169 c.add(createServiceDependency()
170 .setService(PipelineOrchestrator.class)
172 c.add(createServiceDependency().setService(MdsalConsumer.class).setRequired(true));
175 if (imp.equals(ClassifierService.class)) {
176 Properties properties = new Properties();
177 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.CLASSIFIER);
178 c.setInterface(AbstractServiceInstance.class.getName(), properties);
181 if (imp.equals(ArpResponderService.class)) {
182 Properties properties = new Properties();
183 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.ARP_RESPONDER);
184 c.setInterface(AbstractServiceInstance.class.getName(), properties);
187 if (imp.equals(InboundNatService.class)) {
188 Properties properties = new Properties();
189 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.INBOUND_NAT);
190 c.setInterface(AbstractServiceInstance.class.getName(), properties);
193 if (imp.equals(IngressAclService.class)) {
194 Properties properties = new Properties();
195 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.INGRESS_ACL);
196 c.setInterface(AbstractServiceInstance.class.getName(), properties);
199 if (imp.equals(LoadBalancerService.class)) {
200 Properties properties = new Properties();
201 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.LOAD_BALANCER);
202 c.setInterface(AbstractServiceInstance.class.getName(), properties);
205 if (imp.equals(RoutingService.class)) {
206 Properties properties = new Properties();
207 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.ROUTING);
208 c.setInterface(AbstractServiceInstance.class.getName(), properties);
211 if (imp.equals(L2RewriteService.class)) {
212 Properties properties = new Properties();
213 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.L2_REWRITE);
214 c.setInterface(AbstractServiceInstance.class.getName(), properties);
217 if (imp.equals(L2ForwardingService.class)) {
218 Properties properties = new Properties();
219 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.L2_FORWARDING);
220 c.setInterface(AbstractServiceInstance.class.getName(), properties);
223 if (imp.equals(IngressAclService.class)) {
224 Properties properties = new Properties();
225 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.INGRESS_ACL);
226 c.setInterface(AbstractServiceInstance.class.getName(), properties);
229 if (imp.equals(OutboundNatService.class)) {
230 Properties properties = new Properties();
231 properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.OUTBOUND_NAT);
232 c.setInterface(AbstractServiceInstance.class.getName(), properties);