Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015-present Open Networking Laboratory |
| 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 | package org.opencord.cordvtn.impl; |
| 17 | |
| 18 | import com.google.common.collect.Sets; |
| 19 | import org.apache.felix.scr.annotations.Activate; |
| 20 | import org.apache.felix.scr.annotations.Component; |
| 21 | import org.apache.felix.scr.annotations.Deactivate; |
| 22 | import org.apache.felix.scr.annotations.Reference; |
| 23 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 24 | import org.apache.felix.scr.annotations.Service; |
| 25 | import org.onlab.packet.Ip4Address; |
| 26 | import org.onlab.packet.MacAddress; |
| 27 | import org.onlab.packet.VlanId; |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 28 | import org.onosproject.cluster.ClusterService; |
| 29 | import org.onosproject.cluster.LeadershipService; |
| 30 | import org.onosproject.cluster.NodeId; |
Hyunsun Moon | 1e88fef | 2016-08-04 14:00:35 -0700 | [diff] [blame] | 31 | import org.opencord.cordconfig.CordConfigService; |
| 32 | import org.opencord.cordconfig.access.AccessAgentData; |
Hyunsun Moon | fd5a24e | 2016-10-19 19:15:48 -0700 | [diff] [blame^] | 33 | import org.opencord.cordvtn.api.core.CordVtnService; |
| 34 | import org.opencord.cordvtn.api.instance.Instance; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 35 | import org.onosproject.core.ApplicationId; |
| 36 | import org.onosproject.core.CoreService; |
| 37 | import org.onosproject.dhcp.DhcpService; |
| 38 | import org.onosproject.dhcp.IpAssignment; |
| 39 | import org.onosproject.net.ConnectPoint; |
| 40 | import org.onosproject.net.DefaultAnnotations; |
| 41 | import org.onosproject.net.Host; |
| 42 | import org.onosproject.net.HostId; |
| 43 | import org.onosproject.net.HostLocation; |
| 44 | import org.onosproject.net.Port; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 45 | import org.onosproject.net.device.DeviceService; |
| 46 | import org.onosproject.net.host.DefaultHostDescription; |
| 47 | import org.onosproject.net.host.HostDescription; |
| 48 | import org.onosproject.net.host.HostProvider; |
| 49 | import org.onosproject.net.host.HostProviderRegistry; |
| 50 | import org.onosproject.net.host.HostProviderService; |
| 51 | import org.onosproject.net.host.HostService; |
| 52 | import org.onosproject.net.provider.AbstractProvider; |
| 53 | import org.onosproject.net.provider.ProviderId; |
Hyunsun Moon | fd5a24e | 2016-10-19 19:15:48 -0700 | [diff] [blame^] | 54 | import org.opencord.cordvtn.api.instance.InstanceService; |
| 55 | import org.opencord.cordvtn.api.net.PortId; |
| 56 | import org.opencord.cordvtn.api.net.VtnNetwork; |
| 57 | import org.opencord.cordvtn.api.net.VtnNetworkEvent; |
| 58 | import org.opencord.cordvtn.api.net.VtnNetworkListener; |
| 59 | import org.opencord.cordvtn.api.net.VtnPort; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 60 | import org.slf4j.Logger; |
| 61 | |
| 62 | import java.util.Date; |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 63 | import java.util.Objects; |
Hyunsun Moon | 1e88fef | 2016-08-04 14:00:35 -0700 | [diff] [blame] | 64 | import java.util.Optional; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 65 | import java.util.concurrent.ExecutorService; |
| 66 | |
Hyunsun Moon | 537018f | 2016-07-27 18:51:00 -0700 | [diff] [blame] | 67 | import static java.util.concurrent.Executors.newSingleThreadExecutor; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 68 | import static org.onlab.util.Tools.groupedThreads; |
| 69 | import static org.onosproject.dhcp.IpAssignment.AssignmentStatus.Option_RangeNotEnforced; |
Hyunsun Moon | 81a1356 | 2016-08-04 13:48:08 -0700 | [diff] [blame] | 70 | import static org.onosproject.net.AnnotationKeys.PORT_NAME; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 71 | import static org.opencord.cordvtn.api.Constants.*; |
Hyunsun Moon | fd5a24e | 2016-10-19 19:15:48 -0700 | [diff] [blame^] | 72 | import static org.opencord.cordvtn.api.net.ServiceNetwork.ServiceNetworkType.ACCESS_AGENT; |
| 73 | import static org.opencord.cordvtn.api.net.ServiceNetwork.ServiceNetworkType.MANAGEMENT_HOST; |
| 74 | import static org.opencord.cordvtn.api.net.ServiceNetwork.ServiceNetworkType.MANAGEMENT_LOCAL; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 75 | import static org.slf4j.LoggerFactory.getLogger; |
| 76 | |
| 77 | /** |
| 78 | * Adds or removes instances to network services. |
| 79 | */ |
| 80 | @Component(immediate = true) |
| 81 | @Service |
| 82 | public class InstanceManager extends AbstractProvider implements HostProvider, |
| 83 | InstanceService { |
| 84 | |
| 85 | protected final Logger log = getLogger(getClass()); |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 86 | private static final String ERR_VTN_NETWORK = "Faild to get VTN network for %s"; |
| 87 | private static final String ERR_VTN_PORT = "Faild to get VTN port for %s"; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 88 | |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 89 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 90 | protected CoreService coreService; |
| 91 | |
| 92 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 93 | protected HostProviderRegistry hostProviderRegistry; |
| 94 | |
| 95 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 96 | protected DeviceService deviceService; |
| 97 | |
| 98 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 99 | protected HostService hostService; |
| 100 | |
| 101 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 102 | protected LeadershipService leadershipService; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 103 | |
| 104 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 105 | protected ClusterService clusterService; |
| 106 | |
| 107 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 108 | protected DhcpService dhcpService; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 109 | |
Hyunsun Moon | 1e88fef | 2016-08-04 14:00:35 -0700 | [diff] [blame] | 110 | // TODO get access agent container information from XOS |
| 111 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 112 | protected CordConfigService cordConfig; |
| 113 | |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 114 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 115 | protected CordVtnService vtnService; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 116 | |
| 117 | private final ExecutorService eventExecutor = |
Hyunsun Moon | 1e88fef | 2016-08-04 14:00:35 -0700 | [diff] [blame] | 118 | newSingleThreadExecutor(groupedThreads(this.getClass().getSimpleName(), "event-handler")); |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 119 | private final VtnNetworkListener vtnNetListener = new InternalVtnNetworkListener(); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 120 | |
| 121 | private ApplicationId appId; |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 122 | private NodeId localNodeId; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 123 | private HostProviderService hostProvider; |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 124 | |
| 125 | /** |
| 126 | * Creates an cordvtn host location provider. |
| 127 | */ |
| 128 | public InstanceManager() { |
| 129 | super(new ProviderId("host", CORDVTN_APP_ID)); |
| 130 | } |
| 131 | |
| 132 | @Activate |
| 133 | protected void activate() { |
| 134 | appId = coreService.registerApplication(CORDVTN_APP_ID); |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 135 | localNodeId = clusterService.getLocalNode().id(); |
| 136 | leadershipService.runForLeadership(appId.name()); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 137 | |
| 138 | hostProvider = hostProviderRegistry.register(this); |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 139 | vtnService.addListener(vtnNetListener); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 140 | |
| 141 | log.info("Started"); |
| 142 | } |
| 143 | |
| 144 | @Deactivate |
| 145 | protected void deactivate() { |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 146 | vtnService.removeListener(vtnNetListener); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 147 | hostProviderRegistry.unregister(this); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 148 | eventExecutor.shutdown(); |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 149 | leadershipService.withdraw(appId.name()); |
| 150 | |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 151 | log.info("Stopped"); |
| 152 | } |
| 153 | |
| 154 | @Override |
| 155 | public void triggerProbe(Host host) { |
| 156 | /* |
| 157 | * Note: In CORD deployment, we assume that all hosts are configured. |
| 158 | * Therefore no probe is required. |
| 159 | */ |
| 160 | } |
| 161 | |
| 162 | @Override |
| 163 | public void addInstance(ConnectPoint connectPoint) { |
| 164 | Port port = deviceService.getPort(connectPoint.deviceId(), connectPoint.port()); |
| 165 | if (port == null) { |
| 166 | log.debug("No port found from {}", connectPoint); |
| 167 | return; |
| 168 | } |
| 169 | |
Hyunsun Moon | 1e88fef | 2016-08-04 14:00:35 -0700 | [diff] [blame] | 170 | // TODO remove this when XOS provides access agent information |
| 171 | // and handle it the same way wit the other instances |
| 172 | if (isAccessAgent(connectPoint)) { |
| 173 | addAccessAgentInstance(connectPoint); |
| 174 | return; |
| 175 | } |
| 176 | |
Hyunsun Moon | 5c14395 | 2016-10-19 18:34:46 -0700 | [diff] [blame] | 177 | VtnPort vtnPort = vtnService.vtnPort(port.annotations().value(PORT_NAME)); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 178 | if (vtnPort == null) { |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 179 | log.warn(String.format(ERR_VTN_PORT, port)); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 180 | return; |
| 181 | } |
| 182 | |
Hyunsun Moon | 5c14395 | 2016-10-19 18:34:46 -0700 | [diff] [blame] | 183 | VtnNetwork vtnNet = vtnService.vtnNetwork(vtnPort.netId()); |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 184 | if (vtnNet == null) { |
| 185 | log.warn(String.format(ERR_VTN_NETWORK, vtnPort)); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 186 | return; |
| 187 | } |
| 188 | |
| 189 | // register DHCP lease for the new instance |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 190 | registerDhcpLease(vtnPort.mac(), vtnPort.ip().getIp4Address(), vtnNet); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 191 | |
| 192 | // Added CREATE_TIME intentionally to trigger HOST_UPDATED event for the |
| 193 | // existing instances. |
| 194 | DefaultAnnotations.Builder annotations = DefaultAnnotations.builder() |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 195 | .set(Instance.NETWORK_TYPE, vtnNet.type().name()) |
| 196 | .set(Instance.NETWORK_ID, vtnNet.id().id()) |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 197 | .set(Instance.PORT_ID, vtnPort.id().id()) |
| 198 | .set(Instance.CREATE_TIME, String.valueOf(System.currentTimeMillis())); |
| 199 | |
| 200 | HostDescription hostDesc = new DefaultHostDescription( |
| 201 | vtnPort.mac(), |
| 202 | VlanId.NONE, |
| 203 | new HostLocation(connectPoint, System.currentTimeMillis()), |
| 204 | Sets.newHashSet(vtnPort.ip()), |
| 205 | annotations.build()); |
| 206 | |
| 207 | HostId hostId = HostId.hostId(vtnPort.mac()); |
| 208 | hostProvider.hostDetected(hostId, hostDesc, false); |
| 209 | } |
| 210 | |
| 211 | @Override |
| 212 | public void addNestedInstance(HostId hostId, HostDescription description) { |
| 213 | DefaultAnnotations annotations = DefaultAnnotations.builder() |
| 214 | .set(Instance.NESTED_INSTANCE, Instance.TRUE) |
| 215 | .build(); |
| 216 | annotations = annotations.merge(annotations, description.annotations()); |
| 217 | |
| 218 | HostDescription nestedHost = new DefaultHostDescription( |
| 219 | description.hwAddress(), |
| 220 | description.vlan(), |
| 221 | description.location(), |
| 222 | description.ipAddress(), |
| 223 | annotations); |
| 224 | |
| 225 | hostProvider.hostDetected(hostId, nestedHost, false); |
| 226 | } |
| 227 | |
| 228 | @Override |
| 229 | public void removeInstance(ConnectPoint connectPoint) { |
| 230 | hostService.getConnectedHosts(connectPoint).stream() |
| 231 | .forEach(host -> { |
| 232 | dhcpService.removeStaticMapping(host.mac()); |
| 233 | hostProvider.hostVanished(host.id()); |
| 234 | }); |
| 235 | } |
| 236 | |
| 237 | @Override |
| 238 | public void removeNestedInstance(HostId hostId) { |
| 239 | hostProvider.hostVanished(hostId); |
| 240 | } |
| 241 | |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 242 | private void registerDhcpLease(MacAddress macAddr, Ip4Address ipAddr, VtnNetwork vtnNet) { |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 243 | Ip4Address broadcast = Ip4Address.makeMaskedAddress( |
| 244 | ipAddr, |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 245 | vtnNet.subnet().prefixLength()); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 246 | |
| 247 | IpAssignment.Builder ipBuilder = IpAssignment.builder() |
| 248 | .ipAddress(ipAddr) |
| 249 | .leasePeriod(DHCP_INFINITE_LEASE) |
| 250 | .timestamp(new Date()) |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 251 | .subnetMask(Ip4Address.makeMaskPrefix(vtnNet.subnet().prefixLength())) |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 252 | .broadcast(broadcast) |
| 253 | .domainServer(DEFAULT_DNS) |
| 254 | .assignmentStatus(Option_RangeNotEnforced); |
| 255 | |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 256 | if (vtnNet.type() != MANAGEMENT_HOST && vtnNet.type() != MANAGEMENT_LOCAL) { |
| 257 | ipBuilder = ipBuilder.routerAddress(vtnNet.serviceIp().getIp4Address()); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | log.debug("Set static DHCP mapping for {} {}", macAddr, ipAddr); |
| 261 | dhcpService.setStaticMapping(macAddr, ipBuilder.build()); |
| 262 | } |
| 263 | |
Hyunsun Moon | 1e88fef | 2016-08-04 14:00:35 -0700 | [diff] [blame] | 264 | // TODO remove this when XOS provides access agent information |
| 265 | private boolean isAccessAgent(ConnectPoint connectPoint) { |
| 266 | Optional<AccessAgentData> agent = cordConfig.getAccessAgent(connectPoint.deviceId()); |
| 267 | if (!agent.isPresent() || !agent.get().getVtnLocation().isPresent()) { |
| 268 | return false; |
| 269 | } |
| 270 | return agent.get().getVtnLocation().get().port().equals(connectPoint.port()); |
| 271 | } |
| 272 | |
| 273 | // TODO remove this when XOS provides access agent information |
| 274 | private void addAccessAgentInstance(ConnectPoint connectPoint) { |
| 275 | AccessAgentData agent = cordConfig.getAccessAgent(connectPoint.deviceId()).get(); |
| 276 | DefaultAnnotations.Builder annotations = DefaultAnnotations.builder() |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 277 | .set(Instance.NETWORK_TYPE, ACCESS_AGENT.name()) |
| 278 | .set(Instance.NETWORK_ID, NOT_APPLICABLE) |
Hyunsun Moon | 1e88fef | 2016-08-04 14:00:35 -0700 | [diff] [blame] | 279 | .set(Instance.PORT_ID, NOT_APPLICABLE) |
| 280 | .set(Instance.CREATE_TIME, String.valueOf(System.currentTimeMillis())); |
| 281 | |
| 282 | HostDescription hostDesc = new DefaultHostDescription( |
| 283 | agent.getAgentMac(), |
| 284 | VlanId.NONE, |
| 285 | new HostLocation(connectPoint, System.currentTimeMillis()), |
| 286 | Sets.newHashSet(), |
| 287 | annotations.build()); |
| 288 | |
| 289 | HostId hostId = HostId.hostId(agent.getAgentMac()); |
| 290 | hostProvider.hostDetected(hostId, hostDesc, false); |
| 291 | } |
| 292 | |
Hyunsun Moon | 5c14395 | 2016-10-19 18:34:46 -0700 | [diff] [blame] | 293 | private Instance getInstance(PortId portId) { |
| 294 | VtnPort vtnPort = vtnService.vtnPort(portId); |
| 295 | if (vtnPort == null) { |
| 296 | final String error = "Failed to build VTN port for " + portId.id(); |
| 297 | throw new IllegalStateException(error); |
| 298 | } |
| 299 | Host host = hostService.getHost(HostId.hostId(vtnPort.mac())); |
| 300 | if (host == null) { |
| 301 | return null; |
| 302 | } |
| 303 | return Instance.of(host); |
| 304 | } |
| 305 | |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 306 | private class InternalVtnNetworkListener implements VtnNetworkListener { |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 307 | |
| 308 | @Override |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 309 | public void event(VtnNetworkEvent event) { |
| 310 | NodeId leader = leadershipService.getLeader(appId.name()); |
| 311 | if (!Objects.equals(localNodeId, leader)) { |
| 312 | // do not allow to proceed without leadership |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 313 | return; |
| 314 | } |
| 315 | |
| 316 | switch (event.type()) { |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 317 | case VTN_PORT_CREATED: |
| 318 | case VTN_PORT_UPDATED: |
| 319 | log.debug("Processing service port {}", event.vtnPort()); |
| 320 | PortId portId = event.vtnPort().id(); |
| 321 | eventExecutor.execute(() -> { |
Hyunsun Moon | 5c14395 | 2016-10-19 18:34:46 -0700 | [diff] [blame] | 322 | Instance instance = getInstance(portId); |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 323 | if (instance != null) { |
| 324 | addInstance(instance.host().location()); |
| 325 | } |
| 326 | }); |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 327 | break; |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 328 | case VTN_PORT_REMOVED: |
| 329 | case VTN_NETWORK_CREATED: |
| 330 | case VTN_NETWORK_UPDATED: |
| 331 | case VTN_NETWORK_REMOVED: |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 332 | default: |
Hyunsun Moon | eaf75e6 | 2016-09-27 16:40:23 -0700 | [diff] [blame] | 333 | // do nothing for the other events |
Hyunsun Moon | 5401aaa | 2016-06-12 17:40:34 -0700 | [diff] [blame] | 334 | break; |
| 335 | } |
| 336 | } |
| 337 | } |
| 338 | } |