/*
- * Copyright (c) 2015 Red Hat, Inc. and others. All rights reserved.
+ * Copyright (c) 2015, 2016 Red Hat, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.ovsdb.openstack.netvirt.translator.*;
+import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
+import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
+import org.opendaylight.ovsdb.openstack.netvirt.api.IcmpEchoProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
+import org.opendaylight.ovsdb.openstack.netvirt.api.VlanConfigurationCache;
+import org.opendaylight.ovsdb.openstack.netvirt.api.ArpProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
+import org.opendaylight.ovsdb.openstack.netvirt.api.EgressAclProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher;
+import org.opendaylight.ovsdb.openstack.netvirt.api.GatewayMacResolver;
+import org.opendaylight.ovsdb.openstack.netvirt.api.GatewayMacResolverListener;
+import org.opendaylight.ovsdb.openstack.netvirt.api.InboundNatProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.IngressAclProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.L3ForwardingProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.LoadBalancerProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.MultiTenantAwareRouter;
+import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
+import org.opendaylight.ovsdb.openstack.netvirt.api.NodeCacheListener;
+import org.opendaylight.ovsdb.openstack.netvirt.api.NodeCacheManager;
+import org.opendaylight.ovsdb.openstack.netvirt.api.OutboundNatProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.openstack.netvirt.api.OvsdbInventoryService;
+import org.opendaylight.ovsdb.openstack.netvirt.api.RoutingProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.SecurityGroupCacheManger;
+import org.opendaylight.ovsdb.openstack.netvirt.api.SecurityServicesManager;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.BridgeConfigurationManagerImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.EventDispatcherImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.DistributedArpService;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.NodeCacheManagerImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.OpenstackRouter;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.OvsdbInventoryServiceImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.ProviderNetworkManagerImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.SecurityGroupCacheManagerImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.SecurityServicesImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.SouthboundImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.TenantNetworkManagerImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.impl.VlanConfigurationCacheImpl;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronFloatingIPCRUD;
import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerCRUD;
import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerPoolCRUD;
import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD;
import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSecurityGroupAware;
import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSecurityRuleAware;
import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronSubnetAware;
-import org.opendaylight.ovsdb.openstack.netvirt.api.*;
-import org.opendaylight.ovsdb.openstack.netvirt.impl.*;
+import org.opendaylight.ovsdb.utils.neutron.utils.NeutronModelsDataStoreHelper;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
public class ConfigActivator implements BundleActivator {
private static final Logger LOG = LoggerFactory.getLogger(ConfigActivator.class);
- private List<ServiceRegistration<?>> translatorCRUDRegistrations = new ArrayList<ServiceRegistration<?>>();
+ private List<ServiceRegistration<?>> translatorCRUDRegistrations = new ArrayList<>();
private List<Pair<Object, ServiceRegistration>> servicesAndRegistrations = new ArrayList<>();
private ProviderContext providerContext;
+ private boolean conntrackEnabled = false;
public ConfigActivator(ProviderContext providerContext) {
this.providerContext = providerContext;
new Class[] {INeutronSecurityRuleAware.class, INeutronSecurityGroupAware.class},
AbstractEvent.HandlerType.NEUTRON_PORT_SECURITY, portSecurityHandler);
- final SecurityServicesImpl securityServices = new SecurityServicesImpl();
+ final SecurityServicesImpl securityServices = new SecurityServicesImpl(conntrackEnabled);
+ registerService(context,
+ new String[]{SecurityServicesManager.class.getName()}, null, securityServices);
+
+ final SecurityGroupCacheManger securityGroupCacheManger = new SecurityGroupCacheManagerImpl();
+ registerService(context,
+ new String[]{SecurityGroupCacheManger.class.getName()}, null, securityGroupCacheManger);
+
registerService(context,
new String[]{SecurityServicesManager.class.getName()}, null, securityServices);
registerService(context,
new String[]{EventDispatcher.class.getName()}, null, eventDispatcher);
- final NeutronL3Adapter neutronL3Adapter = new NeutronL3Adapter();
+ Dictionary<String, Object> neutronL3AdapterProperties = new Hashtable<>();
+ neutronL3AdapterProperties.put(Constants.EVENT_HANDLER_TYPE_PROPERTY,
+ AbstractEvent.HandlerType.NEUTRON_L3_ADAPTER);
+ final NeutronL3Adapter neutronL3Adapter = new NeutronL3Adapter(
+ new NeutronModelsDataStoreHelper(this.providerContext.getSALService(DataBroker.class)));
+ registerService(context,
+ new String[]{NeutronL3Adapter.class.getName(), GatewayMacResolverListener.class.getName()},
+ neutronL3AdapterProperties, neutronL3Adapter);
+
+ Dictionary<String, Object> distributedArpServiceProperties = new Hashtable<>();
+ distributedArpServiceProperties.put(Constants.EVENT_HANDLER_TYPE_PROPERTY,
+ AbstractEvent.HandlerType.DISTRIBUTED_ARP_SERVICE);
+ final DistributedArpService distributedArpService = new DistributedArpService();
registerService(context,
- new String[]{NeutronL3Adapter.class.getName()}, null, neutronL3Adapter);
+ new String[]{DistributedArpService.class.getName()},
+ distributedArpServiceProperties, distributedArpService);
OpenstackRouter openstackRouter = new OpenstackRouter();
registerService(context,
// addingService may not be called if the service is already available when the ServiceTracker
// is started
trackService(context, INeutronNetworkCRUD.class, tenantNetworkManager, networkHandler, lBaaSHandler,
- lBaaSPoolHandler, lBaaSPoolMemberHandler, neutronL3Adapter);
+ lBaaSPoolHandler, lBaaSPoolMemberHandler, neutronL3Adapter, distributedArpService);
trackService(context, INeutronSubnetCRUD.class, lBaaSHandler, lBaaSPoolHandler, lBaaSPoolMemberHandler,
securityServices, neutronL3Adapter);
trackService(context, INeutronPortCRUD.class, tenantNetworkManager, lBaaSHandler, lBaaSPoolHandler,
- lBaaSPoolMemberHandler, securityServices, neutronL3Adapter);
+ lBaaSPoolMemberHandler, securityServices, neutronL3Adapter, distributedArpService);
+ trackService(context, INeutronFloatingIPCRUD.class, neutronL3Adapter);
trackService(context, INeutronLoadBalancerCRUD.class, lBaaSHandler, lBaaSPoolHandler, lBaaSPoolMemberHandler);
trackService(context, INeutronLoadBalancerPoolCRUD.class, lBaaSHandler, lBaaSPoolMemberHandler);
trackService(context, LoadBalancerProvider.class, lBaaSHandler, lBaaSPoolHandler, lBaaSPoolMemberHandler);
- trackService(context, ArpProvider.class, neutronL3Adapter);
+ trackService(context, ArpProvider.class, neutronL3Adapter, distributedArpService);
trackService(context, InboundNatProvider.class, neutronL3Adapter);
trackService(context, OutboundNatProvider.class, neutronL3Adapter);
trackService(context, RoutingProvider.class, neutronL3Adapter);
trackService(context, GatewayMacResolver.class, neutronL3Adapter);
trackService(context, IngressAclProvider.class, securityServices);
trackService(context, EgressAclProvider.class, securityServices);
+ trackService(context, IcmpEchoProvider.class, neutronL3Adapter);
// We no longer need to track the services, avoid keeping references around
servicesAndRegistrations.clear();
@Override
public void stop(BundleContext context) throws Exception {
- LOG.info("Stop Translator CRUD service provides");
+ LOG.info("ConfigActivator stop");
// ServiceTrackers and services are already released when bundle stops,
// so we don't need to close the trackers or unregister the services
- for (ServiceRegistration registration : translatorCRUDRegistrations) {
- if (registration != null) {
- registration.unregister();
- }
- }
-
}
private ServiceRegistration<?> registerService(BundleContext bundleContext, String[] interfaces,
servicesAndRegistrations.add(Pair.of(impl, serviceRegistration));
return serviceRegistration;
}
+
+ public void setConntrackEnabled(boolean conntrackEnabled) {
+ this.conntrackEnabled = conntrackEnabled;
+ }
}