Add missing test methods to IRouterAware and clean up unused imports.
[controller.git] / opendaylight / northbound / networkconfiguration / neutron / src / main / java / org / opendaylight / controller / networkconfig / neutron / northbound / NeutronRoutersNorthbound.java
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.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
@@ -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.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
@@ -416,12 +414,19 @@ public class NeutronRoutersNorthbound {
                 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
-        Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);\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
+            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
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);\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
+            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
-            Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);\r
             for (Object instance : instances) {\r
                 INeutronRouterAware service = (INeutronRouterAware) instance;\r
                 service.neutronRouterInterfaceDetached(target, input);\r