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>
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
*/\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
*/\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
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
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
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
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
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
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
\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