Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | |
| 18 | package org.onosproject.net.edgeservice.impl; |
| 19 | |
| 20 | import com.google.common.collect.ImmutableSet; |
| 21 | import com.google.common.collect.Maps; |
| 22 | import com.google.common.collect.Sets; |
| 23 | import org.apache.felix.scr.annotations.Activate; |
| 24 | import org.apache.felix.scr.annotations.Component; |
| 25 | import org.apache.felix.scr.annotations.Deactivate; |
| 26 | import org.apache.felix.scr.annotations.Reference; |
| 27 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 28 | import org.apache.felix.scr.annotations.Service; |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 29 | import org.onosproject.event.AbstractListenerManager; |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 30 | import org.onosproject.net.ConnectPoint; |
| 31 | import org.onosproject.net.DeviceId; |
Yuta HIGUCHI | b440ef4 | 2016-07-15 09:09:09 -0700 | [diff] [blame] | 32 | import org.onosproject.net.Link.Type; |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 33 | import org.onosproject.net.device.DeviceEvent; |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 34 | import org.onosproject.net.device.DeviceListener; |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 35 | import org.onosproject.net.device.DeviceService; |
| 36 | import org.onosproject.net.edge.EdgePortEvent; |
| 37 | import org.onosproject.net.edge.EdgePortListener; |
| 38 | import org.onosproject.net.edge.EdgePortService; |
| 39 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
| 40 | import org.onosproject.net.flow.TrafficTreatment; |
| 41 | import org.onosproject.net.link.LinkEvent; |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 42 | import org.onosproject.net.link.LinkListener; |
| 43 | import org.onosproject.net.link.LinkService; |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 44 | import org.onosproject.net.packet.DefaultOutboundPacket; |
| 45 | import org.onosproject.net.packet.OutboundPacket; |
| 46 | import org.onosproject.net.packet.PacketService; |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 47 | import org.slf4j.Logger; |
| 48 | |
| 49 | import java.nio.ByteBuffer; |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 50 | import java.util.Map; |
| 51 | import java.util.Optional; |
| 52 | import java.util.Set; |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 53 | |
| 54 | import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED; |
| 55 | import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED; |
| 56 | import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_REMOVED; |
| 57 | import static org.onosproject.net.device.DeviceEvent.Type.PORT_STATS_UPDATED; |
| 58 | import static org.onosproject.net.device.DeviceEvent.Type.PORT_UPDATED; |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 59 | import static org.onosproject.net.edge.EdgePortEvent.Type.EDGE_PORT_ADDED; |
| 60 | import static org.onosproject.net.edge.EdgePortEvent.Type.EDGE_PORT_REMOVED; |
Heedo Kang | 4a47a30 | 2016-02-29 17:40:23 +0900 | [diff] [blame] | 61 | import static org.onosproject.security.AppGuard.checkPermission; |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 62 | import static org.onosproject.security.AppPermission.Type.PACKET_WRITE; |
| 63 | import static org.onosproject.security.AppPermission.Type.TOPOLOGY_READ; |
| 64 | import static org.slf4j.LoggerFactory.getLogger; |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 65 | |
| 66 | /** |
| 67 | * This is an implementation of the edge net service. |
| 68 | */ |
| 69 | @Component(immediate = true) |
| 70 | @Service |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 71 | public class EdgeManager |
| 72 | extends AbstractListenerManager<EdgePortEvent, EdgePortListener> |
| 73 | implements EdgePortService { |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 74 | |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 75 | private final Logger log = getLogger(getClass()); |
| 76 | |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 77 | // Set of edge ConnectPoints per Device. |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 78 | private final Map<DeviceId, Set<ConnectPoint>> connectionPoints = Maps.newConcurrentMap(); |
| 79 | |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 80 | private final DeviceListener deviceListener = new InnerDeviceListener(); |
| 81 | private final LinkListener linkListener = new InnerLinkListener(); |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 82 | |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 83 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 84 | protected PacketService packetService; |
| 85 | |
| 86 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 87 | protected DeviceService deviceService; |
| 88 | |
| 89 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 90 | protected LinkService linkService; |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 91 | |
| 92 | @Activate |
| 93 | public void activate() { |
| 94 | eventDispatcher.addSink(EdgePortEvent.class, listenerRegistry); |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 95 | deviceService.addListener(deviceListener); |
| 96 | linkService.addListener(linkListener); |
alshabib | 8a4a600 | 2015-11-25 14:31:16 -0800 | [diff] [blame] | 97 | loadAllEdgePorts(); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 98 | log.info("Started"); |
| 99 | } |
| 100 | |
| 101 | @Deactivate |
| 102 | public void deactivate() { |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 103 | deviceService.removeListener(deviceListener); |
| 104 | linkService.removeListener(linkListener); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 105 | eventDispatcher.removeSink(EdgePortEvent.class); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 106 | log.info("Stopped"); |
| 107 | } |
| 108 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 109 | @Override |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 110 | public boolean isEdgePoint(ConnectPoint point) { |
Heedo Kang | 4a47a30 | 2016-02-29 17:40:23 +0900 | [diff] [blame] | 111 | checkPermission(TOPOLOGY_READ); |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 112 | Set<ConnectPoint> connectPoints = connectionPoints.get(point.deviceId()); |
| 113 | return connectPoints != null && connectPoints.contains(point); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 114 | } |
| 115 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 116 | @Override |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 117 | public Iterable<ConnectPoint> getEdgePoints() { |
Heedo Kang | 4a47a30 | 2016-02-29 17:40:23 +0900 | [diff] [blame] | 118 | checkPermission(TOPOLOGY_READ); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 119 | ImmutableSet.Builder<ConnectPoint> builder = ImmutableSet.builder(); |
| 120 | connectionPoints.forEach((k, v) -> v.forEach(builder::add)); |
| 121 | return builder.build(); |
| 122 | } |
| 123 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 124 | @Override |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 125 | public Iterable<ConnectPoint> getEdgePoints(DeviceId deviceId) { |
Heedo Kang | 4a47a30 | 2016-02-29 17:40:23 +0900 | [diff] [blame] | 126 | checkPermission(TOPOLOGY_READ); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 127 | ImmutableSet.Builder<ConnectPoint> builder = ImmutableSet.builder(); |
| 128 | Set<ConnectPoint> set = connectionPoints.get(deviceId); |
| 129 | if (set != null) { |
| 130 | set.forEach(builder::add); |
| 131 | } |
| 132 | return builder.build(); |
| 133 | } |
| 134 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 135 | @Override |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 136 | public void emitPacket(ByteBuffer data, Optional<TrafficTreatment> treatment) { |
Heedo Kang | 4a47a30 | 2016-02-29 17:40:23 +0900 | [diff] [blame] | 137 | checkPermission(PACKET_WRITE); |
Sho SHIMIZU | ef7e290 | 2016-02-12 18:38:29 -0800 | [diff] [blame] | 138 | TrafficTreatment.Builder builder = treatment.map(DefaultTrafficTreatment::builder) |
| 139 | .orElse(DefaultTrafficTreatment.builder()); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 140 | getEdgePoints().forEach(p -> packetService.emit(packet(builder, p, data))); |
| 141 | } |
| 142 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 143 | @Override |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 144 | public void emitPacket(DeviceId deviceId, ByteBuffer data, |
| 145 | Optional<TrafficTreatment> treatment) { |
Sho SHIMIZU | ef7e290 | 2016-02-12 18:38:29 -0800 | [diff] [blame] | 146 | TrafficTreatment.Builder builder = treatment.map(DefaultTrafficTreatment::builder) |
| 147 | .orElse(DefaultTrafficTreatment.builder()); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 148 | getEdgePoints(deviceId).forEach(p -> packetService.emit(packet(builder, p, data))); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | private OutboundPacket packet(TrafficTreatment.Builder builder, ConnectPoint point, ByteBuffer data) { |
| 152 | builder.setOutput(point.port()); |
| 153 | return new DefaultOutboundPacket(point.deviceId(), builder.build(), data); |
| 154 | } |
| 155 | |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 156 | private class InnerLinkListener implements LinkListener { |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 157 | @Override |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 158 | public void event(LinkEvent event) { |
| 159 | processLinkEvent(event); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | private class InnerDeviceListener implements DeviceListener { |
| 164 | @Override |
| 165 | public void event(DeviceEvent event) { |
| 166 | if (event.type() == PORT_STATS_UPDATED) { |
| 167 | return; |
| 168 | } |
| 169 | processDeviceEvent(event); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 170 | } |
| 171 | } |
| 172 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 173 | // Initial loading of the edge port cache. |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 174 | private void loadAllEdgePorts() { |
Thomas Vachuska | f3ed655 | 2015-06-29 13:56:03 -0700 | [diff] [blame] | 175 | deviceService.getAvailableDevices().forEach(d -> deviceService.getPorts(d.id()) |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 176 | .forEach(p -> addEdgePort(new ConnectPoint(d.id(), p.number())))); |
| 177 | } |
| 178 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 179 | // Processes a link event by adding or removing its end-points in our cache. |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 180 | private void processLinkEvent(LinkEvent event) { |
Yuta HIGUCHI | b440ef4 | 2016-07-15 09:09:09 -0700 | [diff] [blame] | 181 | // negative Link event can result in increase of edge ports |
| 182 | boolean addEdgePort = event.type() == LinkEvent.Type.LINK_REMOVED; |
| 183 | |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 184 | // but if the Link is an Edge type, it will be the opposite |
Yuta HIGUCHI | b440ef4 | 2016-07-15 09:09:09 -0700 | [diff] [blame] | 185 | if (event.subject().type() == Type.EDGE) { |
| 186 | addEdgePort = !addEdgePort; |
| 187 | } |
| 188 | |
| 189 | if (addEdgePort) { |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 190 | addEdgePort(event.subject().src()); |
| 191 | addEdgePort(event.subject().dst()); |
Yuta HIGUCHI | b440ef4 | 2016-07-15 09:09:09 -0700 | [diff] [blame] | 192 | } else { |
| 193 | removeEdgePort(event.subject().src()); |
| 194 | removeEdgePort(event.subject().dst()); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 195 | } |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 196 | } |
| 197 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 198 | // Processes a device event by adding or removing its end-points in our cache. |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 199 | private void processDeviceEvent(DeviceEvent event) { |
Aaron Kruglikov | d812383 | 2015-07-06 14:20:25 -0700 | [diff] [blame] | 200 | //FIXME handle the case where a device is suspended, this may or may not come up |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 201 | DeviceEvent.Type type = event.type(); |
| 202 | DeviceId id = event.subject().id(); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 203 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 204 | if (type == DEVICE_ADDED || |
| 205 | type == DEVICE_AVAILABILITY_CHANGED && deviceService.isAvailable(id)) { |
| 206 | // When device is added or becomes available, add all its ports |
| 207 | deviceService.getPorts(event.subject().id()) |
| 208 | .forEach(p -> addEdgePort(new ConnectPoint(id, p.number()))); |
| 209 | } else if (type == DEVICE_REMOVED || |
| 210 | type == DEVICE_AVAILABILITY_CHANGED && !deviceService.isAvailable(id)) { |
Yuta HIGUCHI | b440ef4 | 2016-07-15 09:09:09 -0700 | [diff] [blame] | 211 | // When device is removed or becomes unavailable, remove all its ports. |
| 212 | // Note: cannot rely on Device subsystem, ports may be gone. |
| 213 | Optional.ofNullable(connectionPoints.remove(id)) |
| 214 | .orElse(ImmutableSet.of()) |
| 215 | .forEach(point -> post(new EdgePortEvent(EDGE_PORT_REMOVED, point))); |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 216 | |
| 217 | } else if (type == DeviceEvent.Type.PORT_ADDED || |
| 218 | type == PORT_UPDATED && event.port().isEnabled()) { |
| 219 | addEdgePort(new ConnectPoint(id, event.port().number())); |
| 220 | } else if (type == DeviceEvent.Type.PORT_REMOVED || |
| 221 | type == PORT_UPDATED && !event.port().isEnabled()) { |
| 222 | removeEdgePort(new ConnectPoint(id, event.port().number())); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 223 | } |
| 224 | } |
| 225 | |
Yuta HIGUCHI | b440ef4 | 2016-07-15 09:09:09 -0700 | [diff] [blame] | 226 | private boolean isEdgePort(ConnectPoint point) { |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 227 | // Logical ports are not counted as edge ports nor are infrastructure |
| 228 | // ports. Ports that have only edge links are considered edge ports. |
| 229 | return !point.port().isLogical() && |
Yuta HIGUCHI | 37dca33 | 2016-11-14 18:43:22 -0800 | [diff] [blame] | 230 | deviceService.getPort(point) != null && |
Jonathan Hart | 6ff6ffe | 2016-09-09 11:55:50 -0700 | [diff] [blame] | 231 | linkService.getLinks(point).stream() |
| 232 | .allMatch(link -> link.type() == Type.EDGE); |
Yuta HIGUCHI | b440ef4 | 2016-07-15 09:09:09 -0700 | [diff] [blame] | 233 | } |
| 234 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 235 | // Adds the specified connection point to the edge points if needed. |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 236 | private void addEdgePort(ConnectPoint point) { |
Yuta HIGUCHI | b440ef4 | 2016-07-15 09:09:09 -0700 | [diff] [blame] | 237 | if (isEdgePort(point)) { |
| 238 | Set<ConnectPoint> set = connectionPoints.computeIfAbsent(point.deviceId(), |
| 239 | (k) -> Sets.newConcurrentHashSet()); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 240 | if (set.add(point)) { |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 241 | post(new EdgePortEvent(EDGE_PORT_ADDED, point)); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 242 | } |
| 243 | } |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 244 | } |
| 245 | |
Thomas Vachuska | 8502192 | 2015-06-29 13:29:42 -0700 | [diff] [blame] | 246 | // Removes the specified connection point from the edge points. |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 247 | private void removeEdgePort(ConnectPoint point) { |
Yuta HIGUCHI | 0b5b82e | 2016-07-21 07:54:19 -0700 | [diff] [blame] | 248 | // trying to remove edge ports, so we shouldn't check if it's EdgePoint |
| 249 | if (!point.port().isLogical()) { |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 250 | Set<ConnectPoint> set = connectionPoints.get(point.deviceId()); |
| 251 | if (set == null) { |
| 252 | return; |
| 253 | } |
| 254 | if (set.remove(point)) { |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 255 | post(new EdgePortEvent(EDGE_PORT_REMOVED, point)); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 256 | } |
| 257 | if (set.isEmpty()) { |
Yuta HIGUCHI | b440ef4 | 2016-07-15 09:09:09 -0700 | [diff] [blame] | 258 | connectionPoints.computeIfPresent(point.deviceId(), (k, v) -> { |
| 259 | if (v.isEmpty()) { |
Yuta HIGUCHI | 0b5b82e | 2016-07-21 07:54:19 -0700 | [diff] [blame] | 260 | return null; |
Yuta HIGUCHI | b440ef4 | 2016-07-15 09:09:09 -0700 | [diff] [blame] | 261 | } else { |
| 262 | return v; |
| 263 | } |
| 264 | }); |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 265 | } |
| 266 | } |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 267 | } |
| 268 | } |