Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [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 | package org.onosproject.routing.impl; |
| 18 | |
Jonathan Hart | f04b7d9 | 2016-03-29 09:39:11 -0700 | [diff] [blame] | 19 | import com.google.common.collect.ImmutableSortedSet; |
| 20 | import com.google.common.collect.Maps; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 21 | import org.apache.felix.scr.annotations.Activate; |
| 22 | import org.apache.felix.scr.annotations.Component; |
| 23 | import org.apache.felix.scr.annotations.Deactivate; |
| 24 | import org.apache.felix.scr.annotations.Reference; |
| 25 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 26 | import org.onlab.packet.EthType; |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 27 | import org.onlab.packet.IpPrefix; |
| 28 | import org.onlab.packet.MacAddress; |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 29 | import org.onlab.packet.VlanId; |
kishore | 786b7e4 | 2016-05-19 16:25:57 +0530 | [diff] [blame] | 30 | import org.onosproject.app.ApplicationService; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 31 | import org.onosproject.core.ApplicationId; |
| 32 | import org.onosproject.core.CoreService; |
| 33 | import org.onosproject.incubator.net.intf.Interface; |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 34 | import org.onosproject.incubator.net.intf.InterfaceEvent; |
| 35 | import org.onosproject.incubator.net.intf.InterfaceListener; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 36 | import org.onosproject.incubator.net.intf.InterfaceService; |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 37 | import org.onosproject.mastership.MastershipService; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 38 | import org.onosproject.net.ConnectPoint; |
| 39 | import org.onosproject.net.DeviceId; |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 40 | import org.onosproject.net.Host; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 41 | import org.onosproject.net.PortNumber; |
| 42 | import org.onosproject.net.config.NetworkConfigEvent; |
| 43 | import org.onosproject.net.config.NetworkConfigListener; |
| 44 | import org.onosproject.net.config.NetworkConfigService; |
| 45 | import org.onosproject.net.device.DeviceEvent; |
| 46 | import org.onosproject.net.device.DeviceListener; |
| 47 | import org.onosproject.net.device.DeviceService; |
| 48 | import org.onosproject.net.flow.DefaultTrafficSelector; |
| 49 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
| 50 | import org.onosproject.net.flow.TrafficSelector; |
| 51 | import org.onosproject.net.flow.TrafficTreatment; |
| 52 | import org.onosproject.net.flowobjective.DefaultForwardingObjective; |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 53 | import org.onosproject.net.flowobjective.DefaultNextObjective; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 54 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
| 55 | import org.onosproject.net.flowobjective.ForwardingObjective; |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 56 | import org.onosproject.net.flowobjective.NextObjective; |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 57 | import org.onosproject.net.host.HostEvent; |
| 58 | import org.onosproject.net.host.HostListener; |
| 59 | import org.onosproject.net.host.HostService; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 60 | import org.onosproject.net.host.InterfaceIpAddress; |
| 61 | import org.onosproject.routing.RoutingService; |
| 62 | import org.onosproject.routing.config.RouterConfig; |
| 63 | import org.slf4j.Logger; |
| 64 | |
Jonathan Hart | f04b7d9 | 2016-03-29 09:39:11 -0700 | [diff] [blame] | 65 | import java.util.Collections; |
| 66 | import java.util.Iterator; |
| 67 | import java.util.List; |
| 68 | import java.util.Map; |
| 69 | import java.util.Optional; |
| 70 | import java.util.Set; |
kishore | 7c42cbe | 2016-04-26 22:49:36 +0530 | [diff] [blame] | 71 | import java.util.stream.Collectors; |
Jonathan Hart | f04b7d9 | 2016-03-29 09:39:11 -0700 | [diff] [blame] | 72 | |
| 73 | import static com.google.common.base.Preconditions.checkState; |
| 74 | import static org.slf4j.LoggerFactory.getLogger; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 75 | |
| 76 | /** |
| 77 | * Manages connectivity between peers redirecting control traffic to a routing |
| 78 | * control plane available on the dataplane. |
| 79 | */ |
| 80 | @Component(immediate = true, enabled = false) |
| 81 | public class ControlPlaneRedirectManager { |
| 82 | |
| 83 | private final Logger log = getLogger(getClass()); |
| 84 | |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 85 | private static final int MIN_IP_PRIORITY = 10; |
| 86 | private static final int ACL_PRIORITY = 40001; |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 87 | private static final int OSPF_IP_PROTO = 0x59; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 88 | |
kishore | 786b7e4 | 2016-05-19 16:25:57 +0530 | [diff] [blame] | 89 | private static final String APP_NAME = "org.onosproject.vrouter"; |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 90 | private ApplicationId appId; |
| 91 | |
| 92 | private ConnectPoint controlPlaneConnectPoint; |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 93 | private boolean ospfEnabled = false; |
Jonathan Hart | 883fd37 | 2016-02-10 14:36:15 -0800 | [diff] [blame] | 94 | private List<String> interfaces = Collections.emptyList(); |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 95 | private Map<Host, Set<Integer>> peerNextId = Maps.newConcurrentMap(); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 96 | |
| 97 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 98 | protected CoreService coreService; |
| 99 | |
| 100 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 101 | protected DeviceService deviceService; |
| 102 | |
| 103 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 104 | protected InterfaceService interfaceService; |
| 105 | |
| 106 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 107 | protected FlowObjectiveService flowObjectiveService; |
| 108 | |
| 109 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 110 | protected NetworkConfigService networkConfigService; |
| 111 | |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 112 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 113 | protected MastershipService mastershipService; |
| 114 | |
| 115 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 116 | protected HostService hostService; |
| 117 | |
kishore | 786b7e4 | 2016-05-19 16:25:57 +0530 | [diff] [blame] | 118 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 119 | protected ApplicationService applicationService; |
| 120 | |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 121 | private final InternalDeviceListener deviceListener = new InternalDeviceListener(); |
| 122 | private final InternalNetworkConfigListener networkConfigListener = |
| 123 | new InternalNetworkConfigListener(); |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 124 | private final InternalHostListener hostListener = new InternalHostListener(); |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 125 | private final InternalInterfaceListener interfaceListener = new InternalInterfaceListener(); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 126 | |
| 127 | @Activate |
| 128 | public void activate() { |
| 129 | this.appId = coreService.registerApplication(APP_NAME); |
| 130 | |
| 131 | deviceService.addListener(deviceListener); |
| 132 | networkConfigService.addListener(networkConfigListener); |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 133 | hostService.addListener(hostListener); |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 134 | interfaceService.addListener(interfaceListener); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 135 | |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 136 | readConfig(); |
| 137 | applicationService.registerDeactivateHook(this.appId, () -> provisionDevice(false)); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | @Deactivate |
| 141 | public void deactivate() { |
| 142 | deviceService.removeListener(deviceListener); |
| 143 | networkConfigService.removeListener(networkConfigListener); |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 144 | hostService.removeListener(hostListener); |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 145 | interfaceService.removeListener(interfaceListener); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 146 | } |
| 147 | |
kishore | 786b7e4 | 2016-05-19 16:25:57 +0530 | [diff] [blame] | 148 | /** |
| 149 | * Installs or removes interface configuration |
| 150 | * based on the flag used on activate or deactivate. |
| 151 | * |
kishore | 786b7e4 | 2016-05-19 16:25:57 +0530 | [diff] [blame] | 152 | **/ |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 153 | private void readConfig() { |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 154 | ApplicationId routingAppId = |
| 155 | coreService.registerApplication(RoutingService.ROUTER_APP_ID); |
| 156 | |
| 157 | RouterConfig config = networkConfigService.getConfig( |
| 158 | routingAppId, RoutingService.ROUTER_CONFIG_CLASS); |
| 159 | |
| 160 | if (config == null) { |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 161 | log.warn("Router config not available"); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 162 | return; |
| 163 | } |
| 164 | |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 165 | controlPlaneConnectPoint = config.getControlPlaneConnectPoint(); |
| 166 | ospfEnabled = config.getOspfEnabled(); |
Jonathan Hart | 883fd37 | 2016-02-10 14:36:15 -0800 | [diff] [blame] | 167 | interfaces = config.getInterfaces(); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 168 | |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 169 | provisionDevice(true); |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 170 | } |
| 171 | |
kishore | 786b7e4 | 2016-05-19 16:25:57 +0530 | [diff] [blame] | 172 | /** |
| 173 | * Installs or removes interface configuration for each interface |
| 174 | * based on the flag used on activate or deactivate. |
| 175 | * |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 176 | * @param install true to install flows, false to remove them |
kishore | 786b7e4 | 2016-05-19 16:25:57 +0530 | [diff] [blame] | 177 | **/ |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 178 | private void provisionDevice(boolean install) { |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 179 | if (controlPlaneConnectPoint != null && |
| 180 | deviceService.isAvailable(controlPlaneConnectPoint.deviceId())) { |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 181 | DeviceId deviceId = controlPlaneConnectPoint.deviceId(); |
| 182 | |
| 183 | interfaceService.getInterfaces().stream() |
| 184 | .filter(intf -> intf.connectPoint().deviceId().equals(deviceId)) |
Jonathan Hart | 883fd37 | 2016-02-10 14:36:15 -0800 | [diff] [blame] | 185 | .filter(intf -> interfaces.isEmpty() || interfaces.contains(intf.name())) |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 186 | .forEach(intf -> provisionInterface(intf, install)); |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 187 | |
| 188 | log.info("Set up interfaces on {}", controlPlaneConnectPoint.deviceId()); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 189 | } |
| 190 | } |
| 191 | |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 192 | private void provisionInterface(Interface intf, boolean install) { |
| 193 | updateInterfaceForwarding(intf, install); |
| 194 | updateOspfForwarding(intf, install); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 195 | } |
| 196 | |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 197 | /** |
Jonathan Hart | f04b7d9 | 2016-03-29 09:39:11 -0700 | [diff] [blame] | 198 | * Installs or removes the basic forwarding flows for each interface |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 199 | * based on the flag used. |
| 200 | * |
| 201 | * @param intf the Interface on which event is received |
| 202 | * @param install true to create an add objective, false to create a remove |
| 203 | * objective |
| 204 | **/ |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 205 | private void updateInterfaceForwarding(Interface intf, boolean install) { |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 206 | log.debug("Adding interface objectives for {}", intf); |
| 207 | |
| 208 | DeviceId deviceId = controlPlaneConnectPoint.deviceId(); |
| 209 | PortNumber controlPlanePort = controlPlaneConnectPoint.port(); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 210 | for (InterfaceIpAddress ip : intf.ipAddresses()) { |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 211 | // create nextObjectives for forwarding to this interface and the |
| 212 | // controlPlaneConnectPoint |
| 213 | int cpNextId, intfNextId; |
| 214 | if (intf.vlan() == VlanId.NONE) { |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 215 | cpNextId = modifyNextObjective(deviceId, controlPlanePort, |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 216 | VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN), |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 217 | true, install); |
| 218 | intfNextId = modifyNextObjective(deviceId, intf.connectPoint().port(), |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 219 | VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN), |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 220 | true, install); |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 221 | } else { |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 222 | cpNextId = modifyNextObjective(deviceId, controlPlanePort, |
| 223 | intf.vlan(), false, install); |
| 224 | intfNextId = modifyNextObjective(deviceId, intf.connectPoint().port(), |
| 225 | intf.vlan(), false, install); |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 226 | } |
| 227 | |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 228 | // IPv4 to router |
| 229 | TrafficSelector toSelector = DefaultTrafficSelector.builder() |
| 230 | .matchInPort(intf.connectPoint().port()) |
| 231 | .matchEthDst(intf.mac()) |
| 232 | .matchEthType(EthType.EtherType.IPV4.ethType().toShort()) |
| 233 | .matchVlanId(intf.vlan()) |
| 234 | .matchIPDst(ip.ipAddress().toIpPrefix()) |
| 235 | .build(); |
| 236 | |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 237 | flowObjectiveService.forward(deviceId, |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 238 | buildForwardingObjective(toSelector, null, cpNextId, install)); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 239 | |
| 240 | // IPv4 from router |
| 241 | TrafficSelector fromSelector = DefaultTrafficSelector.builder() |
| 242 | .matchInPort(controlPlanePort) |
| 243 | .matchEthSrc(intf.mac()) |
| 244 | .matchVlanId(intf.vlan()) |
| 245 | .matchEthType(EthType.EtherType.IPV4.ethType().toShort()) |
| 246 | .matchIPSrc(ip.ipAddress().toIpPrefix()) |
| 247 | .build(); |
| 248 | |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 249 | flowObjectiveService.forward(deviceId, |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 250 | buildForwardingObjective(fromSelector, null, intfNextId, install)); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 251 | |
| 252 | // ARP to router |
| 253 | toSelector = DefaultTrafficSelector.builder() |
| 254 | .matchInPort(intf.connectPoint().port()) |
| 255 | .matchEthType(EthType.EtherType.ARP.ethType().toShort()) |
| 256 | .matchVlanId(intf.vlan()) |
| 257 | .build(); |
| 258 | |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 259 | TrafficTreatment puntTreatment = DefaultTrafficTreatment.builder() |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 260 | .punt() |
| 261 | .build(); |
| 262 | |
| 263 | flowObjectiveService.forward(deviceId, |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 264 | buildForwardingObjective(toSelector, puntTreatment, cpNextId, install)); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 265 | |
| 266 | // ARP from router |
| 267 | fromSelector = DefaultTrafficSelector.builder() |
| 268 | .matchInPort(controlPlanePort) |
| 269 | .matchEthSrc(intf.mac()) |
| 270 | .matchVlanId(intf.vlan()) |
| 271 | .matchEthType(EthType.EtherType.ARP.ethType().toShort()) |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 272 | .matchArpSpa(ip.ipAddress().getIp4Address()) |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 273 | .build(); |
| 274 | |
| 275 | flowObjectiveService.forward(deviceId, |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 276 | buildForwardingObjective(fromSelector, puntTreatment, intfNextId, install)); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 277 | } |
| 278 | } |
| 279 | |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 280 | /** |
Jonathan Hart | f04b7d9 | 2016-03-29 09:39:11 -0700 | [diff] [blame] | 281 | * Installs or removes OSPF forwarding rules. |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 282 | * |
Jonathan Hart | f04b7d9 | 2016-03-29 09:39:11 -0700 | [diff] [blame] | 283 | * @param intf the interface on which event is received |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 284 | * @param install true to create an add objective, false to create a remove |
| 285 | * objective |
| 286 | **/ |
| 287 | private void updateOspfForwarding(Interface intf, boolean install) { |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 288 | // OSPF to router |
| 289 | TrafficSelector toSelector = DefaultTrafficSelector.builder() |
| 290 | .matchInPort(intf.connectPoint().port()) |
| 291 | .matchEthType(EthType.EtherType.IPV4.ethType().toShort()) |
| 292 | .matchVlanId(intf.vlan()) |
| 293 | .matchIPProtocol((byte) OSPF_IP_PROTO) |
| 294 | .build(); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 295 | |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 296 | // create nextObjectives for forwarding to the controlPlaneConnectPoint |
| 297 | DeviceId deviceId = controlPlaneConnectPoint.deviceId(); |
| 298 | PortNumber controlPlanePort = controlPlaneConnectPoint.port(); |
| 299 | int cpNextId; |
| 300 | if (intf.vlan() == VlanId.NONE) { |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 301 | cpNextId = modifyNextObjective(deviceId, controlPlanePort, |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 302 | VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN), |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 303 | true, install); |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 304 | } else { |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 305 | cpNextId = modifyNextObjective(deviceId, controlPlanePort, |
| 306 | intf.vlan(), false, install); |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 307 | } |
Jonathan Hart | f04b7d9 | 2016-03-29 09:39:11 -0700 | [diff] [blame] | 308 | log.debug("OSPF flows intf:{} nextid:{}", intf, cpNextId); |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 309 | flowObjectiveService.forward(controlPlaneConnectPoint.deviceId(), |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 310 | buildForwardingObjective(toSelector, null, cpNextId, install ? ospfEnabled : install)); |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | /** |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 314 | * Creates a next objective for forwarding to a port. Handles metadata for |
| 315 | * some pipelines that require vlan information for egress port. |
| 316 | * |
| 317 | * @param deviceId the device on which the next objective is being created |
| 318 | * @param portNumber the egress port |
| 319 | * @param vlanId vlan information for egress port |
| 320 | * @param popVlan if vlan tag should be popped or not |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 321 | * @param install true to create an add next objective, false to create a remove |
| 322 | * next objective |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 323 | * @return nextId of the next objective created |
| 324 | */ |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 325 | private int modifyNextObjective(DeviceId deviceId, PortNumber portNumber, |
| 326 | VlanId vlanId, boolean popVlan, boolean install) { |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 327 | int nextId = flowObjectiveService.allocateNextId(); |
| 328 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 329 | .builder().withId(nextId) |
| 330 | .withType(NextObjective.Type.SIMPLE) |
| 331 | .fromApp(appId); |
| 332 | |
| 333 | TrafficTreatment.Builder ttBuilder = DefaultTrafficTreatment.builder(); |
| 334 | if (popVlan) { |
| 335 | ttBuilder.popVlan(); |
| 336 | } |
| 337 | ttBuilder.setOutput(portNumber); |
| 338 | |
| 339 | // setup metadata to pass to nextObjective - indicate the vlan on egress |
| 340 | // if needed by the switch pipeline. |
| 341 | TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder(); |
| 342 | metabuilder.matchVlanId(vlanId); |
| 343 | |
| 344 | nextObjBuilder.withMeta(metabuilder.build()); |
| 345 | nextObjBuilder.addTreatment(ttBuilder.build()); |
Jonathan Hart | f04b7d9 | 2016-03-29 09:39:11 -0700 | [diff] [blame] | 346 | log.debug("Submitted next objective {} in device {} for port/vlan {}/{}", |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 347 | nextId, deviceId, portNumber, vlanId); |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 348 | if (install) { |
| 349 | flowObjectiveService.next(deviceId, nextObjBuilder.add()); |
| 350 | } else { |
| 351 | flowObjectiveService.next(deviceId, nextObjBuilder.remove()); |
| 352 | } |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 353 | return nextId; |
| 354 | } |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 355 | |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 356 | /** |
| 357 | * Builds a forwarding objective from the given selector, treatment and nextId. |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 358 | * |
| 359 | * @param selector selector |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 360 | * @param treatment treatment to apply to packet, can be null |
| 361 | * @param nextId next objective to point to for forwarding packet |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 362 | * @param add true to create an add objective, false to create a remove |
| 363 | * objective |
| 364 | * @return forwarding objective |
| 365 | */ |
| 366 | private ForwardingObjective buildForwardingObjective(TrafficSelector selector, |
| 367 | TrafficTreatment treatment, |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 368 | int nextId, |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 369 | boolean add) { |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 370 | DefaultForwardingObjective.Builder fobBuilder = DefaultForwardingObjective.builder(); |
| 371 | fobBuilder.withSelector(selector); |
| 372 | if (treatment != null) { |
| 373 | fobBuilder.withTreatment(treatment); |
| 374 | } |
| 375 | if (nextId != -1) { |
| 376 | fobBuilder.nextStep(nextId); |
| 377 | } |
| 378 | fobBuilder.fromApp(appId) |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 379 | .withPriority(ACL_PRIORITY) |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 380 | .withFlag(ForwardingObjective.Flag.VERSATILE); |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 381 | |
| 382 | return add ? fobBuilder.add() : fobBuilder.remove(); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 383 | } |
| 384 | |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 385 | /** |
| 386 | * Listener for device events. |
| 387 | */ |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 388 | private class InternalDeviceListener implements DeviceListener { |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 389 | |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 390 | @Override |
| 391 | public void event(DeviceEvent event) { |
| 392 | if (controlPlaneConnectPoint != null && |
| 393 | event.subject().id().equals(controlPlaneConnectPoint.deviceId())) { |
| 394 | switch (event.type()) { |
| 395 | case DEVICE_ADDED: |
| 396 | case DEVICE_AVAILABILITY_CHANGED: |
| 397 | if (deviceService.isAvailable(event.subject().id())) { |
| 398 | log.info("Device connected {}", event.subject().id()); |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 399 | provisionDevice(true); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 400 | } |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 401 | break; |
| 402 | case DEVICE_UPDATED: |
| 403 | case DEVICE_REMOVED: |
| 404 | case DEVICE_SUSPENDED: |
| 405 | case PORT_ADDED: |
| 406 | case PORT_UPDATED: |
| 407 | case PORT_REMOVED: |
| 408 | default: |
| 409 | break; |
| 410 | } |
| 411 | } |
| 412 | } |
| 413 | } |
| 414 | |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 415 | /** |
| 416 | * Listener for network config events. |
| 417 | */ |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 418 | private class InternalNetworkConfigListener implements NetworkConfigListener { |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 419 | |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 420 | @Override |
| 421 | public void event(NetworkConfigEvent event) { |
Jonathan Hart | ea49238 | 2016-01-13 09:33:13 -0800 | [diff] [blame] | 422 | if (event.configClass().equals(RoutingService.ROUTER_CONFIG_CLASS)) { |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 423 | switch (event.type()) { |
| 424 | case CONFIG_ADDED: |
| 425 | case CONFIG_UPDATED: |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 426 | readConfig(); |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 427 | break; |
| 428 | case CONFIG_REGISTERED: |
| 429 | case CONFIG_UNREGISTERED: |
| 430 | case CONFIG_REMOVED: |
| 431 | default: |
| 432 | break; |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | } |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 437 | |
| 438 | /** |
| 439 | * Listener for host events. |
| 440 | */ |
| 441 | private class InternalHostListener implements HostListener { |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 442 | |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 443 | private void peerAdded(HostEvent event) { |
| 444 | Host peer = event.subject(); |
| 445 | Optional<Interface> peerIntf = |
| 446 | interfaceService.getInterfacesByPort(peer.location()).stream() |
| 447 | .filter(intf -> interfaces.isEmpty() || interfaces.contains(intf.name())) |
| 448 | .filter(intf -> peer.vlan().equals(intf.vlan())) |
| 449 | .findFirst(); |
| 450 | if (!peerIntf.isPresent()) { |
| 451 | log.debug("Adding peer {}/{} on {} but the interface is not configured", |
| 452 | peer.mac(), peer.vlan(), peer.location()); |
| 453 | return; |
| 454 | } |
| 455 | |
| 456 | // Generate L3 Unicast groups and store it in the map |
| 457 | int toRouterL3Unicast = createPeerGroup(peer.mac(), peerIntf.get().mac(), |
| 458 | peer.vlan(), peer.location().deviceId(), controlPlaneConnectPoint.port()); |
| 459 | int toPeerL3Unicast = createPeerGroup(peerIntf.get().mac(), peer.mac(), |
| 460 | peer.vlan(), peer.location().deviceId(), peer.location().port()); |
| 461 | peerNextId.put(peer, ImmutableSortedSet.of(toRouterL3Unicast, toPeerL3Unicast)); |
| 462 | |
| 463 | // From peer to router |
| 464 | peerIntf.get().ipAddresses().forEach(routerIp -> { |
| 465 | flowObjectiveService.forward(peer.location().deviceId(), |
| 466 | createPeerObjBuilder(toRouterL3Unicast, routerIp.ipAddress().toIpPrefix()).add()); |
| 467 | }); |
| 468 | |
| 469 | // From router to peer |
| 470 | peer.ipAddresses().forEach(peerIp -> { |
| 471 | flowObjectiveService.forward(peer.location().deviceId(), |
| 472 | createPeerObjBuilder(toPeerL3Unicast, peerIp.toIpPrefix()).add()); |
| 473 | }); |
| 474 | } |
| 475 | |
| 476 | private void peerRemoved(HostEvent event) { |
| 477 | Host peer = event.subject(); |
| 478 | Optional<Interface> peerIntf = |
| 479 | interfaceService.getInterfacesByPort(peer.location()).stream() |
| 480 | .filter(intf -> interfaces.isEmpty() || interfaces.contains(intf.name())) |
| 481 | .filter(intf -> peer.vlan().equals(intf.vlan())) |
| 482 | .findFirst(); |
| 483 | if (!peerIntf.isPresent()) { |
| 484 | log.debug("Removing peer {}/{} on {} but the interface is not configured", |
| 485 | peer.mac(), peer.vlan(), peer.location()); |
| 486 | return; |
| 487 | } |
| 488 | |
Charles Chan | d0fd5dc | 2016-02-16 23:14:49 -0800 | [diff] [blame] | 489 | checkState(peerNextId.get(peer) != null, |
| 490 | "Peer nextId should not be null"); |
| 491 | checkState(peerNextId.get(peer).size() == 2, |
| 492 | "Wrong nextId associated with the peer"); |
| 493 | Iterator<Integer> iter = peerNextId.get(peer).iterator(); |
| 494 | int toRouterL3Unicast = iter.next(); |
| 495 | int toPeerL3Unicast = iter.next(); |
| 496 | |
| 497 | // From peer to router |
| 498 | peerIntf.get().ipAddresses().forEach(routerIp -> { |
| 499 | flowObjectiveService.forward(peer.location().deviceId(), |
| 500 | createPeerObjBuilder(toRouterL3Unicast, routerIp.ipAddress().toIpPrefix()).remove()); |
| 501 | }); |
| 502 | |
| 503 | // From router to peer |
| 504 | peer.ipAddresses().forEach(peerIp -> { |
| 505 | flowObjectiveService.forward(peer.location().deviceId(), |
| 506 | createPeerObjBuilder(toPeerL3Unicast, peerIp.toIpPrefix()).remove()); |
| 507 | }); |
| 508 | } |
| 509 | |
| 510 | private ForwardingObjective.Builder createPeerObjBuilder( |
| 511 | int nextId, IpPrefix ipAddresses) { |
| 512 | TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder(); |
| 513 | sbuilder.matchEthType(EthType.EtherType.IPV4.ethType().toShort()); |
| 514 | sbuilder.matchIPDst(ipAddresses); |
| 515 | DefaultForwardingObjective.Builder builder = |
| 516 | DefaultForwardingObjective.builder() |
| 517 | .withSelector(sbuilder.build()) |
| 518 | .fromApp(appId) |
| 519 | .withPriority(getPriorityFromPrefix(ipAddresses)) |
| 520 | .withFlag(ForwardingObjective.Flag.SPECIFIC); |
| 521 | if (nextId != -1) { |
| 522 | builder.nextStep(nextId); |
| 523 | } |
| 524 | return builder; |
| 525 | } |
| 526 | |
| 527 | private int createPeerGroup(MacAddress srcMac, MacAddress dstMac, |
| 528 | VlanId vlanId, DeviceId deviceId, PortNumber port) { |
| 529 | int nextId = flowObjectiveService.allocateNextId(); |
| 530 | NextObjective.Builder nextObjBuilder = DefaultNextObjective.builder() |
| 531 | .withId(nextId) |
| 532 | .withType(NextObjective.Type.SIMPLE) |
| 533 | .fromApp(appId); |
| 534 | |
| 535 | TrafficTreatment.Builder ttBuilder = DefaultTrafficTreatment.builder(); |
| 536 | ttBuilder.setEthSrc(srcMac); |
| 537 | ttBuilder.setEthDst(dstMac); |
| 538 | ttBuilder.setOutput(port); |
| 539 | nextObjBuilder.addTreatment(ttBuilder.build()); |
| 540 | |
| 541 | TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder(); |
| 542 | VlanId matchVlanId = (vlanId.equals(VlanId.NONE)) ? |
| 543 | VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN) : |
| 544 | vlanId; |
| 545 | metabuilder.matchVlanId(matchVlanId); |
| 546 | nextObjBuilder.withMeta(metabuilder.build()); |
| 547 | |
| 548 | flowObjectiveService.next(deviceId, nextObjBuilder.add()); |
| 549 | return nextId; |
| 550 | } |
| 551 | |
| 552 | @Override |
| 553 | public void event(HostEvent event) { |
| 554 | DeviceId deviceId = event.subject().location().deviceId(); |
| 555 | if (!mastershipService.isLocalMaster(deviceId)) { |
| 556 | return; |
| 557 | } |
| 558 | switch (event.type()) { |
| 559 | case HOST_ADDED: |
| 560 | peerAdded(event); |
| 561 | break; |
| 562 | case HOST_MOVED: |
| 563 | //TODO We assume BGP peer does not move for now |
| 564 | break; |
| 565 | case HOST_REMOVED: |
| 566 | peerRemoved(event); |
| 567 | break; |
| 568 | case HOST_UPDATED: |
| 569 | //TODO We assume BGP peer does not change IP for now |
| 570 | break; |
| 571 | default: |
| 572 | break; |
| 573 | } |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | private int getPriorityFromPrefix(IpPrefix prefix) { |
| 578 | return (prefix.isIp4()) ? |
| 579 | 2000 * prefix.prefixLength() + MIN_IP_PRIORITY : |
| 580 | 500 * prefix.prefixLength() + MIN_IP_PRIORITY; |
| 581 | } |
kishore | 7c42cbe | 2016-04-26 22:49:36 +0530 | [diff] [blame] | 582 | |
| 583 | /** |
| 584 | * Update the flows comparing previous event and current event. |
| 585 | * |
| 586 | * @param prevIntf the previous interface event |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 587 | * @param intf the current occurred update event |
kishore | 7c42cbe | 2016-04-26 22:49:36 +0530 | [diff] [blame] | 588 | **/ |
| 589 | private void updateInterface(Interface prevIntf, Interface intf) { |
| 590 | if (!prevIntf.vlan().equals(intf.vlan()) || !prevIntf.mac().equals(intf)) { |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 591 | provisionInterface(prevIntf, false); |
| 592 | provisionInterface(intf, true); |
kishore | 7c42cbe | 2016-04-26 22:49:36 +0530 | [diff] [blame] | 593 | } else { |
| 594 | List<InterfaceIpAddress> removeIps = |
| 595 | prevIntf.ipAddressesList().stream() |
| 596 | .filter(pre -> !intf.ipAddressesList().contains(pre)) |
| 597 | .collect(Collectors.toList()); |
| 598 | List<InterfaceIpAddress> addIps = |
| 599 | intf.ipAddressesList().stream() |
| 600 | .filter(cur -> !prevIntf.ipAddressesList().contains(cur)) |
| 601 | .collect(Collectors.toList()); |
| 602 | // removing flows with match parameters present in previous subject |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 603 | updateInterfaceForwarding(new Interface(prevIntf.name(), prevIntf.connectPoint(), |
kishore | 7c42cbe | 2016-04-26 22:49:36 +0530 | [diff] [blame] | 604 | removeIps, prevIntf.mac(), prevIntf.vlan()), false); |
| 605 | // adding flows with match parameters present in event subject |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 606 | updateInterfaceForwarding(new Interface(intf.name(), intf.connectPoint(), |
kishore | 7c42cbe | 2016-04-26 22:49:36 +0530 | [diff] [blame] | 607 | addIps, intf.mac(), intf.vlan()), true); |
| 608 | } |
| 609 | } |
| 610 | |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 611 | private class InternalInterfaceListener implements InterfaceListener { |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 612 | @Override |
| 613 | public void event(InterfaceEvent event) { |
Charles Chan | 4a6e91e | 2016-07-19 18:36:33 -0700 | [diff] [blame^] | 614 | if (controlPlaneConnectPoint == null) { |
| 615 | log.info("Control plane connect point is not configured. Abort InterfaceEvent."); |
| 616 | return; |
| 617 | } |
| 618 | Interface intf = event.subject(); |
| 619 | Interface prevIntf = event.prevSubject(); |
| 620 | switch (event.type()) { |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 621 | case INTERFACE_ADDED: |
| 622 | if (intf != null && !intf.connectPoint().equals(controlPlaneConnectPoint)) { |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 623 | provisionInterface(intf, true); |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 624 | } |
| 625 | break; |
| 626 | case INTERFACE_UPDATED: |
kishore | 7c42cbe | 2016-04-26 22:49:36 +0530 | [diff] [blame] | 627 | if (intf != null && !intf.connectPoint().equals(controlPlaneConnectPoint)) { |
| 628 | updateInterface(prevIntf, intf); |
| 629 | } |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 630 | break; |
| 631 | case INTERFACE_REMOVED: |
| 632 | if (intf != null && !intf.connectPoint().equals(controlPlaneConnectPoint)) { |
Jonathan Hart | f8035d3 | 2016-06-16 16:23:26 -0700 | [diff] [blame] | 633 | provisionInterface(intf, false); |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 634 | } |
| 635 | break; |
| 636 | default: |
| 637 | break; |
Charles Chan | 4a6e91e | 2016-07-19 18:36:33 -0700 | [diff] [blame^] | 638 | } |
kishore | 71a2753 | 2016-03-16 20:23:49 +0530 | [diff] [blame] | 639 | } |
| 640 | } |
Jonathan Hart | 6344f57 | 2015-12-15 08:26:25 -0800 | [diff] [blame] | 641 | } |