<karaf.resources.version>1.5.0-SNAPSHOT</karaf.resources.version>
<lispflowmapping.version>1.2.0-SNAPSHOT</lispflowmapping.version>
<mdsal.version>1.2.0-SNAPSHOT</mdsal.version>
+ <neutron.version>0.5.0-SNAPSHOT</neutron.version>
<nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
<nsf.version>0.5.0-SNAPSHOT</nsf.version>
<sal.version>0.9.0-SNAPSHOT</sal.version>
<classifier>features</classifier>
<type>xml</type>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>features-neutron</artifactId>
+ <version>${neutron.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-nsf</artifactId>
<classifier>features</classifier>
<type>xml</type>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>features-neutron</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-nsf</artifactId>
<repository>mvn:org.opendaylight.controller/features-mdsal/${mdsal.version}/xml/features</repository>
<repository>mvn:org.opendaylight.controller/features-adsal/${sal.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.controller/features-neutron/${neutron.version}/xml/features</repository>
<repository>mvn:org.opendaylight.controller/features-nsf/${nsf.version}/xml/features</repository>
<repository>mvn:org.opendaylight.controller/features-netconf-connector/${mdsal.version}/xml/features</repository>
</feature>
<feature name="odl-lispflowmapping-neutron" description="OpenDaylight :: LISP Flow Mapping :: Neutron Integration" version='${lispflowmapping.version}'>
- <feature version="${nsf.version}">odl-adsal-northbound</feature>
+ <feature version="${neutron.version}">odl-neutron-all</feature>
<feature version="${lispflowmapping.version}">odl-lispflowmapping-mappingservice</feature>
<bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.neutron/${lispflowmapping.version}</bundle>
</feature>
<packaging>bundle</packaging>
<name>LISP Flow Mapping Neutron APIs</name>
<dependencies>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.northbound</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>containermanager</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>networkconfig.neutron</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.lispflowmapping</groupId>
<artifactId>mappingservice.api</artifactId>
<configuration>
<instructions>
<Export-Package></Export-Package>
- <Import-Package>org.opendaylight.controller.sal.core,
- org.opendaylight.controller.sal.utils,
- org.opendaylight.controller.containermanager,
- org.opendaylight.controller.switchmanager,
+ <Import-Package>org.apache.commons.net.util,
+ org.apache.felix.dm,
org.opendaylight.controller.networkconfig.neutron,
- org.opendaylight.controller.northbound.commons,
- org.opendaylight.controller.northbound.commons.exception,
- org.opendaylight.controller.northbound.commons.utils,
- com.sun.jersey.spi.container.servlet,
- org.opendaylight.controller.sal.authorization,
- org.opendaylight.controller.usermanager,
org.opendaylight.lispflowmapping.type,
org.opendaylight.lispflowmapping.type.lisp,
org.opendaylight.lispflowmapping.type.lisp.address,
org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer,
org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.address,
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924,
- org.slf4j,
- org.apache.catalina.filters,
- org.apache.felix.dm,
- org.apache.commons.net.util,
- org.apache.commons.lang3.builder,
- org.osgi.service.component,
- org.eclipse.osgi.framework.console,
- org.osgi.framework,</Import-Package>
+ org.slf4j</Import-Package>
<Bundle-Activator>org.opendaylight.lispflowmapping.neutron.Activator</Bundle-Activator>
<Export-Package></Export-Package>
/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2014, 2015 Cisco Systems, 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 java.util.Dictionary;
import java.util.Hashtable;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
+import org.apache.felix.dm.DependencyActivatorBase;
+import org.apache.felix.dm.DependencyManager;
import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkAware;
import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;
import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware;
+import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*
*/
-public class Activator extends ComponentActivatorAbstractBase {
+public class Activator extends DependencyActivatorBase {
- /*
- * Logger instance
- */
protected static final Logger logger = LoggerFactory.getLogger(Activator.class);
- /**
- * Function called when the activator starts just after some initializations
- * are done by the ComponentActivatorAbstractBase.
- *
- */
@Override
- public void init() {
- logger.debug("LISP Neutron Service is initialized!");
-
- }
-
- /**
- * Function called when the activator stops just before the cleanup done by
- * ComponentActivatorAbstractBase
- *
- */
- @Override
- public void destroy() {
- logger.debug("LISP Neutron Service is destroyed!");
- }
-
- /**
- * Function that is used to communicate to dependency manager the list of
- * known implementations for services inside a container
- *
- *
- * @return An array containing all the CLASS objects that will be
- * instantiated in order to get an fully working implementation
- * Object
- */
- @Override
- public Object[] getImplementations() {
- Object[] res = { LispNeutronService.class,
- LispNeutronSubnetHandler.class,
- LispNeutronPortHandler.class,
- LispNeutronNetworkHandler.class};
- return res;
- }
-
- /**
- * Function that is called when configuration of the dependencies is
- * required.
- *
- * @param c
- * dependency manager Component object, used for configuring the
- * dependencies exported and imported
- * @param imp
- * Implementation class that is being configured, needed as long
- * as the same routine can configure multiple implementations
- * @param containerName
- * The containerName being configured, this allow also optional
- * per-container different behavior if needed, usually should not
- * be the case though.
- */
- @Override
- public void configureInstance(Component c, Object imp, String containerName) {
+ public void init(BundleContext context, DependencyManager manager) throws Exception {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("name", "mappingservice");
- if (imp.equals(LispNeutronService.class)) {
- c.setInterface(ILispNeutronService.class.getName(), props);
- }
+ manager.add(createComponent()
+ .setInterface(ILispNeutronService.class.getName(), null)
+ .setImplementation(LispNeutronService.class)
+ .add(createServiceDependency().setService(IFlowMapping.class)));
- if (imp.equals(LispNeutronNetworkHandler.class)) {
- c.setInterface(new String[] { ILispNeutronService.class.getName(), INeutronNetworkAware.class.getName()}, props);
- }
+ manager.add(createComponent()
+ .setInterface(new String[] { ILispNeutronService.class.getName(), INeutronNetworkAware.class.getName()}, props)
+ .setImplementation(LispNeutronNetworkHandler.class));
- if (imp.equals(LispNeutronSubnetHandler.class)) {
- c.setInterface(new String[] { ILispNeutronService.class.getName(), INeutronSubnetAware.class.getName()}, props);
- }
+ manager.add(createComponent()
+ .setInterface(new String[] { ILispNeutronService.class.getName(), INeutronSubnetAware.class.getName()}, props)
+ .setImplementation(LispNeutronSubnetHandler.class)
+ .add(createServiceDependency().setService(ILispNeutronService.class)));
- if (imp.equals(LispNeutronPortHandler.class)) {
- c.setInterface(new String[] { ILispNeutronService.class.getName(), INeutronPortAware.class.getName()}, props);
- }
+ manager.add(createComponent()
+ .setInterface(new String[] { ILispNeutronService.class.getName(), INeutronPortAware.class.getName()}, props)
+ .setImplementation(LispNeutronPortHandler.class));
- c.add(createContainerServiceDependency(containerName)
- .setService(IFlowMapping.class)
- .setCallbacks("setMappingService", "unsetMappingService")
- .setRequired(true));
+ logger.debug("LISP Neutron Service is initialized!");
+ }
+ @Override
+ public void destroy(BundleContext context, DependencyManager manager) throws Exception {
+ logger.debug("LISP Neutron Service is destroyed!");
}
}
import org.apache.commons.net.util.SubnetUtils.SubnetInfo;
import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-
-import org.opendaylight.controller.sal.utils.ServiceHelper;
import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispAFIAddress;
import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.LispAddressContainer;
import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.LispAddressContainerBuilder;
*/
public class LispNeutronSubnetHandler extends LispNeutronService implements INeutronSubnetAware {
+ // The implementation for each of these services is resolved by the OSGi Service Manager
+ private volatile ILispNeutronService lispNeutronService;
+
@Override
public int canCreateSubnet(NeutronSubnet subnet) {
logger.info("Neutron canCreateSubnet : Subnet name: " + subnet.getName() + " Subnet Cidr: " +
LispAFIAddress lispAddress = new Ipv4Builder().setIpv4Address(new Ipv4Address(info.getNetworkAddress())).setAfi(ianaCode).build();
LispAddressContainer addressContainer = new LispAddressContainerBuilder().setAddress((Address) lispAddress).build();
- ILispNeutronService lispService = (ILispNeutronService) ServiceHelper.getGlobalInstance(ILispNeutronService.class, this);
-
try{
- lispService.getMappingService().addAuthenticationKey(addressContainer, masklen, subnet.getNetworkUUID());
+ lispNeutronService.getMappingService().addAuthenticationKey(addressContainer, masklen, subnet.getNetworkUUID());
logger.debug("Neutron Subnet Added to MapServer : Subnet name: " + subnet.getName() + " EID Prefix: " +
addressContainer.toString() + " Key: " + subnet.getNetworkUUID());
LispAFIAddress lispAddress = new Ipv4Builder().setIpv4Address(new Ipv4Address(info.getNetworkAddress())).setAfi(ianaCode).build();
LispAddressContainer addressContainer = new LispAddressContainerBuilder().setAddress((Address) lispAddress).build();
- ILispNeutronService lispService = (ILispNeutronService) ServiceHelper.getGlobalInstance(ILispNeutronService.class, this);
-
// if subnet does not exist in MapServer, return error
try{
- if (lispService.getMappingService().getAuthenticationKey(addressContainer, masklen) == null){
+ if (lispNeutronService.getMappingService().getAuthenticationKey(addressContainer, masklen) == null){
logger.error("Neutron canDeleteSubnet rejected : Subnet does not exist: Subnet name: " +
subnet.getName() +
LispAddressContainer addressContainer = new LispAddressContainerBuilder().setAddress((Address) lispAddress).build();
try{
- ILispNeutronService lispService = (ILispNeutronService) ServiceHelper.getGlobalInstance(ILispNeutronService.class, this);
-
// if subnet does not exist in MapServer, return error
- if (lispService.getMappingService().getAuthenticationKey(addressContainer,masklen) == null){
+ if (lispNeutronService.getMappingService().getAuthenticationKey(addressContainer,masklen) == null){
logger.error("Neutron Delete Subnet Failed: Subnet does not exist: Subnet name: " + subnet.getName() +
" Eid Prefix: " + addressContainer.toString() +
"Key: " + subnet.getNetworkUUID());
return;
}
- lispService.getMappingService().removeAuthenticationKey(addressContainer, masklen);
+ lispNeutronService.getMappingService().removeAuthenticationKey(addressContainer, masklen);
logger.debug("Neutron Subnet Deleted from MapServer : Subnet name: " + subnet.getName() +
" Eid Prefix: " + addressContainer.toString() +