--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>commons.opendaylight</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ <relativePath>../../opendaylight/commons/opendaylight</relativePath>
+ </parent>
+ <artifactId>features-neutron</artifactId>
+ <version>${networkconfig.neutron.version}</version>
+ <packaging>jar</packaging>
+
+ <properties>
+ <features.file>features.xml</features.file>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>networkconfig.neutron</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-servlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>org.eclipse.persistence.moxy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>org.eclipse.persistence.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>networkconfig.neutron</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-net</groupId>
+ <artifactId>commons-net</artifactId>
+ </dependency>
+ <!-- test to validate features.xml -->
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-test</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+ <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+ <karaf.distro.version>${commons.opendaylight.version}</karaf.distro.version>
+ </systemPropertyVariables>
+ <dependenciesToScan>
+ <dependency>org.opendaylight.yangtools:features-test</dependency>
+ </dependenciesToScan>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
+ </scm>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<features name="odl-neutron-${networkconfig.neutron.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+ <feature name='odl-neutron-all' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: API">
+ <feature version='${networkconfig.neutron.version}'>odl-neutron-api</feature>
+ <feature version='${networkconfig.neutron.version}'>odl-neutron-northbound</feature>
+ <feature version='${networkconfig.neutron.version}'>odl-neutron-implementation</feature>
+ </feature>
+ <feature name='odl-neutron-northbound' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: Northbound">
+ <feature version='${networkconfig.neutron.version}'>odl-neutron-api</feature>
+ <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.moxy/${eclipse.persistence.version}</bundle>
+ <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.core/${eclipse.persistence.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/networkconfig.neutron.northbound/${networkconfig.neutron.northbound.version}</bundle>
+ <bundle>mvn:com.sun.jersey/jersey-core/${jersey.version}</bundle>
+ <bundle>mvn:com.sun.jersey/jersey-server/${jersey.version}</bundle>
+ <bundle>mvn:com.sun.jersey/jersey-servlet/${jersey.version}</bundle>
+ <bundle>mvn:org.osgi/org.osgi.core/${osgi.core.version}</bundle>
+ </feature>
+
+ <feature name='odl-neutron-api' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: API">
+ <bundle>mvn:org.opendaylight.controller/networkconfig.neutron/${networkconfig.neutron.version}</bundle>
+ <bundle>mvn:commons-net/commons-net/${commons.net.version}</bundle>
+ <bundle>mvn:org.osgi/org.osgi.core/${osgi.core.version}</bundle>
+ </feature>
+ <feature name='odl-neutron-implementation' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: Implementation">
+ <feature version='${networkconfig.neutron.version}'>odl-neutron-api</feature>
+ <bundle>mvn:org.opendaylight.controller/networkconfig.neutron.implementation/${networkconfig.neutron.implementation.version}</bundle>
+ <bundle>mvn:org.osgi/org.osgi.core/${osgi.core.version}</bundle>
+ </feature>
+</features>
\ No newline at end of file
<module>netconf-connector</module>
<module>restconf</module>
<module>extras</module>
+ <module>neutron</module>
</modules>
</project>
<type>xml</type>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>features-neutron</artifactId>
+ <version>${networkconfig.neutron.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
<!-- Netconf connector features. When this is included, users can test the netconf connector using netconf-testtool -->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<enunciate.version>1.26.2</enunciate.version>
</properties>
<dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>clustering.services</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>configuration</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.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
- <Import-Package>org.opendaylight.controller.clustering.services,
- org.opendaylight.controller.configuration,
- org.opendaylight.controller.sal.core,
- org.opendaylight.controller.sal.utils,
- org.apache.felix.dm,
- org.apache.commons.net.util,
- org.osgi.service.component,
- org.opendaylight.controller.networkconfig.neutron,
- org.slf4j,
- javax.xml.bind.annotation</Import-Package>
+ <Import-Package>*</Import-Package>
<Bundle-Activator>org.opendaylight.controller.networkconfig.neutron.implementation.Activator</Bundle-Activator>
</instructions>
<manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
+import java.util.ArrayList;
+import java.util.List;
+
import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-public class Activator extends ComponentActivatorAbstractBase {
+public class Activator implements BundleActivator {
protected static final Logger logger = LoggerFactory
.getLogger(Activator.class);
+ private List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>();
- /**
- * Function called when the activator starts just after some
- * initializations are done by the
- * ComponentActivatorAbstractBase.
- *
- */
- @Override
- public void init() {
-
- }
-
- /**
- * Function called when the activator stops just before the
- * cleanup done by ComponentActivatorAbstractBase
- *
- */
- @Override
- public void destroy() {
-
- }
-
- /**
- * 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 = { NeutronFloatingIPInterface.class,
- NeutronRouterInterface.class,
- NeutronPortInterface.class,
- NeutronSubnetInterface.class,
- NeutronNetworkInterface.class,
- NeutronSecurityGroupInterface.class,
- NeutronSecurityRuleInterface.class,
- NeutronFirewallInterface.class,
- NeutronFirewallPolicyInterface.class,
- NeutronFirewallRuleInterface.class,
- NeutronLoadBalancerInterface.class,
- NeutronLoadBalancerPoolInterface.class,
- NeutronLoadBalancerListenerInterface.class,
- NeutronLoadBalancerHealthMonitorInterface.class,
- NeutronLoadBalancerPoolMemberInterface.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) {
- if (imp.equals(NeutronFloatingIPInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronFloatingIPCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
- }
- if (imp.equals(NeutronRouterInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronRouterCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+ public void start(BundleContext context) throws Exception {
+ NeutronRouterInterface neutronRouterInterface = new NeutronRouterInterface();
+ ServiceRegistration<INeutronRouterCRUD> neutronRouterInterfaceRegistration = context.registerService(INeutronRouterCRUD.class, neutronRouterInterface, null);
+ if(neutronRouterInterfaceRegistration != null) {
+ registrations.add(neutronRouterInterfaceRegistration);
}
- if (imp.equals(NeutronPortInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronPortCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+ NeutronPortInterface neutronPortInterface = new NeutronPortInterface();
+ ServiceRegistration<INeutronPortCRUD> neutronPortInterfaceRegistration = context.registerService(INeutronPortCRUD.class, neutronPortInterface, null);
+ if(neutronPortInterfaceRegistration != null) {
+ registrations.add(neutronPortInterfaceRegistration);
}
- if (imp.equals(NeutronSubnetInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronSubnetCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronSubnetInterface neutronSubnetInterface = new NeutronSubnetInterface();
+ ServiceRegistration<INeutronSubnetCRUD> neutronSubnetInterfaceRegistration = context.registerService(INeutronSubnetCRUD.class, neutronSubnetInterface, null);
+ if(neutronSubnetInterfaceRegistration != null) {
+ registrations.add(neutronSubnetInterfaceRegistration);
}
- if (imp.equals(NeutronNetworkInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronNetworkCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronNetworkInterface neutronNetworkInterface = new NeutronNetworkInterface();
+ ServiceRegistration<INeutronNetworkCRUD> neutronNetworkInterfaceRegistration = context.registerService(INeutronNetworkCRUD.class, neutronNetworkInterface, null);
+ if(neutronNetworkInterfaceRegistration != null) {
+ registrations.add(neutronNetworkInterfaceRegistration);
}
- if (imp.equals(NeutronSecurityGroupInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronSecurityGroupCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronSecurityGroupInterface neutronSecurityGroupInterface = new NeutronSecurityGroupInterface();
+ ServiceRegistration<INeutronSecurityGroupCRUD> neutronSecurityGroupInterfaceRegistration = context.registerService(INeutronSecurityGroupCRUD.class, neutronSecurityGroupInterface, null);
+ if(neutronSecurityGroupInterfaceRegistration != null) {
+ registrations.add(neutronSecurityGroupInterfaceRegistration);
}
- if (imp.equals(NeutronSecurityRuleInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronSecurityRuleCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronSecurityRuleInterface neutronSecurityRuleInterface = new NeutronSecurityRuleInterface();
+ ServiceRegistration<INeutronSecurityRuleCRUD> neutronSecurityRuleInterfaceRegistration = context.registerService(INeutronSecurityRuleCRUD.class, neutronSecurityRuleInterface, null);
+ if(neutronSecurityRuleInterfaceRegistration != null) {
+ registrations.add(neutronSecurityRuleInterfaceRegistration);
}
- if (imp.equals(NeutronFirewallInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronFirewallCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronFirewallInterface neutronFirewallInterface = new NeutronFirewallInterface();
+ ServiceRegistration<INeutronFirewallCRUD> neutronFirewallInterfaceRegistration = context.registerService(INeutronFirewallCRUD.class, neutronFirewallInterface, null);
+ if(neutronFirewallInterfaceRegistration != null) {
+ registrations.add(neutronFirewallInterfaceRegistration);
}
- if (imp.equals(NeutronFirewallPolicyInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronFirewallPolicyCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronFirewallPolicyInterface neutronFirewallPolicyInterface = new NeutronFirewallPolicyInterface();
+ ServiceRegistration<INeutronFirewallPolicyCRUD> neutronFirewallPolicyInterfaceRegistration = context.registerService(INeutronFirewallPolicyCRUD.class, neutronFirewallPolicyInterface, null);
+ if(neutronFirewallPolicyInterfaceRegistration != null) {
+ registrations.add(neutronFirewallPolicyInterfaceRegistration);
}
- if (imp.equals(NeutronFirewallRuleInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronFirewallRuleCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronFirewallRuleInterface neutronFirewallRuleInterface = new NeutronFirewallRuleInterface();
+ ServiceRegistration<INeutronFirewallRuleCRUD> neutronFirewallRuleInterfaceRegistration = context.registerService(INeutronFirewallRuleCRUD.class, neutronFirewallRuleInterface, null);
+ if(neutronFirewallRuleInterfaceRegistration != null) {
+ registrations.add(neutronFirewallRuleInterfaceRegistration);
}
- if (imp.equals(NeutronLoadBalancerInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronLoadBalancerCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronLoadBalancerInterface neutronLoadBalancerInterface = new NeutronLoadBalancerInterface();
+ ServiceRegistration<INeutronLoadBalancerCRUD> neutronLoadBalancerInterfaceRegistration = context.registerService(INeutronLoadBalancerCRUD.class, neutronLoadBalancerInterface, null);
+ if(neutronFirewallInterfaceRegistration != null) {
+ registrations.add(neutronLoadBalancerInterfaceRegistration);
}
- if (imp.equals(NeutronLoadBalancerListenerInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronLoadBalancerListenerCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronLoadBalancerPoolInterface neutronLoadBalancerPoolInterface = new NeutronLoadBalancerPoolInterface();
+ ServiceRegistration<INeutronLoadBalancerPoolCRUD> neutronLoadBalancerPoolInterfaceRegistration = context.registerService(INeutronLoadBalancerPoolCRUD.class, neutronLoadBalancerPoolInterface, null);
+ if(neutronLoadBalancerPoolInterfaceRegistration != null) {
+ registrations.add(neutronLoadBalancerPoolInterfaceRegistration);
}
- if (imp.equals(NeutronLoadBalancerPoolInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronLoadBalancerPoolCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronLoadBalancerListenerInterface neutronLoadBalancerListenerInterface = new NeutronLoadBalancerListenerInterface();
+ ServiceRegistration<INeutronLoadBalancerListenerCRUD> neutronLoadBalancerListenerInterfaceRegistration = context.registerService(INeutronLoadBalancerListenerCRUD.class, neutronLoadBalancerListenerInterface, null);
+ if(neutronLoadBalancerListenerInterfaceRegistration != null) {
+ registrations.add(neutronLoadBalancerListenerInterfaceRegistration);
}
- if (imp.equals(NeutronLoadBalancerHealthMonitorInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronLoadBalancerHealthMonitorCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronLoadBalancerHealthMonitorInterface neutronLoadBalancerHealthMonitorInterface = new NeutronLoadBalancerHealthMonitorInterface();
+ ServiceRegistration<INeutronLoadBalancerHealthMonitorCRUD> neutronLoadBalancerHealthMonitorInterfaceRegistration = context.registerService(INeutronLoadBalancerHealthMonitorCRUD.class, neutronLoadBalancerHealthMonitorInterface, null);
+ if(neutronLoadBalancerHealthMonitorInterfaceRegistration != null) {
+ registrations.add(neutronLoadBalancerHealthMonitorInterfaceRegistration);
}
- if (imp.equals(NeutronLoadBalancerPoolMemberInterface.class)) {
- // export the service
- c.setInterface(
- new String[] { INeutronLoadBalancerPoolMemberCRUD.class.getName(),
- IConfigurationContainerAware.class.getName()}, null);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "neutron");
- c.add(createContainerServiceDependency(containerName)
- .setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService",
- "unsetClusterContainerService").setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IConfigurationContainerService.class).setCallbacks(
- "setConfigurationContainerService",
- "unsetConfigurationContainerService").setRequired(true));
+
+ NeutronLoadBalancerPoolMemberInterface neutronLoadBalancerPoolMemberInterface = new NeutronLoadBalancerPoolMemberInterface();
+ ServiceRegistration<INeutronLoadBalancerPoolMemberCRUD> neutronLoadBalancerPoolMemberInterfaceRegistration = context.registerService(INeutronLoadBalancerPoolMemberCRUD.class, neutronLoadBalancerPoolMemberInterface, null);
+ if(neutronLoadBalancerPoolMemberInterfaceRegistration != null) {
+ registrations.add(neutronLoadBalancerPoolMemberInterfaceRegistration);
}
+
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ for(ServiceRegistration registration : registrations) {
+ if(registration != null) {
+ registration.unregister();
+ }
+ }
+
}
-}
+}
\ No newline at end of file
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronFirewall;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-public class NeutronFirewallInterface implements INeutronFirewallCRUD, IConfigurationContainerAware, IObjectReader {
+public class NeutronFirewallInterface implements INeutronFirewallCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronFirewallInterface.class);
- private static final String FILE_NAME = "neutron.firewall.conf";
- private String containerName = null;
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronFirewall> firewallDB;
-
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron Firewall");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronFirewalls",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron Firewall - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron Firewall already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron Firewall");
- }
-
- @SuppressWarnings ({"unchecked"})
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron Firewall");
- firewallDB = (ConcurrentMap<String, NeutronFirewall>) clusterContainerService
- .getCache("neutronFirewalls");
- if (firewallDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron Firewall");
- }
- logger.debug("Cache was successfully retrieved for Neutron Firewall");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for HostTracker");
- clusterContainerService.destroyCache("neutronFirewalls");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- */
- void stop() {
- }
+ private ConcurrentMap<String, NeutronFirewall> firewallDB = new ConcurrentHashMap<String, NeutronFirewall>();
// this method uses reflection to update an object from it's delta.
return !neutronFirewallExists(firewallUUID);
}
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronFirewall nn = (NeutronFirewall) conf;
- firewallDB.put(nn.getFirewallUUID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(firewallDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
}
\ No newline at end of file
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallPolicy;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-public class NeutronFirewallPolicyInterface implements INeutronFirewallPolicyCRUD, IConfigurationContainerAware, IObjectReader {
+public class NeutronFirewallPolicyInterface implements INeutronFirewallPolicyCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronFirewallPolicyInterface.class);
- private static final String FILE_NAME ="neutron.firewallpolicy.conf";
- private String containerName = null;
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronFirewallPolicy> firewallPolicyDB;
-
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron Firewall Rule");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronFirewallPolicies",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron Firewall Rule - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron Firewall Rule already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron Firewall Rule");
- }
-
- @SuppressWarnings({ "unchecked" })
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron Firewall Rule");
- firewallPolicyDB = (ConcurrentMap<String, NeutronFirewallPolicy>) clusterContainerService
- .getCache("neutronFirewallPolicies");
- if (firewallPolicyDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron Firewall Rule");
- }
- logger.debug("Cache was successfully retrieved for Neutron Firewall Rule");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for HostTracker");
- clusterContainerService.destroyCache("neutronFirewallPolicies");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- *
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
+ private ConcurrentMap<String, NeutronFirewallPolicy> firewallPolicyDB = new ConcurrentHashMap<String, NeutronFirewallPolicy>();
// this method uses reflection to update an object from it's delta.
return !neutronFirewallPolicyExists(firewallPolicyUUID);
}
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronFirewallPolicy nn = (NeutronFirewallPolicy) conf;
- firewallPolicyDB.put(nn.getFirewallPolicyUUID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(firewallPolicyDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
-
}
\ No newline at end of file
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallRule;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
+
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-public class NeutronFirewallRuleInterface implements INeutronFirewallRuleCRUD, IConfigurationContainerAware, IObjectReader {
+public class NeutronFirewallRuleInterface implements INeutronFirewallRuleCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronFirewallRuleInterface.class);
- private static final String FILE_NAME ="neutron.firewallrules.conf";
- private String containerName = null;
-
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronFirewallRule> firewallRuleDB;
-
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron Firewall Rule");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronFirewallRules",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron Firewall Rule - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron Firewall Rule already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron Firewall Rule");
- }
-
- @SuppressWarnings({ "unchecked" })
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron Firewall Rule");
- firewallRuleDB = (ConcurrentMap<String, NeutronFirewallRule>) clusterContainerService
- .getCache("neutronFirewallRules");
- if (firewallRuleDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron Firewall Rule");
- }
- logger.debug("Cache was successfully retrieved for Neutron Firewall Rule");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for HostTracker");
- clusterContainerService.destroyCache("neutronFirewallRules");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- *
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
+ private ConcurrentMap<String, NeutronFirewallRule> firewallRuleDB = new ConcurrentHashMap<String, NeutronFirewallRule>();
// this method uses reflection to update an object from it's delta.
return !neutronFirewallRuleExists(firewallRuleUUID);
}
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronFirewallRule nn = (NeutronFirewallRule) conf;
- firewallRuleDB.put(nn.getFirewallRuleUUID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(firewallRuleDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
-
}
\ No newline at end of file
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP;
import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronFloatingIPInterface implements INeutronFloatingIPCRUD, IConfigurationContainerAware,
- IObjectReader {
+public class NeutronFloatingIPInterface implements INeutronFloatingIPCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronFloatingIPInterface.class);
- private static final String FILE_NAME = "neutron.floatingip.conf";
- private String containerName = null;
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronFloatingIP> floatingIPDB;
-
- // methods needed for creating caches
-
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- this.clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (this.clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- this.clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- this.configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- this.configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron FloatingIPs");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronFloatingIPs",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for NeutronFloatingIps");
- }
-
- @SuppressWarnings({ "unchecked" })
- private void retrieveCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron FloatingIPs");
- floatingIPDB = (ConcurrentMap<String, NeutronFloatingIP>) this.clusterContainerService
- .getCache("neutronFloatingIPs");
- if (floatingIPDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron FloatingIPs");
- }
- logger.debug("Cache was successfully retrieved for Neutron FloatingIPs");
- }
-
- private void destroyCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for HostTracker");
- this.clusterContainerService.destroyCache("neutronFloatingIPs");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- *
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
+ private ConcurrentMap<String, NeutronFloatingIP> floatingIPDB = new ConcurrentHashMap<String, NeutronFloatingIP>();
// this method uses reflection to update an object from it's delta.
target.setFixedIPAddress(delta.getFixedIPAddress());
return true;
}
-
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronFloatingIP nfIP = (NeutronFloatingIP) conf;
- floatingIPDB.put(nfIP.getID(), nfIP);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(floatingIPDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerHealthMonitor;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-public class NeutronLoadBalancerHealthMonitorInterface implements INeutronLoadBalancerHealthMonitorCRUD, IConfigurationContainerAware,
- IObjectReader {
+public class NeutronLoadBalancerHealthMonitorInterface implements INeutronLoadBalancerHealthMonitorCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerHealthMonitorInterface.class);
- private static final String FILE_NAME = "neutron.loadBalancerHealthMonitor.conf";
- private String containerName = null;
+ private ConcurrentMap<String, NeutronLoadBalancerHealthMonitor> loadBalancerHealthMonitorDB = new ConcurrentHashMap<String, NeutronLoadBalancerHealthMonitor>();
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronLoadBalancerHealthMonitor> loadBalancerHealthMonitorDB;
-
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron LoadBalancerHealthMonitor");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronLoadBalancerHealthMonitors",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron LoadBalancerHealthMonitor - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron LoadBalancerHealthMonitor already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron LoadBalancerHealthMonitor");
- }
-
- @SuppressWarnings ({"unchecked"})
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron LoadBalancerHealthMonitor");
- loadBalancerHealthMonitorDB = (ConcurrentMap<String, NeutronLoadBalancerHealthMonitor>) clusterContainerService
- .getCache("neutronLoadBalancerHealthMonitors");
- if (loadBalancerHealthMonitorDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron LoadBalancerHealthMonitor");
- }
- logger.debug("Cache was successfully retrieved for Neutron LoadBalancerHealthMonitor");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for LoadBalancerHealthMonitor");
- clusterContainerService.destroyCache("neutronLoadBalancerHealthMonitors");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- */
- void stop() {
- }
// this method uses reflection to update an object from it's delta.
public boolean neutronLoadBalancerHealthMonitorInUse(String loadBalancerHealthMonitorUUID) {
return !neutronLoadBalancerHealthMonitorExists(loadBalancerHealthMonitorUUID);
}
-
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronLoadBalancerHealthMonitor nn = (NeutronLoadBalancerHealthMonitor) conf;
- loadBalancerHealthMonitorDB.put(nn.getLoadBalancerHealthMonitorID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(loadBalancerHealthMonitorDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-public class NeutronLoadBalancerInterface implements INeutronLoadBalancerCRUD, IConfigurationContainerAware,
- IObjectReader {
+public class NeutronLoadBalancerInterface implements INeutronLoadBalancerCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerInterface.class);
- private static final String FILE_NAME = "neutron.loadBalancer.conf";
- private String containerName = null;
+ private ConcurrentMap<String, NeutronLoadBalancer> loadBalancerDB = new ConcurrentHashMap<String, NeutronLoadBalancer>();
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronLoadBalancer> loadBalancerDB;
-
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron LoadBalancer");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronLoadBalancers",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron LoadBalancer - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron LoadBalancer already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron LoadBalancer");
- }
-
- @SuppressWarnings ({"unchecked"})
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron LoadBalancer");
- loadBalancerDB = (ConcurrentMap<String, NeutronLoadBalancer>) clusterContainerService
- .getCache("neutronLoadBalancers");
- if (loadBalancerDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron LoadBalancer");
- }
- logger.debug("Cache was successfully retrieved for Neutron LoadBalancer");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for LoadBalancer");
- clusterContainerService.destroyCache("neutronLoadBalancers");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- */
- void stop() {
- }
// this method uses reflection to update an object from it's delta.
return !neutronLoadBalancerExists(loadBalancerUUID);
}
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronLoadBalancer nn = (NeutronLoadBalancer) conf;
- loadBalancerDB.put(nn.getLoadBalancerID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(loadBalancerDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerListener;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-public class NeutronLoadBalancerListenerInterface implements INeutronLoadBalancerListenerCRUD, IConfigurationContainerAware,
- IObjectReader {
+public class NeutronLoadBalancerListenerInterface implements INeutronLoadBalancerListenerCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerListenerInterface.class);
- private static final String FILE_NAME = "neutron.loadBalancerListener.conf";
- private String containerName = null;
+ private ConcurrentMap<String, NeutronLoadBalancerListener> loadBalancerListenerDB = new ConcurrentHashMap<String, NeutronLoadBalancerListener>();
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronLoadBalancerListener> loadBalancerListenerDB;
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron LoadBalancerListener");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronLoadBalancerListeners",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron LoadBalancerListener - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron LoadBalancerListener already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron LoadBalancerListener");
- }
-
- @SuppressWarnings ({"unchecked"})
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron LoadBalancerListener");
- loadBalancerListenerDB = (ConcurrentMap<String, NeutronLoadBalancerListener>) clusterContainerService
- .getCache("neutronLoadBalancerListeners");
- if (loadBalancerListenerDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron LoadBalancerListener");
- }
- logger.debug("Cache was successfully retrieved for Neutron LoadBalancerListener");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for LoadBalancerListener");
- clusterContainerService.destroyCache("neutronLoadBalancerListeners");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- */
- void stop() {
- }
// this method uses reflection to update an object from it's delta.
public boolean neutronLoadBalancerListenerInUse(String loadBalancerListenerUUID) {
return !neutronLoadBalancerListenerExists(loadBalancerListenerUUID);
}
-
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronLoadBalancerListener nn = (NeutronLoadBalancerListener) conf;
- loadBalancerListenerDB.put(nn.getLoadBalancerListenerID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(loadBalancerListenerDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-public class NeutronLoadBalancerPoolInterface implements INeutronLoadBalancerPoolCRUD, IConfigurationContainerAware,
- IObjectReader {
+public class NeutronLoadBalancerPoolInterface implements INeutronLoadBalancerPoolCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerPoolInterface.class);
- private static final String FILE_NAME = "neutron.loadBalancerPool.conf";
- private String containerName = null;
+ private ConcurrentMap<String, NeutronLoadBalancerPool> loadBalancerPoolDB = new ConcurrentHashMap<String, NeutronLoadBalancerPool>();
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronLoadBalancerPool> loadBalancerPoolDB;
-
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron LoadBalancerPool");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronLoadBalancerPools",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron LoadBalancerPool - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron LoadBalancerPool already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron LoadBalancerPool");
- }
-
- @SuppressWarnings ({"unchecked"})
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron LoadBalancerPool");
- loadBalancerPoolDB = (ConcurrentMap<String, NeutronLoadBalancerPool>) clusterContainerService
- .getCache("neutronLoadBalancerPools");
- if (loadBalancerPoolDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron LoadBalancerPool");
- }
- logger.debug("Cache was successfully retrieved for Neutron LoadBalancerPool");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for LoadBalancerPool");
- clusterContainerService.destroyCache("neutronLoadBalancerPools");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- */
- void stop() {
- }
// this method uses reflection to update an object from it's delta.
return !neutronLoadBalancerPoolExists(loadBalancerPoolUUID);
}
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronLoadBalancerPool nn = (NeutronLoadBalancerPool) conf;
- loadBalancerPoolDB.put(nn.getLoadBalancerPoolID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(loadBalancerPoolDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolMemberCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class NeutronLoadBalancerPoolMemberInterface
- implements INeutronLoadBalancerPoolMemberCRUD, IConfigurationContainerAware,
- IObjectReader {
+ implements INeutronLoadBalancerPoolMemberCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancerPoolMemberInterface.class);
- private static final String FILE_NAME = "neutron.loadBalancerPoolMember.conf";
- private String containerName = null;
+ private ConcurrentMap<String, NeutronLoadBalancerPoolMember> loadBalancerPoolMemberDB = new ConcurrentHashMap<String, NeutronLoadBalancerPoolMember>();
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronLoadBalancerPoolMember> loadBalancerPoolMemberDB;
-
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron LoadBalancerPoolMember");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronLoadBalancerPoolMembers",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch(CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron LoadBalancerPoolMember - check cache mode");
- } catch(CacheExistException cce) {
- logger.error("Cache for Neutron LoadBalancerPoolMember already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron LoadBalancerPoolMember");
- }
-
- @SuppressWarnings({"unchecked"})
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron LoadBalancerPoolMember");
- loadBalancerPoolMemberDB = (ConcurrentMap<String, NeutronLoadBalancerPoolMember>) clusterContainerService
- .getCache("neutronLoadBalancerPoolMembers");
- if (loadBalancerPoolMemberDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron LoadBalancerPoolMember");
- }
- logger.debug("Cache was successfully retrieved for Neutron LoadBalancerPoolMember");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for HostTracker");
- clusterContainerService.destroyCache("neutronLoadBalancerPoolMembers");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- */
- void stop() {
- }
// this method uses reflection to update an object from it's delta.
public boolean neutronLoadBalancerPoolMemberInUse(String loadBalancerPoolMemberID) {
return !neutronLoadBalancerPoolMemberExists(loadBalancerPoolMemberID);
}
-
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronLoadBalancerPoolMember nn = (NeutronLoadBalancerPoolMember) conf;
- loadBalancerPoolMemberDB.put(nn.getPoolMemberID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(
- new ArrayList<ConfigurationObject>(loadBalancerPoolMemberDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronNetworkInterface implements INeutronNetworkCRUD, IConfigurationContainerAware,
- IObjectReader {
+public class NeutronNetworkInterface implements INeutronNetworkCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronNetworkInterface.class);
- private static final String FILE_NAME ="neutron.network.conf";
- private String containerName = null;
+ private ConcurrentMap<String, NeutronNetwork> networkDB = new ConcurrentHashMap<String, NeutronNetwork>();
- private ConcurrentMap<String, NeutronNetwork> networkDB;
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- this.clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (this.clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- this.clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- this.configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- this.configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron Networks");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronNetworks",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron Networks - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron Networks already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron Networks");
- }
-
- @SuppressWarnings({ "unchecked" })
- private void retrieveCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
- logger.debug("Retrieving cache for Neutron Networks");
- networkDB = (ConcurrentMap<String, NeutronNetwork>) this.clusterContainerService.getCache("neutronNetworks");
- if (networkDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron Networks");
- }
- logger.debug("Cache was successfully retrieved for Neutron Networks");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- *
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- private void destroyCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for Neutron Networks");
- this.clusterContainerService.destroyCache("Neutron Networks");
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
// this method uses reflection to update an object from it's delta.
}
return false;
}
-
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronNetwork nn = (NeutronNetwork) conf;
- networkDB.put(nn.getID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(networkDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
-
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronPortInterface implements INeutronPortCRUD, IConfigurationContainerAware,
- IObjectReader {
+public class NeutronPortInterface implements INeutronPortCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronPortInterface.class);
- private static final String FILE_NAME ="neutron.port.conf";
- private String containerName = null;
+ private ConcurrentMap<String, NeutronPort> portDB = new ConcurrentHashMap<String, NeutronPort>();
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronPort> portDB;
- // methods needed for creating caches
-
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for OpenDOVE");
- try {
- // neutron caches
- clusterContainerService.createCache("neutronPorts",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for OpenDOVE - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for OpenDOVE already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for OpenDOVE");
- }
-
- @SuppressWarnings({ "unchecked" })
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron Ports");
- portDB = (ConcurrentMap<String, NeutronPort>) clusterContainerService
- .getCache("neutronPorts");
- if (portDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron Ports");
- }
- logger.debug("Cache was successfully retrieved for Neutron Ports");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for HostTracker");
- clusterContainerService.destroyCache("neutronPorts");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- *
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", containerName);
- } else {
- // In the Global instance case the containerName is empty
- containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
// this method uses reflection to update an object from it's delta.
}
return null;
}
-
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronPort nn = (NeutronPort) conf;
- portDB.put(nn.getID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(portDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
-
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronRouterInterface implements INeutronRouterCRUD, IConfigurationContainerAware,
- IObjectReader {
+public class NeutronRouterInterface implements INeutronRouterCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronRouterInterface.class);
- private static final String FILE_NAME ="neutron.router.conf";
- private String containerName = null;
-
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronRouter> routerDB;
+ private ConcurrentMap<String, NeutronRouter> routerDB = new ConcurrentHashMap<String, NeutronRouter>();
// methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- this.clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (this.clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- this.clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- this.configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- this.configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron Routers");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronRouters",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron Routers - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron Routers already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron Routers");
- }
-
- @SuppressWarnings({ "unchecked" })
- private void retrieveCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron Routers");
- routerDB = (ConcurrentMap<String, NeutronRouter>) this.clusterContainerService
- .getCache("neutronRouters");
- if (routerDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron Routers");
- }
- logger.debug("Cache was successfully retrieved for Neutron Routers");
- }
-
- private void destroyCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for HostTracker");
- this.clusterContainerService.destroyCache("neutronRouters");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- *
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
// this method uses reflection to update an object from it's delta.
return (target.getInterfaces().size() > 0);
}
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronRouter nr = (NeutronRouter) conf;
- routerDB.put(nr.getID(), nr);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(routerDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
-
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
+
import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityGroup;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronSecurityGroupInterface implements INeutronSecurityGroupCRUD, IConfigurationContainerAware, IObjectReader {
+public class NeutronSecurityGroupInterface implements INeutronSecurityGroupCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronSecurityGroupInterface.class);
- private static final String FILE_NAME ="neutron.securitygroup.conf";
- private String containerName = null;
-
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronSecurityGroup> securityGroupDB;
-
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
+ private ConcurrentMap<String, NeutronSecurityGroup> securityGroupDB = new ConcurrentHashMap<String, NeutronSecurityGroup>();
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron Security Groups");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronSecurityGroups",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron Security Groups - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron Security Groups already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron Security Groups");
- }
-
- @SuppressWarnings({ "unchecked" })
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron Security Groups");
- securityGroupDB = (ConcurrentMap<String, NeutronSecurityGroup>) clusterContainerService
- .getCache("neutronSecurityGroups");
- if (securityGroupDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron Security Groups");
- }
- logger.debug("Cache was successfully retrieved for Neutron Security Groups");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for Neutron Security Groups");
- clusterContainerService.destroyCache("neutronSecurityGroups");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- *
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
// this method uses reflection to update an object from it's delta.
return !neutronSecurityGroupExists(securityGroupUUID);
}
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronSecurityGroup nn = (NeutronSecurityGroup) conf;
- securityGroupDB.put(nn.getSecurityGroupUUID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(securityGroupDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
-
}
\ No newline at end of file
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityRule;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronSecurityRuleInterface implements INeutronSecurityRuleCRUD, IConfigurationContainerAware, IObjectReader {
+public class NeutronSecurityRuleInterface implements INeutronSecurityRuleCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronSecurityRuleInterface.class);
- private static final String FILE_NAME = "neutron.securityrule.conf";
- private String containerName = null;
-
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronSecurityRule> securityRuleDB;
-
- // methods needed for creating caches
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron Security Rules");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronSecurityRules",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron Security Rules - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron Security Rules already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron Security Rules");
- }
-
- @SuppressWarnings({"unchecked"})
- private void retrieveCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron Security Rules");
- securityRuleDB = (ConcurrentMap<String, NeutronSecurityRule>) clusterContainerService
- .getCache("neutronSecurityRules");
- if (securityRuleDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron Security Rules");
- }
- logger.debug("Cache was successfully retrieved for Neutron Security Rules");
- }
-
- private void destroyCache() {
- if (clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for Neutron Security Rules");
- clusterContainerService.destroyCache("neutronSecurityRules");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- */
- void stop() {
- }
+ private ConcurrentMap<String, NeutronSecurityRule> securityRuleDB = new ConcurrentHashMap<String, NeutronSecurityRule>();
// this method uses reflection to update an object from it's delta.
private boolean overwrite(Object target, Object delta) {
return !neutronSecurityRuleExists(securityRuleUUID);
}
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronSecurityRule nn = (NeutronSecurityRule) conf;
- securityRuleDB.put(nn.getSecurityRuleUUID(), nn);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(securityRuleDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
-
}
\ No newline at end of file
package org.opendaylight.controller.networkconfig.neutron.implementation;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.CacheConfigException;
-import org.opendaylight.controller.clustering.services.CacheExistException;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.clustering.services.IClusterServices;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-import org.opendaylight.controller.configuration.IConfigurationContainerService;
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronSubnetInterface implements INeutronSubnetCRUD, IConfigurationContainerAware,
- IObjectReader {
+public class NeutronSubnetInterface implements INeutronSubnetCRUD {
private static final Logger logger = LoggerFactory.getLogger(NeutronSubnetInterface.class);
- private static final String FILE_NAME ="neutron.subnet.conf";
+ private ConcurrentMap<String, NeutronSubnet> subnetDB = new ConcurrentHashMap<String, NeutronSubnet>();
- private String containerName = null;
- private IClusterContainerServices clusterContainerService = null;
- private IConfigurationContainerService configurationService;
- private ConcurrentMap<String, NeutronSubnet> subnetDB;
-
- // methods needed for creating caches
-
- void setClusterContainerService(IClusterContainerServices s) {
- logger.debug("Cluster Service set");
- this.clusterContainerService = s;
- }
-
- void unsetClusterContainerService(IClusterContainerServices s) {
- if (this.clusterContainerService == s) {
- logger.debug("Cluster Service removed!");
- this.clusterContainerService = null;
- }
- }
-
- public void setConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service set: {}", service);
- this.configurationService = service;
- }
-
- public void unsetConfigurationContainerService(IConfigurationContainerService service) {
- logger.trace("Configuration service removed: {}", service);
- this.configurationService = null;
- }
-
- private void allocateCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't create cache");
- return;
- }
- logger.debug("Creating Cache for Neutron Subnets");
- try {
- // neutron caches
- this.clusterContainerService.createCache("neutronSubnets",
- EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL));
- } catch (CacheConfigException cce) {
- logger.error("Cache couldn't be created for Neutron Subnets - check cache mode");
- } catch (CacheExistException cce) {
- logger.error("Cache for Neutron Subnets already exists, destroy and recreate");
- }
- logger.debug("Cache successfully created for Neutron Subnets");
- }
-
- @SuppressWarnings({ "unchecked" })
- private void retrieveCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterContainerService, can't retrieve cache");
- return;
- }
-
- logger.debug("Retrieving cache for Neutron Subnets");
- subnetDB = (ConcurrentMap<String, NeutronSubnet>) this.clusterContainerService
- .getCache("neutronSubnets");
- if (subnetDB == null) {
- logger.error("Cache couldn't be retrieved for Neutron Subnets");
- }
- logger.debug("Cache was successfully retrieved for Neutron Subnets");
- }
-
- private void destroyCache() {
- if (this.clusterContainerService == null) {
- logger.error("un-initialized clusterMger, can't destroy cache");
- return;
- }
- logger.debug("Destroying Cache for HostTracker");
- this.clusterContainerService.destroyCache("neutronSubnets");
- }
-
- private void startUp() {
- allocateCache();
- retrieveCache();
- loadConfiguration();
- }
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- *
- */
- void init(Component c) {
- Dictionary<?, ?> props = c.getServiceProperties();
- if (props != null) {
- this.containerName = (String) props.get("containerName");
- logger.debug("Running containerName: {}", this.containerName);
- } else {
- // In the Global instance case the containerName is empty
- this.containerName = "";
- }
- startUp();
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- destroyCache();
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
// this method uses reflection to update an object from it's delta.
NeutronSubnet target = subnetDB.get(subnetUUID);
return (target.getPortsInSubnet().size() > 0);
}
-
- private void loadConfiguration() {
- for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, FILE_NAME)) {
- NeutronSubnet ns = (NeutronSubnet) conf;
- subnetDB.put(ns.getID(), ns);
- }
- }
-
- @Override
- public Status saveConfiguration() {
- return configurationService.persistConfiguration(new ArrayList<ConfigurationObject>(subnetDB.values()),
- FILE_NAME);
- }
-
- @Override
- public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
- return ois.readObject();
- }
-
}
<artifactId>jersey-core</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.enunciate</groupId>
- <artifactId>enunciate-core-annotations</artifactId>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-server</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>org.eclipse.persistence.antlr</artifactId>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-servlet</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>org.eclipse.persistence.core</artifactId>
+ <groupId>org.codehaus.enunciate</groupId>
+ <artifactId>enunciate-core-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</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>
</dependencies>
<build>
<extensions>true</extensions>
<configuration>
<instructions>
- <Import-Package>org.opendaylight.controller.sal.utils,
- org.opendaylight.controller.containermanager,
- org.opendaylight.controller.northbound.commons,
- org.opendaylight.controller.northbound.commons.exception,
- org.opendaylight.controller.northbound.commons.utils,
- org.opendaylight.controller.networkconfig.neutron,
+ <Import-Package>org.opendaylight.controller.networkconfig.neutron,
org.eclipse.persistence.jaxb.rs,
com.sun.jersey.spi.container.servlet,
javax.ws.rs,
javax.xml.bind.annotation,
javax.xml.bind,
org.slf4j,
+ org.osgi.framework,
!org.codehaus.enunciate.jaxrs</Import-Package>
<Web-ContextPath>/controller/nb/v2/neutron</Web-ContextPath>
</instructions>
--- /dev/null
+/*
+ * Copyright (c) 2013 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+/**
+ * Status Code 400 (Bad Request)
+ *
+ * The request could not be understood by the server due to malformed syntax.
+ * The client SHOULD NOT repeat the request without modifications.
+ */
+public class BadRequestException extends WebApplicationException {
+ private static final long serialVersionUID = 1L;
+
+ public BadRequestException(String string) {
+ super(Response.status(Response.Status.BAD_REQUEST).entity(string).type(MediaType.TEXT_PLAIN).build());
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Status Code 500 (Internal Server Error)
+ *
+ * The server encountered an unexpected condition which prevented
+ * it from fulfilling the request.
+ *
+ *
+ *
+ */
+public class InternalServerErrorException extends WebApplicationException {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor for the INTERNAL_SERVER_ERROR custom handler
+ *
+ * @param string Error message to specify further the
+ * INTERNAL_SERVER_ERROR response
+ *
+ */
+ public InternalServerErrorException(String string) {
+ super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
+ string).type(MediaType.TEXT_PLAIN).build());
+ }
+}
import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
import org.opendaylight.controller.networkconfig.neutron.NeutronFirewall;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
throw new BadRequestException("Firewall UUID already exists");
}
firewallInterface.addNeutronFirewall(singleton);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFirewallAware service = (INeutronFirewallAware) instance;
List<NeutronFirewall> bulk = input.getBulk();
Iterator<NeutronFirewall> i = bulk.iterator();
HashMap<String, NeutronFirewall> testMap = new HashMap<String, NeutronFirewall>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this);
while (i.hasNext()) {
NeutronFirewall test = i.next();
throw new BadRequestException("Attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFirewallAware service = (INeutronFirewallAware) instance;
return Response.status(409).build();
}
NeutronFirewall singleton = firewallInterface.getNeutronFirewall(firewallUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFirewallAware service = (INeutronFirewallAware) instance;
package org.opendaylight.controller.networkconfig.neutron.northbound;
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallPolicy;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallPolicy;
/**
* Neutron Northbound REST APIs for Firewall Policies.<br>
}
firewallPolicyInterface.addNeutronFirewallPolicy(singleton);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallPolicyAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance;
List<NeutronFirewallPolicy> bulk = input.getBulk();
Iterator<NeutronFirewallPolicy> i = bulk.iterator();
HashMap<String, NeutronFirewallPolicy> testMap = new HashMap<String, NeutronFirewallPolicy>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallPolicyAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this);
while (i.hasNext()) {
NeutronFirewallPolicy test = i.next();
throw new BadRequestException("Attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallPolicyAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance;
return Response.status(409).build();
}
NeutronFirewallPolicy singleton = firewallPolicyInterface.getNeutronFirewallPolicy(firewallPolicyUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallPolicyAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFirewallPolicyAware service = (INeutronFirewallPolicyAware) instance;
package org.opendaylight.controller.networkconfig.neutron.northbound;
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallRule;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallPolicyCRUD;
+import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallRuleCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronFirewallRule;
/**
* Neutron Northbound REST APIs for Firewall Rule.<br>
throw new BadRequestException("Firewall Rule UUID already exists");
}
firewallRuleInterface.addNeutronFirewallRule(singleton);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallRuleAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance;
List<NeutronFirewallRule> bulk = input.getBulk();
Iterator<NeutronFirewallRule> i = bulk.iterator();
HashMap<String, NeutronFirewallRule> testMap = new HashMap<String, NeutronFirewallRule>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallRuleAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this);
while (i.hasNext()) {
NeutronFirewallRule test = i.next();
throw new BadRequestException("Attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallRuleAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance;
return Response.status(409).build();
}
NeutronFirewallRule singleton = firewallRuleInterface.getNeutronFirewallRule(firewallRuleUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallRuleAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFirewallRuleAware service = (INeutronFirewallRuleAware) instance;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
/**
* Neutron Northbound REST APIs.<br>
throw new ResourceConflictException("fixed IP is in use.");
singleton.setFixedIPAddress(fixedIP);
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFloatingIPAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance;
singleton.setFixedIPAddress(fixedIP);
}
NeutronFloatingIP target = floatingIPInterface.getFloatingIP(floatingipUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFloatingIPAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance;
throw new ResourceNotFoundException("Floating IP UUID doesn't exist.");
// TODO: need to undo port association if it exists
NeutronFloatingIP singleton = floatingIPInterface.getFloatingIP(floatingipUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronFloatingIPAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance;
package org.opendaylight.controller.networkconfig.neutron.northbound;
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerHealthMonitor;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerHealthMonitorCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerHealthMonitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Neutron Northbound REST APIs for Load Balancer HealthMonitor.<br>
}
loadBalancerHealthMonitorInterface.addNeutronLoadBalancerHealthMonitor(singleton);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerHealthMonitorAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance;
List<NeutronLoadBalancerHealthMonitor> bulk = input.getBulk();
Iterator<NeutronLoadBalancerHealthMonitor> i = bulk.iterator();
HashMap<String, NeutronLoadBalancerHealthMonitor> testMap = new HashMap<String, NeutronLoadBalancerHealthMonitor>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerHealthMonitorAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this);
while (i.hasNext()) {
NeutronLoadBalancerHealthMonitor test = i.next();
throw new BadRequestException("Attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerHealthMonitorAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance;
return Response.status(409).build();
}
NeutronLoadBalancerHealthMonitor singleton = loadBalancerHealthMonitorInterface.getNeutronLoadBalancerHealthMonitor(loadBalancerHealthMonitorID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerHealthMonitorAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerHealthMonitorAware service = (INeutronLoadBalancerHealthMonitorAware) instance;
package org.opendaylight.controller.networkconfig.neutron.northbound;
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerListener;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerListenerCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerListener;
/**
* Neutron Northbound REST APIs for LoadBalancerListener Policies.<br>
}
loadBalancerListenerInterface.addNeutronLoadBalancerListener(singleton);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerListenerAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance;
List<NeutronLoadBalancerListener> bulk = input.getBulk();
Iterator<NeutronLoadBalancerListener> i = bulk.iterator();
HashMap<String, NeutronLoadBalancerListener> testMap = new HashMap<String, NeutronLoadBalancerListener>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerListenerAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this);
while (i.hasNext()) {
NeutronLoadBalancerListener test = i.next();
throw new BadRequestException("Attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerListenerAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance;
return Response.status(409).build();
}
NeutronLoadBalancerListener singleton = loadBalancerListenerInterface.getNeutronLoadBalancerListener(loadBalancerListenerID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerListenerAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerListenerAware service = (INeutronLoadBalancerListenerAware) instance;
package org.opendaylight.controller.networkconfig.neutron.northbound;
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancer;
/**
* Neutron Northbound REST APIs for LoadBalancers.<br>
if (loadBalancerInterface.neutronLoadBalancerExists(singleton.getLoadBalancerID())) {
throw new BadRequestException("LoadBalancer UUID already exists");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance;
List<NeutronLoadBalancer> bulk = input.getBulk();
Iterator<NeutronLoadBalancer> i = bulk.iterator();
HashMap<String, NeutronLoadBalancer> testMap = new HashMap<String, NeutronLoadBalancer>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this);
while (i.hasNext()) {
NeutronLoadBalancer test = i.next();
throw new BadRequestException("Attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance;
return Response.status(409).build();
}
NeutronLoadBalancer singleton = loadBalancerInterface.getNeutronLoadBalancer(loadBalancerID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerAware service = (INeutronLoadBalancerAware) instance;
package org.opendaylight.controller.networkconfig.neutron.northbound;
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolMemberAware;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolMemberAware;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
@Path("/pools/{loadBalancerPoolUUID}/members")
public class NeutronLoadBalancerPoolMembersNorthbound {
throw new BadRequestException("LoadBalancerPoolMember UUID already exists");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolMemberAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerPoolMemberAware service = (INeutronLoadBalancerPoolMemberAware) instance;
List<NeutronLoadBalancerPoolMember> bulk = input.getBulk();
Iterator<NeutronLoadBalancerPoolMember> i = bulk.iterator();
HashMap<String, NeutronLoadBalancerPoolMember> testMap = new HashMap<String, NeutronLoadBalancerPoolMember>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolMemberAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this);
while (i.hasNext()) {
NeutronLoadBalancerPoolMember test = i.next();
String loadBalancerPoolMemberUUID = test.getPoolMemberID();
if (singleton == null)
throw new BadRequestException("LoadBalancerPoolMember UUID does not exist.");
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolMemberAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerPoolMemberAware service = (INeutronLoadBalancerPoolMemberAware) instance;
package org.opendaylight.controller.networkconfig.neutron.northbound;
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolAware;
-import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD;
-import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
-import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+import org.codehaus.enunciate.jaxrs.ResponseCode;
+import org.codehaus.enunciate.jaxrs.StatusCodes;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronLoadBalancerPoolCRUD;
+import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPool;
+import org.opendaylight.controller.networkconfig.neutron.NeutronLoadBalancerPoolMember;
/**
* Neutron Northbound REST APIs for LoadBalancerPool Policies.<br>
if (loadBalancerPoolInterface.neutronLoadBalancerPoolExists(singleton.getLoadBalancerPoolID())) {
throw new BadRequestException("LoadBalancerPool UUID already exists");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolAware.class, this, null);
+
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance;
List<NeutronLoadBalancerPool> bulk = input.getBulk();
Iterator<NeutronLoadBalancerPool> i = bulk.iterator();
HashMap<String, NeutronLoadBalancerPool> testMap = new HashMap<String, NeutronLoadBalancerPool>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this);
while (i.hasNext()) {
NeutronLoadBalancerPool test = i.next();
throw new BadRequestException("Attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance;
return Response.status(409).build();
}
NeutronLoadBalancerPool singleton = loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronLoadBalancerPoolAware service = (INeutronLoadBalancerPoolAware) instance;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
import org.codehaus.enunciate.jaxrs.ResponseCode;
import org.codehaus.enunciate.jaxrs.StatusCodes;
import org.codehaus.enunciate.jaxrs.TypeHint;
-
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkAware;
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
/**
* Neutron Northbound REST APIs for Network.<br>
throw new BadRequestException("network UUID already exists");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronNetworkAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronNetworkAware service = (INeutronNetworkAware) instance;
List<NeutronNetwork> bulk = input.getBulk();
Iterator<NeutronNetwork> i = bulk.iterator();
HashMap<String, NeutronNetwork> testMap = new HashMap<String, NeutronNetwork>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronNetworkAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this);
while (i.hasNext()) {
NeutronNetwork test = i.next();
throw new BadRequestException("attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronNetworkAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronNetworkAware service = (INeutronNetworkAware) instance;
}
NeutronNetwork singleton = networkInterface.getNetwork(netUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronNetworkAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronNetworkAware service = (INeutronNetworkAware) instance;
import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
/**
* Neutron Northbound REST APIs.<br>
}
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronPortAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronPortAware service = (INeutronPortAware) instance;
List<NeutronPort> bulk = input.getBulk();
Iterator<NeutronPort> i = bulk.iterator();
HashMap<String, NeutronPort> testMap = new HashMap<String, NeutronPort>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronPortAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this);
while (i.hasNext()) {
NeutronPort test = i.next();
throw new BadRequestException("attribute change blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronPortAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronPortAware service = (INeutronPortAware) instance;
Response.status(403).build();
}
NeutronPort singleton = portInterface.getPort(portUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronPortAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronPortAware service = (INeutronPortAware) instance;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;
import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
/**
if (!externNetwork.isRouterExternal())
throw new BadRequestException("External Network Pointer isn't marked as router:external");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
singleton.getStatus() != null)
throw new BadRequestException("Request attribute change not allowed");
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
if (routerInterface.routerInUse(routerUUID))
throw new ResourceConflictException("Router UUID in Use");
NeutronRouter singleton = routerInterface.getRouter(routerUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
if (targetPort.getDeviceID() != null ||
targetPort.getDeviceOwner() != null)
throw new ResourceConflictException("Target Port already allocated");
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
input.setID(target.getID());
input.setTenantID(target.getTenantID());
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
port.setDeviceID(null);
port.setDeviceOwner(null);
target.removeInterface(input.getPortUUID());
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
service.neutronRouterInterfaceDetached(target, input);
throw new ResourceConflictException("Target Port IP not in Target Subnet");
input.setID(target.getID());
input.setTenantID(target.getTenantID());
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityGroup;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
throw new BadRequestException("Security Group UUID already exists");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityGroupAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance;
List<NeutronSecurityGroup> bulk = input.getBulk();
Iterator<NeutronSecurityGroup> i = bulk.iterator();
HashMap<String, NeutronSecurityGroup> testMap = new HashMap<String, NeutronSecurityGroup>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityGroupAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this);
while (i.hasNext()) {
NeutronSecurityGroup test = i.next();
throw new BadRequestException("Attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityGroupAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance;
return Response.status(409).build();
}
NeutronSecurityGroup singleton = securityGroupInterface.getNeutronSecurityGroup(securityGroupUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityGroupAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityRule;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
if (securityRuleInterface.neutronSecurityRuleExists(singleton.getSecurityRuleUUID())) {
throw new BadRequestException("Security Rule UUID already exists");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityRuleAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance;
List<NeutronSecurityRule> bulk = input.getBulk();
Iterator<NeutronSecurityRule> i = bulk.iterator();
HashMap<String, NeutronSecurityRule> testMap = new HashMap<String, NeutronSecurityRule>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityRuleAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this);
while (i.hasNext()) {
NeutronSecurityRule test = i.next();
throw new BadRequestException("Attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityRuleAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance;
return Response.status(409).build();
}
NeutronSecurityRule singleton = securityRuleInterface.getNeutronSecurityRule(securityRuleUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityRuleAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronSecurityRuleAware service = (INeutronSecurityRuleAware) instance;
import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.northbound.commons.RestMessages;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import org.opendaylight.controller.northbound.commons.exception.InternalServerErrorException;
-import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
/**
* Neutron Northbound REST APIs for Subnets.<br>
if (singleton.gatewayIP_Pool_overlap()) {
throw new ResourceConflictException("IP pool overlaps with gateway");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSubnetAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronSubnetAware service = (INeutronSubnetAware) instance;
List<NeutronSubnet> bulk = input.getBulk();
Iterator<NeutronSubnet> i = bulk.iterator();
HashMap<String, NeutronSubnet> testMap = new HashMap<String, NeutronSubnet>();
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSubnetAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this);
while (i.hasNext()) {
NeutronSubnet test = i.next();
throw new BadRequestException("Attribute edit blocked by Neutron");
}
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSubnetAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronSubnetAware service = (INeutronSubnetAware) instance;
return Response.status(409).build();
}
NeutronSubnet singleton = subnetInterface.getSubnet(subnetUUID);
- Object[] instances = ServiceHelper.getGlobalInstances(INeutronSubnetAware.class, this, null);
+ Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this);
if (instances != null) {
for (Object instance : instances) {
INeutronSubnetAware service = (INeutronSubnetAware) instance;
--- /dev/null
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NeutronUtil {
+ private static final Logger logger = LoggerFactory
+ .getLogger(NeutronUtil.class);
+ public static Object[] getInstances(Class<?> clazz,Object bundle) {
+ Object instances[] = null;
+ try {
+ BundleContext bCtx = FrameworkUtil.getBundle(bundle.getClass())
+ .getBundleContext();
+
+ ServiceReference<?>[] services = null;
+ services = bCtx.getServiceReferences(clazz.getName(),
+ null);
+ if (services != null) {
+ instances = new Object[services.length];
+ for (int i = 0; i < services.length; i++) {
+ instances[i] = bCtx.getService(services[i]);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Instance reference is NULL");
+ }
+ return instances;
+ }
+}
import java.util.Comparator;
import java.util.List;
import javax.ws.rs.core.UriInfo;
+
import org.opendaylight.controller.networkconfig.neutron.INeutronObject;
import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
-import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
-import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
public class PaginatedRequestFactory {
private static final Comparator<INeutronObject> NEUTRON_OBJECT_COMPARATOR = new Comparator<INeutronObject>() {
--- /dev/null
+/*
+ * Copyright (c) 2013 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Status Code 409 (Conflict)
+ *
+ * The request could not be completed due to a conflict with the
+ * current state of the resource. This code is only allowed in
+ * situations where it is expected that the user might be able to
+ * resolve the conflict and resubmit the request. The response body
+ * SHOULD include enough information for the user to recognize the
+ * source of the conflict. Ideally, the response entity would include
+ * enough information for the user or user agent to fix the problem;
+ * however, that might not be possible and is not required.
+ *
+ *
+ *
+ */
+public class ResourceConflictException extends WebApplicationException {
+ private static final long serialVersionUID = 1L;
+
+ public ResourceConflictException(String string) {
+ super(Response.status(Response.Status.CONFLICT).entity(string).type(
+ MediaType.TEXT_PLAIN).build());
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Status Code 404 (Not Found)
+ *
+ * The server has not found anything matching the Request-URI.
+ * No indication is given of whether the condition is temporary or permanent.
+ * The 410 (Gone) status code SHOULD be used if the server knows,
+ * through some internally configurable mechanism, that an old resource
+ * is permanently unavailable and has no forwarding address.
+ * This status code is commonly used when the server does not wish to
+ * reveal exactly why the request has been refused, or when no other
+ * response is applicable.
+ *
+ *
+ *
+ */
+public class ResourceNotFoundException extends WebApplicationException {
+ private static final long serialVersionUID = 1L;
+
+ public ResourceNotFoundException(String string) {
+ super(Response.status(Response.Status.NOT_FOUND).entity(string).type(
+ MediaType.TEXT_PLAIN).build());
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+public enum RestMessages {
+ SUCCESS("Success"), NOCONTAINER("Container does not exist"), NOSUBNET("Subnet does not exist"), NOSTATICROUTE(
+ "Static Route does not exist"), NOHOST("Host does not exist"), NOFLOW("Flow does not exist"), NONODE(
+ "Node does not exist"), NOPOLICY("Policy does not exist"), NORESOURCE("Resource does not exist"), RESOURCECONFLICT(
+ "Operation failed due to Resource Conflict"), NODEFAULT("Container default is not a custom container"), DEFAULTDISABLED(
+ "Container(s) are configured. Container default is not operational"), NOTALLOWEDONDEFAULT(
+ "Container default is a static resource, no modification allowed on it"), UNKNOWNACTION("Unknown action"), INVALIDJSON(
+ "JSON message is invalid"), INVALIDADDRESS("Invalid InetAddress"), AVAILABLESOON(
+ "Resource is not implemented yet"), INTERNALERROR("Internal Error"), SERVICEUNAVAILABLE(
+ "Service is not available. Could be down for maintanence"), INVALIDDATA(
+ "Data is invalid or conflicts with URI");
+
+ private String message;
+
+ private RestMessages(String msg) {
+ message = msg;
+ }
+
+ @Override
+ public String toString() {
+ return message;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron.northbound;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Status Code 503 (Service Unavailable Error)
+ *
+ * The server is currently unable to handle the request due to a temporary
+ * overloading or maintenance of the server.
+ * The implication is that this is a temporary condition which will be alleviated
+ * after some delay.
+ *
+ *
+ */
+public class ServiceUnavailableException extends WebApplicationException {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor for the SERVICE_UNAVAILABLE custom handler
+ *
+ * @param string Error message to specify further the
+ * SERVICE_UNAVAILABLE response
+ *
+ */
+ public ServiceUnavailableException(String string) {
+ super(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(
+ string).type(MediaType.TEXT_PLAIN).build());
+ }
+}
<artifactId>commons-net</artifactId>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>clustering.services</artifactId>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>configuration</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
<build>
<extensions>true</extensions>
<configuration>
<instructions>
- <Import-Package>org.opendaylight.controller.configuration,
- org.opendaylight.controller.clustering.services,
- org.opendaylight.controller.sal.core,
- org.opendaylight.controller.sal.utils,
- org.apache.felix.dm,
- org.apache.commons.net.util,
- org.osgi.service.component,
- org.slf4j,
- javax.xml.bind.annotation</Import-Package>
+ <Import-Package>*</Import-Package>
</instructions>
<manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
</configuration>
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class NeutronCRUDInterfaces {
+ private static final Logger logger = LoggerFactory
+ .getLogger(NeutronCRUDInterfaces.class);
public static INeutronNetworkCRUD getINeutronNetworkCRUD(Object o) {
- INeutronNetworkCRUD answer = (INeutronNetworkCRUD) ServiceHelper.getGlobalInstance(INeutronNetworkCRUD.class, o);
+ INeutronNetworkCRUD answer = (INeutronNetworkCRUD) getInstances(INeutronNetworkCRUD.class, o);
return answer;
}
public static INeutronSubnetCRUD getINeutronSubnetCRUD(Object o) {
- INeutronSubnetCRUD answer = (INeutronSubnetCRUD) ServiceHelper.getGlobalInstance(INeutronSubnetCRUD.class, o);
+ INeutronSubnetCRUD answer = (INeutronSubnetCRUD) getInstances(INeutronSubnetCRUD.class, o);
return answer;
}
public static INeutronPortCRUD getINeutronPortCRUD(Object o) {
- INeutronPortCRUD answer = (INeutronPortCRUD) ServiceHelper.getGlobalInstance(INeutronPortCRUD.class, o);
+ INeutronPortCRUD answer = (INeutronPortCRUD) getInstances(INeutronPortCRUD.class, o);
return answer;
}
public static INeutronRouterCRUD getINeutronRouterCRUD(Object o) {
- INeutronRouterCRUD answer = (INeutronRouterCRUD) ServiceHelper.getGlobalInstance(INeutronRouterCRUD.class, o);
+ INeutronRouterCRUD answer = (INeutronRouterCRUD) getInstances(INeutronRouterCRUD.class, o);
return answer;
}
public static INeutronFloatingIPCRUD getINeutronFloatingIPCRUD(Object o) {
- INeutronFloatingIPCRUD answer = (INeutronFloatingIPCRUD) ServiceHelper.getGlobalInstance(INeutronFloatingIPCRUD.class, o);
+ INeutronFloatingIPCRUD answer = (INeutronFloatingIPCRUD) getInstances(INeutronFloatingIPCRUD.class, o);
return answer;
}
public static INeutronSecurityGroupCRUD getINeutronSecurityGroupCRUD(Object o) {
- INeutronSecurityGroupCRUD answer = (INeutronSecurityGroupCRUD) ServiceHelper.getGlobalInstance(INeutronSecurityGroupCRUD.class, o);
+ INeutronSecurityGroupCRUD answer = (INeutronSecurityGroupCRUD) getInstances(INeutronSecurityGroupCRUD.class, o);
return answer;
}
public static INeutronSecurityRuleCRUD getINeutronSecurityRuleCRUD(Object o) {
- INeutronSecurityRuleCRUD answer = (INeutronSecurityRuleCRUD) ServiceHelper.getGlobalInstance(INeutronSecurityRuleCRUD.class, o);
+ INeutronSecurityRuleCRUD answer = (INeutronSecurityRuleCRUD) getInstances(INeutronSecurityRuleCRUD.class, o);
return answer;
}
public static INeutronFirewallCRUD getINeutronFirewallCRUD(Object o) {
- INeutronFirewallCRUD answer = (INeutronFirewallCRUD) ServiceHelper.getGlobalInstance(INeutronFirewallCRUD.class, o);
+ INeutronFirewallCRUD answer = (INeutronFirewallCRUD) getInstances(INeutronFirewallCRUD.class, o);
return answer;
}
public static INeutronFirewallPolicyCRUD getINeutronFirewallPolicyCRUD(Object o) {
- INeutronFirewallPolicyCRUD answer = (INeutronFirewallPolicyCRUD) ServiceHelper.getGlobalInstance(INeutronFirewallPolicyCRUD.class, o);
+ INeutronFirewallPolicyCRUD answer = (INeutronFirewallPolicyCRUD) getInstances(INeutronFirewallPolicyCRUD.class, o);
return answer;
}
public static INeutronFirewallRuleCRUD getINeutronFirewallRuleCRUD(Object o) {
- INeutronFirewallRuleCRUD answer = (INeutronFirewallRuleCRUD) ServiceHelper.getGlobalInstance(INeutronFirewallRuleCRUD.class, o);
+ INeutronFirewallRuleCRUD answer = (INeutronFirewallRuleCRUD) getInstances(INeutronFirewallRuleCRUD.class, o);
return answer;
}
public static INeutronLoadBalancerCRUD getINeutronLoadBalancerCRUD(Object o) {
- INeutronLoadBalancerCRUD answer = (INeutronLoadBalancerCRUD) ServiceHelper.getGlobalInstance(INeutronLoadBalancerCRUD.class, o);
+ INeutronLoadBalancerCRUD answer = (INeutronLoadBalancerCRUD) getInstances(INeutronLoadBalancerCRUD.class, o);
return answer;
}
public static INeutronLoadBalancerPoolCRUD getINeutronLoadBalancerPoolCRUD(Object o) {
- INeutronLoadBalancerPoolCRUD answer = (INeutronLoadBalancerPoolCRUD) ServiceHelper.getGlobalInstance(INeutronLoadBalancerPoolCRUD.class, o);
+ INeutronLoadBalancerPoolCRUD answer = (INeutronLoadBalancerPoolCRUD) getInstances(INeutronLoadBalancerPoolCRUD.class, o);
return answer;
}
public static INeutronLoadBalancerListenerCRUD getINeutronLoadBalancerListenerCRUD(Object o) {
- INeutronLoadBalancerListenerCRUD answer = (INeutronLoadBalancerListenerCRUD) ServiceHelper.getGlobalInstance(INeutronLoadBalancerListenerCRUD.class, o);
+ INeutronLoadBalancerListenerCRUD answer = (INeutronLoadBalancerListenerCRUD) getInstances(INeutronLoadBalancerListenerCRUD.class, o);
return answer;
}
public static INeutronLoadBalancerHealthMonitorCRUD getINeutronLoadBalancerHealthMonitorCRUD(Object o) {
- INeutronLoadBalancerHealthMonitorCRUD answer = (INeutronLoadBalancerHealthMonitorCRUD) ServiceHelper.getGlobalInstance(INeutronLoadBalancerHealthMonitorCRUD.class, o);
+ INeutronLoadBalancerHealthMonitorCRUD answer = (INeutronLoadBalancerHealthMonitorCRUD) getInstances(INeutronLoadBalancerHealthMonitorCRUD.class, o);
return answer;
}
public static INeutronLoadBalancerPoolMemberCRUD getINeutronLoadBalancerPoolMemberCRUD(Object o) {
- INeutronLoadBalancerPoolMemberCRUD answer = (INeutronLoadBalancerPoolMemberCRUD) ServiceHelper.getGlobalInstance(INeutronLoadBalancerPoolMemberCRUD.class, o);
+ INeutronLoadBalancerPoolMemberCRUD answer = (INeutronLoadBalancerPoolMemberCRUD) getInstances(INeutronLoadBalancerPoolMemberCRUD.class, o);
return answer;
}
+
+ public static Object getInstances(Class<?> clazz,Object bundle) {
+ try {
+ BundleContext bCtx = FrameworkUtil.getBundle(bundle.getClass())
+ .getBundleContext();
+
+ ServiceReference<?>[] services = null;
+ services = bCtx.getServiceReferences(clazz.getName(),
+ null);
+ if (services != null) {
+ return bCtx.getService(services[0]);
+ }
+ } catch (Exception e) {
+ logger.error("Instance reference is NULL");
+ }
+ return null;
+ }
}
\ No newline at end of file
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronFirewall extends ConfigurationObject implements Serializable {
+public class NeutronFirewall implements Serializable {
private static final long serialVersionUID = 1L;
@XmlElement(name="id")
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronFirewallPolicy extends ConfigurationObject implements Serializable {
+public class NeutronFirewallPolicy implements Serializable {
private static final long serialVersionUID = 1L;
@XmlElement(name="id")
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronFirewallRule extends ConfigurationObject implements Serializable {
+public class NeutronFirewallRule implements Serializable {
private static final long serialVersionUID = 1L;
@XmlElement(name = "id")
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronFloatingIP extends ConfigurationObject implements Serializable {
+public class NeutronFloatingIP implements Serializable {
private static final long serialVersionUID = 1L;
// See OpenStack Network API v2.0 Reference for description of
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronLoadBalancer extends ConfigurationObject implements Serializable {
+public class NeutronLoadBalancer implements Serializable {
private static final long serialVersionUID = 1L;
@XmlElement(name="id")
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.configuration.ConfigurationObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronLoadBalancerHealthMonitor extends ConfigurationObject implements Serializable {
+public class NeutronLoadBalancerHealthMonitor implements Serializable {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(NeutronLoadBalancer.class);
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronLoadBalancerListener extends ConfigurationObject implements Serializable {
+public class NeutronLoadBalancerListener implements Serializable {
private static final long serialVersionUID = 1L;
@XmlElement(name="id")
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronLoadBalancerPool extends ConfigurationObject implements Serializable {
+public class NeutronLoadBalancerPool implements Serializable {
private static final long serialVersionUID = 1L;
@XmlElement(name="id")
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronLoadBalancerPoolMember extends ConfigurationObject implements Serializable {
+public class NeutronLoadBalancerPoolMember implements Serializable {
private static final long serialVersionUID = 1L;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
@XmlRootElement(name = "network")
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronNetwork extends ConfigurationObject implements Serializable, INeutronObject {
+public class NeutronNetwork implements Serializable, INeutronObject {
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronPort extends ConfigurationObject implements Serializable, INeutronObject {
+public class NeutronPort implements Serializable, INeutronObject {
private static final long serialVersionUID = 1L;
// See OpenStack Network API v2.0 Reference for description of
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronRouter extends ConfigurationObject implements Serializable, INeutronObject {
+public class NeutronRouter implements Serializable, INeutronObject {
private static final long serialVersionUID = 1L;
// See OpenStack Network API v2.0 Reference for description of
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronSecurityGroup extends ConfigurationObject implements Serializable {
+public class NeutronSecurityGroup implements Serializable {
private static final long serialVersionUID = 1L;
@XmlElement(name = "id")
package org.opendaylight.controller.networkconfig.neutron;
-import org.opendaylight.controller.configuration.ConfigurationObject;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronSecurityRule extends ConfigurationObject implements Serializable {
+public class NeutronSecurityRule implements Serializable {
private static final long serialVersionUID = 1L;
@XmlElement(name = "id")
import org.apache.commons.net.util.SubnetUtils;
import org.apache.commons.net.util.SubnetUtils.SubnetInfo;
-import org.opendaylight.controller.configuration.ConfigurationObject;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronSubnet extends ConfigurationObject implements Serializable, INeutronObject {
+public class NeutronSubnet implements Serializable, INeutronObject {
private static final long serialVersionUID = 1L;
// See OpenStack Network API v2.0 Reference for description of
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import org.opendaylight.controller.configuration.ConfigurationObject;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class Neutron_IPs extends ConfigurationObject implements Serializable {
+public class Neutron_IPs implements Serializable {
private static final long serialVersionUID = 1L;
// See OpenStack Network API v2.0 Reference for description of