Add missing test methods to IRouterAware and clean up unused imports. 31/1731/1
authorRyan Moats <rmoats@us.ibm.com>
Mon, 7 Oct 2013 18:20:06 +0000 (13:20 -0500)
committerRyan Moats <rmoats@us.ibm.com>
Mon, 7 Oct 2013 18:20:06 +0000 (13:20 -0500)
Realized that initial Neutron IRouterAware was missing test methods
for interface attach and detach operation.  In addition, removed
unused imports from other classes.

Change-Id: I8547ad7e7437d7215151f843744b56b2e0d93197
Signed-off-by: Ryan Moats <rmoats@us.ibm.com>
opendaylight/networkconfiguration/neutron/implementation/src/main/java/org/opendaylight/controller/networkconfig/neutron/implementation/NeutronNetworkInterface.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/INeutronRouterAware.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronFloatingIPsNorthbound.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronSubnetsNorthbound.java

index 035e6dc4a8ccbb5c670d759a04bde7c1968f8a47..a2454217a64327c2d8adfc707598c904c7d395ce 100644 (file)
@@ -13,7 +13,6 @@ import java.util.ArrayList;
 import java.util.Dictionary;\r
 import java.util.EnumSet;\r
 import java.util.HashSet;\r
 import java.util.Dictionary;\r
 import java.util.EnumSet;\r
 import java.util.HashSet;\r
-import java.util.Iterator;\r
 import java.util.List;\r
 import java.util.Set;\r
 import java.util.Map.Entry;\r
 import java.util.List;\r
 import java.util.Set;\r
 import java.util.Map.Entry;\r
index 16a9aec2397ac51a4ea98dc3ac07f5bb4b3beffb..040bdd87c4cdfd0fddbe39dae95dd67a4e956f04 100644 (file)
@@ -81,6 +81,20 @@ public interface INeutronRouterAware {
      */\r
     public void neutronRouterDeleted(NeutronRouter router);\r
 \r
      */\r
     public void neutronRouterDeleted(NeutronRouter router);\r
 \r
+    /**\r
+     * Services provide this interface method to indicate if the specified interface can be attached to the specified route\r
+     *\r
+     * @param router\r
+     *            instance of the base Neutron Router object\r
+     * @param routerInterface\r
+     *            instance of the NeutronRouter_Interface to be attached to the router\r
+     * @return integer\r
+     *            the return value is understood to be a HTTP status code.  A return value outside of 200 through 299\r
+     *            results in the attach operation being interrupted and the returned status value reflected in the\r
+     *            HTTP response.\r
+     */\r
+    public int canAttachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface);\r
+\r
     /**\r
      * Services provide this interface method for taking action after an interface has been added to a router\r
      *\r
     /**\r
      * Services provide this interface method for taking action after an interface has been added to a router\r
      *\r
@@ -92,6 +106,20 @@ public interface INeutronRouterAware {
      */\r
     public void neutronRouterInterfaceAttached(NeutronRouter router, NeutronRouter_Interface routerInterface);\r
 \r
      */\r
     public void neutronRouterInterfaceAttached(NeutronRouter router, NeutronRouter_Interface routerInterface);\r
 \r
+    /**\r
+     * Services provide this interface method to indicate if the specified interface can be detached from the specified router\r
+     *\r
+     * @param router\r
+     *            instance of the base Neutron Router object\r
+     * @param routerInterface\r
+     *            instance of the NeutronRouter_Interface to be detached to the router\r
+     * @return integer\r
+     *            the return value is understood to be a HTTP status code.  A return value outside of 200 through 299\r
+     *            results in the detach operation being interrupted and the returned status value reflected in the\r
+     *            HTTP response.\r
+     */\r
+    public int canDetachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface);\r
+\r
     /**\r
      * Services provide this interface method for taking action after an interface has been removed from a router\r
      *\r
     /**\r
      * Services provide this interface method for taking action after an interface has been removed from a router\r
      *\r
index 14eaedd63d2829bd7b29a15a2d26f1f66fbcf00b..6f3ed13c363cd79dfd92ff5a6020e2f6e84a55dd 100644 (file)
@@ -28,7 +28,6 @@ import org.codehaus.enunciate.jaxrs.StatusCodes;
 import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPAware;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPAware;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;\r
-import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP;\r
index 0ffb085488d21921904b351e8c626cf5ae55779b..e83d1fe51b8769674f7ebd067a640a449ec230bb 100644 (file)
@@ -26,7 +26,6 @@ import javax.ws.rs.core.Response;
 import org.codehaus.enunciate.jaxrs.ResponseCode;\r
 import org.codehaus.enunciate.jaxrs.StatusCodes;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;\r
 import org.codehaus.enunciate.jaxrs.ResponseCode;\r
 import org.codehaus.enunciate.jaxrs.StatusCodes;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;\r
-import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronRouterAware;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronRouterAware;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronRouterCRUD;\r
@@ -36,7 +35,6 @@ import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
 import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;\r
 import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface;\r
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;\r
 import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;\r
 import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface;\r
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;\r
-import org.opendaylight.controller.networkconfig.neutron.Neutron_IPs;\r
 import org.opendaylight.controller.northbound.commons.RestMessages;\r
 import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;\r
 import org.opendaylight.controller.sal.utils.ServiceHelper;\r
 import org.opendaylight.controller.northbound.commons.RestMessages;\r
 import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;\r
 import org.opendaylight.controller.sal.utils.ServiceHelper;\r
@@ -416,12 +414,19 @@ public class NeutronRoutersNorthbound {
                 targetPort.getDeviceOwner() != null)\r
             return Response.status(409).build();\r
 \r
                 targetPort.getDeviceOwner() != null)\r
             return Response.status(409).build();\r
 \r
+        Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);\r
+        if (instances != null) {\r
+            for (Object instance : instances) {\r
+                INeutronRouterAware service = (INeutronRouterAware) instance;\r
+                service.canAttachInterface(target, input);\r
+            }\r
+        }\r
+\r
         //mark the port device id and device owner fields\r
         targetPort.setDeviceOwner("network:router_interface");\r
         targetPort.setDeviceID(routerUUID);\r
 \r
         target.addInterface(input.getPortUUID(), input);\r
         //mark the port device id and device owner fields\r
         targetPort.setDeviceOwner("network:router_interface");\r
         targetPort.setDeviceID(routerUUID);\r
 \r
         target.addInterface(input.getPortUUID(), input);\r
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);\r
         if (instances != null) {\r
             for (Object instance : instances) {\r
                 INeutronRouterAware service = (INeutronRouterAware) instance;\r
         if (instances != null) {\r
             for (Object instance : instances) {\r
                 INeutronRouterAware service = (INeutronRouterAware) instance;\r
@@ -485,12 +490,19 @@ public class NeutronRoutersNorthbound {
             input.setID(target.getID());\r
             input.setTenantID(target.getTenantID());\r
 \r
             input.setID(target.getID());\r
             input.setTenantID(target.getTenantID());\r
 \r
+            Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);\r
+            if (instances != null) {\r
+                for (Object instance : instances) {\r
+                    INeutronRouterAware service = (INeutronRouterAware) instance;\r
+                    service.canDetachInterface(target, input);\r
+                }\r
+            }\r
+\r
             // reset the port ownership\r
             port.setDeviceID(null);\r
             port.setDeviceOwner(null);\r
 \r
             target.removeInterface(input.getPortUUID());\r
             // reset the port ownership\r
             port.setDeviceID(null);\r
             port.setDeviceOwner(null);\r
 \r
             target.removeInterface(input.getPortUUID());\r
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);\r
             if (instances != null) {\r
                 for (Object instance : instances) {\r
                     INeutronRouterAware service = (INeutronRouterAware) instance;\r
             if (instances != null) {\r
                 for (Object instance : instances) {\r
                     INeutronRouterAware service = (INeutronRouterAware) instance;\r
@@ -535,10 +547,16 @@ public class NeutronRoutersNorthbound {
                 return Response.status(409).build();\r
             input.setID(target.getID());\r
             input.setTenantID(target.getTenantID());\r
                 return Response.status(409).build();\r
             input.setID(target.getID());\r
             input.setTenantID(target.getTenantID());\r
+            Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);\r
+            if (instances != null) {\r
+                for (Object instance : instances) {\r
+                    INeutronRouterAware service = (INeutronRouterAware) instance;\r
+                    service.canDetachInterface(target, input);\r
+                }\r
+            }\r
             port.setDeviceID(null);\r
             port.setDeviceOwner(null);\r
             target.removeInterface(input.getPortUUID());\r
             port.setDeviceID(null);\r
             port.setDeviceOwner(null);\r
             target.removeInterface(input.getPortUUID());\r
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);\r
             for (Object instance : instances) {\r
                 INeutronRouterAware service = (INeutronRouterAware) instance;\r
                 service.neutronRouterInterfaceDetached(target, input);\r
             for (Object instance : instances) {\r
                 INeutronRouterAware service = (INeutronRouterAware) instance;\r
                 service.neutronRouterInterfaceDetached(target, input);\r
index 1aaee93cea76bd98d46f3e254b66053fe1af8421..e73afb8a99cc4423dadb373ae20677ce3986c440 100644 (file)
@@ -27,11 +27,9 @@ import javax.ws.rs.core.Response;
 \r
 import org.codehaus.enunciate.jaxrs.ResponseCode;\r
 import org.codehaus.enunciate.jaxrs.StatusCodes;\r
 \r
 import org.codehaus.enunciate.jaxrs.ResponseCode;\r
 import org.codehaus.enunciate.jaxrs.StatusCodes;\r
-import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkAware;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;\r
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;\r
-import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;\r
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;\r
 import org.opendaylight.controller.northbound.commons.RestMessages;\r
 import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;\r
 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;\r
 import org.opendaylight.controller.northbound.commons.RestMessages;\r
 import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;\r