Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -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.net.intent.impl; |
| 18 | |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 19 | import com.google.common.collect.ImmutableSet; |
| 20 | import com.google.common.annotations.Beta; |
Yuta HIGUCHI | 63bbedd | 2017-01-30 10:49:29 -0800 | [diff] [blame] | 21 | import com.google.common.base.MoreObjects; |
| 22 | import com.google.common.base.MoreObjects.ToStringHelper; |
Ray Milkey | fd72440 | 2016-05-26 14:45:46 -0700 | [diff] [blame] | 23 | import com.google.common.collect.Lists; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 24 | import com.google.common.collect.Sets; |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 25 | |
| 26 | import org.apache.commons.lang3.tuple.Pair; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 27 | import org.onosproject.net.DeviceId; |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 28 | import org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription; |
| 29 | import org.onosproject.net.behaviour.protection.ProtectionConfig; |
| 30 | import org.onosproject.net.config.NetworkConfigService; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 31 | import org.onosproject.net.flow.FlowRule; |
| 32 | import org.onosproject.net.flow.FlowRuleOperations; |
| 33 | import org.onosproject.net.flow.FlowRuleOperationsContext; |
| 34 | import org.onosproject.net.flow.FlowRuleService; |
| 35 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 36 | import org.onosproject.net.flowobjective.Objective; |
| 37 | import org.onosproject.net.flowobjective.ObjectiveContext; |
| 38 | import org.onosproject.net.flowobjective.ObjectiveError; |
| 39 | import org.onosproject.net.intent.FlowObjectiveIntent; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 40 | import org.onosproject.net.intent.FlowRuleIntent; |
| 41 | import org.onosproject.net.intent.Intent; |
| 42 | import org.onosproject.net.intent.IntentData; |
| 43 | import org.onosproject.net.intent.IntentStore; |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 44 | import org.onosproject.net.intent.ProtectionEndpointIntent; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 45 | import org.slf4j.Logger; |
| 46 | |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 47 | import java.util.ArrayList; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 48 | import java.util.Collection; |
Brian O'Connor | a78f060 | 2016-09-22 10:56:08 -0700 | [diff] [blame] | 49 | import java.util.Collections; |
helenyrwu | e6aaa33 | 2016-08-05 15:41:42 -0700 | [diff] [blame] | 50 | import java.util.Iterator; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 51 | import java.util.List; |
| 52 | import java.util.Optional; |
| 53 | import java.util.Set; |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 54 | import java.util.concurrent.CompletableFuture; |
| 55 | import java.util.concurrent.CopyOnWriteArrayList; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 56 | import java.util.function.Consumer; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 57 | import java.util.stream.Collectors; |
| 58 | |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 59 | import static com.google.common.base.Preconditions.checkNotNull; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 60 | import static com.google.common.base.Preconditions.checkState; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 61 | import static org.onosproject.net.intent.IntentState.*; |
| 62 | import static org.slf4j.LoggerFactory.getLogger; |
| 63 | |
| 64 | /** |
| 65 | * Auxiliary entity responsible for installing the intents into the environment. |
| 66 | */ |
| 67 | class IntentInstaller { |
| 68 | |
Brian O'Connor | c590ebb | 2016-12-08 18:16:41 -0800 | [diff] [blame] | 69 | private static final Logger log = getLogger(IntentInstaller.class); |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 70 | |
| 71 | private IntentStore store; |
| 72 | private ObjectiveTrackerService trackerService; |
| 73 | private FlowRuleService flowRuleService; |
| 74 | private FlowObjectiveService flowObjectiveService; |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 75 | private NetworkConfigService networkConfigService; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 76 | |
| 77 | private enum Direction { |
| 78 | ADD, |
| 79 | REMOVE |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Initializes the installer with references to required services. |
| 84 | * |
| 85 | * @param intentStore intent store |
| 86 | * @param trackerService objective tracking service |
| 87 | * @param flowRuleService flow rule service |
| 88 | * @param flowObjectiveService flow objective service |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 89 | * @param networkConfigService network configuration service |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 90 | */ |
| 91 | void init(IntentStore intentStore, ObjectiveTrackerService trackerService, |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 92 | FlowRuleService flowRuleService, FlowObjectiveService flowObjectiveService, |
| 93 | NetworkConfigService networkConfigService) { |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 94 | this.store = intentStore; |
| 95 | this.trackerService = trackerService; |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 96 | //TODO Various services should be plugged to the intent installer instead of being hardcoded |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 97 | this.flowRuleService = flowRuleService; |
| 98 | this.flowObjectiveService = flowObjectiveService; |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 99 | this.networkConfigService = networkConfigService; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 100 | } |
| 101 | |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 102 | // FIXME: Intent Manager should have never become dependent on a specific intent type(s). |
| 103 | // This will be addressed in intent domains work; not now. |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 104 | |
| 105 | /** |
| 106 | * Applies the specified intent updates to the environment by uninstalling |
| 107 | * and installing the intents and updating the store references appropriately. |
| 108 | * |
| 109 | * @param toUninstall optional intent to uninstall |
| 110 | * @param toInstall optional intent to install |
| 111 | */ |
| 112 | void apply(Optional<IntentData> toUninstall, Optional<IntentData> toInstall) { |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 113 | // Hook for handling success at intent installation level. |
| 114 | Consumer<IntentInstallationContext> successConsumer = (ctx) -> { |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 115 | if (toInstall.isPresent()) { |
| 116 | IntentData installData = toInstall.get(); |
| 117 | log.debug("Completed installing: {}", installData.key()); |
| 118 | installData.setState(INSTALLED); |
| 119 | store.write(installData); |
| 120 | } else if (toUninstall.isPresent()) { |
| 121 | IntentData uninstallData = toUninstall.get(); |
| 122 | log.debug("Completed withdrawing: {}", uninstallData.key()); |
| 123 | switch (uninstallData.request()) { |
| 124 | case INSTALL_REQ: |
| 125 | uninstallData.setState(FAILED); |
| 126 | break; |
| 127 | case WITHDRAW_REQ: |
| 128 | default: //TODO "default" case should not happen |
| 129 | uninstallData.setState(WITHDRAWN); |
| 130 | break; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 131 | } |
Brian O'Connor | a78f060 | 2016-09-22 10:56:08 -0700 | [diff] [blame] | 132 | // Intent has been withdrawn; we can clear the installables |
| 133 | store.write(new IntentData(uninstallData, Collections.emptyList())); |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 134 | } |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 135 | }; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 136 | |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 137 | // Hook for handling errors at intent installation level |
| 138 | Consumer<IntentInstallationContext> errorConsumer = (ctx) -> { |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 139 | // if toInstall was cause of error, then recompile (manage/increment counter, when exceeded -> CORRUPT) |
| 140 | if (toInstall.isPresent()) { |
| 141 | IntentData installData = toInstall.get(); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 142 | installData.setState(CORRUPT); |
| 143 | installData.incrementErrorCount(); |
| 144 | store.write(installData); |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 145 | } |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 146 | // if toUninstall was cause of error, then CORRUPT (another job will clean this up) |
| 147 | if (toUninstall.isPresent()) { |
| 148 | IntentData uninstallData = toUninstall.get(); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 149 | uninstallData.setState(CORRUPT); |
| 150 | uninstallData.incrementErrorCount(); |
| 151 | store.write(uninstallData); |
| 152 | } |
| 153 | }; |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 154 | |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 155 | // Hooks at operation level |
| 156 | Consumer<OperationContext> successOperationConsumer = (ctx) -> { |
| 157 | ctx.intentContext.finishContext(ctx); |
| 158 | }; |
| 159 | Consumer<OperationContext> errorOperationConsumer = (ctx) -> { |
| 160 | if (ctx.toInstall.isPresent()) { |
| 161 | IntentData installData = toInstall.get(); |
| 162 | log.warn("Failed installation operation for: {} {} due to {}", |
| 163 | installData.key(), installData.intent(), ctx.error()); |
| 164 | } |
| 165 | if (ctx.toUninstall.isPresent()) { |
| 166 | IntentData uninstallData = toUninstall.get(); |
| 167 | log.warn("Failed withdrawal operation for: {} {} due to {}", |
| 168 | uninstallData.key(), uninstallData.intent(), ctx.error()); |
| 169 | } |
| 170 | ctx.intentContext.handleError(ctx); |
| 171 | }; |
| 172 | |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 173 | // Create a context for tracking the backing operations for applying |
| 174 | // the intents to the environment. |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 175 | IntentInstallationContext intentContext = |
| 176 | new IntentInstallationContext(successConsumer, errorConsumer); |
| 177 | Set<OperationContext> contexts = createContext(intentContext, toUninstall, toInstall); |
| 178 | intentContext.pendingContexts = contexts; |
| 179 | contexts.forEach(ctx -> { |
| 180 | ctx.prepare(toUninstall, toInstall, successOperationConsumer, errorOperationConsumer); |
| 181 | ctx.apply(); |
| 182 | }); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 183 | } |
| 184 | |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 185 | // Context for applying and tracking multiple kinds of operation contexts |
| 186 | // related to specific intent data. |
| 187 | private final class IntentInstallationContext { |
| 188 | private Set<OperationContext> pendingContexts = Sets.newHashSet(); |
| 189 | private Set<OperationContext> errorContexts = Sets.newHashSet(); |
| 190 | private Consumer<IntentInstallationContext> successConsumer; |
| 191 | private Consumer<IntentInstallationContext> errorConsumer; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 192 | |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 193 | private IntentInstallationContext(Consumer<IntentInstallationContext> succesConsumer, |
| 194 | Consumer<IntentInstallationContext> errorConsumer) { |
| 195 | this.successConsumer = succesConsumer; |
| 196 | this.errorConsumer = errorConsumer; |
| 197 | } |
| 198 | |
| 199 | private void handleError(OperationContext ctx) { |
| 200 | errorContexts.add(ctx); |
| 201 | finishContext(ctx); |
| 202 | } |
| 203 | |
| 204 | private void finishContext(OperationContext ctx) { |
| 205 | synchronized (pendingContexts) { |
| 206 | pendingContexts.remove(ctx); |
| 207 | if (pendingContexts.isEmpty()) { |
| 208 | if (errorContexts.isEmpty()) { |
| 209 | successConsumer.accept(IntentInstallationContext.this); |
| 210 | } else { |
| 211 | errorConsumer.accept(IntentInstallationContext.this); |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | } |
Yuta HIGUCHI | 63bbedd | 2017-01-30 10:49:29 -0800 | [diff] [blame] | 216 | |
| 217 | @Override |
| 218 | public String toString() { |
| 219 | return MoreObjects.toStringHelper(this) |
| 220 | .add("pendingContexts", pendingContexts) |
| 221 | .add("errorContexts", errorContexts) |
| 222 | .toString(); |
| 223 | } |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | // --- Utilities to support various installable Intent ---- |
| 227 | |
| 228 | // Creates the set of contexts appropriate for tracking operations of the |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 229 | // the specified intents. |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 230 | private Set<OperationContext> createContext(IntentInstallationContext intentContext, |
| 231 | Optional<IntentData> toUninstall, |
| 232 | Optional<IntentData> toInstall) { |
| 233 | |
| 234 | Set<OperationContext> contexts = Sets.newConcurrentHashSet(); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 235 | if (isInstallable(toUninstall, toInstall, FlowRuleIntent.class)) { |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 236 | contexts.add(new FlowRuleOperationContext(intentContext)); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 237 | } |
| 238 | if (isInstallable(toUninstall, toInstall, FlowObjectiveIntent.class)) { |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 239 | contexts.add(new FlowObjectiveOperationContext(intentContext)); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 240 | } |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 241 | if (isInstallable(toUninstall, toInstall, ProtectionEndpointIntent.class)) { |
| 242 | contexts.add(new ProtectionConfigOperationContext(intentContext)); |
| 243 | } |
| 244 | |
Yuta HIGUCHI | 63bbedd | 2017-01-30 10:49:29 -0800 | [diff] [blame] | 245 | if (contexts.isEmpty()) { |
| 246 | log.warn("{} did not contain installable Intents", intentContext); |
| 247 | return ImmutableSet.of(new ErrorContext(intentContext)); |
| 248 | } |
| 249 | |
| 250 | return contexts; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | private boolean isInstallable(Optional<IntentData> toUninstall, Optional<IntentData> toInstall, |
| 254 | Class<? extends Intent> intentClass) { |
| 255 | boolean notBothNull = false; |
| 256 | if (toInstall.isPresent()) { |
| 257 | notBothNull = true; |
| 258 | if (!toInstall.get().installables().stream() |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 259 | .anyMatch(i -> intentClass.isAssignableFrom(i.getClass()))) { |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 260 | return false; |
| 261 | } |
| 262 | } |
| 263 | if (toUninstall.isPresent()) { |
| 264 | notBothNull = true; |
| 265 | if (!toUninstall.get().installables().stream() |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 266 | .anyMatch(i -> intentClass.isAssignableFrom(i.getClass()))) { |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 267 | return false; |
| 268 | } |
| 269 | } |
| 270 | return notBothNull; |
| 271 | } |
| 272 | |
| 273 | // Base context for applying and tracking operations related to installable intents. |
| 274 | private abstract class OperationContext { |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 275 | protected IntentInstallationContext intentContext; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 276 | protected Optional<IntentData> toUninstall; |
| 277 | protected Optional<IntentData> toInstall; |
Yuta HIGUCHI | 4d19ab9 | 2016-10-27 16:27:15 -0700 | [diff] [blame] | 278 | /** |
| 279 | * Implementation of {@link OperationContext} should call this on success. |
| 280 | */ |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 281 | protected Consumer<OperationContext> successConsumer; |
Yuta HIGUCHI | 4d19ab9 | 2016-10-27 16:27:15 -0700 | [diff] [blame] | 282 | /** |
| 283 | * Implementation of {@link OperationContext} should call this on error. |
| 284 | */ |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 285 | protected Consumer<OperationContext> errorConsumer; |
| 286 | |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 287 | protected OperationContext(IntentInstallationContext context) { |
| 288 | this.intentContext = context; |
| 289 | } |
| 290 | |
Yuta HIGUCHI | 4d19ab9 | 2016-10-27 16:27:15 -0700 | [diff] [blame] | 291 | /** |
| 292 | * Applies the Intents specified by |
| 293 | * {@link #prepareIntents(List, Direction)} call(s) prior to this call. |
| 294 | */ |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 295 | abstract void apply(); |
| 296 | |
Yuta HIGUCHI | 4d19ab9 | 2016-10-27 16:27:15 -0700 | [diff] [blame] | 297 | /** |
| 298 | * Returns error state of the context. |
| 299 | * <p> |
| 300 | * Used for error logging purpose. |
| 301 | * Returned Object should have reasonable toString() implementation. |
| 302 | * @return context state, describing current error state |
| 303 | */ |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 304 | abstract Object error(); |
| 305 | |
Yuta HIGUCHI | 4d19ab9 | 2016-10-27 16:27:15 -0700 | [diff] [blame] | 306 | /** |
| 307 | * Prepares Intent(s) to {@link #apply() apply} in this operation. |
| 308 | * <p> |
| 309 | * Intents specified by {@code intentsToApply} in a single call |
| 310 | * can be applied to the Devices in arbitrary order. |
| 311 | * But group of Intents specified in consecutive {@link #prepareIntents(List, Direction)} |
| 312 | * calls must be applied in order. (e.g., guarded by barrier) |
| 313 | * |
| 314 | * @param intentsToApply {@link Intent}s to apply |
| 315 | * @param direction of operation |
| 316 | */ |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 317 | abstract void prepareIntents(List<Intent> intentsToApply, Direction direction); |
| 318 | |
| 319 | void prepare(Optional<IntentData> toUninstall, Optional<IntentData> toInstall, |
| 320 | Consumer<OperationContext> successConsumer, |
| 321 | Consumer<OperationContext> errorConsumer) { |
| 322 | this.toUninstall = toUninstall; |
| 323 | this.toInstall = toInstall; |
| 324 | this.successConsumer = successConsumer; |
| 325 | this.errorConsumer = errorConsumer; |
helenyrwu | e6aaa33 | 2016-08-05 15:41:42 -0700 | [diff] [blame] | 326 | prepareIntentData(toUninstall, toInstall); |
| 327 | } |
| 328 | |
| 329 | private void prepareIntentData(Optional<IntentData> uninstallData, |
| 330 | Optional<IntentData> installData) { |
| 331 | if (!installData.isPresent() && !uninstallData.isPresent()) { |
| 332 | return; |
| 333 | } else if (!installData.isPresent()) { |
| 334 | prepareIntentData(uninstallData, Direction.REMOVE); |
| 335 | } else if (!uninstallData.isPresent()) { |
| 336 | prepareIntentData(installData, Direction.ADD); |
| 337 | } else { |
| 338 | IntentData uninstall = uninstallData.get(); |
| 339 | IntentData install = installData.get(); |
Brian O'Connor | 09d90f0 | 2016-09-13 11:06:14 -0700 | [diff] [blame] | 340 | List<Intent> uninstallIntents = Lists.newArrayList(uninstall.installables()); |
| 341 | List<Intent> installIntents = Lists.newArrayList(install.installables()); |
helenyrwu | e6aaa33 | 2016-08-05 15:41:42 -0700 | [diff] [blame] | 342 | |
| 343 | checkState(uninstallIntents.stream().allMatch(this::isSupported), |
Yuta HIGUCHI | d5324f3 | 2017-01-27 14:35:13 -0800 | [diff] [blame] | 344 | "Unsupported installable intents detected: %s", uninstallIntents); |
helenyrwu | e6aaa33 | 2016-08-05 15:41:42 -0700 | [diff] [blame] | 345 | checkState(installIntents.stream().allMatch(this::isSupported), |
Yuta HIGUCHI | d5324f3 | 2017-01-27 14:35:13 -0800 | [diff] [blame] | 346 | "Unsupported installable intents detected: %s", installIntents); |
helenyrwu | e6aaa33 | 2016-08-05 15:41:42 -0700 | [diff] [blame] | 347 | |
| 348 | //TODO: Filter FlowObjective intents |
| 349 | // Filter out same intents and intents with same flow rules |
| 350 | Iterator<Intent> iterator = installIntents.iterator(); |
| 351 | while (iterator.hasNext()) { |
| 352 | Intent installIntent = iterator.next(); |
| 353 | uninstallIntents.stream().filter(uIntent -> { |
| 354 | if (uIntent.equals(installIntent)) { |
| 355 | return true; |
| 356 | } else if (uIntent instanceof FlowRuleIntent && installIntent instanceof FlowRuleIntent) { |
Brian O'Connor | 09d90f0 | 2016-09-13 11:06:14 -0700 | [diff] [blame] | 357 | //FIXME we can further optimize this by doing the filtering on a flow-by-flow basis |
| 358 | // (direction can be implied from intent state) |
helenyrwu | e6aaa33 | 2016-08-05 15:41:42 -0700 | [diff] [blame] | 359 | return ((FlowRuleIntent) uIntent).flowRules() |
| 360 | .containsAll(((FlowRuleIntent) installIntent).flowRules()); |
| 361 | } else { |
| 362 | return false; |
| 363 | } |
| 364 | }).findFirst().ifPresent(common -> { |
| 365 | uninstallIntents.remove(common); |
Brian O'Connor | 09d90f0 | 2016-09-13 11:06:14 -0700 | [diff] [blame] | 366 | if (INSTALLED.equals(uninstall.state())) { |
| 367 | // only remove the install intent if the existing |
| 368 | // intent (i.e. the uninstall one) is already |
| 369 | // installed or installing |
| 370 | iterator.remove(); |
| 371 | } |
helenyrwu | e6aaa33 | 2016-08-05 15:41:42 -0700 | [diff] [blame] | 372 | }); |
| 373 | } |
| 374 | |
| 375 | final IntentData newUninstall = new IntentData(uninstall, uninstallIntents); |
| 376 | final IntentData newInstall = new IntentData(install, installIntents); |
| 377 | |
| 378 | trackerService.removeTrackedResources(newUninstall.key(), newUninstall.intent().resources()); |
| 379 | uninstallIntents.forEach(installable -> |
| 380 | trackerService.removeTrackedResources(newUninstall.intent().key(), |
| 381 | installable.resources())); |
| 382 | trackerService.addTrackedResources(newInstall.key(), newInstall.intent().resources()); |
| 383 | installIntents.forEach(installable -> |
| 384 | trackerService.addTrackedResources(newInstall.key(), |
| 385 | installable.resources())); |
| 386 | prepareIntents(uninstallIntents, Direction.REMOVE); |
| 387 | prepareIntents(installIntents, Direction.ADD); |
| 388 | } |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 389 | } |
| 390 | |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 391 | /** |
| 392 | * Applies the specified intent data, if present, to the network using the |
| 393 | * specified context. |
| 394 | * |
| 395 | * @param intentData optional intent data; no-op if not present |
| 396 | * @param direction indicates adding or removal |
| 397 | */ |
| 398 | private void prepareIntentData(Optional<IntentData> intentData, Direction direction) { |
| 399 | if (!intentData.isPresent()) { |
| 400 | return; |
| 401 | } |
| 402 | |
| 403 | IntentData data = intentData.get(); |
| 404 | List<Intent> intentsToApply = data.installables(); |
| 405 | checkState(intentsToApply.stream().allMatch(this::isSupported), |
Yuta HIGUCHI | d5324f3 | 2017-01-27 14:35:13 -0800 | [diff] [blame] | 406 | "Unsupported installable intents detected: %s", intentsToApply); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 407 | |
| 408 | if (direction == Direction.ADD) { |
| 409 | trackerService.addTrackedResources(data.key(), data.intent().resources()); |
| 410 | intentsToApply.forEach(installable -> |
| 411 | trackerService.addTrackedResources(data.key(), |
| 412 | installable.resources())); |
| 413 | } else { |
| 414 | trackerService.removeTrackedResources(data.key(), data.intent().resources()); |
| 415 | intentsToApply.forEach(installable -> |
| 416 | trackerService.removeTrackedResources(data.intent().key(), |
| 417 | installable.resources())); |
| 418 | } |
| 419 | |
| 420 | prepareIntents(intentsToApply, direction); |
| 421 | } |
| 422 | |
| 423 | private boolean isSupported(Intent intent) { |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 424 | return intent instanceof FlowRuleIntent || |
| 425 | intent instanceof FlowObjectiveIntent || |
| 426 | intent instanceof ProtectionEndpointIntent; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 427 | } |
Yuta HIGUCHI | 63bbedd | 2017-01-30 10:49:29 -0800 | [diff] [blame] | 428 | |
| 429 | protected ToStringHelper toStringHelper() { |
| 430 | return MoreObjects.toStringHelper(this) |
| 431 | .add("intentContext", intentContext) |
| 432 | .add("toUninstall", toUninstall) |
| 433 | .add("toInstall", toInstall); |
| 434 | } |
| 435 | |
| 436 | @Override |
| 437 | public String toString() { |
| 438 | return toStringHelper() |
| 439 | .toString(); |
| 440 | } |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 441 | } |
| 442 | |
| 443 | |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 444 | // Context for applying and tracking operations related to flow rule intents. |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 445 | private class FlowRuleOperationContext extends OperationContext { |
| 446 | FlowRuleOperations.Builder builder = FlowRuleOperations.builder(); |
| 447 | FlowRuleOperationsContext flowRuleOperationsContext; |
| 448 | |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 449 | FlowRuleOperationContext(IntentInstallationContext context) { |
| 450 | super(context); |
| 451 | } |
| 452 | |
Yuta HIGUCHI | 4d19ab9 | 2016-10-27 16:27:15 -0700 | [diff] [blame] | 453 | @Override |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 454 | void apply() { |
| 455 | flowRuleOperationsContext = new FlowRuleOperationsContext() { |
| 456 | @Override |
| 457 | public void onSuccess(FlowRuleOperations ops) { |
| 458 | successConsumer.accept(FlowRuleOperationContext.this); |
| 459 | } |
| 460 | |
| 461 | @Override |
| 462 | public void onError(FlowRuleOperations ops) { |
| 463 | errorConsumer.accept(FlowRuleOperationContext.this); |
| 464 | } |
| 465 | }; |
| 466 | FlowRuleOperations operations = builder.build(flowRuleOperationsContext); |
| 467 | |
| 468 | if (log.isTraceEnabled()) { |
| 469 | log.trace("applying intent {} -> {} with {} rules: {}", |
| 470 | toUninstall.map(x -> x.key().toString()).orElse("<empty>"), |
| 471 | toInstall.map(x -> x.key().toString()).orElse("<empty>"), |
| 472 | operations.stages().stream().mapToLong(Set::size).sum(), |
| 473 | operations.stages()); |
| 474 | } |
| 475 | |
| 476 | flowRuleService.apply(operations); |
| 477 | } |
| 478 | |
| 479 | @Override |
| 480 | public void prepareIntents(List<Intent> intentsToApply, Direction direction) { |
| 481 | // FIXME do FlowRuleIntents have stages??? Can we do uninstall work in parallel? I think so. |
| 482 | builder.newStage(); |
| 483 | |
| 484 | List<Collection<FlowRule>> stages = intentsToApply.stream() |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 485 | .filter(x -> x instanceof FlowRuleIntent) |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 486 | .map(x -> (FlowRuleIntent) x) |
| 487 | .map(FlowRuleIntent::flowRules) |
| 488 | .collect(Collectors.toList()); |
| 489 | |
| 490 | for (Collection<FlowRule> rules : stages) { |
| 491 | if (direction == Direction.ADD) { |
| 492 | rules.forEach(builder::add); |
| 493 | } else { |
| 494 | rules.forEach(builder::remove); |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | } |
| 499 | |
| 500 | @Override |
| 501 | public Object error() { |
| 502 | return flowRuleOperationsContext; |
| 503 | } |
Yuta HIGUCHI | 63bbedd | 2017-01-30 10:49:29 -0800 | [diff] [blame] | 504 | |
| 505 | @Override |
| 506 | protected ToStringHelper toStringHelper() { |
| 507 | return super.toStringHelper() |
| 508 | .omitNullValues() |
| 509 | .add("flowRuleOperationsContext", flowRuleOperationsContext); |
| 510 | } |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 511 | } |
| 512 | |
| 513 | // Context for applying and tracking operations related to flow objective intents. |
| 514 | private class FlowObjectiveOperationContext extends OperationContext { |
Ray Milkey | fd72440 | 2016-05-26 14:45:46 -0700 | [diff] [blame] | 515 | List<FlowObjectiveInstallationContext> contexts = Lists.newLinkedList(); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 516 | final Set<ObjectiveContext> pendingContexts = Sets.newHashSet(); |
| 517 | final Set<ObjectiveContext> errorContexts = Sets.newConcurrentHashSet(); |
| 518 | |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 519 | FlowObjectiveOperationContext(IntentInstallationContext context) { |
| 520 | super(context); |
| 521 | } |
| 522 | |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 523 | @Override |
| 524 | public void prepareIntents(List<Intent> intentsToApply, Direction direction) { |
Ray Milkey | fd72440 | 2016-05-26 14:45:46 -0700 | [diff] [blame] | 525 | intentsToApply.stream() |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 526 | .filter(x -> x instanceof FlowObjectiveIntent) |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 527 | .flatMap(x -> buildObjectiveContexts((FlowObjectiveIntent) x, direction).stream()) |
Ray Milkey | fd72440 | 2016-05-26 14:45:46 -0700 | [diff] [blame] | 528 | .forEach(contexts::add); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 529 | } |
| 530 | |
| 531 | // Builds the specified objective in the appropriate direction |
| 532 | private List<FlowObjectiveInstallationContext> buildObjectiveContexts(FlowObjectiveIntent intent, |
| 533 | Direction direction) { |
| 534 | int size = intent.objectives().size(); |
| 535 | List<FlowObjectiveInstallationContext> contexts = new ArrayList<>(size); |
| 536 | for (int i = 0; i < size; i++) { |
| 537 | DeviceId deviceId = intent.devices().get(i); |
| 538 | Objective.Builder builder = intent.objectives().get(i).copy(); |
| 539 | FlowObjectiveInstallationContext context = new FlowObjectiveInstallationContext(); |
| 540 | |
| 541 | final Objective objective; |
| 542 | switch (direction) { |
| 543 | case ADD: |
| 544 | objective = builder.add(context); |
| 545 | break; |
| 546 | case REMOVE: |
| 547 | objective = builder.remove(context); |
| 548 | break; |
| 549 | default: |
| 550 | throw new UnsupportedOperationException("Unsupported direction " + direction); |
| 551 | } |
| 552 | context.setObjective(objective, deviceId); |
| 553 | contexts.add(context); |
| 554 | } |
| 555 | return contexts; |
| 556 | } |
| 557 | |
| 558 | @Override |
| 559 | void apply() { |
Pier Ventre | 2c433ce | 2016-12-13 13:23:02 -0800 | [diff] [blame] | 560 | pendingContexts.addAll(contexts); |
| 561 | contexts.forEach(objectiveContext -> |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 562 | flowObjectiveService.apply(objectiveContext.deviceId, |
Pier Ventre | 2c433ce | 2016-12-13 13:23:02 -0800 | [diff] [blame] | 563 | objectiveContext.objective) |
| 564 | ); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 565 | } |
| 566 | |
| 567 | @Override |
| 568 | public Object error() { |
| 569 | return errorContexts; |
| 570 | } |
| 571 | |
Yuta HIGUCHI | 63bbedd | 2017-01-30 10:49:29 -0800 | [diff] [blame] | 572 | @Override |
| 573 | protected ToStringHelper toStringHelper() { |
| 574 | return super.toStringHelper() |
| 575 | .add("contexts", contexts) |
| 576 | .add("pendingContexts", pendingContexts) |
| 577 | .add("errorContexts", errorContexts); |
| 578 | } |
| 579 | |
| 580 | |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 581 | private class FlowObjectiveInstallationContext implements ObjectiveContext { |
| 582 | Objective objective; |
| 583 | DeviceId deviceId; |
Thomas Vachuska | d27097c | 2016-06-14 19:10:41 -0700 | [diff] [blame] | 584 | ObjectiveError error; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 585 | |
| 586 | void setObjective(Objective objective, DeviceId deviceId) { |
| 587 | this.objective = objective; |
| 588 | this.deviceId = deviceId; |
| 589 | } |
| 590 | |
| 591 | @Override |
| 592 | public void onSuccess(Objective objective) { |
| 593 | finish(); |
| 594 | } |
| 595 | |
| 596 | @Override |
| 597 | public void onError(Objective objective, ObjectiveError error) { |
Thomas Vachuska | d27097c | 2016-06-14 19:10:41 -0700 | [diff] [blame] | 598 | this.error = error; |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 599 | errorContexts.add(this); |
| 600 | finish(); |
| 601 | } |
| 602 | |
| 603 | private void finish() { |
| 604 | synchronized (pendingContexts) { |
| 605 | pendingContexts.remove(this); |
| 606 | if (pendingContexts.isEmpty()) { |
| 607 | if (errorContexts.isEmpty()) { |
| 608 | successConsumer.accept(FlowObjectiveOperationContext.this); |
| 609 | } else { |
| 610 | errorConsumer.accept(FlowObjectiveOperationContext.this); |
| 611 | } |
| 612 | } |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | @Override |
| 617 | public String toString() { |
Thomas Vachuska | d27097c | 2016-06-14 19:10:41 -0700 | [diff] [blame] | 618 | return String.format("(%s on %s for %s)", error, deviceId, objective); |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 619 | } |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | private class ErrorContext extends OperationContext { |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 624 | ErrorContext(IntentInstallationContext context) { |
| 625 | super(context); |
| 626 | } |
Thomas Vachuska | 2980c97 | 2016-02-23 20:58:49 -0800 | [diff] [blame] | 627 | @Override |
| 628 | void apply() { |
| 629 | throw new UnsupportedOperationException("Unsupported installable intent"); |
| 630 | } |
| 631 | |
| 632 | @Override |
| 633 | Object error() { |
| 634 | return null; |
| 635 | } |
| 636 | |
| 637 | @Override |
| 638 | void prepareIntents(List<Intent> intentsToApply, Direction direction) { |
| 639 | } |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 640 | } |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 641 | |
| 642 | |
| 643 | /** |
| 644 | * Context for applying and tracking operations related to |
| 645 | * {@link ProtectionEndpointIntent}. |
| 646 | */ |
| 647 | @Beta |
| 648 | private class ProtectionConfigOperationContext extends OperationContext { |
| 649 | |
| 650 | ProtectionConfigOperationContext(IntentInstallationContext context) { |
| 651 | super(context); |
| 652 | } |
| 653 | |
| 654 | /** |
| 655 | * Stage of installable Intents which can be processed in parallel. |
| 656 | */ |
| 657 | private final class Stage { |
| 658 | // should it have progress state, how far it went? |
| 659 | private final Collection<Pair<ProtectionEndpointIntent, Direction>> ops; |
| 660 | |
| 661 | Stage(Collection<Pair<ProtectionEndpointIntent, Direction>> ops) { |
| 662 | this.ops = checkNotNull(ops); |
| 663 | } |
| 664 | |
| 665 | CompletableFuture<Void> apply() { |
| 666 | return ops.stream() |
| 667 | .map(op -> applyOp(op.getRight(), op.getLeft())) |
| 668 | .reduce(CompletableFuture.completedFuture(null), |
| 669 | (l, r) -> { |
| 670 | l.join(); |
| 671 | return r; |
| 672 | }); |
| 673 | } |
| 674 | |
| 675 | private CompletableFuture<Void> applyOp(Direction dir, ProtectionEndpointIntent intent) { |
| 676 | log.trace("applying {}: {}", dir, intent); |
| 677 | if (dir == Direction.REMOVE) { |
| 678 | networkConfigService.removeConfig(intent.deviceId(), ProtectionConfig.class); |
| 679 | } else if (dir == Direction.ADD) { |
| 680 | ProtectedTransportEndpointDescription description = intent.description(); |
| 681 | |
| 682 | // Can't do following. Will trigger empty CONFIG_ADDED |
| 683 | //ProtectionConfig cfg = networkConfigService.addConfig(intent.deviceId(), |
| 684 | // ProtectionConfig.class); |
| 685 | ProtectionConfig cfg = new ProtectionConfig(intent.deviceId()); |
| 686 | cfg.fingerprint(description.fingerprint()); |
| 687 | cfg.peer(description.peer()); |
| 688 | cfg.paths(description.paths()); |
| 689 | //cfg.apply(); |
| 690 | |
| 691 | networkConfigService.applyConfig(intent.deviceId(), |
| 692 | ProtectionConfig.class, |
| 693 | cfg.node()); |
| 694 | } |
| 695 | // TODO Should monitor progress and complete only after it's |
| 696 | // actually done. |
| 697 | return CompletableFuture.completedFuture(null); |
| 698 | } |
| 699 | |
| 700 | @Override |
| 701 | public String toString() { |
| 702 | return ops.toString(); |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | /** |
| 707 | * List of Stages which must be executed in order. |
| 708 | */ |
| 709 | private final List<Stage> stages = new ArrayList<>(); |
| 710 | |
| 711 | private final List<Stage> failed = new CopyOnWriteArrayList<>(); |
| 712 | |
| 713 | @Override |
| 714 | synchronized void apply() { |
| 715 | for (Stage stage : stages) { |
| 716 | log.trace("applying Stage {}", stage); |
| 717 | CompletableFuture<Void> result = stage.apply(); |
| 718 | // wait for stage completion |
| 719 | result.join(); |
| 720 | if (result.isCompletedExceptionally()) { |
| 721 | log.error("Stage {} failed", stage); |
| 722 | failed.add(stage); |
| 723 | errorConsumer.accept(ProtectionConfigOperationContext.this); |
| 724 | return; |
| 725 | } |
| 726 | } |
| 727 | successConsumer.accept(ProtectionConfigOperationContext.this); |
| 728 | } |
| 729 | |
| 730 | @Override |
| 731 | Object error() { |
| 732 | // Something to represent error state |
| 733 | return failed; |
| 734 | } |
| 735 | |
| 736 | @Override |
| 737 | synchronized void prepareIntents(List<Intent> intentsToApply, |
| 738 | Direction direction) { |
| 739 | |
| 740 | stages.add(new Stage(intentsToApply.stream() |
| 741 | .filter(i -> i instanceof ProtectionEndpointIntent) |
| 742 | .map(i -> Pair.of((ProtectionEndpointIntent) i, direction)) |
| 743 | .collect(Collectors.toList()))); |
| 744 | } |
| 745 | |
Yuta HIGUCHI | 63bbedd | 2017-01-30 10:49:29 -0800 | [diff] [blame] | 746 | @Override |
| 747 | protected ToStringHelper toStringHelper() { |
| 748 | return super.toStringHelper() |
| 749 | .add("stages", stages) |
| 750 | .add("failed", failed); |
| 751 | } |
Andreas Papazois | 0554896 | 2016-11-23 11:36:55 +0200 | [diff] [blame] | 752 | } |
Thomas Vachuska | f6ec97b | 2016-02-22 10:59:23 -0800 | [diff] [blame] | 753 | } |