import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
import org.opendaylight.controller.northbound.commons.RestMessages;
import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
import org.opendaylight.controller.northbound.commons.RestMessages;
import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
import org.opendaylight.controller.sal.utils.ServiceHelper;
/**
import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException;
import org.opendaylight.controller.sal.utils.ServiceHelper;
/**
throw new ServiceUnavailableException("Router CRUD Interface "
+ RestMessages.SERVICEUNAVAILABLE.toString());
}
throw new ServiceUnavailableException("Router CRUD Interface "
+ RestMessages.SERVICEUNAVAILABLE.toString());
}
* exists and has been designated as "router:external"
*/
if (routerInterface.routerExists(singleton.getID()))
* exists and has been designated as "router:external"
*/
if (routerInterface.routerExists(singleton.getID()))
if (singleton.getExternalGatewayInfo() != null) {
String externNetworkPtr = singleton.getExternalGatewayInfo().getNetworkID();
if (!networkInterface.networkExists(externNetworkPtr))
if (singleton.getExternalGatewayInfo() != null) {
String externNetworkPtr = singleton.getExternalGatewayInfo().getNetworkID();
if (!networkInterface.networkExists(externNetworkPtr))
NeutronNetwork externNetwork = networkInterface.getNetwork(externNetworkPtr);
if (!externNetwork.isRouterExternal())
NeutronNetwork externNetwork = networkInterface.getNetwork(externNetworkPtr);
if (!externNetwork.isRouterExternal())
* router has to exist and only a single delta can be supplied
*/
if (!routerInterface.routerExists(routerUUID))
* router has to exist and only a single delta can be supplied
*/
if (!routerInterface.routerExists(routerUUID))
NeutronRouter singleton = input.getSingleton();
NeutronRouter original = routerInterface.getRouter(routerUUID);
NeutronRouter singleton = input.getSingleton();
NeutronRouter original = routerInterface.getRouter(routerUUID);
if (singleton.getExternalGatewayInfo() != null) {
String externNetworkPtr = singleton.getExternalGatewayInfo().getNetworkID();
if (!networkInterface.networkExists(externNetworkPtr))
if (singleton.getExternalGatewayInfo() != null) {
String externNetworkPtr = singleton.getExternalGatewayInfo().getNetworkID();
if (!networkInterface.networkExists(externNetworkPtr))
NeutronNetwork externNetwork = networkInterface.getNetwork(externNetworkPtr);
if (!externNetwork.isRouterExternal())
NeutronNetwork externNetwork = networkInterface.getNetwork(externNetworkPtr);
if (!externNetwork.isRouterExternal())
* verify that the router exists and is not in use before removing it
*/
if (!routerInterface.routerExists(routerUUID))
* verify that the router exists and is not in use before removing it
*/
if (!routerInterface.routerExists(routerUUID))
NeutronRouter singleton = routerInterface.getRouter(routerUUID);
Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
if (instances != null) {
NeutronRouter singleton = routerInterface.getRouter(routerUUID);
Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
if (instances != null) {
* or a port id, but not both, this code assumes that the plugin has filled everything in for us and so both must be present
*/
if (!routerInterface.routerExists(routerUUID))
* or a port id, but not both, this code assumes that the plugin has filled everything in for us and so both must be present
*/
if (!routerInterface.routerExists(routerUUID))
NeutronRouter target = routerInterface.getRouter(routerUUID);
if (input.getSubnetUUID() == null ||
input.getPortUUID() == null)
NeutronRouter target = routerInterface.getRouter(routerUUID);
if (input.getSubnetUUID() == null ||
input.getPortUUID() == null)
// check that the port is part of the subnet
NeutronSubnet targetSubnet = subnetInterface.getSubnet(input.getSubnetUUID());
if (targetSubnet == null)
// check that the port is part of the subnet
NeutronSubnet targetSubnet = subnetInterface.getSubnet(input.getSubnetUUID());
if (targetSubnet == null)
Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
- service.canAttachInterface(target, input);
+ int status = service.canAttachInterface(target, input);
+ if (status < 200 || status > 299)
+ return Response.status(status).build();
input.getSubnetUUID() != null) {
NeutronPort port = portInterface.getGatewayPort(input.getSubnetUUID());
if (port == null)
input.getSubnetUUID() != null) {
NeutronPort port = portInterface.getGatewayPort(input.getSubnetUUID());
if (port == null)
input.setPortUUID(port.getID());
input.setID(target.getID());
input.setTenantID(target.getTenantID());
input.setPortUUID(port.getID());
input.setID(target.getID());
input.setTenantID(target.getTenantID());
- service.canDetachInterface(target, input);
+ int status = service.canDetachInterface(target, input);
+ if (status < 200 || status > 299)
+ return Response.status(status).build();
if (input.getPortUUID() != null &&
input.getSubnetUUID() != null) {
NeutronPort port = portInterface.getPort(input.getPortUUID());
if (input.getPortUUID() != null &&
input.getSubnetUUID() != null) {
NeutronPort port = portInterface.getPort(input.getPortUUID());
input.setID(target.getID());
input.setTenantID(target.getTenantID());
Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);
input.setID(target.getID());
input.setTenantID(target.getTenantID());
Object[] instances = ServiceHelper.getGlobalInstances(INeutronRouterAware.class, this, null);