blob: a0d6e37c118b2b7b9be9b82deffdaec4c01ae8c9 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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
Thomas Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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.
Thomas Vachuska781d18b2014-10-27 10:31:25 -070015 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.provider.host.impl;
alshabibe1cf87d2014-10-17 09:23:50 -070017
Charles Chan35a32322017-08-14 11:42:11 -070018import com.google.common.collect.Sets;
alshabibe1cf87d2014-10-17 09:23:50 -070019import org.apache.felix.scr.annotations.Activate;
20import org.apache.felix.scr.annotations.Component;
21import org.apache.felix.scr.annotations.Deactivate;
Thomas Vachuska33601602014-11-19 03:32:15 -080022import org.apache.felix.scr.annotations.Modified;
23import org.apache.felix.scr.annotations.Property;
alshabibe1cf87d2014-10-17 09:23:50 -070024import org.apache.felix.scr.annotations.Reference;
25import org.apache.felix.scr.annotations.ReferenceCardinality;
Jonathan Harte8600eb2015-01-12 10:30:45 -080026import org.onlab.packet.ARP;
Yi Tsengfcf5dce2017-07-26 14:30:41 -070027import org.onlab.packet.BasePacket;
Charles Chane6067892016-11-17 10:23:46 -080028import org.onlab.packet.DHCP;
Yi Tsengfcf5dce2017-07-26 14:30:41 -070029import org.onlab.packet.DHCP6;
Jonathan Harte8600eb2015-01-12 10:30:45 -080030import org.onlab.packet.Ethernet;
Pavlin Radoslavovd6612f92015-02-23 13:53:32 -080031import org.onlab.packet.ICMP6;
Thomas Vachuskaf845cf62015-03-24 10:13:09 -070032import org.onlab.packet.IPacket;
Charles Chane6067892016-11-17 10:23:46 -080033import org.onlab.packet.IPv4;
Jonathan Harte8600eb2015-01-12 10:30:45 -080034import org.onlab.packet.IPv6;
Charles Chan35a32322017-08-14 11:42:11 -070035import org.onlab.packet.Ip4Address;
Yi Tsengfcf5dce2017-07-26 14:30:41 -070036import org.onlab.packet.Ip6Address;
Jonathan Harte8600eb2015-01-12 10:30:45 -080037import org.onlab.packet.IpAddress;
Charles M.C. Chan956cb692015-04-26 18:49:39 +080038import org.onlab.packet.MacAddress;
Charles Chane6067892016-11-17 10:23:46 -080039import org.onlab.packet.UDP;
Jonathan Harte8600eb2015-01-12 10:30:45 -080040import org.onlab.packet.VlanId;
Yi Tsengfcf5dce2017-07-26 14:30:41 -070041import org.onlab.packet.dhcp.Dhcp6ClientIdOption;
42import org.onlab.packet.dhcp.Dhcp6IaAddressOption;
43import org.onlab.packet.dhcp.Dhcp6IaNaOption;
44import org.onlab.packet.dhcp.Dhcp6IaTaOption;
45import org.onlab.packet.dhcp.Dhcp6RelayOption;
Charles M.C. Chan956cb692015-04-26 18:49:39 +080046import org.onlab.packet.ipv6.IExtensionHeader;
Jonathan Harte8600eb2015-01-12 10:30:45 -080047import org.onlab.packet.ndp.NeighborAdvertisement;
48import org.onlab.packet.ndp.NeighborSolicitation;
Charles M.C. Chan441d7da2015-03-17 21:03:39 +080049import org.onlab.packet.ndp.RouterAdvertisement;
50import org.onlab.packet.ndp.RouterSolicitation;
Jian Lid9b5f552016-03-11 18:15:31 -080051import org.onlab.util.Tools;
Thomas Vachuska6519e6f2015-03-11 02:29:31 -070052import org.onosproject.cfg.ComponentConfigService;
Pavlin Radoslavovd36a74b2015-01-09 11:59:07 -080053import org.onosproject.core.ApplicationId;
54import org.onosproject.core.CoreService;
Ray Milkeyfacf2862017-08-03 11:58:29 -070055import org.onosproject.net.intf.InterfaceService;
Brian O'Connorabafb502014-12-02 22:26:20 -080056import org.onosproject.net.ConnectPoint;
Pavlin Radoslavovd36a74b2015-01-09 11:59:07 -080057import org.onosproject.net.Device;
Charles Chan888e20a2017-05-01 15:44:23 -070058import org.onosproject.net.DeviceId;
Brian O'Connorabafb502014-12-02 22:26:20 -080059import org.onosproject.net.Host;
60import org.onosproject.net.HostId;
61import org.onosproject.net.HostLocation;
62import org.onosproject.net.device.DeviceEvent;
63import org.onosproject.net.device.DeviceListener;
64import org.onosproject.net.device.DeviceService;
Pavlin Radoslavovd36a74b2015-01-09 11:59:07 -080065import org.onosproject.net.flow.DefaultTrafficSelector;
sdn94b00152016-08-30 02:12:32 -070066import org.onosproject.net.flow.DefaultTrafficTreatment;
Pavlin Radoslavovd36a74b2015-01-09 11:59:07 -080067import org.onosproject.net.flow.TrafficSelector;
sdn94b00152016-08-30 02:12:32 -070068import org.onosproject.net.flow.TrafficTreatment;
Brian O'Connorabafb502014-12-02 22:26:20 -080069import org.onosproject.net.host.DefaultHostDescription;
70import org.onosproject.net.host.HostDescription;
71import org.onosproject.net.host.HostProvider;
72import org.onosproject.net.host.HostProviderRegistry;
73import org.onosproject.net.host.HostProviderService;
74import org.onosproject.net.host.HostService;
sdn94b00152016-08-30 02:12:32 -070075import org.onosproject.net.packet.DefaultOutboundPacket;
76import org.onosproject.net.packet.OutboundPacket;
Brian O'Connorabafb502014-12-02 22:26:20 -080077import org.onosproject.net.packet.PacketContext;
Jonathan Hart3cfce8e2015-01-14 16:43:27 -080078import org.onosproject.net.packet.PacketPriority;
Brian O'Connorabafb502014-12-02 22:26:20 -080079import org.onosproject.net.packet.PacketProcessor;
80import org.onosproject.net.packet.PacketService;
81import org.onosproject.net.provider.AbstractProvider;
82import org.onosproject.net.provider.ProviderId;
83import org.onosproject.net.topology.Topology;
84import org.onosproject.net.topology.TopologyService;
Thomas Vachuska33601602014-11-19 03:32:15 -080085import org.osgi.service.component.ComponentContext;
alshabibe1cf87d2014-10-17 09:23:50 -070086import org.slf4j.Logger;
87
sdn94b00152016-08-30 02:12:32 -070088import java.nio.ByteBuffer;
Thomas Vachuskaf845cf62015-03-24 10:13:09 -070089import java.util.Dictionary;
Yi Tseng7a38f9a2017-06-09 14:36:40 -070090import java.util.Objects;
91import java.util.Optional;
Madan Jampania3770c32015-12-11 12:07:41 -080092import java.util.concurrent.ExecutorService;
Yi Tseng7a38f9a2017-06-09 14:36:40 -070093import java.util.stream.Stream;
Charles Chan35a32322017-08-14 11:42:11 -070094import java.util.Set;
Thomas Vachuskaf845cf62015-03-24 10:13:09 -070095
Madan Jampania3770c32015-12-11 12:07:41 -080096import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
97import static org.onlab.util.Tools.groupedThreads;
Thomas Vachuskaf845cf62015-03-24 10:13:09 -070098import static org.slf4j.LoggerFactory.getLogger;
99
alshabibe1cf87d2014-10-17 09:23:50 -0700100/**
Thomas Vachuskaec9c7dd2015-09-03 18:30:04 -0700101 * Provider which uses an OpenFlow controller to detect network end-station
102 * hosts.
alshabibe1cf87d2014-10-17 09:23:50 -0700103 */
104@Component(immediate = true)
105public class HostLocationProvider extends AbstractProvider implements HostProvider {
alshabibe1cf87d2014-10-17 09:23:50 -0700106 private final Logger log = getLogger(getClass());
107
Pavlin Radoslavovd36a74b2015-01-09 11:59:07 -0800108 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
109 protected CoreService coreService;
110
111 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
alshabibe1cf87d2014-10-17 09:23:50 -0700112 protected HostProviderRegistry providerRegistry;
113
114 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
Pavlin Radoslavovd6612f92015-02-23 13:53:32 -0800115 protected PacketService packetService;
alshabibe1cf87d2014-10-17 09:23:50 -0700116
117 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
118 protected TopologyService topologyService;
119
Thomas Vachuska33601602014-11-19 03:32:15 -0800120 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
121 protected HostService hostService;
122
123 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
124 protected DeviceService deviceService;
125
Thomas Vachuska6519e6f2015-03-11 02:29:31 -0700126 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
127 protected ComponentConfigService cfgService;
128
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700129 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
130 protected InterfaceService interfaceService;
131
alshabibe1cf87d2014-10-17 09:23:50 -0700132 private HostProviderService providerService;
133
134 private final InternalHostProvider processor = new InternalHostProvider();
Thomas Vachuska33601602014-11-19 03:32:15 -0800135 private final DeviceListener deviceListener = new InternalDeviceListener();
136
Pavlin Radoslavovd36a74b2015-01-09 11:59:07 -0800137 private ApplicationId appId;
138
Thomas Vachuska33601602014-11-19 03:32:15 -0800139 @Property(name = "hostRemovalEnabled", boolValue = true,
140 label = "Enable host removal on port/device down events")
141 private boolean hostRemovalEnabled = true;
alshabibe1cf87d2014-10-17 09:23:50 -0700142
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700143 @Property(name = "requestArp", boolValue = true,
144 label = "Request ARP packets for neighbor discovery by the " +
Charles Chane6067892016-11-17 10:23:46 -0800145 "Host Location Provider; default is true")
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700146 private boolean requestArp = true;
Charles Chane6067892016-11-17 10:23:46 -0800147
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700148 @Property(name = "requestIpv6ND", boolValue = false,
149 label = "Requests IPv6 Neighbor Discovery by the " +
Thomas Vachuska27bee092015-06-23 19:03:10 -0700150 "Host Location Provider; default is false")
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700151 private boolean requestIpv6ND = false;
Charles Chane6067892016-11-17 10:23:46 -0800152
153 @Property(name = "useDhcp", boolValue = false,
Yi Tsengaa417a62017-09-08 17:22:51 -0700154 label = "Use DHCP to update IP address of the host; default is false")
Charles Chane6067892016-11-17 10:23:46 -0800155 private boolean useDhcp = false;
alshabibe1cf87d2014-10-17 09:23:50 -0700156
Yi Tsengfcf5dce2017-07-26 14:30:41 -0700157 @Property(name = "useDhcp6", boolValue = false,
Yi Tsengaa417a62017-09-08 17:22:51 -0700158 label = "Use DHCPv6 to update IP address of the host; default is false")
Yi Tsengfcf5dce2017-07-26 14:30:41 -0700159 private boolean useDhcp6 = false;
160
Jonathan Hart9af322d2016-01-06 17:42:04 -0800161 @Property(name = "requestInterceptsEnabled", boolValue = true,
162 label = "Enable requesting packet intercepts")
163 private boolean requestInterceptsEnabled = true;
164
Charles Chan35a32322017-08-14 11:42:11 -0700165 @Property(name = "multihomingEnabled", boolValue = false,
166 label = "Allow hosts to be multihomed")
167 private boolean multihomingEnabled = false;
Madan Jampania3770c32015-12-11 12:07:41 -0800168
Charles Chan35a32322017-08-14 11:42:11 -0700169 protected ExecutorService eventHandler;
sdn94b00152016-08-30 02:12:32 -0700170
alshabibe1cf87d2014-10-17 09:23:50 -0700171 /**
172 * Creates an OpenFlow host provider.
173 */
174 public HostLocationProvider() {
Brian O'Connorabafb502014-12-02 22:26:20 -0800175 super(new ProviderId("of", "org.onosproject.provider.host"));
alshabibe1cf87d2014-10-17 09:23:50 -0700176 }
177
178 @Activate
Thomas Vachuska33601602014-11-19 03:32:15 -0800179 public void activate(ComponentContext context) {
Thomas Vachuska6519e6f2015-03-11 02:29:31 -0700180 cfgService.registerProperties(getClass());
181 appId = coreService.registerApplication("org.onosproject.provider.host");
Jonathan Hart9af322d2016-01-06 17:42:04 -0800182 eventHandler = newSingleThreadScheduledExecutor(
HIGUCHI Yutad9e01052016-04-14 09:31:42 -0700183 groupedThreads("onos/host-loc-provider", "event-handler", log));
alshabibe1cf87d2014-10-17 09:23:50 -0700184 providerService = providerRegistry.register(this);
Brian O'Connor3b783262015-07-29 17:49:24 -0700185 packetService.addProcessor(processor, PacketProcessor.advisor(1));
Thomas Vachuska33601602014-11-19 03:32:15 -0800186 deviceService.addListener(deviceListener);
Jonathan Hart9af322d2016-01-06 17:42:04 -0800187
188 modified(context);
Jonathan Hart3cfce8e2015-01-14 16:43:27 -0800189
Charles M.C. Chane148de82015-05-06 12:38:21 +0800190 log.info("Started with Application ID {}", appId.id());
191 }
192
193 @Deactivate
194 public void deactivate() {
Charles M.C. Chane148de82015-05-06 12:38:21 +0800195 cfgService.unregisterProperties(getClass(), false);
Thomas Vachuska27bee092015-06-23 19:03:10 -0700196
197 withdrawIntercepts();
198
Charles M.C. Chane148de82015-05-06 12:38:21 +0800199 providerRegistry.unregister(this);
200 packetService.removeProcessor(processor);
201 deviceService.removeListener(deviceListener);
Madan Jampania3770c32015-12-11 12:07:41 -0800202 eventHandler.shutdown();
Charles M.C. Chane148de82015-05-06 12:38:21 +0800203 providerService = null;
204 log.info("Stopped");
205 }
206
207 @Modified
208 public void modified(ComponentContext context) {
Charles M.C. Chane148de82015-05-06 12:38:21 +0800209 readComponentConfiguration(context);
Jonathan Hart9af322d2016-01-06 17:42:04 -0800210
211 if (requestInterceptsEnabled) {
212 requestIntercepts();
213 } else {
214 withdrawIntercepts();
215 }
Charles M.C. Chane148de82015-05-06 12:38:21 +0800216 }
217
218 /**
Thomas Vachuska27bee092015-06-23 19:03:10 -0700219 * Request packet intercepts.
Charles M.C. Chane148de82015-05-06 12:38:21 +0800220 */
Thomas Vachuska27bee092015-06-23 19:03:10 -0700221 private void requestIntercepts() {
Charles Chane6067892016-11-17 10:23:46 -0800222 // Use ARP
223 TrafficSelector arpSelector = DefaultTrafficSelector.builder()
224 .matchEthType(Ethernet.TYPE_ARP)
225 .build();
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700226 if (requestArp) {
Charles Chane6067892016-11-17 10:23:46 -0800227 packetService.requestPackets(arpSelector, PacketPriority.CONTROL, appId);
Thomas Vachuska27bee092015-06-23 19:03:10 -0700228 } else {
Charles Chane6067892016-11-17 10:23:46 -0800229 packetService.cancelPackets(arpSelector, PacketPriority.CONTROL, appId);
Pavlin Radoslavov93b606b2015-02-25 17:28:39 -0800230 }
Thomas Vachuska27bee092015-06-23 19:03:10 -0700231
Charles Chane6067892016-11-17 10:23:46 -0800232 // Use IPv6 Neighbor Discovery
233 TrafficSelector ipv6NsSelector = DefaultTrafficSelector.builder()
234 .matchEthType(Ethernet.TYPE_IPV6)
235 .matchIPProtocol(IPv6.PROTOCOL_ICMP6)
236 .matchIcmpv6Type(ICMP6.NEIGHBOR_SOLICITATION)
237 .build();
238 TrafficSelector ipv6NaSelector = DefaultTrafficSelector.builder()
239 .matchEthType(Ethernet.TYPE_IPV6)
240 .matchIPProtocol(IPv6.PROTOCOL_ICMP6)
241 .matchIcmpv6Type(ICMP6.NEIGHBOR_ADVERTISEMENT)
242 .build();
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700243 if (requestIpv6ND) {
Charles Chane6067892016-11-17 10:23:46 -0800244 packetService.requestPackets(ipv6NsSelector, PacketPriority.CONTROL, appId);
245 packetService.requestPackets(ipv6NaSelector, PacketPriority.CONTROL, appId);
Thomas Vachuska27bee092015-06-23 19:03:10 -0700246 } else {
Charles Chane6067892016-11-17 10:23:46 -0800247 packetService.cancelPackets(ipv6NsSelector, PacketPriority.CONTROL, appId);
248 packetService.cancelPackets(ipv6NaSelector, PacketPriority.CONTROL, appId);
249 }
Thomas Vachuska27bee092015-06-23 19:03:10 -0700250 }
251
252 /**
253 * Withdraw packet intercepts.
254 */
255 private void withdrawIntercepts() {
256 TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
257 selector.matchEthType(Ethernet.TYPE_ARP);
Aaron Kruglikov07a923d2015-07-03 13:30:57 -0700258 packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId);
Thomas Vachuska27bee092015-06-23 19:03:10 -0700259
260 // IPv6 Neighbor Solicitation packet.
261 selector.matchEthType(Ethernet.TYPE_IPV6);
262 selector.matchIPProtocol(IPv6.PROTOCOL_ICMP6);
263 selector.matchIcmpv6Type(ICMP6.NEIGHBOR_SOLICITATION);
264 packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId);
265
266 // IPv6 Neighbor Advertisement packet.
267 selector.matchIcmpv6Type(ICMP6.NEIGHBOR_ADVERTISEMENT);
268 packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId);
Pavlin Radoslavov93b606b2015-02-25 17:28:39 -0800269 }
270
271 /**
272 * Extracts properties from the component configuration context.
273 *
274 * @param context the component context
275 */
276 private void readComponentConfiguration(ComponentContext context) {
277 Dictionary<?, ?> properties = context.getProperties();
278 Boolean flag;
279
Jian Lid9b5f552016-03-11 18:15:31 -0800280 flag = Tools.isPropertyEnabled(properties, "hostRemovalEnabled");
Pavlin Radoslavov93b606b2015-02-25 17:28:39 -0800281 if (flag == null) {
282 log.info("Host removal on port/device down events is not configured, " +
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700283 "using current value of {}", hostRemovalEnabled);
Pavlin Radoslavov93b606b2015-02-25 17:28:39 -0800284 } else {
285 hostRemovalEnabled = flag;
286 log.info("Configured. Host removal on port/device down events is {}",
287 hostRemovalEnabled ? "enabled" : "disabled");
Thomas Vachuska33601602014-11-19 03:32:15 -0800288 }
Pavlin Radoslavov93b606b2015-02-25 17:28:39 -0800289
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700290 flag = Tools.isPropertyEnabled(properties, "requestArp");
Charles Chane6067892016-11-17 10:23:46 -0800291 if (flag == null) {
292 log.info("Using ARP is not configured, " +
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700293 "using current value of {}", requestArp);
Charles Chane6067892016-11-17 10:23:46 -0800294 } else {
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700295 requestArp = flag;
Charles Chane6067892016-11-17 10:23:46 -0800296 log.info("Configured. Using ARP is {}",
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700297 requestArp ? "enabled" : "disabled");
Charles Chane6067892016-11-17 10:23:46 -0800298 }
299
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700300 flag = Tools.isPropertyEnabled(properties, "requestIpv6ND");
Pavlin Radoslavov93b606b2015-02-25 17:28:39 -0800301 if (flag == null) {
302 log.info("Using IPv6 Neighbor Discovery is not configured, " +
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700303 "using current value of {}", requestIpv6ND);
Pavlin Radoslavov93b606b2015-02-25 17:28:39 -0800304 } else {
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700305 requestIpv6ND = flag;
Pavlin Radoslavov93b606b2015-02-25 17:28:39 -0800306 log.info("Configured. Using IPv6 Neighbor Discovery is {}",
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700307 requestIpv6ND ? "enabled" : "disabled");
Charles Chane6067892016-11-17 10:23:46 -0800308 }
309
310 flag = Tools.isPropertyEnabled(properties, "useDhcp");
311 if (flag == null) {
312 log.info("Using DHCP is not configured, " +
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700313 "using current value of {}", useDhcp);
Charles Chane6067892016-11-17 10:23:46 -0800314 } else {
315 useDhcp = flag;
316 log.info("Configured. Using DHCP is {}",
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700317 useDhcp ? "enabled" : "disabled");
Pavlin Radoslavov93b606b2015-02-25 17:28:39 -0800318 }
Jonathan Hart9af322d2016-01-06 17:42:04 -0800319
Jian Lid9b5f552016-03-11 18:15:31 -0800320 flag = Tools.isPropertyEnabled(properties, "requestInterceptsEnabled");
Jonathan Hart9af322d2016-01-06 17:42:04 -0800321 if (flag == null) {
322 log.info("Request intercepts is not configured, " +
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700323 "using current value of {}", requestInterceptsEnabled);
Jonathan Hart9af322d2016-01-06 17:42:04 -0800324 } else {
325 requestInterceptsEnabled = flag;
326 log.info("Configured. Request intercepts is {}",
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700327 requestInterceptsEnabled ? "enabled" : "disabled");
Jonathan Hart9af322d2016-01-06 17:42:04 -0800328 }
Charles Chan35a32322017-08-14 11:42:11 -0700329
330 flag = Tools.isPropertyEnabled(properties, "multihomingEnabled");
331 if (flag == null) {
332 log.info("Multihoming is not configured, " +
333 "using current value of {}", multihomingEnabled);
334 } else {
335 multihomingEnabled = flag;
336 log.info("Configured. Multihoming is {}",
337 multihomingEnabled ? "enabled" : "disabled");
338 }
339
Pavlin Radoslavov93b606b2015-02-25 17:28:39 -0800340 }
341
alshabibe1cf87d2014-10-17 09:23:50 -0700342 @Override
343 public void triggerProbe(Host host) {
Saurav Dasb0ae6ee2017-03-04 16:08:47 -0800344 //log.info("Triggering probe on device {} ", host);
Jonathan Hartf353e402016-09-23 09:27:36 -0700345
346 // FIXME Disabling host probing for now, because sending packets from a
347 // broadcast MAC address caused problems when two ONOS networks were
348 // interconnected. Host probing should take into account the interface
349 // configuration when determining which source address to use.
350
351 //MastershipRole role = deviceService.getRole(host.location().deviceId());
352 //if (role.equals(MastershipRole.MASTER)) {
353 // host.ipAddresses().forEach(ip -> {
354 // sendProbe(host, ip);
355 // });
356 //} else {
357 // log.info("not the master, master will probe {}");
358 //}
sdn94b00152016-08-30 02:12:32 -0700359 }
360
361 private void sendProbe(Host host, IpAddress targetIp) {
362 Ethernet probePacket = null;
363 if (targetIp.isIp4()) {
364 // IPv4: Use ARP
365 probePacket = buildArpRequest(targetIp, host);
366 } else {
367 // IPv6: Use Neighbor Discovery
Jonathan Hartf353e402016-09-23 09:27:36 -0700368 //TODO need to implement ndp probe
sdn94b00152016-08-30 02:12:32 -0700369 log.info("Triggering probe on device {} ", host);
370 }
371
372 TrafficTreatment treatment = DefaultTrafficTreatment.builder().setOutput(host.location().port()).build();
373
374 OutboundPacket outboundPacket = new DefaultOutboundPacket(host.location().deviceId(), treatment,
375 ByteBuffer.wrap(probePacket.serialize()));
376
377 packetService.emit(outboundPacket);
378 }
379
Charles Chan888e20a2017-05-01 15:44:23 -0700380 // This method is using source ip as 0.0.0.0 , to receive the reply even from the sub net hosts.
sdn94b00152016-08-30 02:12:32 -0700381 private Ethernet buildArpRequest(IpAddress targetIp, Host host) {
Charles Chan35a32322017-08-14 11:42:11 -0700382 return ARP.buildArpRequest(MacAddress.BROADCAST.toBytes(), Ip4Address.ZERO.toOctets(),
383 MacAddress.BROADCAST.toBytes(), targetIp.toOctets(),
384 MacAddress.BROADCAST.toBytes(), VlanId.NONE.toShort());
alshabibe1cf87d2014-10-17 09:23:50 -0700385 }
386
387 private class InternalHostProvider implements PacketProcessor {
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800388 /**
Charles Chan888e20a2017-05-01 15:44:23 -0700389 * Create or update host information.
390 * Will not update IP if IP is null, all zero or self-assigned.
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800391 *
Thomas Vachuska27bee092015-06-23 19:03:10 -0700392 * @param hid host ID
393 * @param mac source Mac address
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800394 * @param vlan VLAN ID
395 * @param hloc host location
Charles Chan888e20a2017-05-01 15:44:23 -0700396 * @param ip source IP address or null if not updating
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800397 */
Charles Chan888e20a2017-05-01 15:44:23 -0700398 private void createOrUpdateHost(HostId hid, MacAddress mac,
399 VlanId vlan, HostLocation hloc,
400 IpAddress ip) {
Charles Chan35a32322017-08-14 11:42:11 -0700401 Set<HostLocation> newLocations = Sets.newHashSet(hloc);
402
403 if (multihomingEnabled) {
404 Host existingHost = hostService.getHost(hid);
405 if (existingHost != null) {
406 Set<HostLocation> prevLocations = existingHost.locations();
407 newLocations.addAll(prevLocations);
408
409 if (!existingHost.locations().contains(hloc)) {
410 probeLocations(existingHost);
411 }
412 }
413 }
414
Charles Chan888e20a2017-05-01 15:44:23 -0700415 HostDescription desc = ip == null || ip.isZero() || ip.isSelfAssigned() ?
Charles Chan35a32322017-08-14 11:42:11 -0700416 new DefaultHostDescription(mac, vlan, newLocations, Sets.newHashSet(), false) :
417 new DefaultHostDescription(mac, vlan, newLocations, Sets.newHashSet(ip), false);
Sahil Lele3a0cdd52015-07-21 14:16:31 -0700418 try {
Ray Milkeydc083442016-02-22 11:27:57 -0800419 providerService.hostDetected(hid, desc, false);
Sahil Lele3a0cdd52015-07-21 14:16:31 -0700420 } catch (IllegalStateException e) {
421 log.debug("Host {} suppressed", hid);
422 }
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800423 }
alshabibe1cf87d2014-10-17 09:23:50 -0700424
Charles Chane6067892016-11-17 10:23:46 -0800425 /**
Charles Chan35a32322017-08-14 11:42:11 -0700426 * Start verification procedure of all previous locations by sending probes.
427 *
428 * @param host Host to be probed
429 */
430 private void probeLocations(Host host) {
431 host.locations().forEach(location -> {
432 MacAddress probeMac = providerService.addPendingHostLocation(host.id(), location);
433
434 host.ipAddresses().stream().findFirst().ifPresent(ip -> {
Charles Chan2fde6d42017-08-23 14:46:43 -0700435 log.debug("Probing host {} with {}", host.id(), ip);
Charles Chan35a32322017-08-14 11:42:11 -0700436 Ethernet probe;
437 if (ip.isIp4()) {
438 probe = ARP.buildArpRequest(probeMac.toBytes(), Ip4Address.ZERO.toOctets(),
439 host.id().mac().toBytes(), ip.toOctets(),
440 host.id().mac().toBytes(), host.id().vlanId().toShort());
441 } else {
442 probe = NeighborSolicitation.buildNdpSolicit(
443 ip.getIp6Address().toOctets(),
444 IPv6.getLinkLocalAddress(probeMac.toBytes()),
445 IPv6.getSolicitNodeAddress(ip.getIp6Address().toOctets()),
446 probeMac.toBytes(),
447 IPv6.getMCastMacAddress(ip.getIp6Address().toOctets()),
448 host.id().vlanId());
449 }
450 sendProbe(probe, location);
451 });
452 });
453 }
454
455 /**
456 * Send the probe packet on given port.
457 *
458 * @param probe the probe packet
459 * @param connectPoint the port we want to probe
460 */
461 private void sendProbe(Ethernet probe, ConnectPoint connectPoint) {
462 log.info("Probing host {} on location {} with probeMac {}",
463 probe.getDestinationMAC(), connectPoint, probe.getSourceMAC());
464 TrafficTreatment treatment = DefaultTrafficTreatment.builder().setOutput(connectPoint.port()).build();
465 OutboundPacket outboundPacket = new DefaultOutboundPacket(connectPoint.deviceId(),
466 treatment, ByteBuffer.wrap(probe.serialize()));
467 packetService.emit(outboundPacket);
468 }
469
470 /**
Charles Chan888e20a2017-05-01 15:44:23 -0700471 * Updates IP address for an existing host.
Charles Chane6067892016-11-17 10:23:46 -0800472 *
473 * @param hid host ID
474 * @param ip IP address
475 */
Charles Chan888e20a2017-05-01 15:44:23 -0700476 private void updateHostIp(HostId hid, IpAddress ip) {
Charles Chane6067892016-11-17 10:23:46 -0800477 Host host = hostService.getHost(hid);
478 if (host == null) {
Charles Chan35a32322017-08-14 11:42:11 -0700479 log.warn("Fail to update IP for {}. Host does not exist", hid);
Charles Chane6067892016-11-17 10:23:46 -0800480 return;
481 }
482
Charles Chan888e20a2017-05-01 15:44:23 -0700483 HostDescription desc = new DefaultHostDescription(hid.mac(), hid.vlanId(),
Charles Chan35a32322017-08-14 11:42:11 -0700484 host.locations(), Sets.newHashSet(ip), false);
Charles Chane6067892016-11-17 10:23:46 -0800485 try {
486 providerService.hostDetected(hid, desc, false);
487 } catch (IllegalStateException e) {
488 log.debug("Host {} suppressed", hid);
489 }
490 }
491
alshabibe1cf87d2014-10-17 09:23:50 -0700492 @Override
493 public void process(PacketContext context) {
alshabib4a179dc2014-10-17 17:17:01 -0700494 if (context == null) {
495 return;
496 }
alshabibe1cf87d2014-10-17 09:23:50 -0700497
Thomas Vachuskaf845cf62015-03-24 10:13:09 -0700498 Ethernet eth = context.inPacket().parsed();
Jonathan Harte8600eb2015-01-12 10:30:45 -0800499 if (eth == null) {
500 return;
501 }
Jonathan Hartf353e402016-09-23 09:27:36 -0700502
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800503 MacAddress srcMac = eth.getSourceMAC();
Jonathan Hartf353e402016-09-23 09:27:36 -0700504 if (srcMac.isBroadcast() || srcMac.isMulticast()) {
505 return;
506 }
Jonathan Harte8600eb2015-01-12 10:30:45 -0800507
alshabibe1cf87d2014-10-17 09:23:50 -0700508 VlanId vlan = VlanId.vlanId(eth.getVlanID());
509 ConnectPoint heardOn = context.inPacket().receivedFrom();
510
Thomas Vachuskaf845cf62015-03-24 10:13:09 -0700511 // If this arrived on control port, bail out.
512 if (heardOn.port().isLogical()) {
513 return;
514 }
515
alshabibe1cf87d2014-10-17 09:23:50 -0700516 // If this is not an edge port, bail out.
517 Topology topology = topologyService.currentTopology();
518 if (topologyService.isInfrastructure(topology, heardOn)) {
519 return;
520 }
521
Thomas Vachuskaec9c7dd2015-09-03 18:30:04 -0700522 HostLocation hloc = new HostLocation(heardOn, System.currentTimeMillis());
alshabibe1cf87d2014-10-17 09:23:50 -0700523 HostId hid = HostId.hostId(eth.getSourceMAC(), vlan);
Charles Chan35a32322017-08-14 11:42:11 -0700524 MacAddress destMac = eth.getDestinationMAC();
525
526 // Receives a location probe. Invalid entry from the cache
527 if (multihomingEnabled && destMac.isOnos() && !MacAddress.NONE.equals(destMac)) {
528 log.info("Receives probe for {}/{} on {}", srcMac, vlan, heardOn);
529 providerService.removePendingHostLocation(destMac);
530 return;
531 }
alshabibe1cf87d2014-10-17 09:23:50 -0700532
Charles M.C. Chan7fee36a2014-12-31 00:19:59 +0800533 // ARP: possible new hosts, update both location and IP
alshabibe1cf87d2014-10-17 09:23:50 -0700534 if (eth.getEtherType() == Ethernet.TYPE_ARP) {
535 ARP arp = (ARP) eth.getPayload();
Pavlin Radoslavovd6612f92015-02-23 13:53:32 -0800536 IpAddress ip = IpAddress.valueOf(IpAddress.Version.INET,
537 arp.getSenderProtocolAddress());
Charles Chan888e20a2017-05-01 15:44:23 -0700538 createOrUpdateHost(hid, srcMac, vlan, hloc, ip);
alshabibe1cf87d2014-10-17 09:23:50 -0700539
Charles Chan5d5e0622015-09-25 13:00:06 -0700540 // IPv4: update location only
alshabibe1cf87d2014-10-17 09:23:50 -0700541 } else if (eth.getEtherType() == Ethernet.TYPE_IPV4) {
Yi Tsengaa417a62017-09-08 17:22:51 -0700542 // Update host location
543 createOrUpdateHost(hid, srcMac, vlan, hloc, null);
544 if (useDhcp) {
545 DHCP dhcp = findDhcp(eth).orElse(null);
546 // DHCP ACK: additionally update IP of DHCP client
547 if (dhcp != null && dhcp.getPacketType().equals(DHCP.MsgType.DHCPACK)) {
548 MacAddress hostMac = MacAddress.valueOf(dhcp.getClientHardwareAddress());
549 VlanId hostVlan = VlanId.vlanId(eth.getVlanID());
550 HostId hostId = HostId.hostId(hostMac, hostVlan);
551 updateHostIp(hostId, IpAddress.valueOf(dhcp.getYourIPAddress()));
Yi Tsengcfa637a2017-07-26 17:24:10 -0700552 }
Charles Chane6067892016-11-17 10:23:46 -0800553 }
Charles Chan5d5e0622015-09-25 13:00:06 -0700554 // NeighborAdvertisement and NeighborSolicitation: possible
555 // new hosts, update both location and IP.
556 //
557 // IPv6: update location only
Charles M.C. Chan7fee36a2014-12-31 00:19:59 +0800558 } else if (eth.getEtherType() == Ethernet.TYPE_IPV6) {
Charles M.C. Chan7fee36a2014-12-31 00:19:59 +0800559 IPv6 ipv6 = (IPv6) eth.getPayload();
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800560 IpAddress ip = IpAddress.valueOf(IpAddress.Version.INET6,
Thomas Vachuska27bee092015-06-23 19:03:10 -0700561 ipv6.getSourceAddress());
Charles M.C. Chan7fee36a2014-12-31 00:19:59 +0800562
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800563 // skip extension headers
564 IPacket pkt = ipv6;
565 while (pkt.getPayload() != null &&
566 pkt.getPayload() instanceof IExtensionHeader) {
567 pkt = pkt.getPayload();
568 }
Charles M.C. Chan9148d2d2015-04-27 03:36:39 +0800569 pkt = pkt.getPayload();
Yi Tsengfcf5dce2017-07-26 14:30:41 -0700570
571 // DHCPv6 protocol
572 DHCP6 dhcp6 = findDhcp6(pkt).orElse(null);
573 if (dhcp6 != null && useDhcp6) {
574 createOrUpdateHost(hid, srcMac, vlan, hloc, null);
575 handleDhcp6(dhcp6, vlan);
576 return;
577 }
578
Charles M.C. Chan9148d2d2015-04-27 03:36:39 +0800579 if (pkt != null && pkt instanceof ICMP6) {
Yi Tsengfcf5dce2017-07-26 14:30:41 -0700580 // Neighbor Discovery Protocol
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800581 pkt = pkt.getPayload();
582 // RouterSolicitation, RouterAdvertisement
Charles M.C. Chan9148d2d2015-04-27 03:36:39 +0800583 if (pkt != null && (pkt instanceof RouterAdvertisement ||
Thomas Vachuska27bee092015-06-23 19:03:10 -0700584 pkt instanceof RouterSolicitation)) {
Charles M.C. Chan441d7da2015-03-17 21:03:39 +0800585 return;
586 }
Charles M.C. Chan9148d2d2015-04-27 03:36:39 +0800587 if (pkt != null && (pkt instanceof NeighborSolicitation ||
Thomas Vachuska27bee092015-06-23 19:03:10 -0700588 pkt instanceof NeighborAdvertisement)) {
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800589 // Duplicate Address Detection
590 if (ip.isZero()) {
Charles M.C. Chan441d7da2015-03-17 21:03:39 +0800591 return;
Charles M.C. Chan7fee36a2014-12-31 00:19:59 +0800592 }
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800593 // NeighborSolicitation, NeighborAdvertisement
Charles Chan888e20a2017-05-01 15:44:23 -0700594 createOrUpdateHost(hid, srcMac, vlan, hloc, ip);
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800595 return;
Charles M.C. Chan7fee36a2014-12-31 00:19:59 +0800596 }
Charles M.C. Chan7fee36a2014-12-31 00:19:59 +0800597 }
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800598
Yi Tsengaa417a62017-09-08 17:22:51 -0700599 // multicast, exclude DHCPv6
600 if (eth.isMulticast() && dhcp6 == null) {
Charles M.C. Chan956cb692015-04-26 18:49:39 +0800601 return;
602 }
603
604 // normal IPv6 packets
Charles Chan888e20a2017-05-01 15:44:23 -0700605 createOrUpdateHost(hid, srcMac, vlan, hloc, null);
alshabibe1cf87d2014-10-17 09:23:50 -0700606 }
607 }
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700608
Yi Tsengfcf5dce2017-07-26 14:30:41 -0700609 /**
610 * Handles DHCPv6 packet, if message type is ACK, update IP address
611 * according to DHCPv6 payload (IA Address option).
612 *
613 * @param dhcp6 the DHCPv6 payload
614 * @param vlanId the vlan of this packet
615 */
616 private void handleDhcp6(DHCP6 dhcp6, VlanId vlanId) {
617 // extract the relay message if exist
618 while (dhcp6 != null && DHCP6.RELAY_MSG_TYPES.contains(dhcp6.getMsgType())) {
619 dhcp6 = dhcp6.getOptions().stream()
620 .filter(opt -> opt instanceof Dhcp6RelayOption)
621 .map(BasePacket::getPayload)
622 .map(pld -> (DHCP6) pld)
623 .findFirst()
624 .orElse(null);
625 }
626
627 if (dhcp6 == null) {
628 // Can't find dhcp payload
629 log.warn("Can't find dhcp payload from relay message");
630 return;
631 }
632
633 if (dhcp6.getMsgType() != DHCP6.MsgType.REPLY.value()) {
634 // Update IP address only when we received REPLY message
635 return;
636 }
637 Optional<Dhcp6ClientIdOption> clientIdOption = dhcp6.getOptions()
638 .stream()
639 .filter(opt -> opt instanceof Dhcp6ClientIdOption)
640 .map(opt -> (Dhcp6ClientIdOption) opt)
641 .findFirst();
642
643 if (!clientIdOption.isPresent()) {
644 // invalid DHCPv6 option
645 log.warn("Can't find client ID from DHCPv6 {}", dhcp6);
646 return;
647 }
648
649 byte[] linkLayerAddr = clientIdOption.get().getDuid().getLinkLayerAddress();
650 if (linkLayerAddr == null || linkLayerAddr.length != 6) {
651 // No any mac address found
652 log.warn("Can't find client mac from option {}", clientIdOption);
653 return;
654 }
655 MacAddress clientMac = MacAddress.valueOf(linkLayerAddr);
656
657 // Extract IPv6 address from IA NA ot IA TA option
658 Optional<Dhcp6IaNaOption> iaNaOption = dhcp6.getOptions()
659 .stream()
660 .filter(opt -> opt instanceof Dhcp6IaNaOption)
661 .map(opt -> (Dhcp6IaNaOption) opt)
662 .findFirst();
663 Optional<Dhcp6IaTaOption> iaTaOption = dhcp6.getOptions()
664 .stream()
665 .filter(opt -> opt instanceof Dhcp6IaTaOption)
666 .map(opt -> (Dhcp6IaTaOption) opt)
667 .findFirst();
668 Optional<Dhcp6IaAddressOption> iaAddressOption;
669 if (iaNaOption.isPresent()) {
670 iaAddressOption = iaNaOption.get().getOptions().stream()
671 .filter(opt -> opt instanceof Dhcp6IaAddressOption)
672 .map(opt -> (Dhcp6IaAddressOption) opt)
673 .findFirst();
674 } else if (iaTaOption.isPresent()) {
675 iaAddressOption = iaTaOption.get().getOptions().stream()
676 .filter(opt -> opt instanceof Dhcp6IaAddressOption)
677 .map(opt -> (Dhcp6IaAddressOption) opt)
678 .findFirst();
679 } else {
680 iaAddressOption = Optional.empty();
681 }
682 if (iaAddressOption.isPresent()) {
683 Ip6Address ip = iaAddressOption.get().getIp6Address();
684 HostId hostId = HostId.hostId(clientMac, vlanId);
685 updateHostIp(hostId, ip);
686 } else {
687 log.warn("Can't find IPv6 address from DHCPv6 {}", dhcp6);
688 }
689 }
690
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700691 private Optional<DHCP> findDhcp(Ethernet eth) {
692 IPacket pkt = eth.getPayload();
693 return Stream.of(pkt)
694 .filter(Objects::nonNull)
695 .filter(p -> p instanceof IPv4)
696 .map(IPacket::getPayload)
697 .filter(Objects::nonNull)
698 .filter(p -> p instanceof UDP)
699 .map(IPacket::getPayload)
700 .filter(Objects::nonNull)
701 .filter(p -> p instanceof DHCP)
702 .map(p -> (DHCP) p)
703 .findFirst();
704 }
Yi Tsengfcf5dce2017-07-26 14:30:41 -0700705
706 private Optional<DHCP6> findDhcp6(IPacket pkt) {
707 return Stream.of(pkt)
708 .filter(Objects::nonNull)
709 .filter(p -> p instanceof UDP)
710 .map(IPacket::getPayload)
711 .filter(Objects::nonNull)
712 .filter(p -> p instanceof DHCP6)
713 .map(p -> (DHCP6) p)
714 .findFirst();
715 }
alshabibe1cf87d2014-10-17 09:23:50 -0700716 }
Thomas Vachuska33601602014-11-19 03:32:15 -0800717
718 // Auxiliary listener to device events.
719 private class InternalDeviceListener implements DeviceListener {
720 @Override
721 public void event(DeviceEvent event) {
Madan Jampania3770c32015-12-11 12:07:41 -0800722 eventHandler.execute(() -> handleEvent(event));
723 }
724
725 private void handleEvent(DeviceEvent event) {
Pavlin Radoslavovd36a74b2015-01-09 11:59:07 -0800726 Device device = event.subject();
727 switch (event.type()) {
Thomas Vachuska27bee092015-06-23 19:03:10 -0700728 case DEVICE_ADDED:
729 break;
730 case DEVICE_AVAILABILITY_CHANGED:
Charles Chan888e20a2017-05-01 15:44:23 -0700731 if (hostRemovalEnabled && !deviceService.isAvailable(device.id())) {
732 processDeviceDown(device.id());
Thomas Vachuska27bee092015-06-23 19:03:10 -0700733 }
734 break;
735 case DEVICE_SUSPENDED:
736 case DEVICE_UPDATED:
737 // Nothing to do?
738 break;
739 case DEVICE_REMOVED:
740 if (hostRemovalEnabled) {
Charles Chan888e20a2017-05-01 15:44:23 -0700741 processDeviceDown(device.id());
Thomas Vachuska27bee092015-06-23 19:03:10 -0700742 }
743 break;
744 case PORT_ADDED:
745 break;
746 case PORT_UPDATED:
Charles Chan888e20a2017-05-01 15:44:23 -0700747 if (hostRemovalEnabled && !event.port().isEnabled()) {
748 processPortDown(new ConnectPoint(device.id(), event.port().number()));
Thomas Vachuska27bee092015-06-23 19:03:10 -0700749 }
750 break;
751 case PORT_REMOVED:
752 // Nothing to do?
753 break;
754 default:
755 break;
Thomas Vachuska33601602014-11-19 03:32:15 -0800756 }
757 }
758 }
759
Charles Chan888e20a2017-05-01 15:44:23 -0700760 /**
761 * When a device goes down, update the location of affected hosts.
762 *
763 * @param deviceId the device that goes down
764 */
765 private void processDeviceDown(DeviceId deviceId) {
766 hostService.getConnectedHosts(deviceId).forEach(affectedHost -> affectedHost.locations().stream()
767 .filter(hostLocation -> hostLocation.deviceId().equals(deviceId))
768 .forEach(affectedLocation ->
769 providerService.removeLocationFromHost(affectedHost.id(), affectedLocation))
770 );
771 }
772
773 /**
774 * When a port goes down, update the location of affected hosts.
775 *
776 * @param connectPoint the port that goes down
777 */
778 private void processPortDown(ConnectPoint connectPoint) {
779 hostService.getConnectedHosts(connectPoint).forEach(affectedHost ->
780 providerService.removeLocationFromHost(affectedHost.id(), new HostLocation(connectPoint, 0L))
781 );
Thomas Vachuska33601602014-11-19 03:32:15 -0800782 }
783
alshabibe1cf87d2014-10-17 09:23:50 -0700784}