Committed by
Gerrit Code Review
[ONOS-2874]update VTN's bug: delete dhcp port unsuccessfully
Change-Id: If85b9f0a6dd5b9714cacb931bd51c8fbd78fa5ed
Showing
1 changed file
with
12 additions
and
5 deletions
... | @@ -21,11 +21,12 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -21,11 +21,12 @@ import static org.slf4j.LoggerFactory.getLogger; |
21 | 21 | ||
22 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
23 | import java.util.Collection; | 23 | import java.util.Collection; |
24 | -import java.util.HashSet; | 24 | +import java.util.Collections; |
25 | import java.util.Iterator; | 25 | import java.util.Iterator; |
26 | import java.util.List; | 26 | import java.util.List; |
27 | import java.util.Set; | 27 | import java.util.Set; |
28 | import java.util.concurrent.ScheduledExecutorService; | 28 | import java.util.concurrent.ScheduledExecutorService; |
29 | +import java.util.stream.Collectors; | ||
29 | 30 | ||
30 | import org.apache.felix.scr.annotations.Activate; | 31 | import org.apache.felix.scr.annotations.Activate; |
31 | import org.apache.felix.scr.annotations.Component; | 32 | import org.apache.felix.scr.annotations.Component; |
... | @@ -608,14 +609,20 @@ public class VTNManager implements VTNService { | ... | @@ -608,14 +609,20 @@ public class VTNManager implements VTNService { |
608 | private Iterable<String> getIfaceIds(String ifaceId) { | 609 | private Iterable<String> getIfaceIds(String ifaceId) { |
609 | VirtualPortId portId = VirtualPortId.portId(ifaceId); | 610 | VirtualPortId portId = VirtualPortId.portId(ifaceId); |
610 | VirtualPort port = virtualPortService.getPort(portId); | 611 | VirtualPort port = virtualPortService.getPort(portId); |
612 | + if (port == null) { | ||
613 | + return Collections.emptyList(); | ||
614 | + } | ||
615 | + | ||
611 | TenantNetwork network = tenantNetworkService | 616 | TenantNetwork network = tenantNetworkService |
612 | .getNetwork(port.networkId()); | 617 | .getNetwork(port.networkId()); |
613 | - Collection<String> ifaceIds = new HashSet<>(); | 618 | + if (network == null) { |
619 | + return Collections.emptyList(); | ||
620 | + } | ||
621 | + | ||
614 | Collection<VirtualPort> ports = virtualPortService | 622 | Collection<VirtualPort> ports = virtualPortService |
615 | .getPorts(network.id()); | 623 | .getPorts(network.id()); |
616 | - Sets.newHashSet(ports).stream() | 624 | + return ports.stream().map(p -> p.portId().portId()) |
617 | - .forEach(p -> ifaceIds.add(p.portId().portId())); | 625 | + .collect(Collectors.toSet()); |
618 | - return ifaceIds; | ||
619 | } | 626 | } |
620 | 627 | ||
621 | private List<PortNumber> getLocalPorts(DeviceId deviceId, String ifaceId) { | 628 | private List<PortNumber> getLocalPorts(DeviceId deviceId, String ifaceId) { | ... | ... |
-
Please register or login to post a comment