With the ODL ML2 Integration, the REST APIs are uni-directional, hence a simple controller restart
results in synchronization issues between Openstack/CloudStack ML2 and ODL.
The solution that was agreed with Kyle, Ryan, Hugo & others is to add the config save support on the
ODL side which will effectively remove the inconsistency issues between Openstack / Cloudstack and ODL.
Change-Id: I9c5cb1a7d4acd0c147a3014da090770b231fd8d9
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
<instructions>
<Import-Package>
org.opendaylight.controller.clustering.services,
+ org.opendaylight.controller.configuration,
org.opendaylight.controller.sal.core,
org.opendaylight.controller.sal.utils,
org.apache.felix.dm,
<artifactId>clustering.services</artifactId>
<version>0.4.1-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>configuration</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>networkconfig.neutron</artifactId>
import java.util.Hashtable;
import java.util.Dictionary;
+
import org.apache.felix.dm.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.opendaylight.controller.clustering.services.IClusterContainerServices;
+import org.opendaylight.controller.configuration.IConfigurationContainerAware;
import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
* ComponentActivatorAbstractBase.
*
*/
+ @Override
public void init() {
}
* cleanup done by ComponentActivatorAbstractBase
*
*/
+ @Override
public void destroy() {
}
* instantiated in order to get an fully working implementation
* Object
*/
+ @Override
public Object[] getImplementations() {
Object[] res = { NeutronFloatingIPInterface.class,
NeutronRouterInterface.class,
* 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() }, null);
+ new String[] { INeutronFloatingIPCRUD.class.getName(),
+ IConfigurationContainerAware.class.getName()}, null);
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("salListenerName", "neutron");
c.add(createContainerServiceDependency(containerName)
if (imp.equals(NeutronRouterInterface.class)) {
// export the service
c.setInterface(
- new String[] { INeutronRouterCRUD.class.getName() }, null);
+ new String[] { INeutronRouterCRUD.class.getName(),
+ IConfigurationContainerAware.class.getName()}, null);
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("salListenerName", "neutron");
c.add(createContainerServiceDependency(containerName)
if (imp.equals(NeutronPortInterface.class)) {
// export the service
c.setInterface(
- new String[] { INeutronPortCRUD.class.getName() }, null);
+ new String[] { INeutronPortCRUD.class.getName(),
+ IConfigurationContainerAware.class.getName()}, null);
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("salListenerName", "neutron");
c.add(createContainerServiceDependency(containerName)
if (imp.equals(NeutronSubnetInterface.class)) {
// export the service
c.setInterface(
- new String[] { INeutronSubnetCRUD.class.getName() }, null);
+ new String[] { INeutronSubnetCRUD.class.getName(),
+ IConfigurationContainerAware.class.getName()}, null);
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("salListenerName", "neutron");
c.add(createContainerServiceDependency(containerName)
if (imp.equals(NeutronNetworkInterface.class)) {
// export the service
c.setInterface(
- new String[] { INeutronNetworkCRUD.class.getName() }, null);
+ new String[] { INeutronNetworkCRUD.class.getName(),
+ IConfigurationContainerAware.class.getName()}, null);
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("salListenerName", "neutron");
c.add(createContainerServiceDependency(containerName)
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.List;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.felix.dm.Component;
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.IConfigurationContainerAware;
import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP;
import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
+import org.opendaylight.controller.sal.utils.IObjectReader;
+import org.opendaylight.controller.sal.utils.ObjectReader;
+import org.opendaylight.controller.sal.utils.ObjectWriter;
+import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronFloatingIPInterface implements INeutronFloatingIPCRUD {
+public class NeutronFloatingIPInterface implements INeutronFloatingIPCRUD, IConfigurationContainerAware,
+ IObjectReader {
private static final Logger logger = LoggerFactory.getLogger(NeutronFloatingIPInterface.class);
+ private static String ROOT = GlobalConstants.STARTUPHOME.toString();
+ private static final String FILENAME ="neutron.floatingip";
+ private static String fileName;
private String containerName = null;
private IClusterContainerServices clusterContainerService = null;
private void startUp() {
allocateCache();
retrieveCache();
+ if (floatingIPDB.isEmpty()) {
+ loadConfiguration();
+ }
}
/**
// In the Global instance case the containerName is empty
this.containerName = "";
}
+ fileName = ROOT + FILENAME + "_" + containerName + ".conf";
startUp();
}
// IfNBFloatingIPCRUD interface methods
+ @Override
public boolean floatingIPExists(String uuid) {
return floatingIPDB.containsKey(uuid);
}
+ @Override
public NeutronFloatingIP getFloatingIP(String uuid) {
if (!floatingIPExists(uuid))
return null;
return floatingIPDB.get(uuid);
}
+ @Override
public List<NeutronFloatingIP> getAllFloatingIPs() {
Set<NeutronFloatingIP> allIPs = new HashSet<NeutronFloatingIP>();
for (Entry<String, NeutronFloatingIP> entry : floatingIPDB.entrySet()) {
return ans;
}
+ @Override
public boolean addFloatingIP(NeutronFloatingIP input) {
INeutronNetworkCRUD networkCRUD = NeutronCRUDInterfaces.getINeutronNetworkCRUD(this);
INeutronSubnetCRUD subnetCRUD = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this);
return true;
}
+ @Override
public boolean removeFloatingIP(String uuid) {
INeutronNetworkCRUD networkCRUD = NeutronCRUDInterfaces.getINeutronNetworkCRUD(this);
INeutronSubnetCRUD subnetCRUD = NeutronCRUDInterfaces.getINeutronSubnetCRUD(this);
return true;
}
+ @Override
public boolean updateFloatingIP(String uuid, NeutronFloatingIP delta) {
INeutronPortCRUD portCRUD = NeutronCRUDInterfaces.getINeutronPortCRUD(this);
target.setFixedIPAddress(delta.getFixedIPAddress());
return true;
}
+
+ @SuppressWarnings("unchecked")
+ private void loadConfiguration() {
+ ObjectReader objReader = new ObjectReader();
+ ConcurrentMap<String, NeutronFloatingIP> confList = (ConcurrentMap<String, NeutronFloatingIP>)
+ objReader.read(this, fileName);
+
+ if (confList == null) {
+ return;
+ }
+
+ for (String key : confList.keySet()) {
+ floatingIPDB.put(key, confList.get(key));
+ }
+ }
+
+ @Override
+ public Status saveConfiguration() {
+ ObjectWriter objWriter = new ObjectWriter();
+ return objWriter.write(new ConcurrentHashMap<String, NeutronFloatingIP>(floatingIPDB), fileName);
+ }
+
+ @Override
+ public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
+ return ois.readObject();
+ }
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.felix.dm.Component;
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.IConfigurationContainerAware;
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
+import org.opendaylight.controller.sal.utils.IObjectReader;
+import org.opendaylight.controller.sal.utils.ObjectReader;
+import org.opendaylight.controller.sal.utils.ObjectWriter;
+import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronNetworkInterface implements INeutronNetworkCRUD {
+public class NeutronNetworkInterface implements INeutronNetworkCRUD, IConfigurationContainerAware,
+ IObjectReader {
private static final Logger logger = LoggerFactory.getLogger(NeutronNetworkInterface.class);
+ private static String ROOT = GlobalConstants.STARTUPHOME.toString();
+ private static final String FILENAME ="neutron.network";
+ private static String fileName;
private String containerName = null;
private ConcurrentMap<String, NeutronNetwork> networkDB;
private void startUp() {
allocateCache();
retrieveCache();
+ if (networkDB.isEmpty()) {
+ loadConfiguration();
+ }
}
/**
// In the Global instance case the containerName is empty
this.containerName = "";
}
+ fileName = ROOT + FILENAME + "_" + containerName + ".conf";
startUp();
}
// IfNBNetworkCRUD methods
+ @Override
public boolean networkExists(String uuid) {
return networkDB.containsKey(uuid);
}
+ @Override
public NeutronNetwork getNetwork(String uuid) {
if (!networkExists(uuid))
return null;
return networkDB.get(uuid);
}
+ @Override
public List<NeutronNetwork> getAllNetworks() {
Set<NeutronNetwork> allNetworks = new HashSet<NeutronNetwork>();
for (Entry<String, NeutronNetwork> entry : networkDB.entrySet()) {
return ans;
}
+ @Override
public boolean addNetwork(NeutronNetwork input) {
if (networkExists(input.getID()))
return false;
return true;
}
+ @Override
public boolean removeNetwork(String uuid) {
if (!networkExists(uuid))
return false;
return true;
}
+ @Override
public boolean updateNetwork(String uuid, NeutronNetwork delta) {
if (!networkExists(uuid))
return false;
return overwrite(target, delta);
}
+ @Override
public boolean networkInUse(String netUUID) {
if (!networkExists(netUUID))
return true;
return true;
return false;
}
+
+ @SuppressWarnings("unchecked")
+ private void loadConfiguration() {
+ ObjectReader objReader = new ObjectReader();
+ ConcurrentMap<String, NeutronNetwork> confList = (ConcurrentMap<String, NeutronNetwork>)
+ objReader.read(this, fileName);
+
+ if (confList == null) {
+ return;
+ }
+
+ for (String key : confList.keySet()) {
+ networkDB.put(key, confList.get(key));
+ }
+ }
+
+ @Override
+ public Status saveConfiguration() {
+ ObjectWriter objWriter = new ObjectWriter();
+ return objWriter.write(new ConcurrentHashMap<String, NeutronNetwork>(networkDB), fileName);
+ }
+
+ @Override
+ public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
+ return ois.readObject();
+ }
+
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.felix.dm.Component;
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.IConfigurationContainerAware;
import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
+import org.opendaylight.controller.sal.utils.IObjectReader;
+import org.opendaylight.controller.sal.utils.ObjectReader;
+import org.opendaylight.controller.sal.utils.ObjectWriter;
+import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronPortInterface implements INeutronPortCRUD {
+public class NeutronPortInterface implements INeutronPortCRUD, IConfigurationContainerAware,
+ IObjectReader {
private static final Logger logger = LoggerFactory.getLogger(NeutronPortInterface.class);
+ private static String ROOT = GlobalConstants.STARTUPHOME.toString();
+ private static final String FILENAME ="neutron.port";
+ private static String fileName;
private String containerName = null;
private IClusterContainerServices clusterContainerService = null;
private void startUp() {
allocateCache();
retrieveCache();
+ if (portDB.isEmpty()) {
+ loadConfiguration();
+ }
+
}
/**
// In the Global instance case the containerName is empty
containerName = "";
}
+ fileName = ROOT + FILENAME + "_" + containerName + ".conf";
startUp();
}
return null;
}
+ @SuppressWarnings("unchecked")
+ private void loadConfiguration() {
+ ObjectReader objReader = new ObjectReader();
+ ConcurrentMap<String, NeutronPort> confList = (ConcurrentMap<String, NeutronPort>)
+ objReader.read(this, fileName);
+
+ if (confList == null) {
+ return;
+ }
+
+ for (String key : confList.keySet()) {
+ portDB.put(key, confList.get(key));
+ }
+ }
+
+ @Override
+ public Status saveConfiguration() {
+ ObjectWriter objWriter = new ObjectWriter();
+ return objWriter.write(new ConcurrentHashMap<String, NeutronPort>(portDB), fileName);
+ }
+
+ @Override
+ public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
+ return ois.readObject();
+ }
+
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.felix.dm.Component;
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.IConfigurationContainerAware;
import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD;
import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
+import org.opendaylight.controller.sal.utils.IObjectReader;
+import org.opendaylight.controller.sal.utils.ObjectReader;
+import org.opendaylight.controller.sal.utils.ObjectWriter;
+import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronRouterInterface implements INeutronRouterCRUD {
+public class NeutronRouterInterface implements INeutronRouterCRUD, IConfigurationContainerAware,
+ IObjectReader {
private static final Logger logger = LoggerFactory.getLogger(NeutronRouterInterface.class);
+ private static String ROOT = GlobalConstants.STARTUPHOME.toString();
+ private static final String FILENAME ="neutron.router";
+ private static String fileName;
private String containerName = null;
private IClusterContainerServices clusterContainerService = null;
private void startUp() {
allocateCache();
retrieveCache();
+ if (routerDB.isEmpty()) {
+ loadConfiguration();
+ }
+
}
/**
// In the Global instance case the containerName is empty
this.containerName = "";
}
+ fileName = ROOT + FILENAME + "_" + containerName + ".conf";
startUp();
}
// IfNBRouterCRUD Interface methods
+ @Override
public boolean routerExists(String uuid) {
return routerDB.containsKey(uuid);
}
+ @Override
public NeutronRouter getRouter(String uuid) {
if (!routerExists(uuid))
return null;
return routerDB.get(uuid);
}
+ @Override
public List<NeutronRouter> getAllRouters() {
Set<NeutronRouter> allRouters = new HashSet<NeutronRouter>();
for (Entry<String, NeutronRouter> entry : routerDB.entrySet()) {
return ans;
}
+ @Override
public boolean addRouter(NeutronRouter input) {
if (routerExists(input.getID()))
return false;
return true;
}
+ @Override
public boolean removeRouter(String uuid) {
if (!routerExists(uuid))
return false;
return true;
}
+ @Override
public boolean updateRouter(String uuid, NeutronRouter delta) {
if (!routerExists(uuid))
return false;
return overwrite(target, delta);
}
+ @Override
public boolean routerInUse(String routerUUID) {
if (!routerExists(routerUUID))
return true;
NeutronRouter target = routerDB.get(routerUUID);
return (target.getInterfaces().size() > 0);
}
+
+ @SuppressWarnings("unchecked")
+ private void loadConfiguration() {
+ ObjectReader objReader = new ObjectReader();
+ ConcurrentMap<String, NeutronRouter> confList = (ConcurrentMap<String, NeutronRouter>)
+ objReader.read(this, fileName);
+
+ if (confList == null) {
+ return;
+ }
+
+ for (String key : confList.keySet()) {
+ routerDB.put(key, confList.get(key));
+ }
+ }
+
+ @Override
+ public Status saveConfiguration() {
+ ObjectWriter objWriter = new ObjectWriter();
+ return objWriter.write(new ConcurrentHashMap<String, NeutronRouter>(routerDB), fileName);
+ }
+
+ @Override
+ public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
+ return ois.readObject();
+ }
+
}
package org.opendaylight.controller.networkconfig.neutron.implementation;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.felix.dm.Component;
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.IConfigurationContainerAware;
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.GlobalConstants;
+import org.opendaylight.controller.sal.utils.IObjectReader;
+import org.opendaylight.controller.sal.utils.ObjectReader;
+import org.opendaylight.controller.sal.utils.ObjectWriter;
+import org.opendaylight.controller.sal.utils.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class NeutronSubnetInterface implements INeutronSubnetCRUD {
+public class NeutronSubnetInterface implements INeutronSubnetCRUD, IConfigurationContainerAware,
+ IObjectReader {
private static final Logger logger = LoggerFactory.getLogger(NeutronSubnetInterface.class);
+ private static String ROOT = GlobalConstants.STARTUPHOME.toString();
+ private static final String FILENAME ="neutron.subnet";
+ private static String fileName;
+
private String containerName = null;
private IClusterContainerServices clusterContainerService = null;
private void startUp() {
allocateCache();
retrieveCache();
+ if (subnetDB.isEmpty()) {
+ loadConfiguration();
+ }
+
}
/**
// In the Global instance case the containerName is empty
this.containerName = "";
}
+ fileName = ROOT + FILENAME + "_" + containerName + ".conf";
startUp();
}
// IfNBSubnetCRUD methods
+ @Override
public boolean subnetExists(String uuid) {
return subnetDB.containsKey(uuid);
}
+ @Override
public NeutronSubnet getSubnet(String uuid) {
if (!subnetExists(uuid))
return null;
return subnetDB.get(uuid);
}
+ @Override
public List<NeutronSubnet> getAllSubnets() {
Set<NeutronSubnet> allSubnets = new HashSet<NeutronSubnet>();
for (Entry<String, NeutronSubnet> entry : subnetDB.entrySet()) {
return ans;
}
+ @Override
public boolean addSubnet(NeutronSubnet input) {
String id = input.getID();
if (subnetExists(id))
return true;
}
+ @Override
public boolean removeSubnet(String uuid) {
if (!subnetExists(uuid))
return false;
return true;
}
+ @Override
public boolean updateSubnet(String uuid, NeutronSubnet delta) {
if (!subnetExists(uuid))
return false;
return overwrite(target, delta);
}
+ @Override
public boolean subnetInUse(String subnetUUID) {
if (!subnetExists(subnetUUID))
return true;
NeutronSubnet target = subnetDB.get(subnetUUID);
return (target.getPortsInSubnet().size() > 0);
}
+
+ @SuppressWarnings("unchecked")
+ private void loadConfiguration() {
+ ObjectReader objReader = new ObjectReader();
+ ConcurrentMap<String, NeutronSubnet> confList = (ConcurrentMap<String, NeutronSubnet>)
+ objReader.read(this, fileName);
+
+ if (confList == null) {
+ return;
+ }
+
+ for (String key : confList.keySet()) {
+ subnetDB.put(key, confList.get(key));
+ }
+ }
+
+ @Override
+ public Status saveConfiguration() {
+ ObjectWriter objWriter = new ObjectWriter();
+ return objWriter.write(new ConcurrentHashMap<String, NeutronSubnet>(subnetDB), fileName);
+ }
+
+ @Override
+ public Object readObject(ObjectInputStream ois) throws FileNotFoundException, IOException, ClassNotFoundException {
+ return ois.readObject();
+ }
+
}
package org.opendaylight.controller.networkconfig.neutron;
+import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronFloatingIP {
+public class NeutronFloatingIP implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
package org.opendaylight.controller.networkconfig.neutron;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@XmlRootElement(name = "network")
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronNetwork {
+public class NeutronNetwork implements Serializable {
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
+ private static final long serialVersionUID = 1L;
+
@XmlElement (name="id")
String networkUUID; // network UUID
package org.opendaylight.controller.networkconfig.neutron;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronPort {
+public class NeutronPort implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
package org.opendaylight.controller.networkconfig.neutron;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronRouter {
+public class NeutronRouter implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
@XmlElement (name="id")
package org.opendaylight.controller.networkconfig.neutron;
+import java.io.Serializable;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronRouter_Interface {
+public class NeutronRouter_Interface implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
package org.opendaylight.controller.networkconfig.neutron;
+import java.io.Serializable;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronRouter_NetworkReference {
+public class NeutronRouter_NetworkReference implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
package org.opendaylight.controller.networkconfig.neutron;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronSubnet {
+public class NeutronSubnet implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
package org.opendaylight.controller.networkconfig.neutron;
+import java.io.Serializable;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronSubnet_HostRoute {
+public class NeutronSubnet_HostRoute implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
package org.opendaylight.controller.networkconfig.neutron;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronSubnet_IPAllocationPool {
+public class NeutronSubnet_IPAllocationPool implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
@XmlElement(name="end")
String poolEnd;
- public NeutronSubnet_IPAllocationPool() { }
+ public NeutronSubnet_IPAllocationPool() {
+ }
public NeutronSubnet_IPAllocationPool(String lowAddress, String highAddress) {
poolStart = lowAddress;
package org.opendaylight.controller.networkconfig.neutron;
+import java.io.Serializable;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class Neutron_IPs {
+public class Neutron_IPs implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes