lishuai
Committed by Gerrit Code Review

[ONOS-3624] update vtnweb's bug and add Not-Null constraints of export.

Change-Id: I7699d8766f0653f5fafd4b32a68051994f43b00e
......@@ -413,7 +413,9 @@ public class VTNManager implements VTNService {
if (type == Objective.Operation.ADD) {
// Save external port
Port export = getExPort(device.id());
exPortOfDevice.put(device.id(), export);
if (export != null) {
exPortOfDevice.put(device.id(), export);
}
switchOfLocalHostPorts.put(device.id(), new NetworkOfLocalHostPorts());
} else if (type == Objective.Operation.REMOVE) {
exPortOfDevice.remove(device.id());
......@@ -777,7 +779,7 @@ public class VTNManager implements VTNService {
for (RouterInterface r : interfacesSet) {
// Get all the host of the subnet
Map<HostId, Host> hosts = hostsOfSubnet.get(r.subnetId());
if (hosts.size() > 0) {
if (hosts != null && hosts.size() > 0) {
subnetVmNum++;
if (subnetVmNum >= SUBNET_NUM) {
routerInfFlagOfTenant.put(r.tenantId(), true);
......
......@@ -134,6 +134,12 @@ public class RouterInterfaceManager implements RouterInterfaceService {
@Override
public boolean addRouterInterface(RouterInterface routerInterface) {
checkNotNull(routerInterface, ROUTER_INTERFACE_NULL);
if (!virtualPortService.exists(routerInterface.portId())) {
log.debug("The port ID of interface is not exist whose identifier is {}",
routerInterface.portId().toString());
throw new IllegalArgumentException(
"port ID of interface doesn't exist");
}
verifyRouterInterfaceData(routerInterface);
routerInterfaceStore.put(routerInterface.subnetId(), routerInterface);
if (!routerInterfaceStore.containsKey(routerInterface.subnetId())) {
......@@ -188,12 +194,6 @@ public class RouterInterfaceManager implements RouterInterfaceService {
throw new IllegalArgumentException(
"subnet ID of interface doesn't exist");
}
if (!virtualPortService.exists(routerInterface.portId())) {
log.debug("The port ID of interface is not exist whose identifier is {}",
routerInterface.portId().toString());
throw new IllegalArgumentException(
"port ID of interface doesn't exist");
}
if (!routerService.exists(routerInterface.routerId())) {
log.debug("The router ID of interface is not exist whose identifier is {}",
routerInterface.routerId().toString());
......