Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 1 | /* |
Jonathan Hart | f4bd048 | 2017-01-27 15:11:18 -0800 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Laboratory |
Jonathan Hart | df20709 | 2015-12-10 11:19: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 | |
Jonathan Hart | f4bd048 | 2017-01-27 15:11:18 -0800 | [diff] [blame] | 17 | package org.onosproject.routing.fibinstaller; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 18 | |
| 19 | import com.google.common.collect.ConcurrentHashMultiset; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 20 | import com.google.common.collect.Maps; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 21 | import com.google.common.collect.Multiset; |
| 22 | import org.apache.felix.scr.annotations.Activate; |
| 23 | import org.apache.felix.scr.annotations.Component; |
| 24 | import org.apache.felix.scr.annotations.Deactivate; |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 25 | import org.apache.felix.scr.annotations.Modified; |
| 26 | import org.apache.felix.scr.annotations.Property; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 27 | import org.apache.felix.scr.annotations.Reference; |
| 28 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 29 | import org.onlab.packet.Ethernet; |
| 30 | import org.onlab.packet.IpAddress; |
| 31 | import org.onlab.packet.IpPrefix; |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 32 | import org.onlab.packet.MacAddress; |
Jonathan Hart | ca47cd7 | 2015-12-13 12:31:09 -0800 | [diff] [blame] | 33 | import org.onlab.packet.VlanId; |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 34 | import org.onlab.util.Tools; |
gaurav | a2e61a5 | 2016-05-05 03:39:31 +0530 | [diff] [blame] | 35 | import org.onosproject.app.ApplicationService; |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 36 | import org.onosproject.cfg.ComponentConfigService; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 37 | import org.onosproject.core.ApplicationId; |
| 38 | import org.onosproject.core.CoreService; |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 39 | import org.onosproject.incubator.net.config.basics.McastConfig; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 40 | import org.onosproject.incubator.net.intf.Interface; |
| 41 | import org.onosproject.incubator.net.intf.InterfaceService; |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 42 | import org.onosproject.incubator.net.routing.ResolvedRoute; |
Jonathan Hart | f2e7a34 | 2017-03-20 15:43:21 -0700 | [diff] [blame] | 43 | import org.onosproject.incubator.net.routing.Route; |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 44 | import org.onosproject.incubator.net.routing.RouteEvent; |
| 45 | import org.onosproject.incubator.net.routing.RouteListener; |
| 46 | import org.onosproject.incubator.net.routing.RouteService; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 47 | import org.onosproject.net.DeviceId; |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 48 | import org.onosproject.net.config.ConfigFactory; |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 49 | import org.onosproject.net.config.NetworkConfigEvent; |
| 50 | import org.onosproject.net.config.NetworkConfigListener; |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 51 | import org.onosproject.net.config.NetworkConfigRegistry; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 52 | import org.onosproject.net.config.NetworkConfigService; |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 53 | import org.onosproject.net.config.basics.SubjectFactories; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 54 | import org.onosproject.net.device.DeviceService; |
| 55 | import org.onosproject.net.flow.DefaultTrafficSelector; |
| 56 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
| 57 | import org.onosproject.net.flow.TrafficSelector; |
| 58 | import org.onosproject.net.flow.TrafficTreatment; |
| 59 | import org.onosproject.net.flow.criteria.Criteria; |
| 60 | import org.onosproject.net.flowobjective.DefaultFilteringObjective; |
| 61 | import org.onosproject.net.flowobjective.DefaultForwardingObjective; |
| 62 | import org.onosproject.net.flowobjective.DefaultNextObjective; |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 63 | import org.onosproject.net.flowobjective.DefaultObjectiveContext; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 64 | import org.onosproject.net.flowobjective.FilteringObjective; |
| 65 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
| 66 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| 67 | import org.onosproject.net.flowobjective.NextObjective; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 68 | import org.onosproject.net.flowobjective.ObjectiveContext; |
Jonathan Hart | f2e7a34 | 2017-03-20 15:43:21 -0700 | [diff] [blame] | 69 | import org.onosproject.routing.InterfaceProvisionRequest; |
Jonathan Hart | f4bd048 | 2017-01-27 15:11:18 -0800 | [diff] [blame] | 70 | import org.onosproject.routing.NextHop; |
| 71 | import org.onosproject.routing.NextHopGroupKey; |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 72 | import org.onosproject.routing.Router; |
Jonathan Hart | f2e7a34 | 2017-03-20 15:43:21 -0700 | [diff] [blame] | 73 | import org.onosproject.routing.RouterInfo; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 74 | import org.onosproject.routing.RoutingService; |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 75 | import org.onosproject.routing.config.RouterConfigHelper; |
| 76 | import org.onosproject.routing.config.RoutersConfig; |
| 77 | import org.onosproject.routing.config.RoutingConfigurationService; |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 78 | import org.osgi.service.component.ComponentContext; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 79 | import org.slf4j.Logger; |
| 80 | import org.slf4j.LoggerFactory; |
| 81 | |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 82 | import java.util.Dictionary; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 83 | import java.util.Map; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 84 | import java.util.Set; |
| 85 | |
| 86 | /** |
| 87 | * Programs routes to a single OpenFlow switch. |
| 88 | */ |
Jonathan Hart | f4bd048 | 2017-01-27 15:11:18 -0800 | [diff] [blame] | 89 | @Component(immediate = true) |
Jonathan Hart | e732704 | 2017-02-02 13:11:25 -0800 | [diff] [blame] | 90 | public class FibInstaller { |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 91 | |
| 92 | private final Logger log = LoggerFactory.getLogger(getClass()); |
Jonathan Hart | e732704 | 2017-02-02 13:11:25 -0800 | [diff] [blame] | 93 | private static final String APP_NAME = "org.onosproject.fibinstaller"; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 94 | |
| 95 | private static final int PRIORITY_OFFSET = 100; |
| 96 | private static final int PRIORITY_MULTIPLIER = 5; |
| 97 | |
Charles Chan | 03a73e0 | 2016-10-24 14:52:01 -0700 | [diff] [blame] | 98 | // FIXME: This should be eliminated when we have an API in SR that |
| 99 | // programs the fabric switches for VR |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 100 | public static final short ASSIGNED_VLAN = 4094; |
| 101 | |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 102 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 103 | protected CoreService coreService; |
| 104 | |
| 105 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 106 | protected RouteService routeService; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 107 | |
| 108 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 109 | protected InterfaceService interfaceService; |
| 110 | |
| 111 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 112 | protected NetworkConfigService networkConfigService; |
| 113 | |
| 114 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 115 | protected NetworkConfigRegistry networkConfigRegistry; |
| 116 | |
| 117 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 118 | protected ComponentConfigService componentConfigService; |
| 119 | |
| 120 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 121 | protected FlowObjectiveService flowObjectiveService; |
| 122 | |
| 123 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 124 | protected DeviceService deviceService; |
| 125 | |
gaurav | a2e61a5 | 2016-05-05 03:39:31 +0530 | [diff] [blame] | 126 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 127 | protected ApplicationService applicationService; |
| 128 | |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 129 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 130 | protected RoutingConfigurationService rs; |
| 131 | |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 132 | @Property(name = "routeToNextHop", boolValue = false, |
Vinayak Tejankar | 3a409c6 | 2017-01-12 02:20:53 +0530 | [diff] [blame] | 133 | label = "Install a /32 or /128 route to each next hop") |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 134 | private boolean routeToNextHop = false; |
| 135 | |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 136 | // Device id of data-plane switch - should be learned from config |
| 137 | private DeviceId deviceId; |
| 138 | |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 139 | private Router interfaceManager; |
Jonathan Hart | 883fd37 | 2016-02-10 14:36:15 -0800 | [diff] [blame] | 140 | |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 141 | private ApplicationId coreAppId; |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 142 | private ApplicationId routerAppId; |
Jonathan Hart | e732704 | 2017-02-02 13:11:25 -0800 | [diff] [blame] | 143 | private ApplicationId fibAppId; |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 144 | |
| 145 | // Reference count for how many times a next hop is used by a route |
| 146 | private final Multiset<IpAddress> nextHopsCount = ConcurrentHashMultiset.create(); |
| 147 | |
| 148 | // Mapping from prefix to its current next hop |
| 149 | private final Map<IpPrefix, IpAddress> prefixToNextHop = Maps.newHashMap(); |
| 150 | |
| 151 | // Mapping from next hop IP to next hop object containing group info |
| 152 | private final Map<IpAddress, Integer> nextHops = Maps.newHashMap(); |
| 153 | |
Jonathan Hart | 25bd668 | 2016-06-03 10:45:47 -0700 | [diff] [blame] | 154 | private final InternalRouteListener routeListener = new InternalRouteListener(); |
| 155 | private final InternalNetworkConfigListener configListener = new InternalNetworkConfigListener(); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 156 | |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 157 | private ConfigFactory<ApplicationId, McastConfig> mcastConfigFactory = |
| 158 | new ConfigFactory<ApplicationId, McastConfig>(SubjectFactories.APP_SUBJECT_FACTORY, |
| 159 | McastConfig.class, "multicast") { |
| 160 | @Override |
| 161 | public McastConfig createConfig() { |
| 162 | return new McastConfig(); |
| 163 | } |
| 164 | }; |
| 165 | |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 166 | @Activate |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 167 | protected void activate(ComponentContext context) { |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 168 | componentConfigService.registerProperties(getClass()); |
Jonathan Hart | 9ad777f | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 169 | modified(context); |
| 170 | |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 171 | coreAppId = coreService.registerApplication(CoreService.CORE_APP_NAME); |
Jonathan Hart | 9ad777f | 2016-02-19 12:44:36 -0800 | [diff] [blame] | 172 | routerAppId = coreService.registerApplication(RoutingService.ROUTER_APP_ID); |
Jonathan Hart | e732704 | 2017-02-02 13:11:25 -0800 | [diff] [blame] | 173 | fibAppId = coreService.registerApplication(APP_NAME); |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 174 | |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 175 | networkConfigRegistry.registerConfigFactory(mcastConfigFactory); |
| 176 | |
Jonathan Hart | 25bd668 | 2016-06-03 10:45:47 -0700 | [diff] [blame] | 177 | networkConfigService.addListener(configListener); |
Jonathan Hart | f8cd052 | 2016-10-25 07:09:55 -0700 | [diff] [blame] | 178 | |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 179 | processRouterConfig(); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 180 | |
Jonathan Hart | e732704 | 2017-02-02 13:11:25 -0800 | [diff] [blame] | 181 | applicationService.registerDeactivateHook(fibAppId, () -> cleanUp()); |
gaurav | a2e61a5 | 2016-05-05 03:39:31 +0530 | [diff] [blame] | 182 | |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 183 | log.info("Started"); |
| 184 | } |
| 185 | |
| 186 | @Deactivate |
| 187 | protected void deactivate() { |
Jonathan Hart | 25bd668 | 2016-06-03 10:45:47 -0700 | [diff] [blame] | 188 | networkConfigService.removeListener(configListener); |
gaurav | 164cf6d | 2016-03-25 21:43:04 +0530 | [diff] [blame] | 189 | |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 190 | componentConfigService.unregisterProperties(getClass(), false); |
| 191 | |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 192 | log.info("Stopped"); |
| 193 | } |
| 194 | |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 195 | @Modified |
| 196 | protected void modified(ComponentContext context) { |
| 197 | Dictionary<?, ?> properties = context.getProperties(); |
| 198 | if (properties == null) { |
| 199 | return; |
| 200 | } |
| 201 | |
| 202 | String strRouteToNextHop = Tools.get(properties, "routeToNextHop"); |
| 203 | routeToNextHop = Boolean.parseBoolean(strRouteToNextHop); |
| 204 | |
| 205 | log.info("routeToNextHop set to {}", routeToNextHop); |
| 206 | } |
| 207 | |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 208 | private void processRouterConfig() { |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 209 | Set<RoutersConfig.Router> routerConfigs = |
| 210 | RouterConfigHelper.getRouterConfigurations(networkConfigService, routerAppId); |
| 211 | if (routerConfigs.isEmpty()) { |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 212 | log.info("Router config not available"); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 213 | return; |
| 214 | } |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 215 | RoutersConfig.Router routerConfig = routerConfigs.stream().findFirst().get(); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 216 | |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 217 | if (interfaceManager == null) { |
| 218 | deviceId = routerConfig.controlPlaneConnectPoint().deviceId(); |
Jonathan Hart | f8cd052 | 2016-10-25 07:09:55 -0700 | [diff] [blame] | 219 | log.info("Router device ID is {}", deviceId); |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 220 | |
Jonathan Hart | f8cd052 | 2016-10-25 07:09:55 -0700 | [diff] [blame] | 221 | routeService.addListener(routeListener); |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 222 | |
| 223 | interfaceManager = createRouter(RouterInfo.from(routerConfig)); |
gaurav | a2e61a5 | 2016-05-05 03:39:31 +0530 | [diff] [blame] | 224 | } else { |
Charles Chan | c6d227e | 2017-02-28 15:15:17 -0800 | [diff] [blame] | 225 | interfaceManager.changeConfiguration(RouterInfo.from(routerConfig), false); |
gaurav | a2e61a5 | 2016-05-05 03:39:31 +0530 | [diff] [blame] | 226 | } |
gaurav | 2511889 | 2016-08-24 05:35:03 +0530 | [diff] [blame] | 227 | } |
| 228 | |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 229 | /** |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 230 | * Removes filtering objectives and routes before deactivate. |
| 231 | */ |
| 232 | private void cleanUp() { |
| 233 | //remove the route listener |
| 234 | routeService.removeListener(routeListener); |
| 235 | |
| 236 | //clean up the routes. |
Jonathan Hart | f2e7a34 | 2017-03-20 15:43:21 -0700 | [diff] [blame] | 237 | prefixToNextHop.entrySet().stream() |
| 238 | .map(e -> new Route(Route.Source.UNDEFINED, e.getKey(), e.getValue())) |
| 239 | .forEach(this::deleteRoute); |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 240 | |
| 241 | if (interfaceManager != null) { |
| 242 | interfaceManager.cleanup(); |
| 243 | } |
| 244 | } |
| 245 | |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 246 | private Router createRouter(RouterInfo info) { |
| 247 | return new Router( |
| 248 | info, |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 249 | interfaceService, |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 250 | deviceService, |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 251 | this::provisionInterface, |
Charles Chan | c6d227e | 2017-02-28 15:15:17 -0800 | [diff] [blame] | 252 | this::unprovisionInterface, |
| 253 | false); |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 254 | } |
| 255 | |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 256 | private void updateRoute(ResolvedRoute route) { |
| 257 | addNextHop(route); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 258 | |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 259 | Integer nextId; |
| 260 | synchronized (this) { |
| 261 | nextId = nextHops.get(route.nextHop()); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 262 | } |
| 263 | |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 264 | flowObjectiveService.forward(deviceId, |
| 265 | generateRibForwardingObj(route.prefix(), nextId).add()); |
| 266 | log.trace("Sending forwarding objective {} -> nextId:{}", route, nextId); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 267 | } |
| 268 | |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 269 | private synchronized void deleteRoute(ResolvedRoute route) { |
Jonathan Hart | 10dbafd | 2017-05-18 15:53:03 -0700 | [diff] [blame^] | 270 | deleteRoute(route.route()); |
Jonathan Hart | f2e7a34 | 2017-03-20 15:43:21 -0700 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | private void deleteRoute(Route route) { |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 274 | //Integer nextId = nextHops.get(route.nextHop()); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 275 | |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 276 | /* Group group = deleteNextHop(route.prefix()); |
| 277 | if (group == null) { |
| 278 | log.warn("Group not found when deleting {}", route); |
| 279 | return; |
| 280 | }*/ |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 281 | |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 282 | flowObjectiveService.forward(deviceId, |
| 283 | generateRibForwardingObj(route.prefix(), null).remove()); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | private ForwardingObjective.Builder generateRibForwardingObj(IpPrefix prefix, |
| 287 | Integer nextId) { |
Vinayak Tejankar | 3a409c6 | 2017-01-12 02:20:53 +0530 | [diff] [blame] | 288 | TrafficSelector selector = buildIpSelectorFromIpPrefix(prefix).build(); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 289 | int priority = prefix.prefixLength() * PRIORITY_MULTIPLIER + PRIORITY_OFFSET; |
| 290 | |
| 291 | ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder() |
Jonathan Hart | e732704 | 2017-02-02 13:11:25 -0800 | [diff] [blame] | 292 | .fromApp(fibAppId) |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 293 | .makePermanent() |
| 294 | .withSelector(selector) |
| 295 | .withPriority(priority) |
| 296 | .withFlag(ForwardingObjective.Flag.SPECIFIC); |
| 297 | |
| 298 | if (nextId == null) { |
| 299 | // Route withdraws are not specified with next hops. Generating |
| 300 | // dummy treatment as there is no equivalent nextId info. |
| 301 | fwdBuilder.withTreatment(DefaultTrafficTreatment.builder().build()); |
| 302 | } else { |
| 303 | fwdBuilder.nextStep(nextId); |
| 304 | } |
| 305 | return fwdBuilder; |
| 306 | } |
| 307 | |
Vinayak Tejankar | 3a409c6 | 2017-01-12 02:20:53 +0530 | [diff] [blame] | 308 | /** |
| 309 | * Method to build IPv4 or IPv6 selector. |
| 310 | * |
| 311 | * @param prefixToMatch the prefix to match |
| 312 | * @return the traffic selector builder |
| 313 | */ |
| 314 | private TrafficSelector.Builder buildIpSelectorFromIpPrefix(IpPrefix prefixToMatch) { |
| 315 | TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder(); |
| 316 | // If the prefix is IPv4 |
| 317 | if (prefixToMatch.isIp4()) { |
| 318 | selectorBuilder.matchEthType(Ethernet.TYPE_IPV4); |
| 319 | selectorBuilder.matchIPDst(prefixToMatch); |
| 320 | return selectorBuilder; |
| 321 | } |
| 322 | // If the prefix is IPv6 |
| 323 | selectorBuilder.matchEthType(Ethernet.TYPE_IPV6); |
| 324 | selectorBuilder.matchIPv6Dst(prefixToMatch); |
| 325 | return selectorBuilder; |
| 326 | } |
| 327 | |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 328 | private synchronized void addNextHop(ResolvedRoute route) { |
| 329 | prefixToNextHop.put(route.prefix(), route.nextHop()); |
| 330 | if (nextHopsCount.count(route.nextHop()) == 0) { |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 331 | // There was no next hop in the multiset |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 332 | Interface egressIntf = interfaceService.getMatchingInterface(route.nextHop()); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 333 | if (egressIntf == null) { |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 334 | log.warn("no egress interface found for {}", route); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 335 | return; |
| 336 | } |
| 337 | |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 338 | NextHopGroupKey groupKey = new NextHopGroupKey(route.nextHop()); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 339 | |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 340 | NextHop nextHop = new NextHop(route.nextHop(), route.nextHopMac(), groupKey); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 341 | |
Jonathan Hart | ca47cd7 | 2015-12-13 12:31:09 -0800 | [diff] [blame] | 342 | TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder() |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 343 | .setEthSrc(egressIntf.mac()) |
Jonathan Hart | ca47cd7 | 2015-12-13 12:31:09 -0800 | [diff] [blame] | 344 | .setEthDst(nextHop.mac()); |
| 345 | |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 346 | TrafficSelector.Builder metabuilder = null; |
Jonathan Hart | ca47cd7 | 2015-12-13 12:31:09 -0800 | [diff] [blame] | 347 | if (!egressIntf.vlan().equals(VlanId.NONE)) { |
| 348 | treatment.pushVlan() |
| 349 | .setVlanId(egressIntf.vlan()) |
| 350 | .setVlanPcp((byte) 0); |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 351 | } else { |
| 352 | // untagged outgoing port may require internal vlan in some pipelines |
| 353 | metabuilder = DefaultTrafficSelector.builder(); |
| 354 | metabuilder.matchVlanId(VlanId.vlanId(ASSIGNED_VLAN)); |
Jonathan Hart | ca47cd7 | 2015-12-13 12:31:09 -0800 | [diff] [blame] | 355 | } |
| 356 | |
| 357 | treatment.setOutput(egressIntf.connectPoint().port()); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 358 | |
| 359 | int nextId = flowObjectiveService.allocateNextId(); |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 360 | NextObjective.Builder nextBuilder = DefaultNextObjective.builder() |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 361 | .withId(nextId) |
Jonathan Hart | ca47cd7 | 2015-12-13 12:31:09 -0800 | [diff] [blame] | 362 | .addTreatment(treatment.build()) |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 363 | .withType(NextObjective.Type.SIMPLE) |
Jonathan Hart | e732704 | 2017-02-02 13:11:25 -0800 | [diff] [blame] | 364 | .fromApp(fibAppId); |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 365 | if (metabuilder != null) { |
| 366 | nextBuilder.withMeta(metabuilder.build()); |
| 367 | } |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 368 | |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 369 | NextObjective nextObjective = nextBuilder.add(); // TODO add callbacks |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 370 | flowObjectiveService.next(deviceId, nextObjective); |
| 371 | |
| 372 | nextHops.put(nextHop.ip(), nextId); |
| 373 | |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 374 | if (routeToNextHop) { |
| 375 | // Install route to next hop |
| 376 | ForwardingObjective fob = |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 377 | generateRibForwardingObj(IpPrefix.valueOf(route.nextHop(), 32), nextId).add(); |
Jonathan Hart | b940190 | 2016-02-02 18:46:01 -0800 | [diff] [blame] | 378 | flowObjectiveService.forward(deviceId, fob); |
| 379 | } |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 380 | } |
| 381 | |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 382 | nextHopsCount.add(route.nextHop()); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 383 | } |
| 384 | |
| 385 | /*private synchronized Group deleteNextHop(IpPrefix prefix) { |
| 386 | IpAddress nextHopIp = prefixToNextHop.remove(prefix); |
| 387 | NextHop nextHop = nextHops.get(nextHopIp); |
| 388 | if (nextHop == null) { |
| 389 | log.warn("No next hop found when removing prefix {}", prefix); |
| 390 | return null; |
| 391 | } |
| 392 | |
| 393 | Group group = groupService.getGroup(deviceId, |
| 394 | new DefaultGroupKey(appKryo. |
| 395 | serialize(nextHop.group()))); |
| 396 | |
| 397 | // FIXME disabling group deletes for now until we verify the logic is OK |
| 398 | if (nextHopsCount.remove(nextHopIp, 1) <= 1) { |
| 399 | // There was one or less next hops, so there are now none |
| 400 | |
| 401 | log.debug("removing group for next hop {}", nextHop); |
| 402 | |
| 403 | nextHops.remove(nextHopIp); |
| 404 | |
| 405 | groupService.removeGroup(deviceId, |
| 406 | new DefaultGroupKey(appKryo.build().serialize(nextHop.group())), |
| 407 | appId); |
| 408 | } |
| 409 | |
| 410 | return group; |
| 411 | }*/ |
| 412 | |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 413 | private void provisionInterface(InterfaceProvisionRequest intf) { |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 414 | updateInterfaceFilters(intf, true); |
gaurav | 164cf6d | 2016-03-25 21:43:04 +0530 | [diff] [blame] | 415 | } |
| 416 | |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 417 | private void unprovisionInterface(InterfaceProvisionRequest intf) { |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 418 | updateInterfaceFilters(intf, false); |
| 419 | } |
| 420 | |
| 421 | /** |
| 422 | * Installs or removes flow objectives relating to an interface. |
| 423 | * |
| 424 | * @param intf interface to update objectives for |
| 425 | * @param install true to install the objectives, false to remove them |
| 426 | */ |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 427 | private void updateInterfaceFilters(InterfaceProvisionRequest intf, boolean install) { |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 428 | updateFilteringObjective(intf, install); |
| 429 | updateMcastFilteringObjective(intf, install); |
| 430 | } |
| 431 | |
| 432 | /** |
| 433 | * Installs or removes unicast filtering objectives relating to an interface. |
| 434 | * |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 435 | * @param routerIntf interface to update objectives for |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 436 | * @param install true to install the objectives, false to remove them |
| 437 | */ |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 438 | private void updateFilteringObjective(InterfaceProvisionRequest routerIntf, boolean install) { |
| 439 | Interface intf = routerIntf.intf(); |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 440 | VlanId assignedVlan = (egressVlan().equals(VlanId.NONE)) ? |
| 441 | VlanId.vlanId(ASSIGNED_VLAN) : |
| 442 | egressVlan(); |
gaurav | 164cf6d | 2016-03-25 21:43:04 +0530 | [diff] [blame] | 443 | |
| 444 | FilteringObjective.Builder fob = DefaultFilteringObjective.builder(); |
| 445 | // first add filter for the interface |
| 446 | fob.withKey(Criteria.matchInPort(intf.connectPoint().port())) |
| 447 | .addCondition(Criteria.matchEthDst(intf.mac())) |
| 448 | .addCondition(Criteria.matchVlanId(intf.vlan())); |
| 449 | fob.withPriority(PRIORITY_OFFSET); |
| 450 | if (intf.vlan() == VlanId.NONE) { |
| 451 | TrafficTreatment tt = DefaultTrafficTreatment.builder() |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 452 | .pushVlan().setVlanId(assignedVlan).build(); |
gaurav | 164cf6d | 2016-03-25 21:43:04 +0530 | [diff] [blame] | 453 | fob.withMeta(tt); |
| 454 | } |
Jonathan Hart | e732704 | 2017-02-02 13:11:25 -0800 | [diff] [blame] | 455 | fob.permit().fromApp(fibAppId); |
gaurav | 164cf6d | 2016-03-25 21:43:04 +0530 | [diff] [blame] | 456 | sendFilteringObjective(install, fob, intf); |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 457 | |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 458 | // then add the same mac/vlan filters for control-plane connect point |
| 459 | fob.withKey(Criteria.matchInPort(routerIntf.controlPlaneConnectPoint().port())); |
| 460 | sendFilteringObjective(install, fob, intf); |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 461 | } |
| 462 | |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 463 | /** |
| 464 | * Installs or removes multicast filtering objectives relating to an interface. |
| 465 | * |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 466 | * @param routerIntf interface to update objectives for |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 467 | * @param install true to install the objectives, false to remove them |
| 468 | */ |
Jonathan Hart | 249b4cf | 2017-02-03 18:02:58 -0800 | [diff] [blame] | 469 | private void updateMcastFilteringObjective(InterfaceProvisionRequest routerIntf, boolean install) { |
| 470 | Interface intf = routerIntf.intf(); |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 471 | VlanId assignedVlan = (egressVlan().equals(VlanId.NONE)) ? |
| 472 | VlanId.vlanId(ASSIGNED_VLAN) : |
| 473 | egressVlan(); |
| 474 | |
| 475 | FilteringObjective.Builder fob = DefaultFilteringObjective.builder(); |
| 476 | // first add filter for the interface |
| 477 | fob.withKey(Criteria.matchInPort(intf.connectPoint().port())) |
| 478 | .addCondition(Criteria.matchEthDstMasked(MacAddress.IPV4_MULTICAST, |
| 479 | MacAddress.IPV4_MULTICAST_MASK)) |
| 480 | .addCondition(Criteria.matchVlanId(ingressVlan())); |
| 481 | fob.withPriority(PRIORITY_OFFSET); |
| 482 | TrafficTreatment tt = DefaultTrafficTreatment.builder() |
| 483 | .pushVlan().setVlanId(assignedVlan).build(); |
| 484 | fob.withMeta(tt); |
| 485 | |
Jonathan Hart | e732704 | 2017-02-02 13:11:25 -0800 | [diff] [blame] | 486 | fob.permit().fromApp(fibAppId); |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 487 | sendFilteringObjective(install, fob, intf); |
| 488 | } |
| 489 | |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 490 | private void sendFilteringObjective(boolean install, FilteringObjective.Builder fob, |
| 491 | Interface intf) { |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 492 | |
Jonathan Hart | f04b7d9 | 2016-03-29 09:39:11 -0700 | [diff] [blame] | 493 | ObjectiveContext context = new DefaultObjectiveContext( |
| 494 | (objective) -> log.info("Installed filter for interface {}", intf), |
| 495 | (objective, error) -> |
| 496 | log.error("Failed to install filter for interface {}: {}", intf, error)); |
gaurav | 164cf6d | 2016-03-25 21:43:04 +0530 | [diff] [blame] | 497 | |
Jonathan Hart | f04b7d9 | 2016-03-29 09:39:11 -0700 | [diff] [blame] | 498 | FilteringObjective filter = install ? fob.add(context) : fob.remove(context); |
| 499 | |
| 500 | flowObjectiveService.filter(deviceId, filter); |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 501 | } |
| 502 | |
Charles Chan | d55e84d | 2016-03-30 17:54:24 -0700 | [diff] [blame] | 503 | private VlanId ingressVlan() { |
| 504 | McastConfig mcastConfig = |
| 505 | networkConfigService.getConfig(coreAppId, McastConfig.class); |
| 506 | return (mcastConfig != null) ? mcastConfig.ingressVlan() : VlanId.NONE; |
| 507 | } |
| 508 | |
| 509 | private VlanId egressVlan() { |
| 510 | McastConfig mcastConfig = |
| 511 | networkConfigService.getConfig(coreAppId, McastConfig.class); |
| 512 | return (mcastConfig != null) ? mcastConfig.egressVlan() : VlanId.NONE; |
| 513 | } |
| 514 | |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 515 | /** |
| 516 | * Listener for route changes. |
| 517 | */ |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 518 | private class InternalRouteListener implements RouteListener { |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 519 | @Override |
Jonathan Hart | a2eb9ff | 2016-04-13 21:27:06 -0700 | [diff] [blame] | 520 | public void event(RouteEvent event) { |
| 521 | ResolvedRoute route = event.subject(); |
| 522 | switch (event.type()) { |
| 523 | case ROUTE_ADDED: |
| 524 | case ROUTE_UPDATED: |
| 525 | updateRoute(route); |
| 526 | break; |
| 527 | case ROUTE_REMOVED: |
| 528 | deleteRoute(route); |
| 529 | break; |
| 530 | default: |
| 531 | break; |
| 532 | } |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 533 | } |
| 534 | } |
| 535 | |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 536 | /** |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 537 | * Listener for network config events. |
| 538 | */ |
| 539 | private class InternalNetworkConfigListener implements NetworkConfigListener { |
| 540 | @Override |
| 541 | public void event(NetworkConfigEvent event) { |
Jonathan Hart | 25bd668 | 2016-06-03 10:45:47 -0700 | [diff] [blame] | 542 | if (event.configClass().equals(RoutingService.ROUTER_CONFIG_CLASS)) { |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 543 | switch (event.type()) { |
| 544 | case CONFIG_ADDED: |
| 545 | case CONFIG_UPDATED: |
Jonathan Hart | 7fc5a72 | 2017-01-26 15:54:12 -0800 | [diff] [blame] | 546 | processRouterConfig(); |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 547 | break; |
| 548 | case CONFIG_REGISTERED: |
gaurav | 2511889 | 2016-08-24 05:35:03 +0530 | [diff] [blame] | 549 | break; |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 550 | case CONFIG_UNREGISTERED: |
gaurav | 2511889 | 2016-08-24 05:35:03 +0530 | [diff] [blame] | 551 | break; |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 552 | case CONFIG_REMOVED: |
gaurav | 2511889 | 2016-08-24 05:35:03 +0530 | [diff] [blame] | 553 | cleanUp(); |
| 554 | break; |
Jonathan Hart | b3fa42c | 2016-01-13 09:50:43 -0800 | [diff] [blame] | 555 | default: |
| 556 | break; |
| 557 | } |
| 558 | } |
| 559 | } |
| 560 | } |
Jonathan Hart | df20709 | 2015-12-10 11:19:25 -0800 | [diff] [blame] | 561 | } |