Committed by
Gerrit Code Review
[ONOS-3624] update vtnweb's bug and add Not-Null constraints of export.
Change-Id: I7699d8766f0653f5fafd4b32a68051994f43b00e
Showing
3 changed files
with
10 additions
and
8 deletions
... | @@ -413,7 +413,9 @@ public class VTNManager implements VTNService { | ... | @@ -413,7 +413,9 @@ public class VTNManager implements VTNService { |
413 | if (type == Objective.Operation.ADD) { | 413 | if (type == Objective.Operation.ADD) { |
414 | // Save external port | 414 | // Save external port |
415 | Port export = getExPort(device.id()); | 415 | Port export = getExPort(device.id()); |
416 | - exPortOfDevice.put(device.id(), export); | 416 | + if (export != null) { |
417 | + exPortOfDevice.put(device.id(), export); | ||
418 | + } | ||
417 | switchOfLocalHostPorts.put(device.id(), new NetworkOfLocalHostPorts()); | 419 | switchOfLocalHostPorts.put(device.id(), new NetworkOfLocalHostPorts()); |
418 | } else if (type == Objective.Operation.REMOVE) { | 420 | } else if (type == Objective.Operation.REMOVE) { |
419 | exPortOfDevice.remove(device.id()); | 421 | exPortOfDevice.remove(device.id()); |
... | @@ -777,7 +779,7 @@ public class VTNManager implements VTNService { | ... | @@ -777,7 +779,7 @@ public class VTNManager implements VTNService { |
777 | for (RouterInterface r : interfacesSet) { | 779 | for (RouterInterface r : interfacesSet) { |
778 | // Get all the host of the subnet | 780 | // Get all the host of the subnet |
779 | Map<HostId, Host> hosts = hostsOfSubnet.get(r.subnetId()); | 781 | Map<HostId, Host> hosts = hostsOfSubnet.get(r.subnetId()); |
780 | - if (hosts.size() > 0) { | 782 | + if (hosts != null && hosts.size() > 0) { |
781 | subnetVmNum++; | 783 | subnetVmNum++; |
782 | if (subnetVmNum >= SUBNET_NUM) { | 784 | if (subnetVmNum >= SUBNET_NUM) { |
783 | routerInfFlagOfTenant.put(r.tenantId(), true); | 785 | routerInfFlagOfTenant.put(r.tenantId(), true); | ... | ... |
... | @@ -134,6 +134,12 @@ public class RouterInterfaceManager implements RouterInterfaceService { | ... | @@ -134,6 +134,12 @@ public class RouterInterfaceManager implements RouterInterfaceService { |
134 | @Override | 134 | @Override |
135 | public boolean addRouterInterface(RouterInterface routerInterface) { | 135 | public boolean addRouterInterface(RouterInterface routerInterface) { |
136 | checkNotNull(routerInterface, ROUTER_INTERFACE_NULL); | 136 | checkNotNull(routerInterface, ROUTER_INTERFACE_NULL); |
137 | + if (!virtualPortService.exists(routerInterface.portId())) { | ||
138 | + log.debug("The port ID of interface is not exist whose identifier is {}", | ||
139 | + routerInterface.portId().toString()); | ||
140 | + throw new IllegalArgumentException( | ||
141 | + "port ID of interface doesn't exist"); | ||
142 | + } | ||
137 | verifyRouterInterfaceData(routerInterface); | 143 | verifyRouterInterfaceData(routerInterface); |
138 | routerInterfaceStore.put(routerInterface.subnetId(), routerInterface); | 144 | routerInterfaceStore.put(routerInterface.subnetId(), routerInterface); |
139 | if (!routerInterfaceStore.containsKey(routerInterface.subnetId())) { | 145 | if (!routerInterfaceStore.containsKey(routerInterface.subnetId())) { |
... | @@ -188,12 +194,6 @@ public class RouterInterfaceManager implements RouterInterfaceService { | ... | @@ -188,12 +194,6 @@ public class RouterInterfaceManager implements RouterInterfaceService { |
188 | throw new IllegalArgumentException( | 194 | throw new IllegalArgumentException( |
189 | "subnet ID of interface doesn't exist"); | 195 | "subnet ID of interface doesn't exist"); |
190 | } | 196 | } |
191 | - if (!virtualPortService.exists(routerInterface.portId())) { | ||
192 | - log.debug("The port ID of interface is not exist whose identifier is {}", | ||
193 | - routerInterface.portId().toString()); | ||
194 | - throw new IllegalArgumentException( | ||
195 | - "port ID of interface doesn't exist"); | ||
196 | - } | ||
197 | if (!routerService.exists(routerInterface.routerId())) { | 197 | if (!routerService.exists(routerInterface.routerId())) { |
198 | log.debug("The router ID of interface is not exist whose identifier is {}", | 198 | log.debug("The router ID of interface is not exist whose identifier is {}", |
199 | routerInterface.routerId().toString()); | 199 | routerInterface.routerId().toString()); | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment