From b1ad203b32b73fc06a856cdfae243986c8037617 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Fri, 7 Nov 2014 15:15:58 -0600 Subject: [PATCH] Make neutron a simple osgi app Change-Id: I57aabd9db316632d6051eae477ea8a9882699d7f Signed-off-by: Ed Warnicke --- features/neutron/pom.xml | 132 ++++++ .../neutron/src/main/resources/features.xml | 32 ++ features/pom.xml | 1 + .../distribution/opendaylight-karaf/pom.xml | 8 + .../neutron/implementation/pom.xml | 23 +- .../neutron/implementation/Activator.java | 390 ++++-------------- .../NeutronFirewallInterface.java | 153 +------ .../NeutronFirewallPolicyInterface.java | 158 +------ .../NeutronFirewallRuleInterface.java | 159 +------ .../NeutronFloatingIPInterface.java | 160 +------ ...ronLoadBalancerHealthMonitorInterface.java | 155 +------ .../NeutronLoadBalancerInterface.java | 154 +------ .../NeutronLoadBalancerListenerInterface.java | 154 +------ .../NeutronLoadBalancerPoolInterface.java | 154 +------ ...eutronLoadBalancerPoolMemberInterface.java | 156 +------ .../NeutronNetworkInterface.java | 157 +------ .../implementation/NeutronPortInterface.java | 160 +------ .../NeutronRouterInterface.java | 157 +------ .../NeutronSecurityGroupInterface.java | 158 +------ .../NeutronSecurityRuleInterface.java | 155 +------ .../NeutronSubnetInterface.java | 161 +------- .../neutron/northbound/pom.xml | 32 +- .../northbound/BadRequestException.java | 27 ++ .../InternalServerErrorException.java | 38 ++ .../northbound/NeutronFirewallNorthbound.java | 13 +- .../NeutronFirewallPolicyNorthbound.java | 34 +- .../NeutronFirewallRulesNorthbound.java | 36 +- .../NeutronFloatingIPsNorthbound.java | 13 +- ...onLoadBalancerHealthMonitorNorthbound.java | 40 +- ...NeutronLoadBalancerListenerNorthbound.java | 34 +- .../NeutronLoadBalancerNorthbound.java | 34 +- ...tronLoadBalancerPoolMembersNorthbound.java | 33 +- .../NeutronLoadBalancerPoolNorthbound.java | 36 +- .../northbound/NeutronNetworksNorthbound.java | 17 +- .../northbound/NeutronPortsNorthbound.java | 14 +- .../northbound/NeutronRoutersNorthbound.java | 21 +- .../NeutronSecurityGroupsNorthbound.java | 14 +- .../NeutronSecurityRulesNorthbound.java | 14 +- .../northbound/NeutronSubnetsNorthbound.java | 15 +- .../neutron/northbound/NeutronUtil.java | 32 ++ .../northbound/PaginatedRequestFactory.java | 3 +- .../northbound/ResourceConflictException.java | 37 ++ .../northbound/ResourceNotFoundException.java | 37 ++ .../neutron/northbound/RestMessages.java | 33 ++ .../ServiceUnavailableException.java | 39 ++ .../networkconfiguration/neutron/pom.xml | 22 +- .../neutron/NeutronCRUDInterfaces.java | 55 ++- .../neutron/NeutronFirewall.java | 4 +- .../neutron/NeutronFirewallPolicy.java | 4 +- .../neutron/NeutronFirewallRule.java | 4 +- .../neutron/NeutronFloatingIP.java | 4 +- .../neutron/NeutronLoadBalancer.java | 4 +- .../NeutronLoadBalancerHealthMonitor.java | 3 +- .../neutron/NeutronLoadBalancerListener.java | 4 +- .../neutron/NeutronLoadBalancerPool.java | 4 +- .../NeutronLoadBalancerPoolMember.java | 4 +- .../networkconfig/neutron/NeutronNetwork.java | 4 +- .../networkconfig/neutron/NeutronPort.java | 4 +- .../networkconfig/neutron/NeutronRouter.java | 4 +- .../neutron/NeutronSecurityGroup.java | 4 +- .../neutron/NeutronSecurityRule.java | 4 +- .../networkconfig/neutron/NeutronSubnet.java | 3 +- .../networkconfig/neutron/Neutron_IPs.java | 3 +- 63 files changed, 770 insertions(+), 2951 deletions(-) create mode 100644 features/neutron/pom.xml create mode 100644 features/neutron/src/main/resources/features.xml create mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java create mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java create mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java create mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java create mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java create mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java create mode 100644 opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java diff --git a/features/neutron/pom.xml b/features/neutron/pom.xml new file mode 100644 index 0000000000..59a0af2f89 --- /dev/null +++ b/features/neutron/pom.xml @@ -0,0 +1,132 @@ + + + 4.0.0 + + org.opendaylight.controller + commons.opendaylight + 1.5.0-SNAPSHOT + ../../opendaylight/commons/opendaylight + + features-neutron + ${networkconfig.neutron.version} + jar + + + features.xml + + + + + org.opendaylight.controller + networkconfig.neutron + + + org.osgi + org.osgi.core + + + com.sun.jersey + jersey-core + + + com.sun.jersey + jersey-server + + + com.sun.jersey + jersey-servlet + + + org.eclipse.persistence + org.eclipse.persistence.moxy + + + org.eclipse.persistence + org.eclipse.persistence.core + + + org.opendaylight.controller + networkconfig.neutron + + + commons-net + commons-net + + + + org.opendaylight.yangtools + features-test + + + org.opendaylight.yangtools + features-test + 0.7.0-SNAPSHOT + + + + + + + true + src/main/resources + + + + + org.apache.maven.plugins + maven-resources-plugin + + + filter + + resources + + generate-resources + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + + attach-artifact + + package + + + + ${project.build.directory}/classes/${features.file} + xml + features + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + org.opendaylight.controller + opendaylight-karaf-empty + ${commons.opendaylight.version} + + + org.opendaylight.yangtools:features-test + + + + + + + scm:git:ssh://git.opendaylight.org:29418/controller.git + scm:git:ssh://git.opendaylight.org:29418/controller.git + HEAD + https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL + + diff --git a/features/neutron/src/main/resources/features.xml b/features/neutron/src/main/resources/features.xml new file mode 100644 index 0000000000..263f907cee --- /dev/null +++ b/features/neutron/src/main/resources/features.xml @@ -0,0 +1,32 @@ + + + + + odl-neutron-api + odl-neutron-northbound + odl-neutron-implementation + + + odl-neutron-api + mvn:org.eclipse.persistence/org.eclipse.persistence.moxy/${eclipse.persistence.version} + mvn:org.eclipse.persistence/org.eclipse.persistence.core/${eclipse.persistence.version} + mvn:org.opendaylight.controller/networkconfig.neutron.northbound/${networkconfig.neutron.northbound.version} + mvn:com.sun.jersey/jersey-core/${jersey.version} + mvn:com.sun.jersey/jersey-server/${jersey.version} + mvn:com.sun.jersey/jersey-servlet/${jersey.version} + mvn:org.osgi/org.osgi.core/${osgi.core.version} + + + + mvn:org.opendaylight.controller/networkconfig.neutron/${networkconfig.neutron.version} + mvn:commons-net/commons-net/${commons.net.version} + mvn:org.osgi/org.osgi.core/${osgi.core.version} + + + odl-neutron-api + mvn:org.opendaylight.controller/networkconfig.neutron.implementation/${networkconfig.neutron.implementation.version} + mvn:org.osgi/org.osgi.core/${osgi.core.version} + + \ No newline at end of file diff --git a/features/pom.xml b/features/pom.xml index 8be9f552f8..4f9ff72927 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -24,5 +24,6 @@ netconf-connector restconf extras + neutron diff --git a/opendaylight/distribution/opendaylight-karaf/pom.xml b/opendaylight/distribution/opendaylight-karaf/pom.xml index f4ca2217ce..4c8f9c5913 100644 --- a/opendaylight/distribution/opendaylight-karaf/pom.xml +++ b/opendaylight/distribution/opendaylight-karaf/pom.xml @@ -105,6 +105,14 @@ xml runtime + + org.opendaylight.controller + features-neutron + ${networkconfig.neutron.version} + features + xml + runtime + org.opendaylight.controller diff --git a/opendaylight/networkconfiguration/neutron/implementation/pom.xml b/opendaylight/networkconfiguration/neutron/implementation/pom.xml index a9061d57d1..1607408e7a 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/pom.xml +++ b/opendaylight/networkconfiguration/neutron/implementation/pom.xml @@ -14,22 +14,10 @@ 1.26.2 - - org.opendaylight.controller - clustering.services - - - org.opendaylight.controller - configuration - org.opendaylight.controller networkconfig.neutron - - org.opendaylight.controller - sal - org.osgi org.osgi.core @@ -43,16 +31,7 @@ true - 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 + * org.opendaylight.controller.networkconfig.neutron.implementation.Activator ${project.basedir}/src/main/resources/META-INF diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/Activator.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/Activator.java index 2723a3c205..0fbf933c17 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/Activator.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/Activator.java @@ -8,14 +8,12 @@ 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; @@ -27,321 +25,111 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD; 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> registrations = new ArrayList>(); - /** - * 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 props = new Hashtable(); - 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 props = new Hashtable(); - 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 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 diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallInterface.java index 60476a1d34..421f850a0e 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallInterface.java @@ -8,154 +8,24 @@ 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 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) 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 firewallDB = new ConcurrentHashMap(); // this method uses reflection to update an object from it's delta. @@ -243,22 +113,5 @@ public class NeutronFirewallInterface implements INeutronFirewallCRUD, IConfigur 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(firewallDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } } \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallPolicyInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallPolicyInterface.java index 84592628f0..886d7fd265 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallPolicyInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallPolicyInterface.java @@ -8,158 +8,24 @@ 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 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) 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 firewallPolicyDB = new ConcurrentHashMap(); // this method uses reflection to update an object from it's delta. @@ -247,22 +113,4 @@ public class NeutronFirewallPolicyInterface implements INeutronFirewallPolicyCRU 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(firewallPolicyDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } - } \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallRuleInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallRuleInterface.java index ba84500cd7..cd0f39a76f 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallRuleInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFirewallRuleInterface.java @@ -8,157 +8,24 @@ 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 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) 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 firewallRuleDB = new ConcurrentHashMap(); // this method uses reflection to update an object from it's delta. @@ -246,22 +113,4 @@ public class NeutronFirewallRuleInterface implements INeutronFirewallRuleCRUD, I 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(firewallRuleDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } - } \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFloatingIPInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFloatingIPInterface.java index 5cbe5cde98..51824d6ce1 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFloatingIPInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronFloatingIPInterface.java @@ -8,27 +8,15 @@ 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; @@ -37,137 +25,13 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; 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 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) 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 floatingIPDB = new ConcurrentHashMap(); // this method uses reflection to update an object from it's delta. @@ -295,22 +159,4 @@ public class NeutronFloatingIPInterface implements INeutronFloatingIPCRUD, IConf 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(floatingIPDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } } diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerHealthMonitorInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerHealthMonitorInterface.java index b0beddf721..ecf3994fb5 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerHealthMonitorInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerHealthMonitorInterface.java @@ -8,155 +8,24 @@ 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 loadBalancerHealthMonitorDB = new ConcurrentHashMap(); - private IClusterContainerServices clusterContainerService = null; - private IConfigurationContainerService configurationService; - private ConcurrentMap 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) 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. @@ -245,22 +114,4 @@ public class NeutronLoadBalancerHealthMonitorInterface implements INeutronLoadBa 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(loadBalancerHealthMonitorDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } } diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerInterface.java index aa7280beed..472de90358 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerInterface.java @@ -8,155 +8,24 @@ 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 loadBalancerDB = new ConcurrentHashMap(); - private IClusterContainerServices clusterContainerService = null; - private IConfigurationContainerService configurationService; - private ConcurrentMap 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) 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. @@ -246,21 +115,4 @@ public class NeutronLoadBalancerInterface implements INeutronLoadBalancerCRUD, I 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(loadBalancerDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } } diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerListenerInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerListenerInterface.java index 3779863647..6acc06deb3 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerListenerInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerListenerInterface.java @@ -8,155 +8,25 @@ 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 loadBalancerListenerDB = new ConcurrentHashMap(); - private IClusterContainerServices clusterContainerService = null; - private IConfigurationContainerService configurationService; - private ConcurrentMap 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) 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. @@ -245,22 +115,4 @@ public class NeutronLoadBalancerListenerInterface implements INeutronLoadBalance 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(loadBalancerListenerDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } } diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolInterface.java index 34cdba3f04..03c9cd94e3 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolInterface.java @@ -8,155 +8,24 @@ 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 loadBalancerPoolDB = new ConcurrentHashMap(); - private IClusterContainerServices clusterContainerService = null; - private IConfigurationContainerService configurationService; - private ConcurrentMap 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) 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. @@ -246,21 +115,4 @@ public class NeutronLoadBalancerPoolInterface implements INeutronLoadBalancerPoo 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(loadBalancerPoolDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } } diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolMemberInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolMemberInterface.java index 7418bb2f3d..8ed3a36826 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolMemberInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronLoadBalancerPoolMemberInterface.java @@ -8,156 +8,25 @@ 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 loadBalancerPoolMemberDB = new ConcurrentHashMap(); - private IClusterContainerServices clusterContainerService = null; - private IConfigurationContainerService configurationService; - private ConcurrentMap 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) 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. @@ -245,23 +114,4 @@ public class NeutronLoadBalancerPoolMemberInterface 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(loadBalancerPoolMemberDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } } diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java index c6e161b91f..c9e1549520 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java @@ -8,158 +8,26 @@ 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 networkDB = new ConcurrentHashMap(); - private ConcurrentMap 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) 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. @@ -256,23 +124,4 @@ public class NeutronNetworkInterface implements INeutronNetworkCRUD, IConfigurat } 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(networkDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } - } diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronPortInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronPortInterface.java index 3294474b49..5c8780028d 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronPortInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronPortInterface.java @@ -8,28 +8,16 @@ 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; @@ -38,137 +26,14 @@ 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.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 portDB = new ConcurrentHashMap(); - private IClusterContainerServices clusterContainerService = null; - private IConfigurationContainerService configurationService; - private ConcurrentMap 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) 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. @@ -351,23 +216,4 @@ public class NeutronPortInterface implements INeutronPortCRUD, IConfigurationCon } 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(portDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } - } diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronRouterInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronRouterInterface.java index 4e19d36fe0..5e4c5a4277 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronRouterInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronRouterInterface.java @@ -8,159 +8,26 @@ 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 routerDB; + private ConcurrentMap routerDB = new ConcurrentHashMap(); // 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) 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. @@ -254,22 +121,4 @@ public class NeutronRouterInterface implements INeutronRouterCRUD, IConfiguratio 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(routerDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } - } diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityGroupInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityGroupInterface.java index a991f61fcb..d59bf9e093 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityGroupInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityGroupInterface.java @@ -9,158 +9,26 @@ 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 securityGroupDB; - - // methods needed for creating caches - void setClusterContainerService(IClusterContainerServices s) { - logger.debug("Cluster Service set"); - clusterContainerService = s; - } + private ConcurrentMap securityGroupDB = new ConcurrentHashMap(); - 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) 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. @@ -248,22 +116,4 @@ public class NeutronSecurityGroupInterface implements INeutronSecurityGroupCRUD, 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(securityGroupDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } - } \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityRuleInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityRuleInterface.java index 5ca907b2b3..884d15f452 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityRuleInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSecurityRuleInterface.java @@ -9,155 +9,24 @@ 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 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) 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 securityRuleDB = new ConcurrentHashMap(); // this method uses reflection to update an object from it's delta. private boolean overwrite(Object target, Object delta) { @@ -244,22 +113,4 @@ public class NeutronSecurityRuleInterface implements INeutronSecurityRuleCRUD, I 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(securityRuleDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } - } \ No newline at end of file diff --git a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSubnetInterface.java b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSubnetInterface.java index 025c2f12f7..81fa107fd8 100644 --- a/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSubnetInterface.java +++ b/opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronSubnetInterface.java @@ -8,164 +8,28 @@ 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 subnetDB = new ConcurrentHashMap(); - private String containerName = null; - private IClusterContainerServices clusterContainerService = null; - private IConfigurationContainerService configurationService; - private ConcurrentMap 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) 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. @@ -268,23 +132,4 @@ public class NeutronSubnetInterface implements INeutronSubnetCRUD, IConfiguratio 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(subnetDB.values()), - FILE_NAME); - } - - @Override - public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException { - return ois.readObject(); - } - } diff --git a/opendaylight/networkconfiguration/neutron/northbound/pom.xml b/opendaylight/networkconfiguration/neutron/northbound/pom.xml index 8111e69c19..0eecca0c3e 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/pom.xml +++ b/opendaylight/networkconfiguration/neutron/northbound/pom.xml @@ -16,37 +16,25 @@ jersey-core - org.codehaus.enunciate - enunciate-core-annotations + com.sun.jersey + jersey-server - org.eclipse.persistence - org.eclipse.persistence.antlr + com.sun.jersey + jersey-servlet - org.eclipse.persistence - org.eclipse.persistence.core + org.codehaus.enunciate + enunciate-core-annotations org.eclipse.persistence org.eclipse.persistence.moxy - - org.opendaylight.controller - commons.northbound - - - org.opendaylight.controller - containermanager - org.opendaylight.controller networkconfig.neutron - - org.opendaylight.controller - sal - @@ -57,12 +45,7 @@ true - 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, + org.opendaylight.controller.networkconfig.neutron, org.eclipse.persistence.jaxb.rs, com.sun.jersey.spi.container.servlet, javax.ws.rs, @@ -71,6 +54,7 @@ javax.xml.bind.annotation, javax.xml.bind, org.slf4j, + org.osgi.framework, !org.codehaus.enunciate.jaxrs /controller/nb/v2/neutron diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java new file mode 100644 index 0000000000..9db8633b99 --- /dev/null +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/BadRequestException.java @@ -0,0 +1,27 @@ +/* + * 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()); + } +} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java new file mode 100644 index 0000000000..5a40a1861b --- /dev/null +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/InternalServerErrorException.java @@ -0,0 +1,38 @@ +/* + * 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()); + } +} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallNorthbound.java index 204c9f5176..33043d4389 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallNorthbound.java @@ -16,11 +16,6 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronFirewallCRUD; 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; @@ -190,7 +185,7 @@ public class NeutronFirewallNorthbound { 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; @@ -211,7 +206,7 @@ public class NeutronFirewallNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronFirewallAware.class, this); while (i.hasNext()) { NeutronFirewall test = i.next(); @@ -301,7 +296,7 @@ public class NeutronFirewallNorthbound { 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; @@ -355,7 +350,7 @@ public class NeutronFirewallNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java index cc45d6de5d..08e563138c 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallPolicyNorthbound.java @@ -9,17 +9,10 @@ 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; @@ -32,10 +25,13 @@ import javax.ws.rs.Produces; 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.
@@ -186,7 +182,7 @@ public class NeutronFirewallPolicyNorthbound { } 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; @@ -207,7 +203,7 @@ public class NeutronFirewallPolicyNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallPolicyAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronFirewallPolicyAware.class, this); while (i.hasNext()) { NeutronFirewallPolicy test = i.next(); @@ -297,7 +293,7 @@ public class NeutronFirewallPolicyNorthbound { 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; @@ -351,7 +347,7 @@ public class NeutronFirewallPolicyNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRulesNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRulesNorthbound.java index 9911b4dfd4..5e51711e5b 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRulesNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFirewallRulesNorthbound.java @@ -9,18 +9,10 @@ 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; @@ -33,10 +25,14 @@ import javax.ws.rs.Produces; 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.
@@ -222,7 +218,7 @@ public class NeutronFirewallRulesNorthbound { 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; @@ -245,7 +241,7 @@ public class NeutronFirewallRulesNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronFirewallRuleAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronFirewallRuleAware.class, this); while (i.hasNext()) { NeutronFirewallRule test = i.next(); @@ -344,7 +340,7 @@ public class NeutronFirewallRulesNorthbound { 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; @@ -401,7 +397,7 @@ public class NeutronFirewallRulesNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java index af7cfd18b9..812a09a0a6 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java @@ -11,6 +11,7 @@ package org.opendaylight.controller.networkconfig.neutron.northbound; 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; @@ -36,12 +37,6 @@ 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.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.
@@ -245,7 +240,7 @@ public class NeutronFloatingIPsNorthbound { 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; @@ -366,7 +361,7 @@ public class NeutronFloatingIPsNorthbound { 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; @@ -409,7 +404,7 @@ public class NeutronFloatingIPsNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorNorthbound.java index 6cd2673ff8..85aba5d690 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerHealthMonitorNorthbound.java @@ -9,20 +9,10 @@ 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; @@ -35,10 +25,16 @@ import javax.ws.rs.Produces; 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.
@@ -212,7 +208,7 @@ public class NeutronLoadBalancerHealthMonitorNorthbound { } 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; @@ -233,7 +229,7 @@ public class NeutronLoadBalancerHealthMonitorNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerHealthMonitorAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerHealthMonitorAware.class, this); while (i.hasNext()) { NeutronLoadBalancerHealthMonitor test = i.next(); @@ -330,7 +326,7 @@ public class NeutronLoadBalancerHealthMonitorNorthbound { 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; @@ -388,7 +384,7 @@ public class NeutronLoadBalancerHealthMonitorNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerNorthbound.java index f3ef39f7ba..345c7ee0f3 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerListenerNorthbound.java @@ -9,17 +9,10 @@ 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; @@ -32,10 +25,13 @@ import javax.ws.rs.Produces; 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.
@@ -200,7 +196,7 @@ public class NeutronLoadBalancerListenerNorthbound { } 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; @@ -221,7 +217,7 @@ public class NeutronLoadBalancerListenerNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerListenerAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerListenerAware.class, this); while (i.hasNext()) { NeutronLoadBalancerListener test = i.next(); @@ -314,7 +310,7 @@ public class NeutronLoadBalancerListenerNorthbound { 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; @@ -368,7 +364,7 @@ public class NeutronLoadBalancerListenerNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerNorthbound.java index 863b3cbdc7..308041fe59 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerNorthbound.java @@ -9,17 +9,10 @@ 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; @@ -32,10 +25,13 @@ import javax.ws.rs.Produces; 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.
@@ -188,7 +184,7 @@ public class NeutronLoadBalancerNorthbound { 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; @@ -209,7 +205,7 @@ public class NeutronLoadBalancerNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerAware.class, this); while (i.hasNext()) { NeutronLoadBalancer test = i.next(); @@ -300,7 +296,7 @@ public class NeutronLoadBalancerNorthbound { 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; @@ -357,7 +353,7 @@ public class NeutronLoadBalancerNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMembersNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMembersNorthbound.java index f8f3cd8c53..f9540679cd 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMembersNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolMembersNorthbound.java @@ -10,18 +10,10 @@ 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; @@ -34,10 +26,13 @@ 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.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 { @@ -203,7 +198,7 @@ public Response createLoadBalancerPoolMember( 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; @@ -229,7 +224,7 @@ public Response createLoadBalancerPoolMember( List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - 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(); @@ -337,7 +332,7 @@ public Response deleteLoadBalancerPoolMember( 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolNorthbound.java index f0ae6094d4..77bb525c84 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronLoadBalancerPoolNorthbound.java @@ -11,18 +11,10 @@ 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; @@ -36,10 +28,13 @@ 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.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.
@@ -200,7 +195,8 @@ public class NeutronLoadBalancerPoolNorthbound { 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; @@ -221,7 +217,7 @@ public class NeutronLoadBalancerPoolNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronLoadBalancerPoolAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolAware.class, this); while (i.hasNext()) { NeutronLoadBalancerPool test = i.next(); @@ -313,7 +309,7 @@ public class NeutronLoadBalancerPoolNorthbound { 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; @@ -368,7 +364,7 @@ public class NeutronLoadBalancerPoolNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworksNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworksNorthbound.java index 9de5aef5f4..9c99f346e8 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworksNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronNetworksNorthbound.java @@ -25,23 +25,16 @@ import javax.ws.rs.Produces; 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.
@@ -209,7 +202,7 @@ public class NeutronNetworksNorthbound { 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; @@ -234,7 +227,7 @@ public class NeutronNetworksNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronNetworkAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronNetworkAware.class, this); while (i.hasNext()) { NeutronNetwork test = i.next(); @@ -317,7 +310,7 @@ public class NeutronNetworksNorthbound { 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; @@ -371,7 +364,7 @@ public class NeutronNetworksNorthbound { } 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java index 5451fbf3e1..23f4979f23 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java @@ -38,12 +38,6 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronCRUDInterfaces; 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.
@@ -263,7 +257,7 @@ public class NeutronPortsNorthbound { } } - 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; @@ -287,7 +281,7 @@ public class NeutronPortsNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronPortAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronPortAware.class, this); while (i.hasNext()) { NeutronPort test = i.next(); @@ -433,7 +427,7 @@ public class NeutronPortsNorthbound { 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; @@ -515,7 +509,7 @@ public class NeutronPortsNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java index 0c02adad8a..45e84f4d15 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java @@ -11,6 +11,7 @@ package org.opendaylight.controller.networkconfig.neutron.northbound; 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; @@ -36,12 +37,6 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronPort; 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; /** @@ -197,7 +192,7 @@ public class NeutronRoutersNorthbound { 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; @@ -273,7 +268,7 @@ public class NeutronRoutersNorthbound { 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; @@ -338,7 +333,7 @@ public class NeutronRoutersNorthbound { 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; @@ -418,7 +413,7 @@ public class NeutronRoutersNorthbound { 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; @@ -496,7 +491,7 @@ public class NeutronRoutersNorthbound { 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; @@ -537,7 +532,7 @@ public class NeutronRoutersNorthbound { 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); @@ -567,7 +562,7 @@ public class NeutronRoutersNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupsNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupsNorthbound.java index 5e9a3318b9..bce4de7cc2 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupsNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityGroupsNorthbound.java @@ -14,6 +14,7 @@ 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.GET; @@ -32,11 +33,6 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupAw 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; @@ -180,7 +176,7 @@ public class NeutronSecurityGroupsNorthbound { 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; @@ -202,7 +198,7 @@ public class NeutronSecurityGroupsNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityGroupAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronSecurityGroupAware.class, this); while (i.hasNext()) { NeutronSecurityGroup test = i.next(); @@ -280,7 +276,7 @@ public class NeutronSecurityGroupsNorthbound { 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; @@ -335,7 +331,7 @@ public class NeutronSecurityGroupsNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRulesNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRulesNorthbound.java index b2c05e0071..762317aaf8 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRulesNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSecurityRulesNorthbound.java @@ -14,6 +14,7 @@ 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.GET; @@ -33,11 +34,6 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleAwa 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; @@ -203,7 +199,7 @@ public class NeutronSecurityRulesNorthbound { 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; @@ -235,7 +231,7 @@ public class NeutronSecurityRulesNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronSecurityRuleAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronSecurityRuleAware.class, this); while (i.hasNext()) { NeutronSecurityRule test = i.next(); @@ -330,7 +326,7 @@ public class NeutronSecurityRulesNorthbound { 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; @@ -385,7 +381,7 @@ public class NeutronSecurityRulesNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java index 8f20269603..142b09f8e4 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java @@ -36,13 +36,6 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware; 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.
@@ -224,7 +217,7 @@ public class NeutronSubnetsNorthbound { 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; @@ -245,7 +238,7 @@ public class NeutronSubnetsNorthbound { List bulk = input.getBulk(); Iterator i = bulk.iterator(); HashMap testMap = new HashMap(); - Object[] instances = ServiceHelper.getGlobalInstances(INeutronSubnetAware.class, this, null); + Object[] instances = NeutronUtil.getInstances(INeutronSubnetAware.class, this); while (i.hasNext()) { NeutronSubnet test = i.next(); @@ -349,7 +342,7 @@ public class NeutronSubnetsNorthbound { 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; @@ -404,7 +397,7 @@ public class NeutronSubnetsNorthbound { 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; diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java new file mode 100644 index 0000000000..481d95a89d --- /dev/null +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronUtil.java @@ -0,0 +1,32 @@ +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; + } +} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java index 7f6c296d98..25b5da1384 100644 --- a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/PaginatedRequestFactory.java @@ -15,12 +15,11 @@ import java.util.Collections; 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 NEUTRON_OBJECT_COMPARATOR = new Comparator() { diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java new file mode 100644 index 0000000000..d9644dfe59 --- /dev/null +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceConflictException.java @@ -0,0 +1,37 @@ +/* + * 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()); + } +} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java new file mode 100644 index 0000000000..3f39eb766c --- /dev/null +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ResourceNotFoundException.java @@ -0,0 +1,37 @@ +/* + * 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()); + } +} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java new file mode 100644 index 0000000000..e619974090 --- /dev/null +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/RestMessages.java @@ -0,0 +1,33 @@ +/* + * 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; + } +} diff --git a/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java new file mode 100644 index 0000000000..2d899a09e9 --- /dev/null +++ b/opendaylight/networkconfiguration/neutron/northbound/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/ServiceUnavailableException.java @@ -0,0 +1,39 @@ +/* + * 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()); + } +} diff --git a/opendaylight/networkconfiguration/neutron/pom.xml b/opendaylight/networkconfiguration/neutron/pom.xml index 75ab2816cc..a9ead67860 100644 --- a/opendaylight/networkconfiguration/neutron/pom.xml +++ b/opendaylight/networkconfiguration/neutron/pom.xml @@ -19,16 +19,12 @@ commons-net
- org.opendaylight.controller - clustering.services + org.osgi + org.osgi.core - org.opendaylight.controller - configuration - - - org.opendaylight.controller - sal + org.slf4j + slf4j-api @@ -39,15 +35,7 @@ true - 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 + * ${project.basedir}/src/main/resources/META-INF diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java index 472debe383..0ae523a138 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java @@ -8,82 +8,105 @@ 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 diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewall.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewall.java index 39f04c9b2b..5d427ef12a 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewall.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewall.java @@ -8,8 +8,6 @@ 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; @@ -38,7 +36,7 @@ import java.util.List; @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") diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallPolicy.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallPolicy.java index 46436b52f4..782e18bb89 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallPolicy.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallPolicy.java @@ -8,8 +8,6 @@ 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; @@ -38,7 +36,7 @@ import java.util.List; @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") diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallRule.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallRule.java index 63a65a27f9..d4c239302a 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallRule.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFirewallRule.java @@ -8,8 +8,6 @@ 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; @@ -47,7 +45,7 @@ import java.util.List; @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") diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java index 9e5aa2d0b4..9c8c91b284 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java @@ -17,12 +17,10 @@ import javax.xml.bind.annotation.XmlAccessorType; 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 diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancer.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancer.java index 15544f0424..58f0eb4512 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancer.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancer.java @@ -8,8 +8,6 @@ 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; @@ -37,7 +35,7 @@ import java.util.List; @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") diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerHealthMonitor.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerHealthMonitor.java index 0e9e1af999..d23fe113a0 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerHealthMonitor.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerHealthMonitor.java @@ -8,7 +8,6 @@ package org.opendaylight.controller.networkconfig.neutron; -import org.opendaylight.controller.configuration.ConfigurationObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,7 +43,7 @@ import java.util.List; @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); diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerListener.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerListener.java index 39897099a2..8b4ada3d0f 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerListener.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerListener.java @@ -8,8 +8,6 @@ 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; @@ -42,7 +40,7 @@ import java.util.List; @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") diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPool.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPool.java index a2df680b07..363de412d8 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPool.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPool.java @@ -8,8 +8,6 @@ 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; @@ -41,7 +39,7 @@ import java.util.List; @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") diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPoolMember.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPoolMember.java index 683d45fcf2..313a951b2f 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPoolMember.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronLoadBalancerPoolMember.java @@ -8,8 +8,6 @@ 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; @@ -22,7 +20,7 @@ import java.util.List; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) -public class NeutronLoadBalancerPoolMember extends ConfigurationObject implements Serializable { +public class NeutronLoadBalancerPoolMember implements Serializable { private static final long serialVersionUID = 1L; diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java index a3c38a9265..1cbbb36f78 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java @@ -18,12 +18,10 @@ import javax.xml.bind.annotation.XmlAccessorType; 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 diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java index 803e5e8d41..a529599a4c 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java @@ -19,13 +19,11 @@ import javax.xml.bind.annotation.XmlAccessorType; 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 diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java index ae5aa0f7fb..9d5ee38b50 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java @@ -18,12 +18,10 @@ import javax.xml.bind.annotation.XmlAccessorType; 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 diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityGroup.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityGroup.java index 0f0a14ca58..ca56c7b050 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityGroup.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityGroup.java @@ -9,8 +9,6 @@ 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; @@ -35,7 +33,7 @@ import java.util.List; @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") diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityRule.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityRule.java index 3fad4fe626..6247691bdd 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityRule.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSecurityRule.java @@ -9,8 +9,6 @@ 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; @@ -39,7 +37,7 @@ import java.util.List; @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") diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java index b0d9bf46d4..2a44d8b88a 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java @@ -22,12 +22,11 @@ import javax.xml.bind.annotation.XmlRootElement; 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 diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java index 1292c2995b..fe5d45b3a6 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java @@ -15,11 +15,10 @@ import javax.xml.bind.annotation.XmlAccessorType; 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 -- 2.36.6