Replace original windows line delimiters in base classes.
Change-Id: I5d50ddf17604a640028bb40a0e8e8129bed67111
Signed-off-by: Ryan Moats <rmoats@us.ibm.com>
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-/**\r
- * This interface defines the methods a service that wishes to be aware of Neutron FloatingIPs needs to implement\r
- *\r
- */\r
-\r
-public interface INeutronFloatingIPAware {\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified floatingIP can be created\r
- *\r
- * @param floatingIP\r
- * instance of proposed new Neutron FloatingIP object\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the create operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canCreateFloatingIP(NeutronFloatingIP floatingIP);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a floatingIP has been created\r
- *\r
- * @param floatingIP\r
- * instance of new Neutron FloatingIP object\r
- * @return void\r
- */\r
- public void neutronFloatingIPCreated(NeutronFloatingIP floatingIP);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified floatingIP can be changed using the specified\r
- * delta\r
- *\r
- * @param delta\r
- * updates to the floatingIP object using patch semantics\r
- * @param floatingIP\r
- * instance of the Neutron FloatingIP object to be updated\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the update operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canUpdateFloatingIP(NeutronFloatingIP delta, NeutronFloatingIP original);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a floatingIP has been updated\r
- *\r
- * @param floatingIP\r
- * instance of modified Neutron FloatingIP object\r
- * @return void\r
- */\r
- public void neutronFloatingIPUpdated(NeutronFloatingIP floatingIP);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified floatingIP can be deleted\r
- *\r
- * @param floatingIP\r
- * instance of the Neutron FloatingIP object to be deleted\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the delete operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canDeleteFloatingIP(NeutronFloatingIP floatingIP);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a floatingIP has been deleted\r
- *\r
- * @param floatingIP\r
- * instance of deleted Neutron FloatingIP object\r
- * @return void\r
- */\r
- public void neutronFloatingIPDeleted(NeutronFloatingIP floatingIP);\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+/**
+ * This interface defines the methods a service that wishes to be aware of Neutron FloatingIPs needs to implement
+ *
+ */
+
+public interface INeutronFloatingIPAware {
+
+ /**
+ * Services provide this interface method to indicate if the specified floatingIP can be created
+ *
+ * @param floatingIP
+ * instance of proposed new Neutron FloatingIP object
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the create operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canCreateFloatingIP(NeutronFloatingIP floatingIP);
+
+ /**
+ * Services provide this interface method for taking action after a floatingIP has been created
+ *
+ * @param floatingIP
+ * instance of new Neutron FloatingIP object
+ * @return void
+ */
+ public void neutronFloatingIPCreated(NeutronFloatingIP floatingIP);
+
+ /**
+ * Services provide this interface method to indicate if the specified floatingIP can be changed using the specified
+ * delta
+ *
+ * @param delta
+ * updates to the floatingIP object using patch semantics
+ * @param floatingIP
+ * instance of the Neutron FloatingIP object to be updated
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the update operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canUpdateFloatingIP(NeutronFloatingIP delta, NeutronFloatingIP original);
+
+ /**
+ * Services provide this interface method for taking action after a floatingIP has been updated
+ *
+ * @param floatingIP
+ * instance of modified Neutron FloatingIP object
+ * @return void
+ */
+ public void neutronFloatingIPUpdated(NeutronFloatingIP floatingIP);
+
+ /**
+ * Services provide this interface method to indicate if the specified floatingIP can be deleted
+ *
+ * @param floatingIP
+ * instance of the Neutron FloatingIP object to be deleted
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the delete operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canDeleteFloatingIP(NeutronFloatingIP floatingIP);
+
+ /**
+ * Services provide this interface method for taking action after a floatingIP has been deleted
+ *
+ * @param floatingIP
+ * instance of deleted Neutron FloatingIP object
+ * @return void
+ */
+ public void neutronFloatingIPDeleted(NeutronFloatingIP floatingIP);
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * This interface defines the methods for CRUD of NB FloatingIP objects\r
- *\r
- */\r
-\r
-public interface INeutronFloatingIPCRUD {\r
- /**\r
- * Applications call this interface method to determine if a particular\r
- * FloatingIP object exists\r
- *\r
- * @param uuid\r
- * UUID of the FloatingIP object\r
- * @return boolean\r
- */\r
-\r
- public boolean floatingIPExists(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to return if a particular\r
- * FloatingIP object exists\r
- *\r
- * @param uuid\r
- * UUID of the FloatingIP object\r
- * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP.OpenStackFloatingIPs}\r
- * OpenStack FloatingIP class\r
- */\r
-\r
- public NeutronFloatingIP getFloatingIP(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to return all FloatingIP objects\r
- *\r
- * @return a Set of OpenStackFloatingIPs objects\r
- */\r
-\r
- public List<NeutronFloatingIP> getAllFloatingIPs();\r
-\r
- /**\r
- * Applications call this interface method to add a FloatingIP object to the\r
- * concurrent map\r
- *\r
- * @param input\r
- * OpenStackFloatingIP object\r
- * @return boolean on whether the object was added or not\r
- */\r
-\r
- public boolean addFloatingIP(NeutronFloatingIP input);\r
-\r
- /**\r
- * Applications call this interface method to remove a FloatingIP object to the\r
- * concurrent map\r
- *\r
- * @param uuid\r
- * identifier for the FloatingIP object\r
- * @return boolean on whether the object was removed or not\r
- */\r
-\r
- public boolean removeFloatingIP(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to edit a FloatingIP object\r
- *\r
- * @param uuid\r
- * identifier of the FloatingIP object\r
- * @param delta\r
- * OpenStackFloatingIP object containing changes to apply\r
- * @return boolean on whether the object was updated or not\r
- */\r
-\r
- public boolean updateFloatingIP(String uuid, NeutronFloatingIP delta);\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import java.util.List;
+
+/**
+ * This interface defines the methods for CRUD of NB FloatingIP objects
+ *
+ */
+
+public interface INeutronFloatingIPCRUD {
+ /**
+ * Applications call this interface method to determine if a particular
+ * FloatingIP object exists
+ *
+ * @param uuid
+ * UUID of the FloatingIP object
+ * @return boolean
+ */
+
+ public boolean floatingIPExists(String uuid);
+
+ /**
+ * Applications call this interface method to return if a particular
+ * FloatingIP object exists
+ *
+ * @param uuid
+ * UUID of the FloatingIP object
+ * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP.OpenStackFloatingIPs}
+ * OpenStack FloatingIP class
+ */
+
+ public NeutronFloatingIP getFloatingIP(String uuid);
+
+ /**
+ * Applications call this interface method to return all FloatingIP objects
+ *
+ * @return a Set of OpenStackFloatingIPs objects
+ */
+
+ public List<NeutronFloatingIP> getAllFloatingIPs();
+
+ /**
+ * Applications call this interface method to add a FloatingIP object to the
+ * concurrent map
+ *
+ * @param input
+ * OpenStackFloatingIP object
+ * @return boolean on whether the object was added or not
+ */
+
+ public boolean addFloatingIP(NeutronFloatingIP input);
+
+ /**
+ * Applications call this interface method to remove a FloatingIP object to the
+ * concurrent map
+ *
+ * @param uuid
+ * identifier for the FloatingIP object
+ * @return boolean on whether the object was removed or not
+ */
+
+ public boolean removeFloatingIP(String uuid);
+
+ /**
+ * Applications call this interface method to edit a FloatingIP object
+ *
+ * @param uuid
+ * identifier of the FloatingIP object
+ * @param delta
+ * OpenStackFloatingIP object containing changes to apply
+ * @return boolean on whether the object was updated or not
+ */
+
+ public boolean updateFloatingIP(String uuid, NeutronFloatingIP delta);
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-/**\r
- * This interface defines the methods a service that wishes to be aware of Neutron Networks needs to implement\r
- *\r
- */\r
-\r
-public interface INeutronNetworkAware {\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified network can be created\r
- *\r
- * @param network\r
- * instance of proposed new Neutron Network object\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the create operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canCreateNetwork(NeutronNetwork network);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a network has been created\r
- *\r
- * @param network\r
- * instance of new Neutron Network object\r
- * @return void\r
- */\r
- public void neutronNetworkCreated(NeutronNetwork network);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified network can be changed using the specified\r
- * delta\r
- *\r
- * @param delta\r
- * updates to the network object using patch semantics\r
- * @param network\r
- * instance of the Neutron Network object to be updated\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the update operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canUpdateNetwork(NeutronNetwork delta, NeutronNetwork original);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a network has been updated\r
- *\r
- * @param network\r
- * instance of modified Neutron Network object\r
- * @return void\r
- */\r
- public void neutronNetworkUpdated(NeutronNetwork network);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified network can be deleted\r
- *\r
- * @param network\r
- * instance of the Neutron Network object to be deleted\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the delete operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canDeleteNetwork(NeutronNetwork network);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a network has been deleted\r
- *\r
- * @param network\r
- * instance of deleted Neutron Network object\r
- * @return void\r
- */\r
- public void neutronNetworkDeleted(NeutronNetwork network);\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+/**
+ * This interface defines the methods a service that wishes to be aware of Neutron Networks needs to implement
+ *
+ */
+
+public interface INeutronNetworkAware {
+
+ /**
+ * Services provide this interface method to indicate if the specified network can be created
+ *
+ * @param network
+ * instance of proposed new Neutron Network object
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the create operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canCreateNetwork(NeutronNetwork network);
+
+ /**
+ * Services provide this interface method for taking action after a network has been created
+ *
+ * @param network
+ * instance of new Neutron Network object
+ * @return void
+ */
+ public void neutronNetworkCreated(NeutronNetwork network);
+
+ /**
+ * Services provide this interface method to indicate if the specified network can be changed using the specified
+ * delta
+ *
+ * @param delta
+ * updates to the network object using patch semantics
+ * @param network
+ * instance of the Neutron Network object to be updated
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the update operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canUpdateNetwork(NeutronNetwork delta, NeutronNetwork original);
+
+ /**
+ * Services provide this interface method for taking action after a network has been updated
+ *
+ * @param network
+ * instance of modified Neutron Network object
+ * @return void
+ */
+ public void neutronNetworkUpdated(NeutronNetwork network);
+
+ /**
+ * Services provide this interface method to indicate if the specified network can be deleted
+ *
+ * @param network
+ * instance of the Neutron Network object to be deleted
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the delete operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canDeleteNetwork(NeutronNetwork network);
+
+ /**
+ * Services provide this interface method for taking action after a network has been deleted
+ *
+ * @param network
+ * instance of deleted Neutron Network object
+ * @return void
+ */
+ public void neutronNetworkDeleted(NeutronNetwork network);
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * This interface defines the methods for CRUD of NB network objects\r
- *\r
- */\r
-\r
-public interface INeutronNetworkCRUD {\r
- /**\r
- * Applications call this interface method to determine if a particular\r
- * Network object exists\r
- *\r
- * @param uuid\r
- * UUID of the Network object\r
- * @return boolean\r
- */\r
-\r
- public boolean networkExists(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to return if a particular\r
- * Network object exists\r
- *\r
- * @param uuid\r
- * UUID of the Network object\r
- * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronNetwork.OpenStackNetworks}\r
- * OpenStack Network class\r
- */\r
-\r
- public NeutronNetwork getNetwork(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to return all Network objects\r
- *\r
- * @return List of OpenStackNetworks objects\r
- */\r
-\r
- public List<NeutronNetwork> getAllNetworks();\r
-\r
- /**\r
- * Applications call this interface method to add a Network object to the\r
- * concurrent map\r
- *\r
- * @param input\r
- * OpenStackNetwork object\r
- * @return boolean on whether the object was added or not\r
- */\r
-\r
- public boolean addNetwork(NeutronNetwork input);\r
-\r
- /**\r
- * Applications call this interface method to remove a Network object to the\r
- * concurrent map\r
- *\r
- * @param uuid\r
- * identifier for the network object\r
- * @return boolean on whether the object was removed or not\r
- */\r
-\r
- public boolean removeNetwork(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to edit a Network object\r
- *\r
- * @param uuid\r
- * identifier of the network object\r
- * @param delta\r
- * OpenStackNetwork object containing changes to apply\r
- * @return boolean on whether the object was updated or not\r
- */\r
-\r
- public boolean updateNetwork(String uuid, NeutronNetwork delta);\r
-\r
- /**\r
- * Applications call this interface method to determine if a Network object\r
- * is use\r
- *\r
- * @param netUUID\r
- * identifier of the network object\r
- *\r
- * @return boolean on whether the network is in use or not\r
- */\r
-\r
- public boolean networkInUse(String netUUID);\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import java.util.List;
+
+/**
+ * This interface defines the methods for CRUD of NB network objects
+ *
+ */
+
+public interface INeutronNetworkCRUD {
+ /**
+ * Applications call this interface method to determine if a particular
+ * Network object exists
+ *
+ * @param uuid
+ * UUID of the Network object
+ * @return boolean
+ */
+
+ public boolean networkExists(String uuid);
+
+ /**
+ * Applications call this interface method to return if a particular
+ * Network object exists
+ *
+ * @param uuid
+ * UUID of the Network object
+ * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronNetwork.OpenStackNetworks}
+ * OpenStack Network class
+ */
+
+ public NeutronNetwork getNetwork(String uuid);
+
+ /**
+ * Applications call this interface method to return all Network objects
+ *
+ * @return List of OpenStackNetworks objects
+ */
+
+ public List<NeutronNetwork> getAllNetworks();
+
+ /**
+ * Applications call this interface method to add a Network object to the
+ * concurrent map
+ *
+ * @param input
+ * OpenStackNetwork object
+ * @return boolean on whether the object was added or not
+ */
+
+ public boolean addNetwork(NeutronNetwork input);
+
+ /**
+ * Applications call this interface method to remove a Network object to the
+ * concurrent map
+ *
+ * @param uuid
+ * identifier for the network object
+ * @return boolean on whether the object was removed or not
+ */
+
+ public boolean removeNetwork(String uuid);
+
+ /**
+ * Applications call this interface method to edit a Network object
+ *
+ * @param uuid
+ * identifier of the network object
+ * @param delta
+ * OpenStackNetwork object containing changes to apply
+ * @return boolean on whether the object was updated or not
+ */
+
+ public boolean updateNetwork(String uuid, NeutronNetwork delta);
+
+ /**
+ * Applications call this interface method to determine if a Network object
+ * is use
+ *
+ * @param netUUID
+ * identifier of the network object
+ *
+ * @return boolean on whether the network is in use or not
+ */
+
+ public boolean networkInUse(String netUUID);
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-/**\r
- * This interface defines the methods a service that wishes to be aware of Neutron Ports needs to implement\r
- *\r
- */\r
-\r
-public interface INeutronPortAware {\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified port can be created\r
- *\r
- * @param port\r
- * instance of proposed new Neutron Port object\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the create operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canCreatePort(NeutronPort port);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a port has been created\r
- *\r
- * @param port\r
- * instance of new Neutron Port object\r
- * @return void\r
- */\r
- public void neutronPortCreated(NeutronPort port);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified port can be changed using the specified\r
- * delta\r
- *\r
- * @param delta\r
- * updates to the port object using patch semantics\r
- * @param port\r
- * instance of the Neutron Port object to be updated\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the update operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canUpdatePort(NeutronPort delta, NeutronPort original);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a port has been updated\r
- *\r
- * @param port\r
- * instance of modified Neutron Port object\r
- * @return void\r
- */\r
- public void neutronPortUpdated(NeutronPort port);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified port can be deleted\r
- *\r
- * @param port\r
- * instance of the Neutron Port object to be deleted\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the delete operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canDeletePort(NeutronPort port);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a port has been deleted\r
- *\r
- * @param port\r
- * instance of deleted Port Network object\r
- * @return void\r
- */\r
- public void neutronPortDeleted(NeutronPort port);\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+/**
+ * This interface defines the methods a service that wishes to be aware of Neutron Ports needs to implement
+ *
+ */
+
+public interface INeutronPortAware {
+
+ /**
+ * Services provide this interface method to indicate if the specified port can be created
+ *
+ * @param port
+ * instance of proposed new Neutron Port object
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the create operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canCreatePort(NeutronPort port);
+
+ /**
+ * Services provide this interface method for taking action after a port has been created
+ *
+ * @param port
+ * instance of new Neutron Port object
+ * @return void
+ */
+ public void neutronPortCreated(NeutronPort port);
+
+ /**
+ * Services provide this interface method to indicate if the specified port can be changed using the specified
+ * delta
+ *
+ * @param delta
+ * updates to the port object using patch semantics
+ * @param port
+ * instance of the Neutron Port object to be updated
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the update operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canUpdatePort(NeutronPort delta, NeutronPort original);
+
+ /**
+ * Services provide this interface method for taking action after a port has been updated
+ *
+ * @param port
+ * instance of modified Neutron Port object
+ * @return void
+ */
+ public void neutronPortUpdated(NeutronPort port);
+
+ /**
+ * Services provide this interface method to indicate if the specified port can be deleted
+ *
+ * @param port
+ * instance of the Neutron Port object to be deleted
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the delete operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canDeletePort(NeutronPort port);
+
+ /**
+ * Services provide this interface method for taking action after a port has been deleted
+ *
+ * @param port
+ * instance of deleted Port Network object
+ * @return void
+ */
+ public void neutronPortDeleted(NeutronPort port);
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * This interface defines the methods for CRUD of NB Port objects\r
- *\r
- */\r
-\r
-public interface INeutronPortCRUD {\r
- /**\r
- * Applications call this interface method to determine if a particular\r
- * Port object exists\r
- *\r
- * @param uuid\r
- * UUID of the Port object\r
- * @return boolean\r
- */\r
-\r
- public boolean portExists(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to return if a particular\r
- * Port object exists\r
- *\r
- * @param uuid\r
- * UUID of the Port object\r
- * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronPort.OpenStackPorts}\r
- * OpenStack Port class\r
- */\r
-\r
- public NeutronPort getPort(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to return all Port objects\r
- *\r
- * @return List of OpenStackPorts objects\r
- */\r
-\r
- public List<NeutronPort> getAllPorts();\r
-\r
- /**\r
- * Applications call this interface method to add a Port object to the\r
- * concurrent map\r
- *\r
- * @param input\r
- * OpenStackPort object\r
- * @return boolean on whether the object was added or not\r
- */\r
-\r
- public boolean addPort(NeutronPort input);\r
-\r
- /**\r
- * Applications call this interface method to remove a Port object to the\r
- * concurrent map\r
- *\r
- * @param uuid\r
- * identifier for the Port object\r
- * @return boolean on whether the object was removed or not\r
- */\r
-\r
- public boolean removePort(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to edit a Port object\r
- *\r
- * @param uuid\r
- * identifier of the Port object\r
- * @param delta\r
- * OpenStackPort object containing changes to apply\r
- * @return boolean on whether the object was updated or not\r
- */\r
-\r
- public boolean updatePort(String uuid, NeutronPort delta);\r
-\r
- /**\r
- * Applications call this interface method to see if a MAC address is in use\r
- *\r
- * @param macAddress\r
- * mac Address to be tested\r
- * @return boolean on whether the macAddress is already associated with a\r
- * port or not\r
- */\r
-\r
- public boolean macInUse(String macAddress);\r
-\r
- /**\r
- * Applications call this interface method to retrieve the port associated with\r
- * the gateway address of a subnet\r
- *\r
- * @param subnetUUID\r
- * identifier of the subnet\r
- * @return OpenStackPorts object if the port exists and null if it does not\r
- */\r
-\r
- public NeutronPort getGatewayPort(String subnetUUID);\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import java.util.List;
+
+/**
+ * This interface defines the methods for CRUD of NB Port objects
+ *
+ */
+
+public interface INeutronPortCRUD {
+ /**
+ * Applications call this interface method to determine if a particular
+ * Port object exists
+ *
+ * @param uuid
+ * UUID of the Port object
+ * @return boolean
+ */
+
+ public boolean portExists(String uuid);
+
+ /**
+ * Applications call this interface method to return if a particular
+ * Port object exists
+ *
+ * @param uuid
+ * UUID of the Port object
+ * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronPort.OpenStackPorts}
+ * OpenStack Port class
+ */
+
+ public NeutronPort getPort(String uuid);
+
+ /**
+ * Applications call this interface method to return all Port objects
+ *
+ * @return List of OpenStackPorts objects
+ */
+
+ public List<NeutronPort> getAllPorts();
+
+ /**
+ * Applications call this interface method to add a Port object to the
+ * concurrent map
+ *
+ * @param input
+ * OpenStackPort object
+ * @return boolean on whether the object was added or not
+ */
+
+ public boolean addPort(NeutronPort input);
+
+ /**
+ * Applications call this interface method to remove a Port object to the
+ * concurrent map
+ *
+ * @param uuid
+ * identifier for the Port object
+ * @return boolean on whether the object was removed or not
+ */
+
+ public boolean removePort(String uuid);
+
+ /**
+ * Applications call this interface method to edit a Port object
+ *
+ * @param uuid
+ * identifier of the Port object
+ * @param delta
+ * OpenStackPort object containing changes to apply
+ * @return boolean on whether the object was updated or not
+ */
+
+ public boolean updatePort(String uuid, NeutronPort delta);
+
+ /**
+ * Applications call this interface method to see if a MAC address is in use
+ *
+ * @param macAddress
+ * mac Address to be tested
+ * @return boolean on whether the macAddress is already associated with a
+ * port or not
+ */
+
+ public boolean macInUse(String macAddress);
+
+ /**
+ * Applications call this interface method to retrieve the port associated with
+ * the gateway address of a subnet
+ *
+ * @param subnetUUID
+ * identifier of the subnet
+ * @return OpenStackPorts object if the port exists and null if it does not
+ */
+
+ public NeutronPort getGatewayPort(String subnetUUID);
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-/**\r
- * This interface defines the methods a service that wishes to be aware of Neutron Routers needs to implement\r
- *\r
- */\r
-\r
-public interface INeutronRouterAware {\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified router can be created\r
- *\r
- * @param router\r
- * instance of proposed new Neutron Router object\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the create operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canCreateRouter(NeutronRouter router);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a router has been created\r
- *\r
- * @param router\r
- * instance of new Neutron Router object\r
- * @return void\r
- */\r
- public void neutronRouterCreated(NeutronRouter router);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified router can be changed using the specified\r
- * delta\r
- *\r
- * @param delta\r
- * updates to the router object using patch semantics\r
- * @param router\r
- * instance of the Neutron Router object to be updated\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the update operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canUpdateRouter(NeutronRouter delta, NeutronRouter original);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a router has been updated\r
- *\r
- * @param router\r
- * instance of modified Neutron Router object\r
- * @return void\r
- */\r
- public void neutronRouterUpdated(NeutronRouter router);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified router can be deleted\r
- *\r
- * @param router\r
- * instance of the Neutron Router object to be deleted\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the delete operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canDeleteRouter(NeutronRouter router);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a router has been deleted\r
- *\r
- * @param router\r
- * instance of deleted Router Network object\r
- * @return void\r
- */\r
- public void neutronRouterDeleted(NeutronRouter router);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified interface can be attached to the specified route\r
- *\r
- * @param router\r
- * instance of the base Neutron Router object\r
- * @param routerInterface\r
- * instance of the NeutronRouter_Interface to be attached to the router\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the attach operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canAttachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface);\r
-\r
- /**\r
- * Services provide this interface method for taking action after an interface has been added to a router\r
- *\r
- * @param router\r
- * instance of the base Neutron Router object\r
- * @param routerInterface\r
- * instance of the NeutronRouter_Interface being attached to the router\r
- * @return void\r
- */\r
- public void neutronRouterInterfaceAttached(NeutronRouter router, NeutronRouter_Interface routerInterface);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified interface can be detached from the specified router\r
- *\r
- * @param router\r
- * instance of the base Neutron Router object\r
- * @param routerInterface\r
- * instance of the NeutronRouter_Interface to be detached to the router\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the detach operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canDetachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface);\r
-\r
- /**\r
- * Services provide this interface method for taking action after an interface has been removed from a router\r
- *\r
- * @param router\r
- * instance of the base Neutron Router object\r
- * @param routerInterface\r
- * instance of the NeutronRouter_Interface being detached from the router\r
- * @return void\r
- */\r
- public void neutronRouterInterfaceDetached(NeutronRouter router, NeutronRouter_Interface routerInterface);\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+/**
+ * This interface defines the methods a service that wishes to be aware of Neutron Routers needs to implement
+ *
+ */
+
+public interface INeutronRouterAware {
+
+ /**
+ * Services provide this interface method to indicate if the specified router can be created
+ *
+ * @param router
+ * instance of proposed new Neutron Router object
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the create operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canCreateRouter(NeutronRouter router);
+
+ /**
+ * Services provide this interface method for taking action after a router has been created
+ *
+ * @param router
+ * instance of new Neutron Router object
+ * @return void
+ */
+ public void neutronRouterCreated(NeutronRouter router);
+
+ /**
+ * Services provide this interface method to indicate if the specified router can be changed using the specified
+ * delta
+ *
+ * @param delta
+ * updates to the router object using patch semantics
+ * @param router
+ * instance of the Neutron Router object to be updated
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the update operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canUpdateRouter(NeutronRouter delta, NeutronRouter original);
+
+ /**
+ * Services provide this interface method for taking action after a router has been updated
+ *
+ * @param router
+ * instance of modified Neutron Router object
+ * @return void
+ */
+ public void neutronRouterUpdated(NeutronRouter router);
+
+ /**
+ * Services provide this interface method to indicate if the specified router can be deleted
+ *
+ * @param router
+ * instance of the Neutron Router object to be deleted
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the delete operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canDeleteRouter(NeutronRouter router);
+
+ /**
+ * Services provide this interface method for taking action after a router has been deleted
+ *
+ * @param router
+ * instance of deleted Router Network object
+ * @return void
+ */
+ public void neutronRouterDeleted(NeutronRouter router);
+
+ /**
+ * Services provide this interface method to indicate if the specified interface can be attached to the specified route
+ *
+ * @param router
+ * instance of the base Neutron Router object
+ * @param routerInterface
+ * instance of the NeutronRouter_Interface to be attached to the router
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the attach operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canAttachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface);
+
+ /**
+ * Services provide this interface method for taking action after an interface has been added to a router
+ *
+ * @param router
+ * instance of the base Neutron Router object
+ * @param routerInterface
+ * instance of the NeutronRouter_Interface being attached to the router
+ * @return void
+ */
+ public void neutronRouterInterfaceAttached(NeutronRouter router, NeutronRouter_Interface routerInterface);
+
+ /**
+ * Services provide this interface method to indicate if the specified interface can be detached from the specified router
+ *
+ * @param router
+ * instance of the base Neutron Router object
+ * @param routerInterface
+ * instance of the NeutronRouter_Interface to be detached to the router
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the detach operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canDetachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface);
+
+ /**
+ * Services provide this interface method for taking action after an interface has been removed from a router
+ *
+ * @param router
+ * instance of the base Neutron Router object
+ * @param routerInterface
+ * instance of the NeutronRouter_Interface being detached from the router
+ * @return void
+ */
+ public void neutronRouterInterfaceDetached(NeutronRouter router, NeutronRouter_Interface routerInterface);
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * This interface defines the methods for CRUD of NB Router objects\r
- *\r
- */\r
-\r
-public interface INeutronRouterCRUD {\r
- /**\r
- * Applications call this interface method to determine if a particular\r
- * Router object exists\r
- *\r
- * @param uuid\r
- * UUID of the Router object\r
- * @return boolean\r
- */\r
-\r
- public boolean routerExists(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to return if a particular\r
- * Router object exists\r
- *\r
- * @param uuid\r
- * UUID of the Router object\r
- * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronRouter.OpenStackRouters}\r
- * OpenStack Router class\r
- */\r
-\r
- public NeutronRouter getRouter(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to return all Router objects\r
- *\r
- * @return List of OpenStackRouters objects\r
- */\r
-\r
- public List<NeutronRouter> getAllRouters();\r
-\r
- /**\r
- * Applications call this interface method to add a Router object to the\r
- * concurrent map\r
- *\r
- * @param input\r
- * OpenStackRouter object\r
- * @return boolean on whether the object was added or not\r
- */\r
-\r
- public boolean addRouter(NeutronRouter input);\r
-\r
- /**\r
- * Applications call this interface method to remove a Router object to the\r
- * concurrent map\r
- *\r
- * @param uuid\r
- * identifier for the Router object\r
- * @return boolean on whether the object was removed or not\r
- */\r
-\r
- public boolean removeRouter(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to edit a Router object\r
- *\r
- * @param uuid\r
- * identifier of the Router object\r
- * @param delta\r
- * OpenStackRouter object containing changes to apply\r
- * @return boolean on whether the object was updated or not\r
- */\r
-\r
- public boolean updateRouter(String uuid, NeutronRouter delta);\r
-\r
- /**\r
- * Applications call this interface method to check if a router is in use\r
- *\r
- * @param uuid\r
- * identifier of the Router object\r
- * @return boolean on whether the router is in use or not\r
- */\r
-\r
- public boolean routerInUse(String routerUUID);\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import java.util.List;
+
+/**
+ * This interface defines the methods for CRUD of NB Router objects
+ *
+ */
+
+public interface INeutronRouterCRUD {
+ /**
+ * Applications call this interface method to determine if a particular
+ * Router object exists
+ *
+ * @param uuid
+ * UUID of the Router object
+ * @return boolean
+ */
+
+ public boolean routerExists(String uuid);
+
+ /**
+ * Applications call this interface method to return if a particular
+ * Router object exists
+ *
+ * @param uuid
+ * UUID of the Router object
+ * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronRouter.OpenStackRouters}
+ * OpenStack Router class
+ */
+
+ public NeutronRouter getRouter(String uuid);
+
+ /**
+ * Applications call this interface method to return all Router objects
+ *
+ * @return List of OpenStackRouters objects
+ */
+
+ public List<NeutronRouter> getAllRouters();
+
+ /**
+ * Applications call this interface method to add a Router object to the
+ * concurrent map
+ *
+ * @param input
+ * OpenStackRouter object
+ * @return boolean on whether the object was added or not
+ */
+
+ public boolean addRouter(NeutronRouter input);
+
+ /**
+ * Applications call this interface method to remove a Router object to the
+ * concurrent map
+ *
+ * @param uuid
+ * identifier for the Router object
+ * @return boolean on whether the object was removed or not
+ */
+
+ public boolean removeRouter(String uuid);
+
+ /**
+ * Applications call this interface method to edit a Router object
+ *
+ * @param uuid
+ * identifier of the Router object
+ * @param delta
+ * OpenStackRouter object containing changes to apply
+ * @return boolean on whether the object was updated or not
+ */
+
+ public boolean updateRouter(String uuid, NeutronRouter delta);
+
+ /**
+ * Applications call this interface method to check if a router is in use
+ *
+ * @param uuid
+ * identifier of the Router object
+ * @return boolean on whether the router is in use or not
+ */
+
+ public boolean routerInUse(String routerUUID);
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-/**\r
- * This interface defines the methods a service that wishes to be aware of Neutron Subnets needs to implement\r
- *\r
- */\r
-\r
-public interface INeutronSubnetAware {\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified subnet can be created\r
- *\r
- * @param subnet\r
- * instance of proposed new Neutron Subnet object\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the create operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canCreateSubnet(NeutronSubnet subnet);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a subnet has been created\r
- *\r
- * @param subnet\r
- * instance of new Neutron Subnet object\r
- * @return void\r
- */\r
- public void neutronSubnetCreated(NeutronSubnet subnet);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified subnet can be changed using the specified\r
- * delta\r
- *\r
- * @param delta\r
- * updates to the subnet object using patch semantics\r
- * @param subnet\r
- * instance of the Neutron Subnet object to be updated\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the update operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canUpdateSubnet(NeutronSubnet delta, NeutronSubnet original);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a subnet has been updated\r
- *\r
- * @param subnet\r
- * instance of modified Neutron Subnet object\r
- * @return void\r
- */\r
- public void neutronSubnetUpdated(NeutronSubnet subnet);\r
-\r
- /**\r
- * Services provide this interface method to indicate if the specified subnet can be deleted\r
- *\r
- * @param subnet\r
- * instance of the Subnet Router object to be deleted\r
- * @return integer\r
- * the return value is understood to be a HTTP status code. A return value outside of 200 through 299\r
- * results in the delete operation being interrupted and the returned status value reflected in the\r
- * HTTP response.\r
- */\r
- public int canDeleteSubnet(NeutronSubnet subnet);\r
-\r
- /**\r
- * Services provide this interface method for taking action after a subnet has been deleted\r
- *\r
- * @param subnet\r
- * instance of deleted Router Subnet object\r
- * @return void\r
- */\r
- public void neutronSubnetDeleted(NeutronSubnet subnet);\r
-\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+/**
+ * This interface defines the methods a service that wishes to be aware of Neutron Subnets needs to implement
+ *
+ */
+
+public interface INeutronSubnetAware {
+
+ /**
+ * Services provide this interface method to indicate if the specified subnet can be created
+ *
+ * @param subnet
+ * instance of proposed new Neutron Subnet object
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the create operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canCreateSubnet(NeutronSubnet subnet);
+
+ /**
+ * Services provide this interface method for taking action after a subnet has been created
+ *
+ * @param subnet
+ * instance of new Neutron Subnet object
+ * @return void
+ */
+ public void neutronSubnetCreated(NeutronSubnet subnet);
+
+ /**
+ * Services provide this interface method to indicate if the specified subnet can be changed using the specified
+ * delta
+ *
+ * @param delta
+ * updates to the subnet object using patch semantics
+ * @param subnet
+ * instance of the Neutron Subnet object to be updated
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the update operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canUpdateSubnet(NeutronSubnet delta, NeutronSubnet original);
+
+ /**
+ * Services provide this interface method for taking action after a subnet has been updated
+ *
+ * @param subnet
+ * instance of modified Neutron Subnet object
+ * @return void
+ */
+ public void neutronSubnetUpdated(NeutronSubnet subnet);
+
+ /**
+ * Services provide this interface method to indicate if the specified subnet can be deleted
+ *
+ * @param subnet
+ * instance of the Subnet Router object to be deleted
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the delete operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ public int canDeleteSubnet(NeutronSubnet subnet);
+
+ /**
+ * Services provide this interface method for taking action after a subnet has been deleted
+ *
+ * @param subnet
+ * instance of deleted Router Subnet object
+ * @return void
+ */
+ public void neutronSubnetDeleted(NeutronSubnet subnet);
+
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * This interface defines the methods for CRUD of NB Subnet objects\r
- *\r
- */\r
-\r
-public interface INeutronSubnetCRUD {\r
- /**\r
- * Applications call this interface method to determine if a particular\r
- * Subnet object exists\r
- *\r
- * @param uuid\r
- * UUID of the Subnet object\r
- * @return boolean\r
- */\r
-\r
- public boolean subnetExists(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to return if a particular\r
- * Subnet object exists\r
- *\r
- * @param uuid\r
- * UUID of the Subnet object\r
- * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronSubnet.OpenStackSubnets}\r
- * OpenStack Subnet class\r
- */\r
-\r
- public NeutronSubnet getSubnet(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to return all Subnet objects\r
- *\r
- * @return List of OpenStackSubnets objects\r
- */\r
-\r
- public List<NeutronSubnet> getAllSubnets();\r
-\r
- /**\r
- * Applications call this interface method to add a Subnet object to the\r
- * concurrent map\r
- *\r
- * @param input\r
- * OpenStackSubnet object\r
- * @return boolean on whether the object was added or not\r
- */\r
-\r
- public boolean addSubnet(NeutronSubnet input);\r
-\r
- /**\r
- * Applications call this interface method to remove a Subnet object to the\r
- * concurrent map\r
- *\r
- * @param uuid\r
- * identifier for the Subnet object\r
- * @return boolean on whether the object was removed or not\r
- */\r
-\r
- public boolean removeSubnet(String uuid);\r
-\r
- /**\r
- * Applications call this interface method to edit a Subnet object\r
- *\r
- * @param uuid\r
- * identifier of the Subnet object\r
- * @param delta\r
- * OpenStackSubnet object containing changes to apply\r
- * @return boolean on whether the object was updated or not\r
- */\r
-\r
- public boolean updateSubnet(String uuid, NeutronSubnet delta);\r
-\r
- /**\r
- * Applications call this interface method to determine if a Subnet object\r
- * is use\r
- *\r
- * @param subnetUUID\r
- * identifier of the subnet object\r
- *\r
- * @return boolean on whether the subnet is in use or not\r
- */\r
-\r
- public boolean subnetInUse(String subnetUUID);\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import java.util.List;
+
+/**
+ * This interface defines the methods for CRUD of NB Subnet objects
+ *
+ */
+
+public interface INeutronSubnetCRUD {
+ /**
+ * Applications call this interface method to determine if a particular
+ * Subnet object exists
+ *
+ * @param uuid
+ * UUID of the Subnet object
+ * @return boolean
+ */
+
+ public boolean subnetExists(String uuid);
+
+ /**
+ * Applications call this interface method to return if a particular
+ * Subnet object exists
+ *
+ * @param uuid
+ * UUID of the Subnet object
+ * @return {@link org.opendaylight.controller.networkconfig.neutron.NeutronSubnet.OpenStackSubnets}
+ * OpenStack Subnet class
+ */
+
+ public NeutronSubnet getSubnet(String uuid);
+
+ /**
+ * Applications call this interface method to return all Subnet objects
+ *
+ * @return List of OpenStackSubnets objects
+ */
+
+ public List<NeutronSubnet> getAllSubnets();
+
+ /**
+ * Applications call this interface method to add a Subnet object to the
+ * concurrent map
+ *
+ * @param input
+ * OpenStackSubnet object
+ * @return boolean on whether the object was added or not
+ */
+
+ public boolean addSubnet(NeutronSubnet input);
+
+ /**
+ * Applications call this interface method to remove a Subnet object to the
+ * concurrent map
+ *
+ * @param uuid
+ * identifier for the Subnet object
+ * @return boolean on whether the object was removed or not
+ */
+
+ public boolean removeSubnet(String uuid);
+
+ /**
+ * Applications call this interface method to edit a Subnet object
+ *
+ * @param uuid
+ * identifier of the Subnet object
+ * @param delta
+ * OpenStackSubnet object containing changes to apply
+ * @return boolean on whether the object was updated or not
+ */
+
+ public boolean updateSubnet(String uuid, NeutronSubnet delta);
+
+ /**
+ * Applications call this interface method to determine if a Subnet object
+ * is use
+ *
+ * @param subnetUUID
+ * identifier of the subnet object
+ *
+ * @return boolean on whether the subnet is in use or not
+ */
+
+ public boolean subnetInUse(String subnetUUID);
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import org.opendaylight.controller.sal.utils.ServiceHelper;\r
-\r
-public class NeutronCRUDInterfaces {\r
-\r
- public static INeutronNetworkCRUD getINeutronNetworkCRUD(Object o) {\r
- INeutronNetworkCRUD answer = (INeutronNetworkCRUD) ServiceHelper.getGlobalInstance(INeutronNetworkCRUD.class, o);\r
- return answer;\r
- }\r
-\r
- public static INeutronSubnetCRUD getINeutronSubnetCRUD(Object o) {\r
- INeutronSubnetCRUD answer = (INeutronSubnetCRUD) ServiceHelper.getGlobalInstance(INeutronSubnetCRUD.class, o);\r
- return answer;\r
- }\r
-\r
- public static INeutronPortCRUD getINeutronPortCRUD(Object o) {\r
- INeutronPortCRUD answer = (INeutronPortCRUD) ServiceHelper.getGlobalInstance(INeutronPortCRUD.class, o);\r
- return answer;\r
- }\r
-\r
- public static INeutronRouterCRUD getINeutronRouterCRUD(Object o) {\r
- INeutronRouterCRUD answer = (INeutronRouterCRUD) ServiceHelper.getGlobalInstance(INeutronRouterCRUD.class, o);\r
- return answer;\r
- }\r
-\r
- public static INeutronFloatingIPCRUD getINeutronFloatingIPCRUD(Object o) {\r
- INeutronFloatingIPCRUD answer = (INeutronFloatingIPCRUD) ServiceHelper.getGlobalInstance(INeutronFloatingIPCRUD.class, o);\r
- return answer;\r
- }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+
+public class NeutronCRUDInterfaces {
+
+ public static INeutronNetworkCRUD getINeutronNetworkCRUD(Object o) {
+ INeutronNetworkCRUD answer = (INeutronNetworkCRUD) ServiceHelper.getGlobalInstance(INeutronNetworkCRUD.class, o);
+ return answer;
+ }
+
+ public static INeutronSubnetCRUD getINeutronSubnetCRUD(Object o) {
+ INeutronSubnetCRUD answer = (INeutronSubnetCRUD) ServiceHelper.getGlobalInstance(INeutronSubnetCRUD.class, o);
+ return answer;
+ }
+
+ public static INeutronPortCRUD getINeutronPortCRUD(Object o) {
+ INeutronPortCRUD answer = (INeutronPortCRUD) ServiceHelper.getGlobalInstance(INeutronPortCRUD.class, o);
+ return answer;
+ }
+
+ public static INeutronRouterCRUD getINeutronRouterCRUD(Object o) {
+ INeutronRouterCRUD answer = (INeutronRouterCRUD) ServiceHelper.getGlobalInstance(INeutronRouterCRUD.class, o);
+ return answer;
+ }
+
+ public static INeutronFloatingIPCRUD getINeutronFloatingIPCRUD(Object o) {
+ INeutronFloatingIPCRUD answer = (INeutronFloatingIPCRUD) ServiceHelper.getGlobalInstance(INeutronFloatingIPCRUD.class, o);
+ return answer;
+ }
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-@XmlRootElement\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-\r
-public class NeutronFloatingIP {\r
- // See OpenStack Network API v2.0 Reference for description of\r
- // annotated attributes\r
-\r
- @XmlElement (name="id")\r
- String floatingIPUUID;\r
-\r
- @XmlElement (name="floating_network_id")\r
- String floatingNetworkUUID;\r
-\r
- @XmlElement (name="port_id")\r
- String portUUID;\r
-\r
- @XmlElement (name="fixed_ip_address")\r
- String fixedIPAddress;\r
-\r
- @XmlElement (name="floating_ip_address")\r
- String floatingIPAddress;\r
-\r
- @XmlElement (name="tenant_id")\r
- String tenantUUID;\r
-\r
- public NeutronFloatingIP() {\r
- }\r
-\r
- public String getID() { return floatingIPUUID; }\r
-\r
- public String getFloatingIPUUID() {\r
- return floatingIPUUID;\r
- }\r
-\r
- public void setFloatingIPUUID(String floatingIPUUID) {\r
- this.floatingIPUUID = floatingIPUUID;\r
- }\r
-\r
- public String getFloatingNetworkUUID() {\r
- return floatingNetworkUUID;\r
- }\r
-\r
- public void setFloatingNetworkUUID(String floatingNetworkUUID) {\r
- this.floatingNetworkUUID = floatingNetworkUUID;\r
- }\r
-\r
- public String getPortUUID() {\r
- return portUUID;\r
- }\r
-\r
- public void setPortUUID(String portUUID) {\r
- this.portUUID = portUUID;\r
- }\r
-\r
- public String getFixedIPAddress() {\r
- return fixedIPAddress;\r
- }\r
-\r
- public void setFixedIPAddress(String fixedIPAddress) {\r
- this.fixedIPAddress = fixedIPAddress;\r
- }\r
-\r
- public String getFloatingIPAddress() {\r
- return floatingIPAddress;\r
- }\r
-\r
- public void setFloatingIPAddress(String floatingIPAddress) {\r
- this.floatingIPAddress = floatingIPAddress;\r
- }\r
-\r
- public String getTenantUUID() {\r
- return tenantUUID;\r
- }\r
-\r
- public void setTenantUUID(String tenantUUID) {\r
- this.tenantUUID = tenantUUID;\r
- }\r
-\r
- /**\r
- * This method copies selected fields from the object and returns them\r
- * as a new object, suitable for marshaling.\r
- *\r
- * @param fields\r
- * List of attributes to be extracted\r
- * @return an OpenStackFloatingIPs object with only the selected fields\r
- * populated\r
- */\r
-\r
- public NeutronFloatingIP extractFields(List<String> fields) {\r
- NeutronFloatingIP ans = new NeutronFloatingIP();\r
- Iterator<String> i = fields.iterator();\r
- while (i.hasNext()) {\r
- String s = i.next();\r
- if (s.equals("id"))\r
- ans.setFloatingIPUUID(this.getFloatingIPUUID());\r
- if (s.equals("floating_network_id"))\r
- ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());\r
- if (s.equals("port_id"))\r
- ans.setPortUUID(this.getPortUUID());\r
- if (s.equals("fixed_ip_address"))\r
- ans.setFixedIPAddress(this.getFixedIPAddress());\r
- if (s.equals("floating_ip_address"))\r
- ans.setFloatingIPAddress(this.getFloatingIPAddress());\r
- if (s.equals("tenant_id"))\r
- ans.setTenantUUID(this.getTenantUUID());\r
- }\r
- return ans;\r
- }\r
-\r
- public void initDefaults() {\r
- }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+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;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+
+public class NeutronFloatingIP {
+ // See OpenStack Network API v2.0 Reference for description of
+ // annotated attributes
+
+ @XmlElement (name="id")
+ String floatingIPUUID;
+
+ @XmlElement (name="floating_network_id")
+ String floatingNetworkUUID;
+
+ @XmlElement (name="port_id")
+ String portUUID;
+
+ @XmlElement (name="fixed_ip_address")
+ String fixedIPAddress;
+
+ @XmlElement (name="floating_ip_address")
+ String floatingIPAddress;
+
+ @XmlElement (name="tenant_id")
+ String tenantUUID;
+
+ public NeutronFloatingIP() {
+ }
+
+ public String getID() { return floatingIPUUID; }
+
+ public String getFloatingIPUUID() {
+ return floatingIPUUID;
+ }
+
+ public void setFloatingIPUUID(String floatingIPUUID) {
+ this.floatingIPUUID = floatingIPUUID;
+ }
+
+ public String getFloatingNetworkUUID() {
+ return floatingNetworkUUID;
+ }
+
+ public void setFloatingNetworkUUID(String floatingNetworkUUID) {
+ this.floatingNetworkUUID = floatingNetworkUUID;
+ }
+
+ public String getPortUUID() {
+ return portUUID;
+ }
+
+ public void setPortUUID(String portUUID) {
+ this.portUUID = portUUID;
+ }
+
+ public String getFixedIPAddress() {
+ return fixedIPAddress;
+ }
+
+ public void setFixedIPAddress(String fixedIPAddress) {
+ this.fixedIPAddress = fixedIPAddress;
+ }
+
+ public String getFloatingIPAddress() {
+ return floatingIPAddress;
+ }
+
+ public void setFloatingIPAddress(String floatingIPAddress) {
+ this.floatingIPAddress = floatingIPAddress;
+ }
+
+ public String getTenantUUID() {
+ return tenantUUID;
+ }
+
+ public void setTenantUUID(String tenantUUID) {
+ this.tenantUUID = tenantUUID;
+ }
+
+ /**
+ * This method copies selected fields from the object and returns them
+ * as a new object, suitable for marshaling.
+ *
+ * @param fields
+ * List of attributes to be extracted
+ * @return an OpenStackFloatingIPs object with only the selected fields
+ * populated
+ */
+
+ public NeutronFloatingIP extractFields(List<String> fields) {
+ NeutronFloatingIP ans = new NeutronFloatingIP();
+ Iterator<String> i = fields.iterator();
+ while (i.hasNext()) {
+ String s = i.next();
+ if (s.equals("id")) {
+ ans.setFloatingIPUUID(this.getFloatingIPUUID());
+ }
+ if (s.equals("floating_network_id")) {
+ ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
+ }
+ if (s.equals("port_id")) {
+ ans.setPortUUID(this.getPortUUID());
+ }
+ if (s.equals("fixed_ip_address")) {
+ ans.setFixedIPAddress(this.getFixedIPAddress());
+ }
+ if (s.equals("floating_ip_address")) {
+ ans.setFloatingIPAddress(this.getFloatingIPAddress());
+ }
+ if (s.equals("tenant_id")) {
+ ans.setTenantUUID(this.getTenantUUID());
+ }
+ }
+ return ans;
+ }
+
+ public void initDefaults() {
+ }
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-@XmlRootElement(name = "network")\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-\r
-public class NeutronNetwork {\r
- // See OpenStack Network API v2.0 Reference for description of\r
- // annotated attributes\r
-\r
- @XmlElement (name="id")\r
- String networkUUID; // network UUID\r
-\r
- @XmlElement (name="name")\r
- String networkName; // name\r
-\r
- @XmlElement (defaultValue="true", name="admin_state_up")\r
- Boolean adminStateUp; // admin state up (true/false)\r
-\r
- @XmlElement (defaultValue="false", name="shared")\r
- Boolean shared; // shared network or not\r
-\r
- @XmlElement (name="tenant_id")\r
- String tenantID; // tenant for this network\r
-\r
- @XmlElement (defaultValue="false", namespace="router", name="external")\r
- Boolean routerExternal; // network external or not\r
-\r
- @XmlElement (defaultValue="flat", namespace="provider", name="network_type")\r
- String providerNetworkType; // provider network type (flat or vlan)\r
-\r
- @XmlElement (namespace="provider", name="physical_network")\r
- String providerPhysicalNetwork; // provider physical network (name)\r
-\r
- @XmlElement (namespace="provider", name="segmentation_id")\r
- String providerSegmentationID; // provide segmentation ID (vlan ID)\r
-\r
- @XmlElement (name="status")\r
- String status; // status (read-only)\r
-\r
- @XmlElement (name="subnets")\r
- List<String> subnets; // subnets (read-only)\r
-\r
- /* This attribute lists the ports associated with an instance\r
- * which is needed for determining if that instance can be deleted\r
- */\r
-\r
- List<NeutronPort> myPorts;\r
-\r
- public NeutronNetwork() {\r
- myPorts = new ArrayList<NeutronPort>();\r
- }\r
-\r
- public void initDefaults() {\r
- subnets = new ArrayList<String>();\r
- if (this.status == null)\r
- this.status = "ACTIVE";\r
- if (this.adminStateUp == null)\r
- this.adminStateUp = true;\r
- if (this.shared == null)\r
- this.shared = false;\r
- if (this.routerExternal == null)\r
- this.routerExternal = false;\r
- if (this.providerNetworkType == null)\r
- this.providerNetworkType = "flat";\r
- }\r
-\r
- public String getID() { return networkUUID; }\r
-\r
- public String getNetworkUUID() {\r
- return networkUUID;\r
- }\r
-\r
- public void setNetworkUUID(String networkUUID) {\r
- this.networkUUID = networkUUID;\r
- }\r
-\r
- public String getNetworkName() {\r
- return networkName;\r
- }\r
-\r
- public void setNetworkName(String networkName) {\r
- this.networkName = networkName;\r
- }\r
-\r
- public boolean isAdminStateUp() {\r
- return adminStateUp;\r
- }\r
-\r
- public Boolean getAdminStateUp() { return adminStateUp; }\r
-\r
- public void setAdminStateUp(boolean newValue) {\r
- this.adminStateUp = newValue;\r
- }\r
-\r
- public boolean isShared() { return shared; }\r
-\r
- public Boolean getShared() { return shared; }\r
-\r
- public void setShared(boolean newValue) {\r
- this.shared = newValue;\r
- }\r
-\r
- public String getTenantID() {\r
- return tenantID;\r
- }\r
-\r
- public void setTenantID(String tenantID) {\r
- this.tenantID = tenantID;\r
- }\r
-\r
- public boolean isRouterExternal() { return routerExternal; }\r
-\r
- public Boolean getRouterExternal() { return routerExternal; }\r
-\r
- public void setRouterExternal(boolean newValue) {\r
- this.routerExternal = newValue;\r
- }\r
-\r
- public String getProviderNetworkType() {\r
- return providerNetworkType;\r
- }\r
-\r
- public void setProviderNetworkType(String providerNetworkType) {\r
- this.providerNetworkType = providerNetworkType;\r
- }\r
-\r
- public String getProviderPhysicalNetwork() {\r
- return providerPhysicalNetwork;\r
- }\r
-\r
- public void setProviderPhysicalNetwork(String providerPhysicalNetwork) {\r
- this.providerPhysicalNetwork = providerPhysicalNetwork;\r
- }\r
-\r
- public String getProviderSegmentationID() {\r
- return providerSegmentationID;\r
- }\r
-\r
- public void setProviderSegmentationID(String providerSegmentationID) {\r
- this.providerSegmentationID = providerSegmentationID;\r
- }\r
-\r
- public String getStatus() {\r
- return status;\r
- }\r
-\r
- public void setStatus(String status) {\r
- this.status = status;\r
- }\r
-\r
- public List<String> getSubnets() {\r
- return subnets;\r
- }\r
-\r
- public void setSubnets(List<String> subnets) {\r
- this.subnets = subnets;\r
- }\r
-\r
- public void addSubnet(String uuid) {\r
- this.subnets.add(uuid);\r
- }\r
-\r
- public void removeSubnet(String uuid) {\r
- this.subnets.remove(uuid);\r
- }\r
-\r
- public List<NeutronPort> getPortsOnNetwork() {\r
- return myPorts;\r
- }\r
-\r
- public void addPort(NeutronPort port) {\r
- myPorts.add(port);\r
- }\r
-\r
- public void removePort(NeutronPort port) {\r
- myPorts.remove(port);\r
- }\r
-\r
- /**\r
- * This method copies selected fields from the object and returns them\r
- * as a new object, suitable for marshaling.\r
- *\r
- * @param fields\r
- * List of attributes to be extracted\r
- * @return an OpenStackNetworks object with only the selected fields\r
- * populated\r
- */\r
-\r
- public NeutronNetwork extractFields(List<String> fields) {\r
- NeutronNetwork ans = new NeutronNetwork();\r
- Iterator<String> i = fields.iterator();\r
- while (i.hasNext()) {\r
- String s = i.next();\r
- if (s.equals("id"))\r
- ans.setNetworkUUID(this.getNetworkUUID());\r
- if (s.equals("name"))\r
- ans.setNetworkName(this.getNetworkName());\r
- if (s.equals("admin_state_up"))\r
- ans.setAdminStateUp(this.adminStateUp);\r
- if (s.equals("status"))\r
- ans.setStatus(this.getStatus());\r
- if (s.equals("subnets")) {\r
- List<String> subnetList = new ArrayList<String>();\r
- subnetList.addAll(this.getSubnets());\r
- ans.setSubnets(subnetList);\r
- }\r
- if (s.equals("shared"))\r
- ans.setShared(this.shared);\r
- if (s.equals("tenant_id"))\r
- ans.setTenantID(this.getTenantID());\r
- }\r
- return ans;\r
- }\r
-\r
-}\r
-\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import java.util.ArrayList;
+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;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "network")
+@XmlAccessorType(XmlAccessType.NONE)
+
+public class NeutronNetwork {
+ // See OpenStack Network API v2.0 Reference for description of
+ // annotated attributes
+
+ @XmlElement (name="id")
+ String networkUUID; // network UUID
+
+ @XmlElement (name="name")
+ String networkName; // name
+
+ @XmlElement (defaultValue="true", name="admin_state_up")
+ Boolean adminStateUp; // admin state up (true/false)
+
+ @XmlElement (defaultValue="false", name="shared")
+ Boolean shared; // shared network or not
+
+ @XmlElement (name="tenant_id")
+ String tenantID; // tenant for this network
+
+ @XmlElement (defaultValue="false", namespace="router", name="external")
+ Boolean routerExternal; // network external or not
+
+ @XmlElement (defaultValue="flat", namespace="provider", name="network_type")
+ String providerNetworkType; // provider network type (flat or vlan)
+
+ @XmlElement (namespace="provider", name="physical_network")
+ String providerPhysicalNetwork; // provider physical network (name)
+
+ @XmlElement (namespace="provider", name="segmentation_id")
+ String providerSegmentationID; // provide segmentation ID (vlan ID)
+
+ @XmlElement (name="status")
+ String status; // status (read-only)
+
+ @XmlElement (name="subnets")
+ List<String> subnets; // subnets (read-only)
+
+ /* This attribute lists the ports associated with an instance
+ * which is needed for determining if that instance can be deleted
+ */
+
+ List<NeutronPort> myPorts;
+
+ public NeutronNetwork() {
+ myPorts = new ArrayList<NeutronPort>();
+ }
+
+ public void initDefaults() {
+ subnets = new ArrayList<String>();
+ if (status == null) {
+ status = "ACTIVE";
+ }
+ if (adminStateUp == null) {
+ adminStateUp = true;
+ }
+ if (shared == null) {
+ shared = false;
+ }
+ if (routerExternal == null) {
+ routerExternal = false;
+ }
+ if (providerNetworkType == null) {
+ providerNetworkType = "flat";
+ }
+ }
+
+ public String getID() { return networkUUID; }
+
+ public String getNetworkUUID() {
+ return networkUUID;
+ }
+
+ public void setNetworkUUID(String networkUUID) {
+ this.networkUUID = networkUUID;
+ }
+
+ public String getNetworkName() {
+ return networkName;
+ }
+
+ public void setNetworkName(String networkName) {
+ this.networkName = networkName;
+ }
+
+ public boolean isAdminStateUp() {
+ return adminStateUp;
+ }
+
+ public Boolean getAdminStateUp() { return adminStateUp; }
+
+ public void setAdminStateUp(boolean newValue) {
+ adminStateUp = newValue;
+ }
+
+ public boolean isShared() { return shared; }
+
+ public Boolean getShared() { return shared; }
+
+ public void setShared(boolean newValue) {
+ shared = newValue;
+ }
+
+ public String getTenantID() {
+ return tenantID;
+ }
+
+ public void setTenantID(String tenantID) {
+ this.tenantID = tenantID;
+ }
+
+ public boolean isRouterExternal() { return routerExternal; }
+
+ public Boolean getRouterExternal() { return routerExternal; }
+
+ public void setRouterExternal(boolean newValue) {
+ routerExternal = newValue;
+ }
+
+ public String getProviderNetworkType() {
+ return providerNetworkType;
+ }
+
+ public void setProviderNetworkType(String providerNetworkType) {
+ this.providerNetworkType = providerNetworkType;
+ }
+
+ public String getProviderPhysicalNetwork() {
+ return providerPhysicalNetwork;
+ }
+
+ public void setProviderPhysicalNetwork(String providerPhysicalNetwork) {
+ this.providerPhysicalNetwork = providerPhysicalNetwork;
+ }
+
+ public String getProviderSegmentationID() {
+ return providerSegmentationID;
+ }
+
+ public void setProviderSegmentationID(String providerSegmentationID) {
+ this.providerSegmentationID = providerSegmentationID;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public List<String> getSubnets() {
+ return subnets;
+ }
+
+ public void setSubnets(List<String> subnets) {
+ this.subnets = subnets;
+ }
+
+ public void addSubnet(String uuid) {
+ subnets.add(uuid);
+ }
+
+ public void removeSubnet(String uuid) {
+ subnets.remove(uuid);
+ }
+
+ public List<NeutronPort> getPortsOnNetwork() {
+ return myPorts;
+ }
+
+ public void addPort(NeutronPort port) {
+ myPorts.add(port);
+ }
+
+ public void removePort(NeutronPort port) {
+ myPorts.remove(port);
+ }
+
+ /**
+ * This method copies selected fields from the object and returns them
+ * as a new object, suitable for marshaling.
+ *
+ * @param fields
+ * List of attributes to be extracted
+ * @return an OpenStackNetworks object with only the selected fields
+ * populated
+ */
+
+ public NeutronNetwork extractFields(List<String> fields) {
+ NeutronNetwork ans = new NeutronNetwork();
+ Iterator<String> i = fields.iterator();
+ while (i.hasNext()) {
+ String s = i.next();
+ if (s.equals("id")) {
+ ans.setNetworkUUID(this.getNetworkUUID());
+ }
+ if (s.equals("name")) {
+ ans.setNetworkName(this.getNetworkName());
+ }
+ if (s.equals("admin_state_up")) {
+ ans.setAdminStateUp(adminStateUp);
+ }
+ if (s.equals("status")) {
+ ans.setStatus(this.getStatus());
+ }
+ if (s.equals("subnets")) {
+ List<String> subnetList = new ArrayList<String>();
+ subnetList.addAll(this.getSubnets());
+ ans.setSubnets(subnetList);
+ }
+ if (s.equals("shared")) {
+ ans.setShared(shared);
+ }
+ if (s.equals("tenant_id")) {
+ ans.setTenantID(this.getTenantID());
+ }
+ }
+ return ans;
+ }
+
+}
+
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-\r
-@XmlRootElement\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-\r
-public class NeutronPort {\r
- // See OpenStack Network API v2.0 Reference for description of\r
- // annotated attributes\r
-\r
- @XmlElement (name="id")\r
- String portUUID;\r
-\r
- @XmlElement (name="network_id")\r
- String networkUUID;\r
-\r
- @XmlElement (name="name")\r
- String name;\r
-\r
- @XmlElement (defaultValue="true", name="admin_state_up")\r
- Boolean adminStateUp;\r
-\r
- @XmlElement (name="status")\r
- String status;\r
-\r
- @XmlElement (name="mac_address")\r
- String macAddress;\r
-\r
- @XmlElement (name="fixed_ips")\r
- List<Neutron_IPs> fixedIPs;\r
-\r
- @XmlElement (name="device_id")\r
- String deviceID;\r
-\r
- @XmlElement (name="device_owner")\r
- String deviceOwner;\r
-\r
- @XmlElement (name="tenant_id")\r
- String tenantID;\r
-\r
- // TODO: add security groups\r
- // @XmlElement (name="security_groups")\r
- // List<String> securityGroups;\r
-\r
- /* this attribute stores the floating IP address assigned to\r
- * each fixed IP address\r
- */\r
-\r
- HashMap<String, NeutronFloatingIP> floatingIPMap;\r
-\r
- public NeutronPort() {\r
- floatingIPMap = new HashMap<String, NeutronFloatingIP>();\r
- }\r
-\r
- public String getID() { return portUUID; }\r
-\r
- public String getPortUUID() {\r
- return portUUID;\r
- }\r
-\r
- public void setPortUUID(String portUUID) {\r
- this.portUUID = portUUID;\r
- }\r
-\r
- public String getNetworkUUID() {\r
- return networkUUID;\r
- }\r
-\r
- public void setNetworkUUID(String networkUUID) {\r
- this.networkUUID = networkUUID;\r
- }\r
-\r
- public String getName() {\r
- return name;\r
- }\r
-\r
- public void setName(String name) {\r
- this.name = name;\r
- }\r
-\r
- public boolean isAdminStateUp() {\r
- if (adminStateUp == null)\r
- return true;\r
- return adminStateUp;\r
- }\r
-\r
- public Boolean getAdminStateUp() { return adminStateUp; }\r
-\r
- public void setAdminStateUp(Boolean newValue) {\r
- this.adminStateUp = newValue;\r
- }\r
-\r
- public String getStatus() {\r
- return status;\r
- }\r
-\r
- public void setStatus(String status) {\r
- this.status = status;\r
- }\r
-\r
- public String getMacAddress() {\r
- return macAddress;\r
- }\r
-\r
- public void setMacAddress(String macAddress) {\r
- this.macAddress = macAddress;\r
- }\r
-\r
- public List<Neutron_IPs> getFixedIPs() {\r
- return fixedIPs;\r
- }\r
-\r
- public void setFixedIPs(List<Neutron_IPs> fixedIPs) {\r
- this.fixedIPs = fixedIPs;\r
- }\r
-\r
- public String getDeviceID() {\r
- return deviceID;\r
- }\r
-\r
- public void setDeviceID(String deviceID) {\r
- this.deviceID = deviceID;\r
- }\r
-\r
- public String getDeviceOwner() {\r
- return deviceOwner;\r
- }\r
-\r
- public void setDeviceOwner(String deviceOwner) {\r
- this.deviceOwner = deviceOwner;\r
- }\r
-\r
- public String getTenantID() {\r
- return tenantID;\r
- }\r
-\r
- public void setTenantID(String tenantID) {\r
- this.tenantID = tenantID;\r
- }\r
-\r
- public NeutronFloatingIP getFloatingIP(String key) {\r
- if (!floatingIPMap.containsKey(key))\r
- return null;\r
- return floatingIPMap.get(key);\r
- }\r
-\r
- public void removeFloatingIP(String key) {\r
- floatingIPMap.remove(key);\r
- }\r
-\r
- public void addFloatingIP(String key, NeutronFloatingIP floatingIP) {\r
- if (!floatingIPMap.containsKey(key))\r
- floatingIPMap.put(key, floatingIP);\r
- }\r
-\r
- /**\r
- * This method copies selected fields from the object and returns them\r
- * as a new object, suitable for marshaling.\r
- *\r
- * @param fields\r
- * List of attributes to be extracted\r
- * @return an OpenStackPorts object with only the selected fields\r
- * populated\r
- */\r
-\r
- public NeutronPort extractFields(List<String> fields) {\r
- NeutronPort ans = new NeutronPort();\r
- Iterator<String> i = fields.iterator();\r
- while (i.hasNext()) {\r
- String s = i.next();\r
- if (s.equals("id"))\r
- ans.setPortUUID(this.getPortUUID());\r
- if (s.equals("network_id"))\r
- ans.setNetworkUUID(this.getNetworkUUID());\r
- if (s.equals("name"))\r
- ans.setName(this.getName());\r
- if (s.equals("admin_state_up"))\r
- ans.setAdminStateUp(this.getAdminStateUp());\r
- if (s.equals("status"))\r
- ans.setStatus(this.getStatus());\r
- if (s.equals("mac_address"))\r
- ans.setMacAddress(this.getMacAddress());\r
- if (s.equals("fixed_ips")) {\r
- List<Neutron_IPs> fixedIPs = new ArrayList<Neutron_IPs>();\r
- fixedIPs.addAll(this.getFixedIPs());\r
- ans.setFixedIPs(fixedIPs);\r
- }\r
- if (s.equals("device_id")) {\r
- ans.setDeviceID(this.getDeviceID());\r
- }\r
- if (s.equals("device_owner")) {\r
- ans.setDeviceOwner(this.getDeviceOwner());\r
- }\r
- if (s.equals("tenant_id"))\r
- ans.setTenantID(this.getTenantID());\r
- }\r
- return ans;\r
- }\r
-\r
- public void initDefaults() {\r
- adminStateUp = true;\r
- if (status == null)\r
- status = "ACTIVE";\r
- if (fixedIPs == null)\r
- fixedIPs = new ArrayList<Neutron_IPs>();\r
- }\r
-\r
- /**\r
- * This method checks to see if the port has a floating IPv4 address\r
- * associated with the supplied fixed IPv4 address\r
- *\r
- * @param fixedIP\r
- * fixed IPv4 address in dotted decimal format\r
- * @return a boolean indicating if there is a floating IPv4 address bound\r
- * to the fixed IPv4 address\r
- */\r
-\r
- public boolean isBoundToFloatingIP(String fixedIP) {\r
- return floatingIPMap.containsKey(fixedIP);\r
- }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import java.util.ArrayList;
+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;
+import javax.xml.bind.annotation.XmlRootElement;
+
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+
+public class NeutronPort {
+ // See OpenStack Network API v2.0 Reference for description of
+ // annotated attributes
+
+ @XmlElement (name="id")
+ String portUUID;
+
+ @XmlElement (name="network_id")
+ String networkUUID;
+
+ @XmlElement (name="name")
+ String name;
+
+ @XmlElement (defaultValue="true", name="admin_state_up")
+ Boolean adminStateUp;
+
+ @XmlElement (name="status")
+ String status;
+
+ @XmlElement (name="mac_address")
+ String macAddress;
+
+ @XmlElement (name="fixed_ips")
+ List<Neutron_IPs> fixedIPs;
+
+ @XmlElement (name="device_id")
+ String deviceID;
+
+ @XmlElement (name="device_owner")
+ String deviceOwner;
+
+ @XmlElement (name="tenant_id")
+ String tenantID;
+
+ // TODO: add security groups
+ // @XmlElement (name="security_groups")
+ // List<String> securityGroups;
+
+ /* this attribute stores the floating IP address assigned to
+ * each fixed IP address
+ */
+
+ HashMap<String, NeutronFloatingIP> floatingIPMap;
+
+ public NeutronPort() {
+ floatingIPMap = new HashMap<String, NeutronFloatingIP>();
+ }
+
+ public String getID() { return portUUID; }
+
+ public String getPortUUID() {
+ return portUUID;
+ }
+
+ public void setPortUUID(String portUUID) {
+ this.portUUID = portUUID;
+ }
+
+ public String getNetworkUUID() {
+ return networkUUID;
+ }
+
+ public void setNetworkUUID(String networkUUID) {
+ this.networkUUID = networkUUID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isAdminStateUp() {
+ if (adminStateUp == null) {
+ return true;
+ }
+ return adminStateUp;
+ }
+
+ public Boolean getAdminStateUp() { return adminStateUp; }
+
+ public void setAdminStateUp(Boolean newValue) {
+ adminStateUp = newValue;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getMacAddress() {
+ return macAddress;
+ }
+
+ public void setMacAddress(String macAddress) {
+ this.macAddress = macAddress;
+ }
+
+ public List<Neutron_IPs> getFixedIPs() {
+ return fixedIPs;
+ }
+
+ public void setFixedIPs(List<Neutron_IPs> fixedIPs) {
+ this.fixedIPs = fixedIPs;
+ }
+
+ public String getDeviceID() {
+ return deviceID;
+ }
+
+ public void setDeviceID(String deviceID) {
+ this.deviceID = deviceID;
+ }
+
+ public String getDeviceOwner() {
+ return deviceOwner;
+ }
+
+ public void setDeviceOwner(String deviceOwner) {
+ this.deviceOwner = deviceOwner;
+ }
+
+ public String getTenantID() {
+ return tenantID;
+ }
+
+ public void setTenantID(String tenantID) {
+ this.tenantID = tenantID;
+ }
+
+ public NeutronFloatingIP getFloatingIP(String key) {
+ if (!floatingIPMap.containsKey(key)) {
+ return null;
+ }
+ return floatingIPMap.get(key);
+ }
+
+ public void removeFloatingIP(String key) {
+ floatingIPMap.remove(key);
+ }
+
+ public void addFloatingIP(String key, NeutronFloatingIP floatingIP) {
+ if (!floatingIPMap.containsKey(key)) {
+ floatingIPMap.put(key, floatingIP);
+ }
+ }
+
+ /**
+ * This method copies selected fields from the object and returns them
+ * as a new object, suitable for marshaling.
+ *
+ * @param fields
+ * List of attributes to be extracted
+ * @return an OpenStackPorts object with only the selected fields
+ * populated
+ */
+
+ public NeutronPort extractFields(List<String> fields) {
+ NeutronPort ans = new NeutronPort();
+ Iterator<String> i = fields.iterator();
+ while (i.hasNext()) {
+ String s = i.next();
+ if (s.equals("id")) {
+ ans.setPortUUID(this.getPortUUID());
+ }
+ if (s.equals("network_id")) {
+ ans.setNetworkUUID(this.getNetworkUUID());
+ }
+ if (s.equals("name")) {
+ ans.setName(this.getName());
+ }
+ if (s.equals("admin_state_up")) {
+ ans.setAdminStateUp(this.getAdminStateUp());
+ }
+ if (s.equals("status")) {
+ ans.setStatus(this.getStatus());
+ }
+ if (s.equals("mac_address")) {
+ ans.setMacAddress(this.getMacAddress());
+ }
+ if (s.equals("fixed_ips")) {
+ List<Neutron_IPs> fixedIPs = new ArrayList<Neutron_IPs>();
+ fixedIPs.addAll(this.getFixedIPs());
+ ans.setFixedIPs(fixedIPs);
+ }
+ if (s.equals("device_id")) {
+ ans.setDeviceID(this.getDeviceID());
+ }
+ if (s.equals("device_owner")) {
+ ans.setDeviceOwner(this.getDeviceOwner());
+ }
+ if (s.equals("tenant_id")) {
+ ans.setTenantID(this.getTenantID());
+ }
+ }
+ return ans;
+ }
+
+ public void initDefaults() {
+ adminStateUp = true;
+ if (status == null) {
+ status = "ACTIVE";
+ }
+ if (fixedIPs == null) {
+ fixedIPs = new ArrayList<Neutron_IPs>();
+ }
+ }
+
+ /**
+ * This method checks to see if the port has a floating IPv4 address
+ * associated with the supplied fixed IPv4 address
+ *
+ * @param fixedIP
+ * fixed IPv4 address in dotted decimal format
+ * @return a boolean indicating if there is a floating IPv4 address bound
+ * to the fixed IPv4 address
+ */
+
+ public boolean isBoundToFloatingIP(String fixedIP) {
+ return floatingIPMap.containsKey(fixedIP);
+ }
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-@XmlRootElement\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-\r
-public class NeutronRouter {\r
- // See OpenStack Network API v2.0 Reference for description of\r
- // annotated attributes\r
- @XmlElement (name="id")\r
- String routerUUID;\r
-\r
- @XmlElement (name="name")\r
- String name;\r
-\r
- @XmlElement (defaultValue="true", name="admin_state_up")\r
- Boolean adminStateUp;\r
-\r
- @XmlElement (name="status")\r
- String status;\r
-\r
- @XmlElement (name="tenant_id")\r
- String tenantID;\r
-\r
- @XmlElement (name="external_gateway_info")\r
- NeutronRouter_NetworkReference externalGatewayInfo;\r
-\r
- /* Holds a map of OpenStackRouterInterfaces by subnet UUID\r
- * used for internal mapping to DOVE\r
- */\r
- HashMap<String, NeutronRouter_Interface> interfaces;\r
-\r
- public NeutronRouter() {\r
- interfaces = new HashMap<String, NeutronRouter_Interface>();\r
- }\r
-\r
- public String getID() { return routerUUID; }\r
-\r
- public String getRouterUUID() {\r
- return routerUUID;\r
- }\r
-\r
- public void setRouterUUID(String routerUUID) {\r
- this.routerUUID = routerUUID;\r
- }\r
-\r
- public String getName() {\r
- return name;\r
- }\r
-\r
- public void setName(String name) {\r
- this.name = name;\r
- }\r
-\r
- public boolean isAdminStateUp() {\r
- if (adminStateUp == null)\r
- return true;\r
- return adminStateUp;\r
- }\r
-\r
- public Boolean getAdminStateUp() { return adminStateUp; }\r
-\r
- public void setAdminStateUp(Boolean newValue) {\r
- this.adminStateUp = newValue;\r
- }\r
-\r
- public String getStatus() {\r
- return status;\r
- }\r
-\r
- public void setStatus(String status) {\r
- this.status = status;\r
- }\r
-\r
- public String getTenantID() {\r
- return tenantID;\r
- }\r
-\r
- public void setTenantID(String tenantID) {\r
- this.tenantID = tenantID;\r
- }\r
-\r
- public NeutronRouter_NetworkReference getExternalGatewayInfo() {\r
- return externalGatewayInfo;\r
- }\r
-\r
- public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) {\r
- this.externalGatewayInfo = externalGatewayInfo;\r
- }\r
-\r
- /**\r
- * This method copies selected fields from the object and returns them\r
- * as a new object, suitable for marshaling.\r
- *\r
- * @param fields\r
- * List of attributes to be extracted\r
- * @return an OpenStackRouters object with only the selected fields\r
- * populated\r
- */\r
-\r
- public NeutronRouter extractFields(List<String> fields) {\r
- NeutronRouter ans = new NeutronRouter();\r
- Iterator<String> i = fields.iterator();\r
- while (i.hasNext()) {\r
- String s = i.next();\r
- if (s.equals("id"))\r
- ans.setRouterUUID(this.getRouterUUID());\r
- if (s.equals("name"))\r
- ans.setName(this.getName());\r
- if (s.equals("admin_state_up"))\r
- ans.setAdminStateUp(this.getAdminStateUp());\r
- if (s.equals("status"))\r
- ans.setStatus(this.getStatus());\r
- if (s.equals("tenant_id"))\r
- ans.setTenantID(this.getTenantID());\r
- if (s.equals("external_gateway_info")) {\r
- ans.setExternalGatewayInfo(this.getExternalGatewayInfo());\r
- }\r
- }\r
- return ans;\r
- }\r
-\r
- public HashMap<String, NeutronRouter_Interface> getInterfaces() {\r
- return interfaces;\r
- }\r
-\r
- public void addInterface(String s, NeutronRouter_Interface i) {\r
- interfaces.put(s, i);\r
- }\r
-\r
- public void removeInterface(String s) {\r
- interfaces.remove(s);\r
- }\r
-\r
- public void initDefaults() {\r
- adminStateUp = true;\r
- }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+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;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+
+public class NeutronRouter {
+ // See OpenStack Network API v2.0 Reference for description of
+ // annotated attributes
+ @XmlElement (name="id")
+ String routerUUID;
+
+ @XmlElement (name="name")
+ String name;
+
+ @XmlElement (defaultValue="true", name="admin_state_up")
+ Boolean adminStateUp;
+
+ @XmlElement (name="status")
+ String status;
+
+ @XmlElement (name="tenant_id")
+ String tenantID;
+
+ @XmlElement (name="external_gateway_info")
+ NeutronRouter_NetworkReference externalGatewayInfo;
+
+ /* Holds a map of OpenStackRouterInterfaces by subnet UUID
+ * used for internal mapping to DOVE
+ */
+ HashMap<String, NeutronRouter_Interface> interfaces;
+
+ public NeutronRouter() {
+ interfaces = new HashMap<String, NeutronRouter_Interface>();
+ }
+
+ public String getID() { return routerUUID; }
+
+ public String getRouterUUID() {
+ return routerUUID;
+ }
+
+ public void setRouterUUID(String routerUUID) {
+ this.routerUUID = routerUUID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isAdminStateUp() {
+ if (adminStateUp == null) {
+ return true;
+ }
+ return adminStateUp;
+ }
+
+ public Boolean getAdminStateUp() { return adminStateUp; }
+
+ public void setAdminStateUp(Boolean newValue) {
+ adminStateUp = newValue;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getTenantID() {
+ return tenantID;
+ }
+
+ public void setTenantID(String tenantID) {
+ this.tenantID = tenantID;
+ }
+
+ public NeutronRouter_NetworkReference getExternalGatewayInfo() {
+ return externalGatewayInfo;
+ }
+
+ public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) {
+ this.externalGatewayInfo = externalGatewayInfo;
+ }
+
+ /**
+ * This method copies selected fields from the object and returns them
+ * as a new object, suitable for marshaling.
+ *
+ * @param fields
+ * List of attributes to be extracted
+ * @return an OpenStackRouters object with only the selected fields
+ * populated
+ */
+
+ public NeutronRouter extractFields(List<String> fields) {
+ NeutronRouter ans = new NeutronRouter();
+ Iterator<String> i = fields.iterator();
+ while (i.hasNext()) {
+ String s = i.next();
+ if (s.equals("id")) {
+ ans.setRouterUUID(this.getRouterUUID());
+ }
+ if (s.equals("name")) {
+ ans.setName(this.getName());
+ }
+ if (s.equals("admin_state_up")) {
+ ans.setAdminStateUp(this.getAdminStateUp());
+ }
+ if (s.equals("status")) {
+ ans.setStatus(this.getStatus());
+ }
+ if (s.equals("tenant_id")) {
+ ans.setTenantID(this.getTenantID());
+ }
+ if (s.equals("external_gateway_info")) {
+ ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
+ }
+ }
+ return ans;
+ }
+
+ public HashMap<String, NeutronRouter_Interface> getInterfaces() {
+ return interfaces;
+ }
+
+ public void addInterface(String s, NeutronRouter_Interface i) {
+ interfaces.put(s, i);
+ }
+
+ public void removeInterface(String s) {
+ interfaces.remove(s);
+ }
+
+ public void initDefaults() {
+ adminStateUp = true;
+ }
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-@XmlRootElement\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-public class NeutronRouter_Interface {\r
- // See OpenStack Network API v2.0 Reference for description of\r
- // annotated attributes\r
-\r
- @XmlElement (name="subnet_id")\r
- String subnetUUID;\r
-\r
- @XmlElement (name="port_id")\r
- String portUUID;\r
-\r
- @XmlElement (name="id")\r
- String id;\r
-\r
- @XmlElement (name="tenant_id")\r
- String tenantID;\r
-\r
- public NeutronRouter_Interface() {\r
- }\r
-\r
- public NeutronRouter_Interface(String subnetUUID, String portUUID) {\r
- this.subnetUUID = subnetUUID;\r
- this.portUUID = portUUID;\r
- }\r
-\r
- public String getSubnetUUID() {\r
- return subnetUUID;\r
- }\r
-\r
- public void setSubnetUUID(String subnetUUID) {\r
- this.subnetUUID = subnetUUID;\r
- }\r
-\r
- public String getPortUUID() {\r
- return portUUID;\r
- }\r
-\r
- public void setPortUUID(String portUUID) {\r
- this.portUUID = portUUID;\r
- }\r
-\r
- public void setID(String id) {\r
- this.id = id;\r
- }\r
-\r
- public void setTenantID(String tenantID) {\r
- this.tenantID = tenantID;\r
- }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class NeutronRouter_Interface {
+ // See OpenStack Network API v2.0 Reference for description of
+ // annotated attributes
+
+ @XmlElement (name="subnet_id")
+ String subnetUUID;
+
+ @XmlElement (name="port_id")
+ String portUUID;
+
+ @XmlElement (name="id")
+ String id;
+
+ @XmlElement (name="tenant_id")
+ String tenantID;
+
+ public NeutronRouter_Interface() {
+ }
+
+ public NeutronRouter_Interface(String subnetUUID, String portUUID) {
+ this.subnetUUID = subnetUUID;
+ this.portUUID = portUUID;
+ }
+
+ public String getSubnetUUID() {
+ return subnetUUID;
+ }
+
+ public void setSubnetUUID(String subnetUUID) {
+ this.subnetUUID = subnetUUID;
+ }
+
+ public String getPortUUID() {
+ return portUUID;
+ }
+
+ public void setPortUUID(String portUUID) {
+ this.portUUID = portUUID;
+ }
+
+ public void setID(String id) {
+ this.id = id;
+ }
+
+ public void setTenantID(String tenantID) {
+ this.tenantID = tenantID;
+ }
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-@XmlRootElement\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-\r
-public class NeutronRouter_NetworkReference {\r
- // See OpenStack Network API v2.0 Reference for description of\r
- // annotated attributes\r
-\r
- @XmlElement(name="network_id")\r
- String networkID;\r
-\r
- public NeutronRouter_NetworkReference() {\r
- }\r
-\r
- public String getNetworkID() {\r
- return networkID;\r
- }\r
-\r
- public void setNetworkID(String networkID) {\r
- this.networkID = networkID;\r
- }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+
+public class NeutronRouter_NetworkReference {
+ // See OpenStack Network API v2.0 Reference for description of
+ // annotated attributes
+
+ @XmlElement(name="network_id")
+ String networkID;
+
+ public NeutronRouter_NetworkReference() {
+ }
+
+ public String getNetworkID() {
+ return networkID;
+ }
+
+ public void setNetworkID(String networkID) {
+ this.networkID = networkID;
+ }
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-import org.apache.commons.net.util.SubnetUtils;\r
-import org.apache.commons.net.util.SubnetUtils.SubnetInfo;\r
-\r
-@XmlRootElement\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-\r
-public class NeutronSubnet {\r
- // See OpenStack Network API v2.0 Reference for description of\r
- // annotated attributes\r
-\r
- @XmlElement (name="id")\r
- String subnetUUID;\r
-\r
- @XmlElement (name="network_id")\r
- String networkUUID;\r
-\r
- @XmlElement (name="name")\r
- String name;\r
-\r
- @XmlElement (defaultValue="4", name="ip_version")\r
- Integer ipVersion;\r
-\r
- @XmlElement (name="cidr")\r
- String cidr;\r
-\r
- @XmlElement (name="gateway_ip")\r
- String gatewayIP;\r
-\r
- @XmlElement (name="dns_nameservers")\r
- List<String> dnsNameservers;\r
-\r
- @XmlElement (name="allocation_pools")\r
- List<NeutronSubnet_IPAllocationPool> allocationPools;\r
-\r
- @XmlElement (name="host_routes")\r
- List<NeutronSubnet_HostRoute> hostRoutes;\r
-\r
- @XmlElement (defaultValue="true", name="enable_dhcp")\r
- Boolean enableDHCP;\r
-\r
- @XmlElement (name="tenant_id")\r
- String tenantID;\r
-\r
- /* stores the OpenStackPorts associated with an instance\r
- * used to determine if that instance can be deleted.\r
- */\r
- List<NeutronPort> myPorts;\r
-\r
- boolean gatewayIPAssigned;\r
-\r
- public NeutronSubnet() {\r
- myPorts = new ArrayList<NeutronPort>();\r
- }\r
-\r
- public String getID() { return subnetUUID; }\r
-\r
- public String getSubnetUUID() {\r
- return subnetUUID;\r
- }\r
-\r
- public void setSubnetUUID(String subnetUUID) {\r
- this.subnetUUID = subnetUUID;\r
- }\r
-\r
- public String getNetworkUUID() {\r
- return networkUUID;\r
- }\r
-\r
- public void setNetworkUUID(String networkUUID) {\r
- this.networkUUID = networkUUID;\r
- }\r
-\r
- public String getName() {\r
- return name;\r
- }\r
-\r
- public void setName(String name) {\r
- this.name = name;\r
- }\r
-\r
- public Integer getIpVersion() {\r
- return ipVersion;\r
- }\r
-\r
- public void setIpVersion(Integer ipVersion) {\r
- this.ipVersion = ipVersion;\r
- }\r
-\r
- public String getCidr() {\r
- return cidr;\r
- }\r
-\r
- public void setCidr(String cidr) {\r
- this.cidr = cidr;\r
- }\r
-\r
- public String getGatewayIP() {\r
- return gatewayIP;\r
- }\r
-\r
- public void setGatewayIP(String gatewayIP) {\r
- this.gatewayIP = gatewayIP;\r
- }\r
-\r
- public List<String> getDnsNameservers() {\r
- return dnsNameservers;\r
- }\r
-\r
- public void setDnsNameservers(List<String> dnsNameservers) {\r
- this.dnsNameservers = dnsNameservers;\r
- }\r
-\r
- public List<NeutronSubnet_IPAllocationPool> getAllocationPools() {\r
- return allocationPools;\r
- }\r
-\r
- public void setAllocationPools(List<NeutronSubnet_IPAllocationPool> allocationPools) {\r
- this.allocationPools = allocationPools;\r
- }\r
-\r
- public List<NeutronSubnet_HostRoute> getHostRoutes() {\r
- return hostRoutes;\r
- }\r
-\r
- public void setHostRoutes(List<NeutronSubnet_HostRoute> hostRoutes) {\r
- this.hostRoutes = hostRoutes;\r
- }\r
-\r
- public boolean isEnableDHCP() {\r
- if (enableDHCP == null) {\r
- return true;\r
- }\r
- return enableDHCP;\r
- }\r
-\r
- public Boolean getEnableDHCP() { return enableDHCP; }\r
-\r
- public void setEnableDHCP(Boolean newValue) {\r
- enableDHCP = newValue;\r
- }\r
-\r
- public String getTenantID() {\r
- return tenantID;\r
- }\r
-\r
- public void setTenantID(String tenantID) {\r
- this.tenantID = tenantID;\r
- }\r
-\r
- /**\r
- * This method copies selected fields from the object and returns them\r
- * as a new object, suitable for marshaling.\r
- *\r
- * @param fields\r
- * List of attributes to be extracted\r
- * @return an OpenStackSubnets object with only the selected fields\r
- * populated\r
- */\r
-\r
- public NeutronSubnet extractFields(List<String> fields) {\r
- NeutronSubnet ans = new NeutronSubnet();\r
- Iterator<String> i = fields.iterator();\r
- while (i.hasNext()) {\r
- String s = i.next();\r
- if (s.equals("id")) {\r
- ans.setSubnetUUID(this.getSubnetUUID());\r
- }\r
- if (s.equals("network_id")) {\r
- ans.setNetworkUUID(this.getNetworkUUID());\r
- }\r
- if (s.equals("name")) {\r
- ans.setName(this.getName());\r
- }\r
- if (s.equals("ip_version")) {\r
- ans.setIpVersion(this.getIpVersion());\r
- }\r
- if (s.equals("cidr")) {\r
- ans.setCidr(this.getCidr());\r
- }\r
- if (s.equals("gateway_ip")) {\r
- ans.setGatewayIP(this.getGatewayIP());\r
- }\r
- if (s.equals("dns_nameservers")) {\r
- List<String> nsList = new ArrayList<String>();\r
- nsList.addAll(this.getDnsNameservers());\r
- ans.setDnsNameservers(nsList);\r
- }\r
- if (s.equals("allocation_pools")) {\r
- List<NeutronSubnet_IPAllocationPool> aPools = new ArrayList<NeutronSubnet_IPAllocationPool>();\r
- aPools.addAll(this.getAllocationPools());\r
- ans.setAllocationPools(aPools);\r
- }\r
- if (s.equals("host_routes")) {\r
- List<NeutronSubnet_HostRoute> hRoutes = new ArrayList<NeutronSubnet_HostRoute>();\r
- hRoutes.addAll(this.getHostRoutes());\r
- ans.setHostRoutes(hRoutes);\r
- }\r
- if (s.equals("enable_dhcp")) {\r
- ans.setEnableDHCP(this.getEnableDHCP());\r
- }\r
- if (s.equals("tenant_id")) {\r
- ans.setTenantID(this.getTenantID());\r
- }\r
- }\r
- return ans;\r
- }\r
-\r
- /* test to see if the cidr address used to define this subnet\r
- * is a valid network address (an necessary condition when creating\r
- * a new subnet)\r
- */\r
- public boolean isValidCIDR() {\r
- try {\r
- SubnetUtils util = new SubnetUtils(cidr);\r
- SubnetInfo info = util.getInfo();\r
- if (!info.getNetworkAddress().equals(info.getAddress())) {\r
- return false;\r
- }\r
- } catch (Exception e) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /* test to see if the gateway IP specified overlaps with specified\r
- * allocation pools (an error condition when creating a new subnet\r
- * or assigning a gateway IP)\r
- */\r
- public boolean gatewayIP_Pool_overlap() {\r
- Iterator<NeutronSubnet_IPAllocationPool> i = allocationPools.iterator();\r
- while (i.hasNext()) {\r
- NeutronSubnet_IPAllocationPool pool = i.next();\r
- if (pool.contains(gatewayIP)) {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- public boolean initDefaults() {\r
- if (enableDHCP == null) {\r
- enableDHCP = true;\r
- }\r
- if (ipVersion == null) {\r
- ipVersion = 4;\r
- }\r
- gatewayIPAssigned = false;\r
- dnsNameservers = new ArrayList<String>();\r
- allocationPools = new ArrayList<NeutronSubnet_IPAllocationPool>();\r
- hostRoutes = new ArrayList<NeutronSubnet_HostRoute>();\r
- try {\r
- SubnetUtils util = new SubnetUtils(cidr);\r
- SubnetInfo info = util.getInfo();\r
- if (gatewayIP == null) {\r
- gatewayIP = info.getLowAddress();\r
- }\r
- if (allocationPools.size() < 1) {\r
- NeutronSubnet_IPAllocationPool source =\r
- new NeutronSubnet_IPAllocationPool(info.getLowAddress(),\r
- info.getHighAddress());\r
- allocationPools = source.splitPool(gatewayIP);\r
- }\r
- } catch (Exception e) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- public List<NeutronPort> getPortsInSubnet() {\r
- return myPorts;\r
- }\r
-\r
- public void addPort(NeutronPort port) {\r
- myPorts.add(port);\r
- }\r
-\r
- public void removePort(NeutronPort port) {\r
- myPorts.remove(port);\r
- }\r
-\r
- /* this method tests to see if the supplied IPv4 address\r
- * is valid for this subnet or not\r
- */\r
- public boolean isValidIP(String ipAddress) {\r
- try {\r
- SubnetUtils util = new SubnetUtils(cidr);\r
- SubnetInfo info = util.getInfo();\r
- return info.isInRange(ipAddress);\r
- } catch (Exception e) {\r
- return false;\r
- }\r
- }\r
-\r
- /* test to see if the supplied IPv4 address is part of one of the\r
- * available allocation pools or not\r
- */\r
- public boolean isIPInUse(String ipAddress) {\r
- if (ipAddress.equals(gatewayIP) && !gatewayIPAssigned ) {\r
- return false;\r
- }\r
- Iterator<NeutronSubnet_IPAllocationPool> i = allocationPools.iterator();\r
- while (i.hasNext()) {\r
- NeutronSubnet_IPAllocationPool pool = i.next();\r
- if (pool.contains(ipAddress)) {\r
- return false;\r
- }\r
- }\r
- return true;\r
- }\r
-\r
- /* method to get the lowest available address of the subnet.\r
- * go through all the allocation pools and keep the lowest of their\r
- * low addresses.\r
- */\r
- public String getLowAddr() {\r
- String ans = null;\r
- Iterator<NeutronSubnet_IPAllocationPool> i = allocationPools.iterator();\r
- while (i.hasNext()) {\r
- NeutronSubnet_IPAllocationPool pool = i.next();\r
- if (ans == null) {\r
- ans = pool.getPoolStart();\r
- }\r
- else\r
- if (NeutronSubnet_IPAllocationPool.convert(pool.getPoolStart()) <\r
- NeutronSubnet_IPAllocationPool.convert(ans)) {\r
- ans = pool.getPoolStart();\r
- }\r
- }\r
- return ans;\r
- }\r
-\r
- /*\r
- * allocate the parameter address. Because this uses an iterator to\r
- * check the instance's list of allocation pools and we want to modify\r
- * pools while the iterator is being used, it is necessary to\r
- * build a new list of allocation pools and replace the list when\r
- * finished (otherwise a split will cause undefined iterator behavior.\r
- */\r
- public void allocateIP(String ipAddress) {\r
- Iterator<NeutronSubnet_IPAllocationPool> i = allocationPools.iterator();\r
- List<NeutronSubnet_IPAllocationPool> newList = new ArrayList<NeutronSubnet_IPAllocationPool>(); // we have to modify a separate list\r
- while (i.hasNext()) {\r
- NeutronSubnet_IPAllocationPool pool = i.next();\r
- /* if the pool contains a single address element and we are allocating it\r
- * then we don't need to copy the pool over. Otherwise, we need to possibly\r
- * split the pool and add both pieces to the new list\r
- */\r
- if (!(pool.getPoolEnd().equalsIgnoreCase(ipAddress) &&\r
- pool.getPoolStart().equalsIgnoreCase(ipAddress))) {\r
- if (pool.contains(ipAddress)) {\r
- List<NeutronSubnet_IPAllocationPool> pools = pool.splitPool(ipAddress);\r
- newList.addAll(pools);\r
- } else {\r
- newList.add(pool);\r
- }\r
- }\r
- }\r
- allocationPools = newList;\r
- }\r
-\r
- /*\r
- * release an IP address back to the subnet. Although an iterator\r
- * is used, the list is not modified until the iterator is complete, so\r
- * an extra list is not necessary.\r
- */\r
- public void releaseIP(String ipAddress) {\r
- NeutronSubnet_IPAllocationPool lPool = null;\r
- NeutronSubnet_IPAllocationPool hPool = null;\r
- Iterator<NeutronSubnet_IPAllocationPool> i = allocationPools.iterator();\r
- long sIP = NeutronSubnet_IPAllocationPool.convert(ipAddress);\r
- //look for lPool where ipAddr - 1 is high address\r
- //look for hPool where ipAddr + 1 is low address\r
- while (i.hasNext()) {\r
- NeutronSubnet_IPAllocationPool pool = i.next();\r
- long lIP = NeutronSubnet_IPAllocationPool.convert(pool.getPoolStart());\r
- long hIP = NeutronSubnet_IPAllocationPool.convert(pool.getPoolEnd());\r
- if (sIP+1 == lIP) {\r
- hPool = pool;\r
- }\r
- if (sIP-1 == hIP) {\r
- lPool = pool;\r
- }\r
- }\r
- //if (lPool == NULL and hPool == NULL) create new pool where low = ip = high\r
- if (lPool == null && hPool == null) {\r
- allocationPools.add(new NeutronSubnet_IPAllocationPool(ipAddress,ipAddress));\r
- }\r
- //if (lPool == NULL and hPool != NULL) change low address of hPool to ipAddr\r
- if (lPool == null && hPool != null) {\r
- hPool.setPoolStart(ipAddress);\r
- }\r
- //if (lPool != NULL and hPool == NULL) change high address of lPool to ipAddr\r
- if (lPool != null && hPool == null) {\r
- lPool.setPoolEnd(ipAddress);\r
- }\r
- //if (lPool != NULL and hPool != NULL) remove lPool and hPool and create new pool\r
- // where low address = lPool.low address and high address = hPool.high Address\r
- if (lPool != null && hPool != null) {\r
- allocationPools.remove(lPool);\r
- allocationPools.remove(hPool);\r
- allocationPools.add(new NeutronSubnet_IPAllocationPool(\r
- lPool.getPoolStart(), hPool.getPoolEnd()));\r
- }\r
- }\r
-\r
- public void setGatewayIPAllocated() {\r
- gatewayIPAssigned = true;\r
- }\r
-\r
- public void resetGatewayIPAllocated() {\r
- gatewayIPAssigned = false;\r
- }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import java.util.ArrayList;
+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;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.commons.net.util.SubnetUtils;
+import org.apache.commons.net.util.SubnetUtils.SubnetInfo;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+
+public class NeutronSubnet {
+ // See OpenStack Network API v2.0 Reference for description of
+ // annotated attributes
+
+ @XmlElement (name="id")
+ String subnetUUID;
+
+ @XmlElement (name="network_id")
+ String networkUUID;
+
+ @XmlElement (name="name")
+ String name;
+
+ @XmlElement (defaultValue="4", name="ip_version")
+ Integer ipVersion;
+
+ @XmlElement (name="cidr")
+ String cidr;
+
+ @XmlElement (name="gateway_ip")
+ String gatewayIP;
+
+ @XmlElement (name="dns_nameservers")
+ List<String> dnsNameservers;
+
+ @XmlElement (name="allocation_pools")
+ List<NeutronSubnet_IPAllocationPool> allocationPools;
+
+ @XmlElement (name="host_routes")
+ List<NeutronSubnet_HostRoute> hostRoutes;
+
+ @XmlElement (defaultValue="true", name="enable_dhcp")
+ Boolean enableDHCP;
+
+ @XmlElement (name="tenant_id")
+ String tenantID;
+
+ /* stores the OpenStackPorts associated with an instance
+ * used to determine if that instance can be deleted.
+ */
+ List<NeutronPort> myPorts;
+
+ boolean gatewayIPAssigned;
+
+ public NeutronSubnet() {
+ myPorts = new ArrayList<NeutronPort>();
+ }
+
+ public String getID() { return subnetUUID; }
+
+ public String getSubnetUUID() {
+ return subnetUUID;
+ }
+
+ public void setSubnetUUID(String subnetUUID) {
+ this.subnetUUID = subnetUUID;
+ }
+
+ public String getNetworkUUID() {
+ return networkUUID;
+ }
+
+ public void setNetworkUUID(String networkUUID) {
+ this.networkUUID = networkUUID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Integer getIpVersion() {
+ return ipVersion;
+ }
+
+ public void setIpVersion(Integer ipVersion) {
+ this.ipVersion = ipVersion;
+ }
+
+ public String getCidr() {
+ return cidr;
+ }
+
+ public void setCidr(String cidr) {
+ this.cidr = cidr;
+ }
+
+ public String getGatewayIP() {
+ return gatewayIP;
+ }
+
+ public void setGatewayIP(String gatewayIP) {
+ this.gatewayIP = gatewayIP;
+ }
+
+ public List<String> getDnsNameservers() {
+ return dnsNameservers;
+ }
+
+ public void setDnsNameservers(List<String> dnsNameservers) {
+ this.dnsNameservers = dnsNameservers;
+ }
+
+ public List<NeutronSubnet_IPAllocationPool> getAllocationPools() {
+ return allocationPools;
+ }
+
+ public void setAllocationPools(List<NeutronSubnet_IPAllocationPool> allocationPools) {
+ this.allocationPools = allocationPools;
+ }
+
+ public List<NeutronSubnet_HostRoute> getHostRoutes() {
+ return hostRoutes;
+ }
+
+ public void setHostRoutes(List<NeutronSubnet_HostRoute> hostRoutes) {
+ this.hostRoutes = hostRoutes;
+ }
+
+ public boolean isEnableDHCP() {
+ if (enableDHCP == null) {
+ return true;
+ }
+ return enableDHCP;
+ }
+
+ public Boolean getEnableDHCP() { return enableDHCP; }
+
+ public void setEnableDHCP(Boolean newValue) {
+ enableDHCP = newValue;
+ }
+
+ public String getTenantID() {
+ return tenantID;
+ }
+
+ public void setTenantID(String tenantID) {
+ this.tenantID = tenantID;
+ }
+
+ /**
+ * This method copies selected fields from the object and returns them
+ * as a new object, suitable for marshaling.
+ *
+ * @param fields
+ * List of attributes to be extracted
+ * @return an OpenStackSubnets object with only the selected fields
+ * populated
+ */
+
+ public NeutronSubnet extractFields(List<String> fields) {
+ NeutronSubnet ans = new NeutronSubnet();
+ Iterator<String> i = fields.iterator();
+ while (i.hasNext()) {
+ String s = i.next();
+ if (s.equals("id")) {
+ ans.setSubnetUUID(this.getSubnetUUID());
+ }
+ if (s.equals("network_id")) {
+ ans.setNetworkUUID(this.getNetworkUUID());
+ }
+ if (s.equals("name")) {
+ ans.setName(this.getName());
+ }
+ if (s.equals("ip_version")) {
+ ans.setIpVersion(this.getIpVersion());
+ }
+ if (s.equals("cidr")) {
+ ans.setCidr(this.getCidr());
+ }
+ if (s.equals("gateway_ip")) {
+ ans.setGatewayIP(this.getGatewayIP());
+ }
+ if (s.equals("dns_nameservers")) {
+ List<String> nsList = new ArrayList<String>();
+ nsList.addAll(this.getDnsNameservers());
+ ans.setDnsNameservers(nsList);
+ }
+ if (s.equals("allocation_pools")) {
+ List<NeutronSubnet_IPAllocationPool> aPools = new ArrayList<NeutronSubnet_IPAllocationPool>();
+ aPools.addAll(this.getAllocationPools());
+ ans.setAllocationPools(aPools);
+ }
+ if (s.equals("host_routes")) {
+ List<NeutronSubnet_HostRoute> hRoutes = new ArrayList<NeutronSubnet_HostRoute>();
+ hRoutes.addAll(this.getHostRoutes());
+ ans.setHostRoutes(hRoutes);
+ }
+ if (s.equals("enable_dhcp")) {
+ ans.setEnableDHCP(this.getEnableDHCP());
+ }
+ if (s.equals("tenant_id")) {
+ ans.setTenantID(this.getTenantID());
+ }
+ }
+ return ans;
+ }
+
+ /* test to see if the cidr address used to define this subnet
+ * is a valid network address (an necessary condition when creating
+ * a new subnet)
+ */
+ public boolean isValidCIDR() {
+ try {
+ SubnetUtils util = new SubnetUtils(cidr);
+ SubnetInfo info = util.getInfo();
+ if (!info.getNetworkAddress().equals(info.getAddress())) {
+ return false;
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+ /* test to see if the gateway IP specified overlaps with specified
+ * allocation pools (an error condition when creating a new subnet
+ * or assigning a gateway IP)
+ */
+ public boolean gatewayIP_Pool_overlap() {
+ Iterator<NeutronSubnet_IPAllocationPool> i = allocationPools.iterator();
+ while (i.hasNext()) {
+ NeutronSubnet_IPAllocationPool pool = i.next();
+ if (pool.contains(gatewayIP)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean initDefaults() {
+ if (enableDHCP == null) {
+ enableDHCP = true;
+ }
+ if (ipVersion == null) {
+ ipVersion = 4;
+ }
+ gatewayIPAssigned = false;
+ dnsNameservers = new ArrayList<String>();
+ allocationPools = new ArrayList<NeutronSubnet_IPAllocationPool>();
+ hostRoutes = new ArrayList<NeutronSubnet_HostRoute>();
+ try {
+ SubnetUtils util = new SubnetUtils(cidr);
+ SubnetInfo info = util.getInfo();
+ if (gatewayIP == null) {
+ gatewayIP = info.getLowAddress();
+ }
+ if (allocationPools.size() < 1) {
+ NeutronSubnet_IPAllocationPool source =
+ new NeutronSubnet_IPAllocationPool(info.getLowAddress(),
+ info.getHighAddress());
+ allocationPools = source.splitPool(gatewayIP);
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+ public List<NeutronPort> getPortsInSubnet() {
+ return myPorts;
+ }
+
+ public void addPort(NeutronPort port) {
+ myPorts.add(port);
+ }
+
+ public void removePort(NeutronPort port) {
+ myPorts.remove(port);
+ }
+
+ /* this method tests to see if the supplied IPv4 address
+ * is valid for this subnet or not
+ */
+ public boolean isValidIP(String ipAddress) {
+ try {
+ SubnetUtils util = new SubnetUtils(cidr);
+ SubnetInfo info = util.getInfo();
+ return info.isInRange(ipAddress);
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ /* test to see if the supplied IPv4 address is part of one of the
+ * available allocation pools or not
+ */
+ public boolean isIPInUse(String ipAddress) {
+ if (ipAddress.equals(gatewayIP) && !gatewayIPAssigned ) {
+ return false;
+ }
+ Iterator<NeutronSubnet_IPAllocationPool> i = allocationPools.iterator();
+ while (i.hasNext()) {
+ NeutronSubnet_IPAllocationPool pool = i.next();
+ if (pool.contains(ipAddress)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /* method to get the lowest available address of the subnet.
+ * go through all the allocation pools and keep the lowest of their
+ * low addresses.
+ */
+ public String getLowAddr() {
+ String ans = null;
+ Iterator<NeutronSubnet_IPAllocationPool> i = allocationPools.iterator();
+ while (i.hasNext()) {
+ NeutronSubnet_IPAllocationPool pool = i.next();
+ if (ans == null) {
+ ans = pool.getPoolStart();
+ }
+ else
+ if (NeutronSubnet_IPAllocationPool.convert(pool.getPoolStart()) <
+ NeutronSubnet_IPAllocationPool.convert(ans)) {
+ ans = pool.getPoolStart();
+ }
+ }
+ return ans;
+ }
+
+ /*
+ * allocate the parameter address. Because this uses an iterator to
+ * check the instance's list of allocation pools and we want to modify
+ * pools while the iterator is being used, it is necessary to
+ * build a new list of allocation pools and replace the list when
+ * finished (otherwise a split will cause undefined iterator behavior.
+ */
+ public void allocateIP(String ipAddress) {
+ Iterator<NeutronSubnet_IPAllocationPool> i = allocationPools.iterator();
+ List<NeutronSubnet_IPAllocationPool> newList = new ArrayList<NeutronSubnet_IPAllocationPool>(); // we have to modify a separate list
+ while (i.hasNext()) {
+ NeutronSubnet_IPAllocationPool pool = i.next();
+ /* if the pool contains a single address element and we are allocating it
+ * then we don't need to copy the pool over. Otherwise, we need to possibly
+ * split the pool and add both pieces to the new list
+ */
+ if (!(pool.getPoolEnd().equalsIgnoreCase(ipAddress) &&
+ pool.getPoolStart().equalsIgnoreCase(ipAddress))) {
+ if (pool.contains(ipAddress)) {
+ List<NeutronSubnet_IPAllocationPool> pools = pool.splitPool(ipAddress);
+ newList.addAll(pools);
+ } else {
+ newList.add(pool);
+ }
+ }
+ }
+ allocationPools = newList;
+ }
+
+ /*
+ * release an IP address back to the subnet. Although an iterator
+ * is used, the list is not modified until the iterator is complete, so
+ * an extra list is not necessary.
+ */
+ public void releaseIP(String ipAddress) {
+ NeutronSubnet_IPAllocationPool lPool = null;
+ NeutronSubnet_IPAllocationPool hPool = null;
+ Iterator<NeutronSubnet_IPAllocationPool> i = allocationPools.iterator();
+ long sIP = NeutronSubnet_IPAllocationPool.convert(ipAddress);
+ //look for lPool where ipAddr - 1 is high address
+ //look for hPool where ipAddr + 1 is low address
+ while (i.hasNext()) {
+ NeutronSubnet_IPAllocationPool pool = i.next();
+ long lIP = NeutronSubnet_IPAllocationPool.convert(pool.getPoolStart());
+ long hIP = NeutronSubnet_IPAllocationPool.convert(pool.getPoolEnd());
+ if (sIP+1 == lIP) {
+ hPool = pool;
+ }
+ if (sIP-1 == hIP) {
+ lPool = pool;
+ }
+ }
+ //if (lPool == NULL and hPool == NULL) create new pool where low = ip = high
+ if (lPool == null && hPool == null) {
+ allocationPools.add(new NeutronSubnet_IPAllocationPool(ipAddress,ipAddress));
+ }
+ //if (lPool == NULL and hPool != NULL) change low address of hPool to ipAddr
+ if (lPool == null && hPool != null) {
+ hPool.setPoolStart(ipAddress);
+ }
+ //if (lPool != NULL and hPool == NULL) change high address of lPool to ipAddr
+ if (lPool != null && hPool == null) {
+ lPool.setPoolEnd(ipAddress);
+ }
+ //if (lPool != NULL and hPool != NULL) remove lPool and hPool and create new pool
+ // where low address = lPool.low address and high address = hPool.high Address
+ if (lPool != null && hPool != null) {
+ allocationPools.remove(lPool);
+ allocationPools.remove(hPool);
+ allocationPools.add(new NeutronSubnet_IPAllocationPool(
+ lPool.getPoolStart(), hPool.getPoolEnd()));
+ }
+ }
+
+ public void setGatewayIPAllocated() {
+ gatewayIPAssigned = true;
+ }
+
+ public void resetGatewayIPAllocated() {
+ gatewayIPAssigned = false;
+ }
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-@XmlRootElement\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-public class NeutronSubnet_HostRoute {\r
- // See OpenStack Network API v2.0 Reference for description of\r
- // annotated attributes\r
-\r
- @XmlElement(name="destination")\r
- String destination;\r
-\r
- @XmlElement(name="nexthop")\r
- String nextHop;\r
-\r
- public NeutronSubnet_HostRoute() { }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class NeutronSubnet_HostRoute {
+ // See OpenStack Network API v2.0 Reference for description of
+ // annotated attributes
+
+ @XmlElement(name="destination")
+ String destination;
+
+ @XmlElement(name="nexthop")
+ String nextHop;
+
+ public NeutronSubnet_HostRoute() { }
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-@XmlRootElement\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-public class NeutronSubnet_IPAllocationPool {\r
- // See OpenStack Network API v2.0 Reference for description of\r
- // annotated attributes\r
-\r
- @XmlElement(name="start")\r
- String poolStart;\r
-\r
- @XmlElement(name="end")\r
- String poolEnd;\r
-\r
- public NeutronSubnet_IPAllocationPool() { }\r
-\r
- public NeutronSubnet_IPAllocationPool(String lowAddress, String highAddress) {\r
- poolStart = lowAddress;\r
- poolEnd = highAddress;\r
- }\r
-\r
- public String getPoolStart() {\r
- return poolStart;\r
- }\r
-\r
- public void setPoolStart(String poolStart) {\r
- this.poolStart = poolStart;\r
- }\r
-\r
- public String getPoolEnd() {\r
- return poolEnd;\r
- }\r
-\r
- public void setPoolEnd(String poolEnd) {\r
- this.poolEnd = poolEnd;\r
- }\r
-\r
- /**\r
- * This method determines if this allocation pool contains the\r
- * input IPv4 address\r
- *\r
- * @param inputString\r
- * IPv4 address in dotted decimal format\r
- * @returns a boolean on whether the pool contains the address or not\r
- */\r
-\r
- public boolean contains(String inputString) {\r
- long inputIP = convert(inputString);\r
- long startIP = convert(poolStart);\r
- long endIP = convert(poolEnd);\r
- return (inputIP >= startIP && inputIP <= endIP);\r
- }\r
-\r
- /**\r
- * This static method converts the supplied IPv4 address to a long\r
- * integer for comparison\r
- *\r
- * @param inputString\r
- * IPv4 address in dotted decimal format\r
- * @returns high-endian representation of the IPv4 address as a long\r
- */\r
-\r
- static long convert(String inputString) {\r
- long ans = 0;\r
- String[] parts = inputString.split("\\.");\r
- for (String part: parts) {\r
- ans <<= 8;\r
- ans |= Integer.parseInt(part);\r
- }\r
- return ans;\r
- }\r
-\r
- /**\r
- * This static method converts the supplied high-ending long back\r
- * into a dotted decimal representation of an IPv4 address\r
- *\r
- * @param l\r
- * high-endian representation of the IPv4 address as a long\r
- * @returns IPv4 address in dotted decimal format\r
- */\r
- static String longtoIP(long l) {\r
- int i;\r
- String[] parts = new String[4];\r
- for (i=0; i<4; i++) {\r
- parts[3-i] = String.valueOf(l & 255);\r
- l >>= 8;\r
- }\r
- return join(parts,".");\r
- }\r
-\r
- /*\r
- * helper routine used by longtoIP\r
- */\r
- public static String join(String r[],String d)\r
- {\r
- if (r.length == 0) return "";\r
- StringBuilder sb = new StringBuilder();\r
- int i;\r
- for(i=0;i<r.length-1;i++) {\r
- sb.append(r[i]+d);\r
- }\r
- return sb.toString()+r[i];\r
- }\r
-\r
- /*\r
- * This method splits the current instance by removing the supplied\r
- * parameter.\r
- *\r
- * If the parameter is either the low or high address,\r
- * then that member is adjusted and a list containing just this instance\r
- * is returned.\r
- *\r
- * If the parameter is in the middle of the pool, then\r
- * create two new instances, one ranging from low to parameter-1\r
- * the other ranging from parameter+1 to high\r
- */\r
- public List<NeutronSubnet_IPAllocationPool> splitPool(String ipAddress) {\r
- List<NeutronSubnet_IPAllocationPool> ans = new ArrayList<NeutronSubnet_IPAllocationPool>();\r
- long gIP = NeutronSubnet_IPAllocationPool.convert(ipAddress);\r
- long sIP = NeutronSubnet_IPAllocationPool.convert(poolStart);\r
- long eIP = NeutronSubnet_IPAllocationPool.convert(poolEnd);\r
- long i;\r
- NeutronSubnet_IPAllocationPool p = new NeutronSubnet_IPAllocationPool();\r
- boolean poolStarted = false;\r
- for (i=sIP; i<=eIP; i++) {\r
- if (i == sIP) {\r
- if (i != gIP) {\r
- p.setPoolStart(poolStart);\r
- poolStarted = true;\r
- }\r
- }\r
- if (i == eIP) {\r
- if (i != gIP) {\r
- p.setPoolEnd(poolEnd);\r
- } else {\r
- p.setPoolEnd(NeutronSubnet_IPAllocationPool.longtoIP(i-1));\r
- }\r
- ans.add(p);\r
- }\r
- if (i != sIP && i != eIP) {\r
- if (i != gIP) {\r
- if (!poolStarted) {\r
- p.setPoolStart(NeutronSubnet_IPAllocationPool.longtoIP(i));\r
- poolStarted = true;\r
- }\r
- } else {\r
- p.setPoolEnd(NeutronSubnet_IPAllocationPool.longtoIP(i-1));\r
- poolStarted = false;\r
- ans.add(p);\r
- p = new NeutronSubnet_IPAllocationPool();\r
- }\r
- }\r
- }\r
- return ans;\r
- }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class NeutronSubnet_IPAllocationPool {
+ // See OpenStack Network API v2.0 Reference for description of
+ // annotated attributes
+
+ @XmlElement(name="start")
+ String poolStart;
+
+ @XmlElement(name="end")
+ String poolEnd;
+
+ public NeutronSubnet_IPAllocationPool() { }
+
+ public NeutronSubnet_IPAllocationPool(String lowAddress, String highAddress) {
+ poolStart = lowAddress;
+ poolEnd = highAddress;
+ }
+
+ public String getPoolStart() {
+ return poolStart;
+ }
+
+ public void setPoolStart(String poolStart) {
+ this.poolStart = poolStart;
+ }
+
+ public String getPoolEnd() {
+ return poolEnd;
+ }
+
+ public void setPoolEnd(String poolEnd) {
+ this.poolEnd = poolEnd;
+ }
+
+ /**
+ * This method determines if this allocation pool contains the
+ * input IPv4 address
+ *
+ * @param inputString
+ * IPv4 address in dotted decimal format
+ * @returns a boolean on whether the pool contains the address or not
+ */
+
+ public boolean contains(String inputString) {
+ long inputIP = convert(inputString);
+ long startIP = convert(poolStart);
+ long endIP = convert(poolEnd);
+ return (inputIP >= startIP && inputIP <= endIP);
+ }
+
+ /**
+ * This static method converts the supplied IPv4 address to a long
+ * integer for comparison
+ *
+ * @param inputString
+ * IPv4 address in dotted decimal format
+ * @returns high-endian representation of the IPv4 address as a long
+ */
+
+ static long convert(String inputString) {
+ long ans = 0;
+ String[] parts = inputString.split("\\.");
+ for (String part: parts) {
+ ans <<= 8;
+ ans |= Integer.parseInt(part);
+ }
+ return ans;
+ }
+
+ /**
+ * This static method converts the supplied high-ending long back
+ * into a dotted decimal representation of an IPv4 address
+ *
+ * @param l
+ * high-endian representation of the IPv4 address as a long
+ * @returns IPv4 address in dotted decimal format
+ */
+ static String longtoIP(long l) {
+ int i;
+ String[] parts = new String[4];
+ for (i=0; i<4; i++) {
+ parts[3-i] = String.valueOf(l & 255);
+ l >>= 8;
+ }
+ return join(parts,".");
+ }
+
+ /*
+ * helper routine used by longtoIP
+ */
+ public static String join(String r[],String d)
+ {
+ if (r.length == 0) {
+ return "";
+ }
+ StringBuilder sb = new StringBuilder();
+ int i;
+ for(i=0;i<r.length-1;i++) {
+ sb.append(r[i]+d);
+ }
+ return sb.toString()+r[i];
+ }
+
+ /*
+ * This method splits the current instance by removing the supplied
+ * parameter.
+ *
+ * If the parameter is either the low or high address,
+ * then that member is adjusted and a list containing just this instance
+ * is returned.
+ *
+ * If the parameter is in the middle of the pool, then
+ * create two new instances, one ranging from low to parameter-1
+ * the other ranging from parameter+1 to high
+ */
+ public List<NeutronSubnet_IPAllocationPool> splitPool(String ipAddress) {
+ List<NeutronSubnet_IPAllocationPool> ans = new ArrayList<NeutronSubnet_IPAllocationPool>();
+ long gIP = NeutronSubnet_IPAllocationPool.convert(ipAddress);
+ long sIP = NeutronSubnet_IPAllocationPool.convert(poolStart);
+ long eIP = NeutronSubnet_IPAllocationPool.convert(poolEnd);
+ long i;
+ NeutronSubnet_IPAllocationPool p = new NeutronSubnet_IPAllocationPool();
+ boolean poolStarted = false;
+ for (i=sIP; i<=eIP; i++) {
+ if (i == sIP) {
+ if (i != gIP) {
+ p.setPoolStart(poolStart);
+ poolStarted = true;
+ }
+ }
+ if (i == eIP) {
+ if (i != gIP) {
+ p.setPoolEnd(poolEnd);
+ } else {
+ p.setPoolEnd(NeutronSubnet_IPAllocationPool.longtoIP(i-1));
+ }
+ ans.add(p);
+ }
+ if (i != sIP && i != eIP) {
+ if (i != gIP) {
+ if (!poolStarted) {
+ p.setPoolStart(NeutronSubnet_IPAllocationPool.longtoIP(i));
+ poolStarted = true;
+ }
+ } else {
+ p.setPoolEnd(NeutronSubnet_IPAllocationPool.longtoIP(i-1));
+ poolStarted = false;
+ ans.add(p);
+ p = new NeutronSubnet_IPAllocationPool();
+ }
+ }
+ }
+ return ans;
+ }
+}
-/*\r
- * Copyright IBM Corporation, 2013. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-@XmlRootElement\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-public class Neutron_IPs {\r
- // See OpenStack Network API v2.0 Reference for description of\r
- // annotated attributes\r
-\r
- @XmlElement(name="ip_address")\r
- String ipAddress;\r
-\r
- @XmlElement(name="subnet_id")\r
- String subnetUUID;\r
-\r
- public Neutron_IPs() { }\r
-\r
- public Neutron_IPs(String uuid) {\r
- this.subnetUUID = uuid;\r
- }\r
-\r
- public String getIpAddress() {\r
- return ipAddress;\r
- }\r
-\r
- public void setIpAddress(String ipAddress) {\r
- this.ipAddress = ipAddress;\r
- }\r
-\r
- public String getSubnetUUID() {\r
- return subnetUUID;\r
- }\r
-\r
- public void setSubnetUUID(String subnetUUID) {\r
- this.subnetUUID = subnetUUID;\r
- }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013. 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;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class Neutron_IPs {
+ // See OpenStack Network API v2.0 Reference for description of
+ // annotated attributes
+
+ @XmlElement(name="ip_address")
+ String ipAddress;
+
+ @XmlElement(name="subnet_id")
+ String subnetUUID;
+
+ public Neutron_IPs() { }
+
+ public Neutron_IPs(String uuid) {
+ subnetUUID = uuid;
+ }
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ public String getSubnetUUID() {
+ return subnetUUID;
+ }
+
+ public void setSubnetUUID(String subnetUUID) {
+ this.subnetUUID = subnetUUID;
+ }
+}