alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -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.driver.pipeline; |
| 17 | |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 18 | import com.google.common.cache.Cache; |
| 19 | import com.google.common.cache.CacheBuilder; |
| 20 | import com.google.common.cache.RemovalCause; |
| 21 | import com.google.common.cache.RemovalNotification; |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 22 | import com.google.common.collect.Lists; |
| 23 | import org.apache.commons.lang3.tuple.ImmutablePair; |
| 24 | import org.apache.commons.lang3.tuple.Pair; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 25 | import org.onlab.osgi.ServiceDirectory; |
Jonathan Hart | dfc3b86 | 2015-07-01 14:49:56 -0700 | [diff] [blame] | 26 | import org.onlab.packet.EthType; |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 27 | import org.onlab.packet.IPv4; |
| 28 | import org.onlab.packet.VlanId; |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 29 | import org.onlab.util.KryoNamespace; |
Jonathan Hart | dfc3b86 | 2015-07-01 14:49:56 -0700 | [diff] [blame] | 30 | import org.onosproject.core.ApplicationId; |
| 31 | import org.onosproject.core.CoreService; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 32 | import org.onosproject.net.DeviceId; |
| 33 | import org.onosproject.net.PortNumber; |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 34 | import org.onosproject.net.behaviour.NextGroup; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 35 | import org.onosproject.net.behaviour.Pipeliner; |
| 36 | import org.onosproject.net.behaviour.PipelinerContext; |
| 37 | import org.onosproject.net.driver.AbstractHandlerBehaviour; |
| 38 | import org.onosproject.net.flow.DefaultFlowRule; |
Jonathan Hart | dfc3b86 | 2015-07-01 14:49:56 -0700 | [diff] [blame] | 39 | import org.onosproject.net.flow.DefaultTrafficSelector; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 40 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
| 41 | import org.onosproject.net.flow.FlowRule; |
| 42 | import org.onosproject.net.flow.FlowRuleOperations; |
| 43 | import org.onosproject.net.flow.FlowRuleOperationsContext; |
| 44 | import org.onosproject.net.flow.FlowRuleService; |
| 45 | import org.onosproject.net.flow.TrafficSelector; |
| 46 | import org.onosproject.net.flow.TrafficTreatment; |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 47 | import org.onosproject.net.flow.criteria.Criteria; |
| 48 | import org.onosproject.net.flow.criteria.Criterion; |
| 49 | import org.onosproject.net.flow.criteria.EthTypeCriterion; |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 50 | import org.onosproject.net.flow.criteria.IPCriterion; |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 51 | import org.onosproject.net.flow.criteria.IPProtocolCriterion; |
| 52 | import org.onosproject.net.flow.criteria.PortCriterion; |
alshabib | 2f74f2c | 2016-01-14 13:29:35 -0800 | [diff] [blame] | 53 | import org.onosproject.net.flow.criteria.VlanIdCriterion; |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 54 | import org.onosproject.net.flow.instructions.Instruction; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 55 | import org.onosproject.net.flow.instructions.Instructions; |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 56 | import org.onosproject.net.flow.instructions.L2ModificationInstruction; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 57 | import org.onosproject.net.flowobjective.FilteringObjective; |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 58 | import org.onosproject.net.flowobjective.FlowObjectiveStore; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 59 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| 60 | import org.onosproject.net.flowobjective.NextObjective; |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 61 | import org.onosproject.net.flowobjective.Objective; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 62 | import org.onosproject.net.flowobjective.ObjectiveError; |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 63 | import org.onosproject.net.group.DefaultGroupBucket; |
| 64 | import org.onosproject.net.group.DefaultGroupDescription; |
| 65 | import org.onosproject.net.group.DefaultGroupKey; |
| 66 | import org.onosproject.net.group.Group; |
| 67 | import org.onosproject.net.group.GroupBucket; |
| 68 | import org.onosproject.net.group.GroupBuckets; |
| 69 | import org.onosproject.net.group.GroupDescription; |
| 70 | import org.onosproject.net.group.GroupEvent; |
| 71 | import org.onosproject.net.group.GroupKey; |
| 72 | import org.onosproject.net.group.GroupListener; |
| 73 | import org.onosproject.net.group.GroupService; |
| 74 | import org.onosproject.store.serializers.KryoNamespaces; |
alshabib | 5ccbe3f | 2016-03-02 22:36:02 -0800 | [diff] [blame] | 75 | import org.onosproject.store.service.StorageService; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 76 | import org.slf4j.Logger; |
| 77 | |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 78 | import java.util.Collection; |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 79 | import java.util.Collections; |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 80 | import java.util.List; |
| 81 | import java.util.Optional; |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 82 | import java.util.concurrent.TimeUnit; |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 83 | import java.util.stream.Collectors; |
| 84 | |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 85 | import static org.slf4j.LoggerFactory.getLogger; |
| 86 | |
| 87 | /** |
Jonathan Hart | 64da69d | 2015-07-15 15:10:28 -0700 | [diff] [blame] | 88 | * Pipeliner for OLT device. |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 89 | */ |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 90 | |
Jonathan Hart | b92cc51 | 2015-11-16 23:05:21 -0800 | [diff] [blame] | 91 | public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 92 | |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 93 | private static final Integer QQ_TABLE = 1; |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 94 | private static final short MCAST_VLAN = 4000; |
alshabib | 5ccbe3f | 2016-03-02 22:36:02 -0800 | [diff] [blame] | 95 | private static final String OLTCOOKIES = "olt-cookies-must-be-unique"; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 96 | private final Logger log = getLogger(getClass()); |
| 97 | |
| 98 | private ServiceDirectory serviceDirectory; |
| 99 | private FlowRuleService flowRuleService; |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 100 | private GroupService groupService; |
Jonathan Hart | dfc3b86 | 2015-07-01 14:49:56 -0700 | [diff] [blame] | 101 | private CoreService coreService; |
alshabib | 5ccbe3f | 2016-03-02 22:36:02 -0800 | [diff] [blame] | 102 | private StorageService storageService; |
Jonathan Hart | dfc3b86 | 2015-07-01 14:49:56 -0700 | [diff] [blame] | 103 | |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 104 | private DeviceId deviceId; |
Jonathan Hart | dfc3b86 | 2015-07-01 14:49:56 -0700 | [diff] [blame] | 105 | private ApplicationId appId; |
alshabib | 8336447 | 2016-03-25 09:59:55 -0700 | [diff] [blame] | 106 | |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 107 | |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 108 | protected FlowObjectiveStore flowObjectiveStore; |
| 109 | |
| 110 | private Cache<GroupKey, NextObjective> pendingGroups; |
| 111 | |
| 112 | protected static KryoNamespace appKryo = new KryoNamespace.Builder() |
| 113 | .register(KryoNamespaces.API) |
| 114 | .register(GroupKey.class) |
| 115 | .register(DefaultGroupKey.class) |
| 116 | .register(OLTPipelineGroup.class) |
Charles Chan | eefdedf | 2016-05-23 16:45:45 -0700 | [diff] [blame] | 117 | .build("OltPipeline"); |
alshabib | 2cc73cb | 2015-06-30 20:26:56 -0700 | [diff] [blame] | 118 | |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 119 | @Override |
| 120 | public void init(DeviceId deviceId, PipelinerContext context) { |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 121 | log.debug("Initiate OLT pipeline"); |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 122 | this.serviceDirectory = context.directory(); |
| 123 | this.deviceId = deviceId; |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 124 | |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 125 | flowRuleService = serviceDirectory.get(FlowRuleService.class); |
Jonathan Hart | dfc3b86 | 2015-07-01 14:49:56 -0700 | [diff] [blame] | 126 | coreService = serviceDirectory.get(CoreService.class); |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 127 | groupService = serviceDirectory.get(GroupService.class); |
| 128 | flowObjectiveStore = context.store(); |
alshabib | 5ccbe3f | 2016-03-02 22:36:02 -0800 | [diff] [blame] | 129 | storageService = serviceDirectory.get(StorageService.class); |
| 130 | |
Jonathan Hart | dfc3b86 | 2015-07-01 14:49:56 -0700 | [diff] [blame] | 131 | appId = coreService.registerApplication( |
| 132 | "org.onosproject.driver.OLTPipeline"); |
| 133 | |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 134 | |
| 135 | pendingGroups = CacheBuilder.newBuilder() |
| 136 | .expireAfterWrite(20, TimeUnit.SECONDS) |
| 137 | .removalListener((RemovalNotification<GroupKey, NextObjective> notification) -> { |
| 138 | if (notification.getCause() == RemovalCause.EXPIRED) { |
| 139 | fail(notification.getValue(), ObjectiveError.GROUPINSTALLATIONFAILED); |
| 140 | } |
| 141 | }).build(); |
| 142 | |
| 143 | groupService.addListener(new InnerGroupListener()); |
| 144 | |
alshabib | b32cefe | 2015-06-08 18:15:05 -0700 | [diff] [blame] | 145 | } |
| 146 | |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 147 | @Override |
| 148 | public void filter(FilteringObjective filter) { |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 149 | Instructions.OutputInstruction output; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 150 | |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 151 | if (filter.meta() != null && !filter.meta().immediate().isEmpty()) { |
| 152 | output = (Instructions.OutputInstruction) filter.meta().immediate().stream() |
| 153 | .filter(t -> t.type().equals(Instruction.Type.OUTPUT)) |
| 154 | .limit(1) |
| 155 | .findFirst().get(); |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 156 | |
alshabib | bb42423 | 2016-01-15 12:20:25 -0800 | [diff] [blame] | 157 | if (output == null || !output.port().equals(PortNumber.CONTROLLER)) { |
| 158 | log.error("OLT can only filter packet to controller"); |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 159 | fail(filter, ObjectiveError.UNSUPPORTED); |
| 160 | return; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 161 | } |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 162 | } else { |
| 163 | fail(filter, ObjectiveError.BADPARAMS); |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 164 | return; |
| 165 | } |
| 166 | |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 167 | if (filter.key().type() != Criterion.Type.IN_PORT) { |
| 168 | fail(filter, ObjectiveError.BADPARAMS); |
| 169 | return; |
| 170 | } |
| 171 | |
| 172 | EthTypeCriterion ethType = (EthTypeCriterion) |
| 173 | filterForCriterion(filter.conditions(), Criterion.Type.ETH_TYPE); |
| 174 | |
| 175 | if (ethType == null) { |
| 176 | fail(filter, ObjectiveError.BADPARAMS); |
| 177 | return; |
| 178 | } |
| 179 | |
alshabib | bb42423 | 2016-01-15 12:20:25 -0800 | [diff] [blame] | 180 | if (ethType.ethType().equals(EthType.EtherType.EAPOL.ethType())) { |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 181 | provisionEapol(filter, ethType, output); |
alshabib | bb42423 | 2016-01-15 12:20:25 -0800 | [diff] [blame] | 182 | } else if (ethType.ethType().equals(EthType.EtherType.IPV4.ethType())) { |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 183 | IPProtocolCriterion ipProto = (IPProtocolCriterion) |
| 184 | filterForCriterion(filter.conditions(), Criterion.Type.IP_PROTO); |
| 185 | if (ipProto.protocol() == IPv4.PROTOCOL_IGMP) { |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 186 | provisionIgmp(filter, ethType, ipProto, output); |
alshabib | bb42423 | 2016-01-15 12:20:25 -0800 | [diff] [blame] | 187 | } else { |
| 188 | log.error("OLT can only filter igmp"); |
| 189 | fail(filter, ObjectiveError.UNSUPPORTED); |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 190 | } |
| 191 | } else { |
alshabib | bb42423 | 2016-01-15 12:20:25 -0800 | [diff] [blame] | 192 | log.error("OLT can only filter eapol and igmp"); |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 193 | fail(filter, ObjectiveError.UNSUPPORTED); |
| 194 | } |
| 195 | |
| 196 | } |
| 197 | |
| 198 | |
| 199 | @Override |
| 200 | public void forward(ForwardingObjective fwd) { |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 201 | |
| 202 | if (checkForMulticast(fwd)) { |
| 203 | processMulticastRule(fwd); |
| 204 | return; |
| 205 | } |
| 206 | |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 207 | TrafficTreatment treatment = fwd.treatment(); |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 208 | |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 209 | List<Instruction> instructions = treatment.allInstructions(); |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 210 | |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 211 | Optional<Instruction> vlanIntruction = instructions.stream() |
| 212 | .filter(i -> i.type() == Instruction.Type.L2MODIFICATION) |
| 213 | .filter(i -> ((L2ModificationInstruction) i).subtype() == |
| 214 | L2ModificationInstruction.L2SubType.VLAN_PUSH || |
| 215 | ((L2ModificationInstruction) i).subtype() == |
| 216 | L2ModificationInstruction.L2SubType.VLAN_POP) |
| 217 | .findAny(); |
| 218 | |
| 219 | if (!vlanIntruction.isPresent()) { |
| 220 | fail(fwd, ObjectiveError.BADPARAMS); |
| 221 | return; |
| 222 | } |
| 223 | |
| 224 | L2ModificationInstruction vlanIns = |
| 225 | (L2ModificationInstruction) vlanIntruction.get(); |
| 226 | |
| 227 | if (vlanIns.subtype() == L2ModificationInstruction.L2SubType.VLAN_PUSH) { |
| 228 | installUpstreamRules(fwd); |
| 229 | } else if (vlanIns.subtype() == L2ModificationInstruction.L2SubType.VLAN_POP) { |
| 230 | installDownstreamRules(fwd); |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 231 | } else { |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 232 | log.error("Unknown OLT operation: {}", fwd); |
| 233 | fail(fwd, ObjectiveError.UNSUPPORTED); |
| 234 | return; |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 235 | } |
| 236 | |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 237 | pass(fwd); |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 238 | |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 239 | } |
| 240 | |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 241 | |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 242 | @Override |
| 243 | public void next(NextObjective nextObjective) { |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 244 | if (nextObjective.type() != NextObjective.Type.BROADCAST) { |
| 245 | log.error("OLT only supports broadcast groups."); |
| 246 | fail(nextObjective, ObjectiveError.BADPARAMS); |
| 247 | } |
| 248 | |
| 249 | if (nextObjective.next().size() != 1) { |
| 250 | log.error("OLT only supports singleton broadcast groups."); |
| 251 | fail(nextObjective, ObjectiveError.BADPARAMS); |
| 252 | } |
| 253 | |
| 254 | TrafficTreatment treatment = nextObjective.next().stream().findFirst().get(); |
| 255 | |
| 256 | |
| 257 | GroupBucket bucket = DefaultGroupBucket.createAllGroupBucket(treatment); |
| 258 | GroupKey key = new DefaultGroupKey(appKryo.serialize(nextObjective.id())); |
| 259 | |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 260 | |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 261 | pendingGroups.put(key, nextObjective); |
| 262 | |
| 263 | switch (nextObjective.op()) { |
| 264 | case ADD: |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 265 | GroupDescription groupDesc = |
| 266 | new DefaultGroupDescription(deviceId, |
| 267 | GroupDescription.Type.ALL, |
| 268 | new GroupBuckets(Collections.singletonList(bucket)), |
| 269 | key, |
| 270 | null, |
| 271 | nextObjective.appId()); |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 272 | groupService.addGroup(groupDesc); |
| 273 | break; |
| 274 | case REMOVE: |
| 275 | groupService.removeGroup(deviceId, key, nextObjective.appId()); |
| 276 | break; |
| 277 | case ADD_TO_EXISTING: |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 278 | groupService.addBucketsToGroup(deviceId, key, |
| 279 | new GroupBuckets(Collections.singletonList(bucket)), |
| 280 | key, nextObjective.appId()); |
| 281 | break; |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 282 | case REMOVE_FROM_EXISTING: |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 283 | groupService.removeBucketsFromGroup(deviceId, key, |
alshabib | 56efe43 | 2016-02-25 17:57:24 -0500 | [diff] [blame] | 284 | new GroupBuckets(Collections.singletonList(bucket)), |
| 285 | key, nextObjective.appId()); |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 286 | break; |
| 287 | default: |
| 288 | log.warn("Unknown next objective operation: {}", nextObjective.op()); |
| 289 | } |
| 290 | |
| 291 | |
| 292 | } |
| 293 | |
| 294 | private void processMulticastRule(ForwardingObjective fwd) { |
| 295 | if (fwd.nextId() == null) { |
| 296 | log.error("Multicast objective does not have a next id"); |
| 297 | fail(fwd, ObjectiveError.BADPARAMS); |
| 298 | } |
| 299 | |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 300 | GroupKey key = getGroupForNextObjective(fwd.nextId()); |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 301 | |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 302 | if (key == null) { |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 303 | log.error("Group for forwarding objective missing: {}", fwd); |
| 304 | fail(fwd, ObjectiveError.GROUPMISSING); |
| 305 | } |
| 306 | |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 307 | Group group = groupService.getGroup(deviceId, key); |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 308 | TrafficTreatment treatment = |
| 309 | buildTreatment(Instructions.createGroup(group.id())); |
| 310 | |
| 311 | FlowRule rule = DefaultFlowRule.builder() |
alshabib | 8336447 | 2016-03-25 09:59:55 -0700 | [diff] [blame] | 312 | .fromApp(fwd.appId()) |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 313 | .forDevice(deviceId) |
| 314 | .forTable(0) |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 315 | .makePermanent() |
| 316 | .withPriority(fwd.priority()) |
| 317 | .withSelector(fwd.selector()) |
| 318 | .withTreatment(treatment) |
| 319 | .build(); |
| 320 | |
| 321 | FlowRuleOperations.Builder builder = FlowRuleOperations.builder(); |
| 322 | switch (fwd.op()) { |
| 323 | |
| 324 | case ADD: |
| 325 | builder.add(rule); |
| 326 | break; |
| 327 | case REMOVE: |
| 328 | builder.remove(rule); |
| 329 | break; |
| 330 | case ADD_TO_EXISTING: |
| 331 | case REMOVE_FROM_EXISTING: |
| 332 | break; |
| 333 | default: |
| 334 | log.warn("Unknown forwarding operation: {}", fwd.op()); |
| 335 | } |
| 336 | |
| 337 | applyFlowRules(builder, fwd); |
| 338 | |
| 339 | } |
| 340 | |
| 341 | private boolean checkForMulticast(ForwardingObjective fwd) { |
| 342 | |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 343 | IPCriterion ip = (IPCriterion) filterForCriterion(fwd.selector().criteria(), |
alshabib | 56efe43 | 2016-02-25 17:57:24 -0500 | [diff] [blame] | 344 | Criterion.Type.IPV4_DST); |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 345 | |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 346 | if (ip == null) { |
| 347 | return false; |
| 348 | } |
| 349 | |
Charles Chan | aedabfd | 2016-02-26 09:31:48 -0800 | [diff] [blame] | 350 | return ip.ip().isMulticast(); |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 351 | |
| 352 | } |
| 353 | |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 354 | private GroupKey getGroupForNextObjective(Integer nextId) { |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 355 | NextGroup next = flowObjectiveStore.getNextGroup(nextId); |
alshabib | 1aa5814 | 2016-02-17 15:37:56 -0800 | [diff] [blame] | 356 | return appKryo.deserialize(next.data()); |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 357 | |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 358 | } |
| 359 | |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 360 | private void installDownstreamRules(ForwardingObjective fwd) { |
| 361 | List<Pair<Instruction, Instruction>> vlanOps = |
| 362 | vlanOps(fwd, |
| 363 | L2ModificationInstruction.L2SubType.VLAN_POP); |
| 364 | |
| 365 | if (vlanOps == null) { |
| 366 | return; |
| 367 | } |
| 368 | |
alshabib | b3c1434 | 2016-03-04 17:05:01 -0800 | [diff] [blame] | 369 | Instructions.OutputInstruction output = (Instructions.OutputInstruction) fetchOutput(fwd, "downstream"); |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 370 | |
| 371 | if (output == null) { |
| 372 | return; |
| 373 | } |
| 374 | |
| 375 | Pair<Instruction, Instruction> popAndRewrite = vlanOps.remove(0); |
| 376 | |
alshabib | fa0dc66 | 2016-01-13 11:23:53 -0800 | [diff] [blame] | 377 | TrafficSelector selector = fwd.selector(); |
| 378 | |
| 379 | Criterion outerVlan = selector.getCriterion(Criterion.Type.VLAN_VID); |
| 380 | Criterion innerVlan = selector.getCriterion(Criterion.Type.INNER_VLAN_VID); |
| 381 | Criterion inport = selector.getCriterion(Criterion.Type.IN_PORT); |
alshabib | b3c1434 | 2016-03-04 17:05:01 -0800 | [diff] [blame] | 382 | Criterion bullshit = Criteria.matchMetadata(output.port().toLong()); |
alshabib | fa0dc66 | 2016-01-13 11:23:53 -0800 | [diff] [blame] | 383 | |
| 384 | if (outerVlan == null || innerVlan == null || inport == null) { |
| 385 | log.error("Forwarding objective is underspecified: {}", fwd); |
| 386 | fail(fwd, ObjectiveError.BADPARAMS); |
| 387 | return; |
| 388 | } |
| 389 | |
alshabib | 2f74f2c | 2016-01-14 13:29:35 -0800 | [diff] [blame] | 390 | Criterion innerVid = Criteria.matchVlanId(((VlanIdCriterion) innerVlan).vlanId()); |
| 391 | |
alshabib | fa0dc66 | 2016-01-13 11:23:53 -0800 | [diff] [blame] | 392 | FlowRule.Builder outer = DefaultFlowRule.builder() |
alshabib | 8336447 | 2016-03-25 09:59:55 -0700 | [diff] [blame] | 393 | .fromApp(fwd.appId()) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 394 | .forDevice(deviceId) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 395 | .makePermanent() |
| 396 | .withPriority(fwd.priority()) |
alshabib | b3c1434 | 2016-03-04 17:05:01 -0800 | [diff] [blame] | 397 | .withSelector(buildSelector(inport, outerVlan, bullshit)) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 398 | .withTreatment(buildTreatment(popAndRewrite.getLeft(), |
| 399 | Instructions.transition(QQ_TABLE))); |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 400 | |
alshabib | fa0dc66 | 2016-01-13 11:23:53 -0800 | [diff] [blame] | 401 | FlowRule.Builder inner = DefaultFlowRule.builder() |
alshabib | 8336447 | 2016-03-25 09:59:55 -0700 | [diff] [blame] | 402 | .fromApp(fwd.appId()) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 403 | .forDevice(deviceId) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 404 | .forTable(QQ_TABLE) |
| 405 | .makePermanent() |
| 406 | .withPriority(fwd.priority()) |
alshabib | 2f74f2c | 2016-01-14 13:29:35 -0800 | [diff] [blame] | 407 | .withSelector(buildSelector(inport, innerVid)) |
alshabib | e507584 | 2016-02-04 13:28:33 -0800 | [diff] [blame] | 408 | .withTreatment(buildTreatment(popAndRewrite.getLeft(), |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 409 | output)); |
| 410 | |
| 411 | applyRules(fwd, inner, outer); |
| 412 | |
| 413 | } |
| 414 | |
| 415 | private void installUpstreamRules(ForwardingObjective fwd) { |
| 416 | List<Pair<Instruction, Instruction>> vlanOps = |
| 417 | vlanOps(fwd, |
| 418 | L2ModificationInstruction.L2SubType.VLAN_PUSH); |
| 419 | |
| 420 | if (vlanOps == null) { |
| 421 | return; |
| 422 | } |
| 423 | |
| 424 | Instruction output = fetchOutput(fwd, "upstream"); |
| 425 | |
| 426 | if (output == null) { |
| 427 | return; |
| 428 | } |
| 429 | |
| 430 | Pair<Instruction, Instruction> innerPair = vlanOps.remove(0); |
| 431 | |
| 432 | Pair<Instruction, Instruction> outerPair = vlanOps.remove(0); |
| 433 | |
| 434 | FlowRule.Builder inner = DefaultFlowRule.builder() |
alshabib | 8336447 | 2016-03-25 09:59:55 -0700 | [diff] [blame] | 435 | .fromApp(fwd.appId()) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 436 | .forDevice(deviceId) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 437 | .makePermanent() |
| 438 | .withPriority(fwd.priority()) |
| 439 | .withSelector(fwd.selector()) |
| 440 | .withTreatment(buildTreatment(innerPair.getRight(), |
| 441 | Instructions.transition(QQ_TABLE))); |
| 442 | |
| 443 | PortCriterion inPort = (PortCriterion) |
| 444 | fwd.selector().getCriterion(Criterion.Type.IN_PORT); |
| 445 | |
| 446 | VlanId cVlanId = ((L2ModificationInstruction.ModVlanIdInstruction) |
| 447 | innerPair.getRight()).vlanId(); |
| 448 | |
| 449 | FlowRule.Builder outer = DefaultFlowRule.builder() |
alshabib | 8336447 | 2016-03-25 09:59:55 -0700 | [diff] [blame] | 450 | .fromApp(fwd.appId()) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 451 | .forDevice(deviceId) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 452 | .forTable(QQ_TABLE) |
| 453 | .makePermanent() |
| 454 | .withPriority(fwd.priority()) |
| 455 | .withSelector(buildSelector(inPort, |
| 456 | Criteria.matchVlanId(cVlanId))) |
| 457 | .withTreatment(buildTreatment(outerPair.getLeft(), |
| 458 | outerPair.getRight(), |
| 459 | output)); |
| 460 | |
| 461 | applyRules(fwd, inner, outer); |
| 462 | |
| 463 | } |
| 464 | |
| 465 | private Instruction fetchOutput(ForwardingObjective fwd, String direction) { |
| 466 | Instruction output = fwd.treatment().allInstructions().stream() |
| 467 | .filter(i -> i.type() == Instruction.Type.OUTPUT) |
| 468 | .findFirst().orElse(null); |
| 469 | |
| 470 | if (output == null) { |
| 471 | log.error("OLT {} rule has no output", direction); |
| 472 | fail(fwd, ObjectiveError.BADPARAMS); |
| 473 | return null; |
| 474 | } |
| 475 | return output; |
| 476 | } |
| 477 | |
| 478 | private List<Pair<Instruction, Instruction>> vlanOps(ForwardingObjective fwd, |
| 479 | L2ModificationInstruction.L2SubType type) { |
| 480 | |
| 481 | List<Pair<Instruction, Instruction>> vlanOps = findVlanOps( |
| 482 | fwd.treatment().allInstructions(), type); |
| 483 | |
| 484 | if (vlanOps == null) { |
| 485 | String direction = type == L2ModificationInstruction.L2SubType.VLAN_POP |
| 486 | ? "downstream" : "upstream"; |
| 487 | log.error("Missing vlan operations in {} forwarding: {}", direction, fwd); |
| 488 | fail(fwd, ObjectiveError.BADPARAMS); |
| 489 | return null; |
| 490 | } |
| 491 | return vlanOps; |
| 492 | } |
| 493 | |
| 494 | |
| 495 | private List<Pair<Instruction, Instruction>> findVlanOps(List<Instruction> instructions, |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 496 | L2ModificationInstruction.L2SubType type) { |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 497 | |
| 498 | List<Instruction> vlanPushs = findL2Instructions( |
| 499 | type, |
| 500 | instructions); |
| 501 | List<Instruction> vlanSets = findL2Instructions( |
| 502 | L2ModificationInstruction.L2SubType.VLAN_ID, |
| 503 | instructions); |
| 504 | |
| 505 | if (vlanPushs.size() != vlanSets.size()) { |
| 506 | return null; |
| 507 | } |
| 508 | |
| 509 | List<Pair<Instruction, Instruction>> pairs = Lists.newArrayList(); |
| 510 | |
| 511 | for (int i = 0; i < vlanPushs.size(); i++) { |
| 512 | pairs.add(new ImmutablePair<>(vlanPushs.get(i), vlanSets.get(i))); |
| 513 | } |
| 514 | return pairs; |
| 515 | } |
| 516 | |
| 517 | private List<Instruction> findL2Instructions(L2ModificationInstruction.L2SubType subType, |
| 518 | List<Instruction> actions) { |
| 519 | return actions.stream() |
| 520 | .filter(i -> i.type() == Instruction.Type.L2MODIFICATION) |
| 521 | .filter(i -> ((L2ModificationInstruction) i).subtype() == subType) |
| 522 | .collect(Collectors.toList()); |
| 523 | } |
| 524 | |
| 525 | private void provisionEapol(FilteringObjective filter, |
| 526 | EthTypeCriterion ethType, |
| 527 | Instructions.OutputInstruction output) { |
| 528 | |
| 529 | TrafficSelector selector = buildSelector(filter.key(), ethType); |
| 530 | TrafficTreatment treatment = buildTreatment(output); |
| 531 | buildAndApplyRule(filter, selector, treatment); |
| 532 | |
| 533 | } |
| 534 | |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 535 | private void provisionIgmp(FilteringObjective filter, EthTypeCriterion ethType, |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 536 | IPProtocolCriterion ipProto, |
| 537 | Instructions.OutputInstruction output) { |
| 538 | TrafficSelector selector = buildSelector(filter.key(), ethType, ipProto); |
| 539 | TrafficTreatment treatment = buildTreatment(output); |
| 540 | buildAndApplyRule(filter, selector, treatment); |
| 541 | } |
| 542 | |
| 543 | private void buildAndApplyRule(FilteringObjective filter, TrafficSelector selector, |
| 544 | TrafficTreatment treatment) { |
| 545 | FlowRule rule = DefaultFlowRule.builder() |
alshabib | 8336447 | 2016-03-25 09:59:55 -0700 | [diff] [blame] | 546 | .fromApp(filter.appId()) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 547 | .forDevice(deviceId) |
| 548 | .forTable(0) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 549 | .makePermanent() |
| 550 | .withSelector(selector) |
| 551 | .withTreatment(treatment) |
alshabib | bb42423 | 2016-01-15 12:20:25 -0800 | [diff] [blame] | 552 | .withPriority(filter.priority()) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 553 | .build(); |
| 554 | |
| 555 | FlowRuleOperations.Builder opsBuilder = FlowRuleOperations.builder(); |
| 556 | |
| 557 | switch (filter.type()) { |
| 558 | case PERMIT: |
| 559 | opsBuilder.add(rule); |
| 560 | break; |
| 561 | case DENY: |
| 562 | opsBuilder.remove(rule); |
| 563 | break; |
| 564 | default: |
| 565 | log.warn("Unknown filter type : {}", filter.type()); |
| 566 | fail(filter, ObjectiveError.UNSUPPORTED); |
| 567 | } |
| 568 | |
| 569 | applyFlowRules(opsBuilder, filter); |
| 570 | } |
| 571 | |
| 572 | private void applyRules(ForwardingObjective fwd, |
| 573 | FlowRule.Builder inner, FlowRule.Builder outer) { |
| 574 | FlowRuleOperations.Builder builder = FlowRuleOperations.builder(); |
| 575 | switch (fwd.op()) { |
| 576 | case ADD: |
| 577 | builder.add(inner.build()).add(outer.build()); |
| 578 | break; |
| 579 | case REMOVE: |
alshabib | b05be2d | 2016-04-11 12:52:36 -0700 | [diff] [blame] | 580 | builder.remove(inner.build()).remove(outer.build()); |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 581 | break; |
| 582 | case ADD_TO_EXISTING: |
| 583 | break; |
| 584 | case REMOVE_FROM_EXISTING: |
| 585 | break; |
| 586 | default: |
| 587 | log.warn("Unknown forwarding operation: {}", fwd.op()); |
| 588 | } |
| 589 | |
| 590 | applyFlowRules(builder, fwd); |
| 591 | } |
| 592 | |
| 593 | private void applyFlowRules(FlowRuleOperations.Builder builder, |
| 594 | Objective objective) { |
| 595 | flowRuleService.apply(builder.build(new FlowRuleOperationsContext() { |
| 596 | @Override |
| 597 | public void onSuccess(FlowRuleOperations ops) { |
| 598 | pass(objective); |
| 599 | } |
| 600 | |
| 601 | @Override |
| 602 | public void onError(FlowRuleOperations ops) { |
| 603 | fail(objective, ObjectiveError.FLOWINSTALLATIONFAILED); |
| 604 | } |
| 605 | })); |
| 606 | } |
| 607 | |
| 608 | private Criterion filterForCriterion(Collection<Criterion> criteria, Criterion.Type type) { |
| 609 | return criteria.stream() |
alshabib | bb42423 | 2016-01-15 12:20:25 -0800 | [diff] [blame] | 610 | .filter(c -> c.type().equals(type)) |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 611 | .limit(1) |
| 612 | .findFirst().orElse(null); |
| 613 | } |
| 614 | |
| 615 | private TrafficSelector buildSelector(Criterion... criteria) { |
| 616 | |
| 617 | |
| 618 | TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); |
| 619 | |
| 620 | for (Criterion c : criteria) { |
| 621 | sBuilder.add(c); |
| 622 | } |
| 623 | |
| 624 | return sBuilder.build(); |
| 625 | } |
| 626 | |
| 627 | private TrafficTreatment buildTreatment(Instruction... instructions) { |
| 628 | |
| 629 | |
| 630 | TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); |
| 631 | |
| 632 | for (Instruction i : instructions) { |
| 633 | tBuilder.add(i); |
| 634 | } |
| 635 | |
| 636 | return tBuilder.build(); |
| 637 | } |
| 638 | |
| 639 | |
| 640 | private void fail(Objective obj, ObjectiveError error) { |
Sho SHIMIZU | ef7e290 | 2016-02-12 18:38:29 -0800 | [diff] [blame] | 641 | obj.context().ifPresent(context -> context.onError(obj, error)); |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 642 | } |
| 643 | |
| 644 | private void pass(Objective obj) { |
Sho SHIMIZU | ef7e290 | 2016-02-12 18:38:29 -0800 | [diff] [blame] | 645 | obj.context().ifPresent(context -> context.onSuccess(obj)); |
alshabib | fd430b6 | 2015-12-16 18:56:38 -0800 | [diff] [blame] | 646 | } |
| 647 | |
alshabib | 2cc73cb | 2015-06-30 20:26:56 -0700 | [diff] [blame] | 648 | |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 649 | private class InnerGroupListener implements GroupListener { |
alshabib | 2cc73cb | 2015-06-30 20:26:56 -0700 | [diff] [blame] | 650 | @Override |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 651 | public void event(GroupEvent event) { |
| 652 | if (event.type() == GroupEvent.Type.GROUP_ADDED) { |
| 653 | GroupKey key = event.subject().appCookie(); |
alshabib | 2cc73cb | 2015-06-30 20:26:56 -0700 | [diff] [blame] | 654 | |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 655 | NextObjective obj = pendingGroups.getIfPresent(key); |
| 656 | if (obj != null) { |
| 657 | flowObjectiveStore.putNextGroup(obj.id(), new OLTPipelineGroup(key)); |
| 658 | pass(obj); |
| 659 | pendingGroups.invalidate(key); |
| 660 | } |
| 661 | } |
alshabib | 2cc73cb | 2015-06-30 20:26:56 -0700 | [diff] [blame] | 662 | } |
| 663 | } |
| 664 | |
alshabib | d61b77b | 2016-02-01 23:30:53 -0800 | [diff] [blame] | 665 | private static class OLTPipelineGroup implements NextGroup { |
| 666 | |
| 667 | private final GroupKey key; |
| 668 | |
| 669 | public OLTPipelineGroup(GroupKey key) { |
| 670 | this.key = key; |
| 671 | } |
| 672 | |
| 673 | public GroupKey key() { |
| 674 | return key; |
| 675 | } |
| 676 | |
| 677 | @Override |
| 678 | public byte[] data() { |
| 679 | return appKryo.serialize(key); |
| 680 | } |
| 681 | |
| 682 | } |
Saurav Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 683 | |
| 684 | @Override |
| 685 | public List<String> getNextMappings(NextGroup nextGroup) { |
| 686 | // TODO Implementation deferred to vendor |
| 687 | return null; |
| 688 | } |
alshabib | 0ccde6d | 2015-05-30 18:22:36 -0700 | [diff] [blame] | 689 | } |