From dde5cf25470fae922209771b4f0aa71ed872cabe Mon Sep 17 00:00:00 2001 From: Ryan Moats Date: Fri, 8 Nov 2013 11:37:21 -0600 Subject: [PATCH] Convert neutron service base classes to unix line delimiters. Replace original windows line delimiters in base classes. Change-Id: I5d50ddf17604a640028bb40a0e8e8129bed67111 Signed-off-by: Ryan Moats --- .../neutron/INeutronFloatingIPAware.java | 166 ++-- .../neutron/INeutronFloatingIPCRUD.java | 166 ++-- .../neutron/INeutronNetworkAware.java | 166 ++-- .../neutron/INeutronNetworkCRUD.java | 190 ++-- .../neutron/INeutronPortAware.java | 166 ++-- .../neutron/INeutronPortCRUD.java | 210 ++--- .../neutron/INeutronRouterAware.java | 266 +++--- .../neutron/INeutronRouterCRUD.java | 186 ++-- .../neutron/INeutronSubnetAware.java | 168 ++-- .../neutron/INeutronSubnetCRUD.java | 190 ++-- .../neutron/NeutronCRUDInterfaces.java | 78 +- .../neutron/NeutronFloatingIP.java | 266 +++--- .../networkconfig/neutron/NeutronNetwork.java | 477 +++++----- .../networkconfig/neutron/NeutronPort.java | 490 +++++----- .../networkconfig/neutron/NeutronRouter.java | 312 +++---- .../neutron/NeutronRouter_Interface.java | 130 +-- .../NeutronRouter_NetworkReference.java | 72 +- .../networkconfig/neutron/NeutronSubnet.java | 862 +++++++++--------- .../neutron/NeutronSubnet_HostRoute.java | 58 +- .../NeutronSubnet_IPAllocationPool.java | 346 +++---- .../networkconfig/neutron/Neutron_IPs.java | 98 +- 21 files changed, 2550 insertions(+), 2513 deletions(-) diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPAware.java index 05d50be818..43175d3236 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPAware.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPAware.java @@ -1,83 +1,83 @@ -/* - * 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); -} +/* + * 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); +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPCRUD.java index 7443deec6e..e416ee7d2f 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPCRUD.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronFloatingIPCRUD.java @@ -1,83 +1,83 @@ -/* - * 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 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); -} +/* + * 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 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); +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkAware.java index dc6df25ab7..88d3c1dc6e 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkAware.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkAware.java @@ -1,83 +1,83 @@ -/* - * 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); -} +/* + * 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); +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkCRUD.java index 248153105c..bf900a618f 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkCRUD.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronNetworkCRUD.java @@ -1,95 +1,95 @@ -/* - * 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 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); -} +/* + * 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 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); +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortAware.java index 36ed4ffb39..3f40ba3879 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortAware.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortAware.java @@ -1,83 +1,83 @@ -/* - * 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); -} +/* + * 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); +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortCRUD.java index 681e925377..ce30c6806e 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortCRUD.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronPortCRUD.java @@ -1,105 +1,105 @@ -/* - * 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 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); -} +/* + * 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 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); +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterAware.java index 040bdd87c4..3c9e83d490 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterAware.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterAware.java @@ -1,133 +1,133 @@ -/* - * 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); -} +/* + * 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); +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterCRUD.java index 19be16d68e..b1a943fce1 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterCRUD.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterCRUD.java @@ -1,93 +1,93 @@ -/* - * 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 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); -} +/* + * 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 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); +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetAware.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetAware.java index b7bafab04c..fa0707698d 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetAware.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetAware.java @@ -1,84 +1,84 @@ -/* - * 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); - -} +/* + * 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); + +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetCRUD.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetCRUD.java index 9c390467e5..6f9a6ffb7b 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetCRUD.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronSubnetCRUD.java @@ -1,95 +1,95 @@ -/* - * 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 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); -} +/* + * 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 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); +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java index 0becb475b8..aebecfa93e 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronCRUDInterfaces.java @@ -1,39 +1,39 @@ -/* - * 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; - } -} +/* + * 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; + } +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java index 906b4d4e76..4d029dccf3 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronFloatingIP.java @@ -1,130 +1,136 @@ -/* - * 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 fields) { - NeutronFloatingIP ans = new NeutronFloatingIP(); - Iterator 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() { - } -} +/* + * 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 fields) { + NeutronFloatingIP ans = new NeutronFloatingIP(); + Iterator 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() { + } +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java index eccbbcc346..f7f7982947 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronNetwork.java @@ -1,233 +1,244 @@ -/* - * 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 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 myPorts; - - public NeutronNetwork() { - myPorts = new ArrayList(); - } - - public void initDefaults() { - subnets = new ArrayList(); - if (this.status == null) - this.status = "ACTIVE"; - if (this.adminStateUp == null) - this.adminStateUp = true; - if (this.shared == null) - this.shared = false; - if (this.routerExternal == null) - this.routerExternal = false; - if (this.providerNetworkType == null) - this.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) { - this.adminStateUp = newValue; - } - - public boolean isShared() { return shared; } - - public Boolean getShared() { return shared; } - - public void setShared(boolean newValue) { - this.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) { - this.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 getSubnets() { - return subnets; - } - - public void setSubnets(List subnets) { - this.subnets = subnets; - } - - public void addSubnet(String uuid) { - this.subnets.add(uuid); - } - - public void removeSubnet(String uuid) { - this.subnets.remove(uuid); - } - - public List 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 fields) { - NeutronNetwork ans = new NeutronNetwork(); - Iterator 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(this.adminStateUp); - if (s.equals("status")) - ans.setStatus(this.getStatus()); - if (s.equals("subnets")) { - List subnetList = new ArrayList(); - subnetList.addAll(this.getSubnets()); - ans.setSubnets(subnetList); - } - if (s.equals("shared")) - ans.setShared(this.shared); - if (s.equals("tenant_id")) - ans.setTenantID(this.getTenantID()); - } - return ans; - } - -} - +/* + * 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 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 myPorts; + + public NeutronNetwork() { + myPorts = new ArrayList(); + } + + public void initDefaults() { + subnets = new ArrayList(); + 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 getSubnets() { + return subnets; + } + + public void setSubnets(List subnets) { + this.subnets = subnets; + } + + public void addSubnet(String uuid) { + subnets.add(uuid); + } + + public void removeSubnet(String uuid) { + subnets.remove(uuid); + } + + public List 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 fields) { + NeutronNetwork ans = new NeutronNetwork(); + Iterator 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 subnetList = new ArrayList(); + 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; + } + +} + diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java index 7f7f712bed..b585554bf8 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronPort.java @@ -1,239 +1,251 @@ -/* - * 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 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 securityGroups; - - /* this attribute stores the floating IP address assigned to - * each fixed IP address - */ - - HashMap floatingIPMap; - - public NeutronPort() { - floatingIPMap = new HashMap(); - } - - 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) { - this.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 getFixedIPs() { - return fixedIPs; - } - - public void setFixedIPs(List 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 fields) { - NeutronPort ans = new NeutronPort(); - Iterator 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 fixedIPs = new ArrayList(); - 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(); - } - - /** - * 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); - } -} +/* + * 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 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 securityGroups; + + /* this attribute stores the floating IP address assigned to + * each fixed IP address + */ + + HashMap floatingIPMap; + + public NeutronPort() { + floatingIPMap = new HashMap(); + } + + 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 getFixedIPs() { + return fixedIPs; + } + + public void setFixedIPs(List 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 fields) { + NeutronPort ans = new NeutronPort(); + Iterator 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 fixedIPs = new ArrayList(); + 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(); + } + } + + /** + * 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); + } +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java index 8329ffc58f..1ef48bd95b 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter.java @@ -1,153 +1,159 @@ -/* - * 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 interfaces; - - public NeutronRouter() { - interfaces = new HashMap(); - } - - 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) { - this.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 fields) { - NeutronRouter ans = new NeutronRouter(); - Iterator 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 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; - } -} +/* + * 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 interfaces; + + public NeutronRouter() { + interfaces = new HashMap(); + } + + 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 fields) { + NeutronRouter ans = new NeutronRouter(); + Iterator 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 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; + } +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_Interface.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_Interface.java index 307789c8cf..5b5e0ce9cc 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_Interface.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_Interface.java @@ -1,65 +1,65 @@ -/* - * 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; - } -} +/* + * 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; + } +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_NetworkReference.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_NetworkReference.java index 012215c719..07f165dc7e 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_NetworkReference.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronRouter_NetworkReference.java @@ -1,36 +1,36 @@ -/* - * 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; - } -} +/* + * 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; + } +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java index 8b1a8d6af4..e53c3d4b1a 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java @@ -1,431 +1,431 @@ -/* - * 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 dnsNameservers; - - @XmlElement (name="allocation_pools") - List allocationPools; - - @XmlElement (name="host_routes") - List 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 myPorts; - - boolean gatewayIPAssigned; - - public NeutronSubnet() { - myPorts = new ArrayList(); - } - - 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 getDnsNameservers() { - return dnsNameservers; - } - - public void setDnsNameservers(List dnsNameservers) { - this.dnsNameservers = dnsNameservers; - } - - public List getAllocationPools() { - return allocationPools; - } - - public void setAllocationPools(List allocationPools) { - this.allocationPools = allocationPools; - } - - public List getHostRoutes() { - return hostRoutes; - } - - public void setHostRoutes(List 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 fields) { - NeutronSubnet ans = new NeutronSubnet(); - Iterator 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 nsList = new ArrayList(); - nsList.addAll(this.getDnsNameservers()); - ans.setDnsNameservers(nsList); - } - if (s.equals("allocation_pools")) { - List aPools = new ArrayList(); - aPools.addAll(this.getAllocationPools()); - ans.setAllocationPools(aPools); - } - if (s.equals("host_routes")) { - List hRoutes = new ArrayList(); - 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 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(); - allocationPools = new ArrayList(); - hostRoutes = new ArrayList(); - 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 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 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 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 i = allocationPools.iterator(); - List newList = new ArrayList(); // 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 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 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; - } -} +/* + * 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 dnsNameservers; + + @XmlElement (name="allocation_pools") + List allocationPools; + + @XmlElement (name="host_routes") + List 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 myPorts; + + boolean gatewayIPAssigned; + + public NeutronSubnet() { + myPorts = new ArrayList(); + } + + 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 getDnsNameservers() { + return dnsNameservers; + } + + public void setDnsNameservers(List dnsNameservers) { + this.dnsNameservers = dnsNameservers; + } + + public List getAllocationPools() { + return allocationPools; + } + + public void setAllocationPools(List allocationPools) { + this.allocationPools = allocationPools; + } + + public List getHostRoutes() { + return hostRoutes; + } + + public void setHostRoutes(List 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 fields) { + NeutronSubnet ans = new NeutronSubnet(); + Iterator 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 nsList = new ArrayList(); + nsList.addAll(this.getDnsNameservers()); + ans.setDnsNameservers(nsList); + } + if (s.equals("allocation_pools")) { + List aPools = new ArrayList(); + aPools.addAll(this.getAllocationPools()); + ans.setAllocationPools(aPools); + } + if (s.equals("host_routes")) { + List hRoutes = new ArrayList(); + 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 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(); + allocationPools = new ArrayList(); + hostRoutes = new ArrayList(); + 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 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 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 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 i = allocationPools.iterator(); + List newList = new ArrayList(); // 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 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 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; + } +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_HostRoute.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_HostRoute.java index c1084297ba..75238c1ad9 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_HostRoute.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_HostRoute.java @@ -1,29 +1,29 @@ -/* - * 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() { } -} +/* + * 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() { } +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java index b4bbd11704..7829ba2199 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet_IPAllocationPool.java @@ -1,172 +1,174 @@ -/* - * 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 splitPool(String ipAddress) { - List ans = new ArrayList(); - 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; - } -} +/* + * 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 splitPool(String ipAddress) { + List ans = new ArrayList(); + 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; + } +} diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java index 7309479399..6fe7c52994 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java @@ -1,49 +1,49 @@ -/* - * 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) { - this.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; - } -} +/* + * 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; + } +} -- 2.36.6