alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.net.flowobjective.impl; |
| 17 | |
| 18 | import com.google.common.collect.Maps; |
Thomas Vachuska | d27097c | 2016-06-14 19:10:41 -0700 | [diff] [blame] | 19 | import com.google.common.collect.Sets; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 20 | import org.apache.felix.scr.annotations.Activate; |
| 21 | import org.apache.felix.scr.annotations.Component; |
| 22 | import org.apache.felix.scr.annotations.Deactivate; |
Yi Tseng | 374c5f3 | 2017-03-05 22:51:35 -0800 | [diff] [blame] | 23 | import org.apache.felix.scr.annotations.Modified; |
| 24 | import org.apache.felix.scr.annotations.Property; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 25 | import org.apache.felix.scr.annotations.Reference; |
| 26 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 27 | import org.apache.felix.scr.annotations.Service; |
| 28 | import org.onlab.osgi.DefaultServiceDirectory; |
| 29 | import org.onlab.osgi.ServiceDirectory; |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 30 | import org.onlab.util.ItemNotFoundException; |
Yi Tseng | 374c5f3 | 2017-03-05 22:51:35 -0800 | [diff] [blame] | 31 | import org.onlab.util.Tools; |
| 32 | import org.onosproject.cfg.ComponentConfigService; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 33 | import org.onosproject.cluster.ClusterService; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 34 | import org.onosproject.net.DeviceId; |
Saurav Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 35 | import org.onosproject.net.behaviour.NextGroup; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 36 | import org.onosproject.net.behaviour.Pipeliner; |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 37 | import org.onosproject.net.behaviour.PipelinerContext; |
alshabib | aebe775 | 2015-04-07 17:45:42 -0700 | [diff] [blame] | 38 | import org.onosproject.net.device.DeviceEvent; |
| 39 | import org.onosproject.net.device.DeviceListener; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 40 | import org.onosproject.net.device.DeviceService; |
Thomas Vachuska | 866b46a | 2015-04-30 00:26:55 -0700 | [diff] [blame] | 41 | import org.onosproject.net.driver.DefaultDriverProviderService; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 42 | import org.onosproject.net.driver.DriverHandler; |
| 43 | import org.onosproject.net.driver.DriverService; |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 44 | import org.onosproject.net.flow.FlowRuleService; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 45 | import org.onosproject.net.flowobjective.FilteringObjective; |
| 46 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 47 | import org.onosproject.net.flowobjective.FlowObjectiveStore; |
| 48 | import org.onosproject.net.flowobjective.FlowObjectiveStoreDelegate; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 49 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| 50 | import org.onosproject.net.flowobjective.NextObjective; |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame] | 51 | import org.onosproject.net.flowobjective.Objective; |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 52 | import org.onosproject.net.flowobjective.ObjectiveError; |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 53 | import org.onosproject.net.flowobjective.ObjectiveEvent; |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 54 | import org.onosproject.net.flowobjective.ObjectiveEvent.Type; |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 55 | import org.onosproject.net.group.GroupService; |
Yi Tseng | 374c5f3 | 2017-03-05 22:51:35 -0800 | [diff] [blame] | 56 | import org.osgi.service.component.ComponentContext; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 57 | import org.slf4j.Logger; |
| 58 | import org.slf4j.LoggerFactory; |
| 59 | |
Saurav Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 60 | import java.util.ArrayList; |
Saurav Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 61 | import java.util.List; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 62 | import java.util.Map; |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 63 | import java.util.Objects; |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 64 | import java.util.Set; |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 65 | import java.util.concurrent.ExecutorService; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 66 | |
Sho SHIMIZU | f45d85d | 2015-07-01 14:39:11 -0700 | [diff] [blame] | 67 | import static com.google.common.base.Preconditions.checkNotNull; |
Yi Tseng | 374c5f3 | 2017-03-05 22:51:35 -0800 | [diff] [blame] | 68 | import static com.google.common.base.Strings.isNullOrEmpty; |
Thomas Vachuska | 866b46a | 2015-04-30 00:26:55 -0700 | [diff] [blame] | 69 | import static java.util.concurrent.Executors.newFixedThreadPool; |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 70 | import static org.onlab.util.Tools.groupedThreads; |
Changhoon Yoon | 541ef71 | 2015-05-23 17:18:34 +0900 | [diff] [blame] | 71 | import static org.onosproject.security.AppGuard.checkPermission; |
Thomas Vachuska | d27097c | 2016-06-14 19:10:41 -0700 | [diff] [blame] | 72 | import static org.onosproject.security.AppPermission.Type.FLOWRULE_WRITE; |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 73 | |
| 74 | /** |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 75 | * Provides implementation of the flow objective programming service. |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 76 | */ |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 77 | @Component(immediate = true) |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 78 | @Service |
| 79 | public class FlowObjectiveManager implements FlowObjectiveService { |
| 80 | |
Saurav Das | bd7f742 | 2015-04-23 16:31:47 -0700 | [diff] [blame] | 81 | public static final int INSTALL_RETRY_ATTEMPTS = 5; |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 82 | public static final long INSTALL_RETRY_INTERVAL = 1000; // ms |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 83 | |
Yi Tseng | 374c5f3 | 2017-03-05 22:51:35 -0800 | [diff] [blame] | 84 | private static final String WORKER_PATTERN = "objective-installer-%d"; |
| 85 | private static final String GROUP_THREAD_NAME = "onos/objective-installer"; |
| 86 | private static final String NUM_THREAD = "numThreads"; |
| 87 | |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 88 | private final Logger log = LoggerFactory.getLogger(getClass()); |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 89 | |
Yi Tseng | 9753fc1 | 2017-03-10 18:42:46 -0800 | [diff] [blame] | 90 | private static final int DEFAULT_NUM_THREADS = 4; |
Yi Tseng | 374c5f3 | 2017-03-05 22:51:35 -0800 | [diff] [blame] | 91 | @Property(name = NUM_THREAD, |
| 92 | intValue = DEFAULT_NUM_THREADS, |
| 93 | label = "Number of worker threads") |
| 94 | private int numThreads = DEFAULT_NUM_THREADS; |
| 95 | |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 96 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 97 | protected DriverService driverService; |
| 98 | |
| 99 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 100 | protected DeviceService deviceService; |
| 101 | |
| 102 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 103 | protected ClusterService clusterService; |
| 104 | |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 105 | // Note: The following dependencies are added on behalf of the pipeline |
| 106 | // driver behaviours to assure these services are available for their |
| 107 | // initialization. |
| 108 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 109 | protected FlowRuleService flowRuleService; |
| 110 | |
| 111 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 112 | protected GroupService groupService; |
| 113 | |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 114 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 115 | protected FlowObjectiveStore flowObjectiveStore; |
| 116 | |
Yi Tseng | 374c5f3 | 2017-03-05 22:51:35 -0800 | [diff] [blame] | 117 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 118 | protected ComponentConfigService cfgService; |
| 119 | |
Thomas Vachuska | 866b46a | 2015-04-30 00:26:55 -0700 | [diff] [blame] | 120 | // Note: This must remain an optional dependency to allow re-install of default drivers. |
| 121 | // Note: For now disabled until we can move to OPTIONAL_UNARY dependency |
| 122 | // @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY, policy = ReferencePolicy.DYNAMIC) |
| 123 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 124 | protected DefaultDriverProviderService defaultDriverService; |
| 125 | |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 126 | private final FlowObjectiveStoreDelegate delegate = new InternalStoreDelegate(); |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 127 | |
| 128 | private final Map<DeviceId, DriverHandler> driverHandlers = Maps.newConcurrentMap(); |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame] | 129 | private final Map<DeviceId, Pipeliner> pipeliners = Maps.newConcurrentMap(); |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 130 | |
| 131 | private final PipelinerContext context = new InnerPipelineContext(); |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 132 | private final DeviceListener deviceListener = new InnerDeviceListener(); |
| 133 | |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 134 | protected ServiceDirectory serviceDirectory = new DefaultServiceDirectory(); |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame] | 135 | |
Thomas Vachuska | d27097c | 2016-06-14 19:10:41 -0700 | [diff] [blame] | 136 | private final Map<Integer, Set<PendingNext>> pendingForwards = Maps.newConcurrentMap(); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 137 | |
Saurav Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 138 | // local store to track which nextObjectives were sent to which device |
| 139 | // for debugging purposes |
| 140 | private Map<Integer, DeviceId> nextToDevice = Maps.newConcurrentMap(); |
| 141 | |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 142 | private ExecutorService executorService; |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 143 | |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 144 | @Activate |
| 145 | protected void activate() { |
Yi Tseng | 374c5f3 | 2017-03-05 22:51:35 -0800 | [diff] [blame] | 146 | cfgService.registerProperties(getClass()); |
| 147 | executorService = newFixedThreadPool(numThreads, |
| 148 | groupedThreads(GROUP_THREAD_NAME, WORKER_PATTERN, log)); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 149 | flowObjectiveStore.setDelegate(delegate); |
alshabib | aebe775 | 2015-04-07 17:45:42 -0700 | [diff] [blame] | 150 | deviceService.addListener(deviceListener); |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 151 | log.info("Started"); |
| 152 | } |
| 153 | |
| 154 | @Deactivate |
| 155 | protected void deactivate() { |
Yi Tseng | 374c5f3 | 2017-03-05 22:51:35 -0800 | [diff] [blame] | 156 | cfgService.unregisterProperties(getClass(), false); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 157 | flowObjectiveStore.unsetDelegate(delegate); |
alshabib | aebe775 | 2015-04-07 17:45:42 -0700 | [diff] [blame] | 158 | deviceService.removeListener(deviceListener); |
Thomas Vachuska | 866b46a | 2015-04-30 00:26:55 -0700 | [diff] [blame] | 159 | executorService.shutdown(); |
| 160 | pipeliners.clear(); |
| 161 | driverHandlers.clear(); |
Saurav Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 162 | nextToDevice.clear(); |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 163 | log.info("Stopped"); |
| 164 | } |
| 165 | |
Yi Tseng | 374c5f3 | 2017-03-05 22:51:35 -0800 | [diff] [blame] | 166 | @Modified |
| 167 | protected void modified(ComponentContext context) { |
| 168 | String propertyValue = |
| 169 | Tools.get(context.getProperties(), NUM_THREAD); |
| 170 | int newNumThreads = isNullOrEmpty(propertyValue) ? numThreads : Integer.parseInt(propertyValue); |
| 171 | |
| 172 | if (newNumThreads != numThreads && newNumThreads > 0) { |
| 173 | numThreads = newNumThreads; |
| 174 | ExecutorService oldWorkerExecutor = executorService; |
| 175 | executorService = newFixedThreadPool(numThreads, |
| 176 | groupedThreads(GROUP_THREAD_NAME, WORKER_PATTERN, log)); |
| 177 | if (oldWorkerExecutor != null) { |
| 178 | oldWorkerExecutor.shutdown(); |
| 179 | } |
| 180 | log.info("Reconfigured number of worker threads to {}", numThreads); |
| 181 | } |
| 182 | } |
| 183 | |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 184 | /** |
| 185 | * Task that passes the flow objective down to the driver. The task will |
| 186 | * make a few attempts to find the appropriate driver, then eventually give |
| 187 | * up and report an error if no suitable driver could be found. |
| 188 | */ |
| 189 | private class ObjectiveInstaller implements Runnable { |
| 190 | private final DeviceId deviceId; |
| 191 | private final Objective objective; |
| 192 | |
Sho SHIMIZU | f45d85d | 2015-07-01 14:39:11 -0700 | [diff] [blame] | 193 | private final int numAttempts; |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 194 | |
| 195 | public ObjectiveInstaller(DeviceId deviceId, Objective objective) { |
Sho SHIMIZU | f45d85d | 2015-07-01 14:39:11 -0700 | [diff] [blame] | 196 | this(deviceId, objective, 1); |
| 197 | } |
| 198 | |
| 199 | public ObjectiveInstaller(DeviceId deviceId, Objective objective, int attemps) { |
| 200 | this.deviceId = checkNotNull(deviceId); |
| 201 | this.objective = checkNotNull(objective); |
| 202 | this.numAttempts = checkNotNull(attemps); |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame] | 203 | } |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 204 | |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 205 | @Override |
| 206 | public void run() { |
| 207 | try { |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 208 | Pipeliner pipeliner = getDevicePipeliner(deviceId); |
| 209 | |
| 210 | if (pipeliner != null) { |
| 211 | if (objective instanceof NextObjective) { |
| 212 | pipeliner.next((NextObjective) objective); |
| 213 | } else if (objective instanceof ForwardingObjective) { |
| 214 | pipeliner.forward((ForwardingObjective) objective); |
| 215 | } else { |
| 216 | pipeliner.filter((FilteringObjective) objective); |
| 217 | } |
Andrea Campanella | 1f8188d | 2016-02-29 13:24:54 -0800 | [diff] [blame] | 218 | //Attempts to check if pipeliner is null for retry attempts |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 219 | } else if (numAttempts < INSTALL_RETRY_ATTEMPTS) { |
Saurav Das | 3d03826 | 2015-04-23 12:36:58 -0700 | [diff] [blame] | 220 | Thread.sleep(INSTALL_RETRY_INTERVAL); |
HIGUCHI Yuta | d9e0105 | 2016-04-14 09:31:42 -0700 | [diff] [blame] | 221 | executorService.execute(new ObjectiveInstaller(deviceId, objective, numAttempts + 1)); |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 222 | } else { |
| 223 | // Otherwise we've tried a few times and failed, report an |
| 224 | // error back to the user. |
| 225 | objective.context().ifPresent( |
Andrea Campanella | 1f8188d | 2016-02-29 13:24:54 -0800 | [diff] [blame] | 226 | c -> c.onError(objective, ObjectiveError.NOPIPELINER)); |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 227 | } |
Andrea Campanella | 1f8188d | 2016-02-29 13:24:54 -0800 | [diff] [blame] | 228 | //Excpetion thrown |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 229 | } catch (Exception e) { |
| 230 | log.warn("Exception while installing flow objective", e); |
| 231 | } |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | @Override |
| 236 | public void filter(DeviceId deviceId, FilteringObjective filteringObjective) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 237 | checkPermission(FLOWRULE_WRITE); |
HIGUCHI Yuta | d9e0105 | 2016-04-14 09:31:42 -0700 | [diff] [blame] | 238 | executorService.execute(new ObjectiveInstaller(deviceId, filteringObjective)); |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | @Override |
Thomas Vachuska | 866b46a | 2015-04-30 00:26:55 -0700 | [diff] [blame] | 242 | public void forward(DeviceId deviceId, ForwardingObjective forwardingObjective) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 243 | checkPermission(FLOWRULE_WRITE); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 244 | if (queueObjective(deviceId, forwardingObjective)) { |
| 245 | return; |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame] | 246 | } |
HIGUCHI Yuta | d9e0105 | 2016-04-14 09:31:42 -0700 | [diff] [blame] | 247 | executorService.execute(new ObjectiveInstaller(deviceId, forwardingObjective)); |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 248 | } |
| 249 | |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 250 | @Override |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 251 | public void next(DeviceId deviceId, NextObjective nextObjective) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 252 | checkPermission(FLOWRULE_WRITE); |
Saurav Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 253 | nextToDevice.put(nextObjective.id(), deviceId); |
HIGUCHI Yuta | d9e0105 | 2016-04-14 09:31:42 -0700 | [diff] [blame] | 254 | executorService.execute(new ObjectiveInstaller(deviceId, nextObjective)); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 255 | } |
| 256 | |
alshabib | f6ea9e6 | 2015-04-21 17:08:26 -0700 | [diff] [blame] | 257 | @Override |
| 258 | public int allocateNextId() { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 259 | checkPermission(FLOWRULE_WRITE); |
alshabib | f6ea9e6 | 2015-04-21 17:08:26 -0700 | [diff] [blame] | 260 | return flowObjectiveStore.allocateNextId(); |
| 261 | } |
| 262 | |
Xin Jin | 313708b | 2015-07-09 13:43:04 -0700 | [diff] [blame] | 263 | @Override |
| 264 | public void initPolicy(String policy) {} |
| 265 | |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 266 | private boolean queueObjective(DeviceId deviceId, ForwardingObjective fwd) { |
Thomas Vachuska | d27097c | 2016-06-14 19:10:41 -0700 | [diff] [blame] | 267 | if (fwd.nextId() == null || |
Yi Tseng | 38fc71e | 2017-02-03 14:50:47 -0800 | [diff] [blame] | 268 | flowObjectiveStore.getNextGroup(fwd.nextId()) != null || |
| 269 | fwd.op() == Objective.Operation.REMOVE) { |
Thomas Vachuska | d27097c | 2016-06-14 19:10:41 -0700 | [diff] [blame] | 270 | // fast path |
| 271 | return false; |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 272 | } |
Thomas Vachuska | d27097c | 2016-06-14 19:10:41 -0700 | [diff] [blame] | 273 | boolean queued = false; |
| 274 | synchronized (pendingForwards) { |
| 275 | // double check the flow objective store, because this block could run |
| 276 | // after a notification arrives |
| 277 | if (flowObjectiveStore.getNextGroup(fwd.nextId()) == null) { |
| 278 | pendingForwards.compute(fwd.nextId(), (id, pending) -> { |
| 279 | PendingNext next = new PendingNext(deviceId, fwd); |
| 280 | if (pending == null) { |
| 281 | return Sets.newHashSet(next); |
| 282 | } else { |
| 283 | pending.add(next); |
| 284 | return pending; |
| 285 | } |
| 286 | }); |
| 287 | queued = true; |
| 288 | } |
| 289 | } |
| 290 | if (queued) { |
| 291 | log.debug("Queued forwarding objective {} for nextId {} meant for device {}", |
| 292 | fwd.id(), fwd.nextId(), deviceId); |
| 293 | } |
| 294 | return queued; |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 295 | } |
| 296 | |
Pier Ventre | 57a61cd | 2016-09-07 10:55:41 -0700 | [diff] [blame] | 297 | /** |
| 298 | * Retrieves (if it exists) the device pipeline behaviour from the cache. |
| 299 | * Otherwise it warms the caches and triggers the init method of the Pipeline. |
| 300 | * |
| 301 | * @param deviceId the id of the device associated to the pipeline |
| 302 | * @return the implementation of the Pipeliner behaviour |
| 303 | */ |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 304 | private Pipeliner getDevicePipeliner(DeviceId deviceId) { |
Yuta HIGUCHI | 1fb0a8c | 2016-08-12 10:59:24 -0700 | [diff] [blame] | 305 | return pipeliners.computeIfAbsent(deviceId, this::initPipelineHandler); |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 306 | } |
| 307 | |
Yuta HIGUCHI | 1fb0a8c | 2016-08-12 10:59:24 -0700 | [diff] [blame] | 308 | /** |
Pier Ventre | 57a61cd | 2016-09-07 10:55:41 -0700 | [diff] [blame] | 309 | * Retrieves (if it exists) the device pipeline behaviour from the cache and |
| 310 | * and triggers the init method of the pipeline. Otherwise (DEVICE_ADDED) it warms |
| 311 | * the caches and triggers the init method of the Pipeline. The rationale of this |
| 312 | * method is for managing the scenario of a switch that goes down for a failure |
| 313 | * and goes up after a while. |
| 314 | * |
| 315 | * @param deviceId the id of the device associated to the pipeline |
| 316 | * @return the implementation of the Pipeliner behaviour |
| 317 | */ |
| 318 | private Pipeliner getAndInitDevicePipeliner(DeviceId deviceId) { |
| 319 | return pipeliners.compute(deviceId, (deviceIdValue, pipelinerValue) -> { |
| 320 | if (pipelinerValue != null) { |
| 321 | pipelinerValue.init(deviceId, context); |
| 322 | return pipelinerValue; |
| 323 | } |
| 324 | return this.initPipelineHandler(deviceId); |
| 325 | }); |
| 326 | } |
| 327 | |
| 328 | /** |
Yuta HIGUCHI | 1fb0a8c | 2016-08-12 10:59:24 -0700 | [diff] [blame] | 329 | * Creates and initialize {@link Pipeliner}. |
| 330 | * <p> |
| 331 | * Note: Expected to be called under per-Device lock. |
| 332 | * e.g., {@code pipeliners}' Map#compute family methods |
| 333 | * |
| 334 | * @param deviceId Device to initialize pipeliner |
| 335 | * @return {@link Pipeliner} instance or null |
| 336 | */ |
| 337 | private Pipeliner initPipelineHandler(DeviceId deviceId) { |
| 338 | start = now(); |
Thomas Vachuska | 866b46a | 2015-04-30 00:26:55 -0700 | [diff] [blame] | 339 | |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 340 | // Attempt to lookup the handler in the cache |
| 341 | DriverHandler handler = driverHandlers.get(deviceId); |
Thomas Vachuska | b19bffb | 2015-07-22 10:56:16 -0700 | [diff] [blame] | 342 | cTime = now(); |
| 343 | |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 344 | if (handler == null) { |
| 345 | try { |
| 346 | // Otherwise create it and if it has pipeline behaviour, cache it |
| 347 | handler = driverService.createHandler(deviceId); |
Thomas Vachuska | b19bffb | 2015-07-22 10:56:16 -0700 | [diff] [blame] | 348 | dTime = now(); |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 349 | if (!handler.driver().hasBehaviour(Pipeliner.class)) { |
Yuta HIGUCHI | a2a4f34 | 2017-03-17 11:38:57 -0700 | [diff] [blame] | 350 | log.debug("Pipeline behaviour not supported for device {}", |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 351 | deviceId); |
Yuta HIGUCHI | 1fb0a8c | 2016-08-12 10:59:24 -0700 | [diff] [blame] | 352 | return null; |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 353 | } |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 354 | } catch (ItemNotFoundException e) { |
| 355 | log.warn("No applicable driver for device {}", deviceId); |
Yuta HIGUCHI | 1fb0a8c | 2016-08-12 10:59:24 -0700 | [diff] [blame] | 356 | return null; |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 357 | } |
| 358 | |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 359 | driverHandlers.put(deviceId, handler); |
Thomas Vachuska | b19bffb | 2015-07-22 10:56:16 -0700 | [diff] [blame] | 360 | eTime = now(); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 361 | } |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 362 | |
| 363 | // Always (re)initialize the pipeline behaviour |
| 364 | log.info("Driver {} bound to device {} ... initializing driver", |
| 365 | handler.driver().name(), deviceId); |
Thomas Vachuska | 0121a61 | 2015-07-21 11:18:09 -0700 | [diff] [blame] | 366 | hTime = now(); |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 367 | Pipeliner pipeliner = handler.behaviour(Pipeliner.class); |
Thomas Vachuska | 94c3cf4 | 2015-07-20 13:01:12 -0700 | [diff] [blame] | 368 | hbTime = now(); |
Jonathan Hart | 17d0045 | 2015-04-21 17:10:00 -0700 | [diff] [blame] | 369 | pipeliner.init(deviceId, context); |
Yuta HIGUCHI | 1fb0a8c | 2016-08-12 10:59:24 -0700 | [diff] [blame] | 370 | stopWatch(); |
| 371 | return pipeliner; |
alshabib | aebe775 | 2015-04-07 17:45:42 -0700 | [diff] [blame] | 372 | } |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 373 | |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 374 | // Triggers driver setup when a device is (re)detected. |
alshabib | aebe775 | 2015-04-07 17:45:42 -0700 | [diff] [blame] | 375 | private class InnerDeviceListener implements DeviceListener { |
| 376 | @Override |
| 377 | public void event(DeviceEvent event) { |
| 378 | switch (event.type()) { |
| 379 | case DEVICE_ADDED: |
| 380 | case DEVICE_AVAILABILITY_CHANGED: |
Madan Jampani | 0174f45 | 2015-05-29 11:52:05 -0700 | [diff] [blame] | 381 | log.debug("Device either added or availability changed {}", |
Thomas Vachuska | 9c9ff7c | 2015-07-20 10:38:59 -0700 | [diff] [blame] | 382 | event.subject().id()); |
alshabib | 4313d10 | 2015-04-08 18:55:08 -0700 | [diff] [blame] | 383 | if (deviceService.isAvailable(event.subject().id())) { |
Madan Jampani | 0174f45 | 2015-05-29 11:52:05 -0700 | [diff] [blame] | 384 | log.debug("Device is now available {}", event.subject().id()); |
Pier Ventre | 57a61cd | 2016-09-07 10:55:41 -0700 | [diff] [blame] | 385 | getAndInitDevicePipeliner(event.subject().id()); |
Yuta HIGUCHI | 1fb0a8c | 2016-08-12 10:59:24 -0700 | [diff] [blame] | 386 | } else { |
| 387 | log.debug("Device is no longer available {}", event.subject().id()); |
alshabib | 4313d10 | 2015-04-08 18:55:08 -0700 | [diff] [blame] | 388 | } |
| 389 | break; |
| 390 | case DEVICE_UPDATED: |
| 391 | break; |
| 392 | case DEVICE_REMOVED: |
Yuta HIGUCHI | ad0c990 | 2016-08-23 10:37:32 -0700 | [diff] [blame] | 393 | // evict Pipeliner and Handler cache, when |
| 394 | // the Device was administratively removed. |
| 395 | // |
| 396 | // System expect the user to clear all existing flows, |
| 397 | // before removing device, especially if they intend to |
| 398 | // replace driver/pipeliner assigned to the device. |
| 399 | driverHandlers.remove(event.subject().id()); |
Yuta HIGUCHI | 1fb0a8c | 2016-08-12 10:59:24 -0700 | [diff] [blame] | 400 | pipeliners.remove(event.subject().id()); |
alshabib | 4313d10 | 2015-04-08 18:55:08 -0700 | [diff] [blame] | 401 | break; |
Yuta HIGUCHI | ad0c990 | 2016-08-23 10:37:32 -0700 | [diff] [blame] | 402 | case DEVICE_SUSPENDED: |
| 403 | break; |
alshabib | 4313d10 | 2015-04-08 18:55:08 -0700 | [diff] [blame] | 404 | case PORT_ADDED: |
| 405 | break; |
| 406 | case PORT_UPDATED: |
| 407 | break; |
| 408 | case PORT_REMOVED: |
alshabib | aebe775 | 2015-04-07 17:45:42 -0700 | [diff] [blame] | 409 | break; |
| 410 | default: |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 411 | break; |
alshabib | aebe775 | 2015-04-07 17:45:42 -0700 | [diff] [blame] | 412 | } |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 413 | } |
| 414 | } |
alshabib | aebe775 | 2015-04-07 17:45:42 -0700 | [diff] [blame] | 415 | |
Thomas Vachuska | 174bb91 | 2015-07-16 21:27:14 -0700 | [diff] [blame] | 416 | // Temporary mechanism to monitor pipeliner setup time-cost; there are |
| 417 | // intermittent time where this takes in excess of 2 seconds. Why? |
Thomas Vachuska | 9c9ff7c | 2015-07-20 10:38:59 -0700 | [diff] [blame] | 418 | private long start = 0, totals = 0, count = 0; |
Thomas Vachuska | b19bffb | 2015-07-22 10:56:16 -0700 | [diff] [blame] | 419 | private long cTime, dTime, eTime, hTime, hbTime; |
Thomas Vachuska | 9c9ff7c | 2015-07-20 10:38:59 -0700 | [diff] [blame] | 420 | private static final long LIMIT = 500; |
Thomas Vachuska | 174bb91 | 2015-07-16 21:27:14 -0700 | [diff] [blame] | 421 | |
Thomas Vachuska | 9c9ff7c | 2015-07-20 10:38:59 -0700 | [diff] [blame] | 422 | private long now() { |
Thomas Vachuska | 174bb91 | 2015-07-16 21:27:14 -0700 | [diff] [blame] | 423 | return System.currentTimeMillis(); |
| 424 | } |
| 425 | |
Thomas Vachuska | 9c9ff7c | 2015-07-20 10:38:59 -0700 | [diff] [blame] | 426 | private void stopWatch() { |
Thomas Vachuska | 174bb91 | 2015-07-16 21:27:14 -0700 | [diff] [blame] | 427 | long duration = System.currentTimeMillis() - start; |
| 428 | totals += duration; |
| 429 | count += 1; |
| 430 | if (duration > LIMIT) { |
Thomas Vachuska | b19bffb | 2015-07-22 10:56:16 -0700 | [diff] [blame] | 431 | log.info("Pipeline setup took {} ms; avg {} ms; cTime={}, dTime={}, eTime={}, hTime={}, hbTime={}", |
| 432 | duration, totals / count, diff(cTime), diff(dTime), diff(eTime), diff(hTime), diff(hbTime)); |
Thomas Vachuska | 174bb91 | 2015-07-16 21:27:14 -0700 | [diff] [blame] | 433 | } |
| 434 | } |
| 435 | |
Thomas Vachuska | 9c9ff7c | 2015-07-20 10:38:59 -0700 | [diff] [blame] | 436 | private long diff(long bTime) { |
Thomas Vachuska | b19bffb | 2015-07-22 10:56:16 -0700 | [diff] [blame] | 437 | long diff = bTime - start; |
| 438 | return diff < 0 ? 0 : diff; |
Thomas Vachuska | 9c9ff7c | 2015-07-20 10:38:59 -0700 | [diff] [blame] | 439 | } |
| 440 | |
Thomas Vachuska | ca88bb7 | 2015-04-08 19:38:02 -0700 | [diff] [blame] | 441 | // Processing context for initializing pipeline driver behaviours. |
| 442 | private class InnerPipelineContext implements PipelinerContext { |
| 443 | @Override |
| 444 | public ServiceDirectory directory() { |
| 445 | return serviceDirectory; |
alshabib | aebe775 | 2015-04-07 17:45:42 -0700 | [diff] [blame] | 446 | } |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 447 | |
| 448 | @Override |
| 449 | public FlowObjectiveStore store() { |
| 450 | return flowObjectiveStore; |
| 451 | } |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | private class InternalStoreDelegate implements FlowObjectiveStoreDelegate { |
| 455 | @Override |
| 456 | public void notify(ObjectiveEvent event) { |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 457 | if (event.type() == Type.ADD) { |
| 458 | log.debug("Received notification of obj event {}", event); |
Thomas Vachuska | d27097c | 2016-06-14 19:10:41 -0700 | [diff] [blame] | 459 | Set<PendingNext> pending; |
| 460 | synchronized (pendingForwards) { |
| 461 | // needs to be synchronized for queueObjective lookup |
| 462 | pending = pendingForwards.remove(event.subject()); |
| 463 | } |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 464 | |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 465 | if (pending == null) { |
Saurav Das | 2519081 | 2016-05-27 13:54:07 -0700 | [diff] [blame] | 466 | log.debug("Nothing pending for this obj event {}", event); |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 467 | return; |
| 468 | } |
| 469 | |
Saurav Das | 49cb5a1 | 2016-01-16 22:54:07 -0800 | [diff] [blame] | 470 | log.debug("Processing {} pending forwarding objectives for nextId {}", |
| 471 | pending.size(), event.subject()); |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 472 | pending.forEach(p -> getDevicePipeliner(p.deviceId()) |
| 473 | .forward(p.forwardingObjective())); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 474 | } |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 475 | } |
| 476 | } |
| 477 | |
| 478 | /** |
| 479 | * Data class used to hold a pending forwarding objective that could not |
| 480 | * be processed because the associated next object was not present. |
| 481 | */ |
| 482 | private class PendingNext { |
| 483 | private final DeviceId deviceId; |
| 484 | private final ForwardingObjective fwd; |
| 485 | |
| 486 | public PendingNext(DeviceId deviceId, ForwardingObjective fwd) { |
| 487 | this.deviceId = deviceId; |
| 488 | this.fwd = fwd; |
| 489 | } |
| 490 | |
| 491 | public DeviceId deviceId() { |
| 492 | return deviceId; |
| 493 | } |
| 494 | |
| 495 | public ForwardingObjective forwardingObjective() { |
| 496 | return fwd; |
| 497 | } |
Saurav Das | 8a0732e | 2015-11-20 15:27:53 -0800 | [diff] [blame] | 498 | |
| 499 | @Override |
| 500 | public int hashCode() { |
| 501 | return Objects.hash(deviceId, fwd); |
| 502 | } |
| 503 | |
| 504 | @Override |
| 505 | public boolean equals(final Object obj) { |
| 506 | if (this == obj) { |
| 507 | return true; |
| 508 | } |
| 509 | if (!(obj instanceof PendingNext)) { |
| 510 | return false; |
| 511 | } |
| 512 | final PendingNext other = (PendingNext) obj; |
| 513 | if (this.deviceId.equals(other.deviceId) && |
| 514 | this.fwd.equals(other.fwd)) { |
| 515 | return true; |
| 516 | } |
| 517 | return false; |
| 518 | } |
alshabib | aebe775 | 2015-04-07 17:45:42 -0700 | [diff] [blame] | 519 | } |
Saurav Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 520 | |
| 521 | @Override |
| 522 | public List<String> getNextMappings() { |
| 523 | List<String> mappings = new ArrayList<>(); |
| 524 | Map<Integer, NextGroup> allnexts = flowObjectiveStore.getAllGroups(); |
Saurav Das | 2519081 | 2016-05-27 13:54:07 -0700 | [diff] [blame] | 525 | // XXX if the NextGroup after de-serialization actually stored info of the deviceId |
Saurav Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 526 | // then info on any nextObj could be retrieved from one controller instance. |
| 527 | // Right now the drivers on one instance can only fetch for next-ids that came |
| 528 | // to them. |
| 529 | // Also, we still need to send the right next-id to the right driver as potentially |
| 530 | // there can be different drivers for different devices. But on that account, |
| 531 | // no instance should be decoding for another instance's nextIds. |
| 532 | |
| 533 | for (Map.Entry<Integer, NextGroup> e : allnexts.entrySet()) { |
| 534 | // get the device this next Objective was sent to |
| 535 | DeviceId deviceId = nextToDevice.get(e.getKey()); |
| 536 | mappings.add("NextId " + e.getKey() + ": " + |
| 537 | ((deviceId != null) ? deviceId : "nextId not in this onos instance")); |
| 538 | if (deviceId != null) { |
| 539 | // this instance of the controller sent the nextObj to a driver |
| 540 | Pipeliner pipeliner = getDevicePipeliner(deviceId); |
| 541 | List<String> nextMappings = pipeliner.getNextMappings(e.getValue()); |
| 542 | if (nextMappings != null) { |
| 543 | mappings.addAll(nextMappings); |
| 544 | } |
| 545 | } |
| 546 | } |
| 547 | return mappings; |
| 548 | } |
Saurav Das | b5c236e | 2016-06-07 10:08:06 -0700 | [diff] [blame] | 549 | |
| 550 | @Override |
| 551 | public List<String> getPendingNexts() { |
| 552 | List<String> pendingNexts = new ArrayList<>(); |
| 553 | for (Integer nextId : pendingForwards.keySet()) { |
| 554 | Set<PendingNext> pnext = pendingForwards.get(nextId); |
Charles Chan | 5473471 | 2017-03-29 11:07:55 -0700 | [diff] [blame] | 555 | |
Sho SHIMIZU | 81470a5 | 2016-08-12 17:24:55 -0700 | [diff] [blame] | 556 | StringBuilder pend = new StringBuilder(); |
Charles Chan | 5473471 | 2017-03-29 11:07:55 -0700 | [diff] [blame] | 557 | pend.append("NextId: ") |
| 558 | .append(nextId); |
Saurav Das | b5c236e | 2016-06-07 10:08:06 -0700 | [diff] [blame] | 559 | for (PendingNext pn : pnext) { |
Charles Chan | 5473471 | 2017-03-29 11:07:55 -0700 | [diff] [blame] | 560 | pend.append("\n FwdId: ") |
| 561 | .append(String.format("%11s", pn.forwardingObjective().id())) |
| 562 | .append(", DeviceId: ") |
| 563 | .append(pn.deviceId()) |
| 564 | .append(", Selector: ") |
| 565 | .append(pn.forwardingObjective().selector().criteria()); |
Saurav Das | b5c236e | 2016-06-07 10:08:06 -0700 | [diff] [blame] | 566 | } |
| 567 | pendingNexts.add(pend.toString()); |
| 568 | } |
| 569 | return pendingNexts; |
| 570 | } |
alshabib | 77b8848 | 2015-04-07 15:47:50 -0700 | [diff] [blame] | 571 | } |