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;
13 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkAware;
14 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
15 import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware;
16 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
17 import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupAware;
18 import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleAware;
19 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;
20 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
21 import org.opendaylight.controller.switchmanager.IInventoryListener;
22 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
23 import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
24 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
25 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
26 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
27 import org.opendaylight.ovsdb.openstack.netvirt.api.VlanConfigurationCache;
28 import org.opendaylight.ovsdb.openstack.netvirt.impl.BridgeConfigurationManagerImpl;
29 import org.opendaylight.ovsdb.openstack.netvirt.impl.ConfigurationServiceImpl;
30 import org.opendaylight.ovsdb.openstack.netvirt.impl.ProviderNetworkManagerImpl;
31 import org.opendaylight.ovsdb.openstack.netvirt.impl.TenantNetworkManagerImpl;
32 import org.opendaylight.ovsdb.openstack.netvirt.impl.VlanConfigurationCacheImpl;
33 import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
34 import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
35 import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
37 import org.apache.felix.dm.Component;
40 * OSGi bundle activator for the OVSDB Neutron Interface.
42 public class Activator extends ComponentActivatorAbstractBase {
44 * Function called when the activator starts just after some
45 * initializations are done by the
46 * ComponentActivatorAbstractBase.
53 * Function called when the activator stops just before the
54 * cleanup done by ComponentActivatorAbstractBase.
58 public void destroy() {
62 * Function that is used to communicate to dependency manager the
63 * list of known implementations for services inside a container.
65 * @return An array containing all the CLASS objects that will be
66 * instantiated in order to get an fully working implementation
70 public Object[] getImplementations() {
71 Object[] res = {ConfigurationServiceImpl.class,
72 BridgeConfigurationManagerImpl.class,
73 TenantNetworkManagerImpl.class,
74 VlanConfigurationCacheImpl.class,
78 SouthboundHandler.class,
79 PortSecurityHandler.class,
80 ProviderNetworkManagerImpl.class};
85 * Function that is called when configuration of the dependencies
88 * @param c dependency manager Component object, used for
89 * configuring the dependencies exported and imported
90 * @param imp Implementation class that is being configured,
91 * needed as long as the same routine can configure multiple
93 * @param containerName The containerName being configured, this allow
94 * also optional per-container different behavior if needed, usually
95 * should not be the case though.
98 public void configureInstance(Component c, Object imp,
99 String containerName) {
100 if (imp.equals(ConfigurationServiceImpl.class)) {
101 c.setInterface(ConfigurationService.class.getName(), null);
102 c.add(createServiceDependency().setService(OvsdbConfigService.class));
105 if (imp.equals(BridgeConfigurationManagerImpl.class)) {
106 c.setInterface(BridgeConfigurationManager.class.getName(), null);
107 c.add(createServiceDependency().setService(ConfigurationService.class).setRequired(true));
108 c.add(createServiceDependency().setService(NetworkingProviderManager.class));
109 c.add(createServiceDependency().setService(OvsdbConfigService.class));
112 if (imp.equals(TenantNetworkManagerImpl.class)) {
113 c.setInterface(TenantNetworkManager.class.getName(), null);
114 c.add(createServiceDependency().setService(NetworkingProviderManager.class));
115 c.add(createServiceDependency().setService(OvsdbConfigService.class));
116 c.add(createServiceDependency().setService(IConnectionServiceInternal.class));
117 c.add(createServiceDependency().
118 setService(INeutronNetworkCRUD.class).
120 c.add(createServiceDependency().
121 setService(INeutronPortCRUD.class).
123 c.add(createServiceDependency().setService(VlanConfigurationCache.class));
126 if (imp.equals(VlanConfigurationCacheImpl.class)) {
127 c.setInterface(VlanConfigurationCache.class.getName(), null);
128 c.add(createServiceDependency().setService(OvsdbConfigService.class));
129 c.add(createServiceDependency().setService(TenantNetworkManager.class));
132 if (imp.equals(NetworkHandler.class)) {
133 c.setInterface(INeutronNetworkAware.class.getName(), null);
134 c.add(createServiceDependency().setService(TenantNetworkManager.class).setRequired(true));
135 c.add(createServiceDependency().setService(BridgeConfigurationManager.class).setRequired(true));
136 c.add(createServiceDependency().setService(ConfigurationService.class).setRequired(true));
137 c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
138 c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
139 c.add(createServiceDependency().setService(INeutronNetworkCRUD.class).setRequired(true));
140 c.add(createServiceDependency().setService(OvsdbInventoryListener.class).setRequired(true));
143 if (imp.equals(SubnetHandler.class)) {
144 c.setInterface(INeutronSubnetAware.class.getName(), null);
147 if (imp.equals(PortHandler.class)) {
148 c.setInterface(INeutronPortAware.class.getName(), null);
149 c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
150 c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
151 c.add(createServiceDependency().setService(OvsdbInventoryListener.class).setRequired(true));
154 if (imp.equals(SouthboundHandler.class)) {
155 c.setInterface(new String[] {OvsdbInventoryListener.class.getName(),
156 IInventoryListener.class.getName()}, null);
157 c.add(createServiceDependency().setService(ConfigurationService.class).setRequired(true));
158 c.add(createServiceDependency().setService(BridgeConfigurationManager.class).setRequired(true));
159 c.add(createServiceDependency().setService(TenantNetworkManager.class).setRequired(true));
160 c.add(createServiceDependency().setService(NetworkingProviderManager.class).setRequired(true));
161 c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
162 c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
165 if (imp.equals(PortSecurityHandler.class)) {
166 c.setInterface(new String[] {INeutronSecurityRuleAware.class.getName(),
167 INeutronSecurityGroupAware.class.getName()}, null);
170 if (imp.equals(ProviderNetworkManagerImpl.class)) {
171 c.setInterface(NetworkingProviderManager.class.getName(), null);
172 c.add(createServiceDependency()
173 .setService(ConfigurationService.class)
175 c.add(createServiceDependency()
176 .setService(NetworkingProvider.class)
177 .setCallbacks("providerAdded", "providerRemoved"));