When doing "Remove interface from router" and only port uuid is
provided; the lookup in hash map may return null. If so, there
needs to be a check against NPE.
Change-Id: Ibaea49ac3fdfc08e92c95e818e5ec82628822f3f
Ref: http://docs.openstack.org/api/openstack-network/2.0/content/PUT_removeRouterInterface__v2.0_routers_remove_router_interface_router_ext.html
Signed-off-by: Flavio Fernandes <ffernand@redhat.com>
if (input.getPortUUID() != null &&
input.getSubnetUUID() == null) {
NeutronRouter_Interface targetInterface = target.getInterfaces().get(input.getPortUUID());
if (input.getPortUUID() != null &&
input.getSubnetUUID() == null) {
NeutronRouter_Interface targetInterface = target.getInterfaces().get(input.getPortUUID());
+ if (targetInterface == null) {
+ throw new ResourceNotFoundException("Router interface not found for given Port UUID");
+ }
input.setSubnetUUID(targetInterface.getSubnetUUID());
input.setID(target.getID());
input.setTenantID(target.getTenantID());
input.setSubnetUUID(targetInterface.getSubnetUUID());
input.setID(target.getID());
input.setTenantID(target.getTenantID());
throw new ResourceNotFoundException("Port UUID not found");
}
if (port.getFixedIPs() == null) {
throw new ResourceNotFoundException("Port UUID not found");
}
if (port.getFixedIPs() == null) {
- throw new ResourceNotFoundException("Port UUID jas no fixed IPs");
+ throw new ResourceNotFoundException("Port UUID has no fixed IPs");
}
NeutronSubnet subnet = subnetInterface.getSubnet(input.getSubnetUUID());
if (subnet == null) {
}
NeutronSubnet subnet = subnetInterface.getSubnet(input.getSubnetUUID());
if (subnet == null) {