Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Foundation |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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. |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.provider.of.flow.impl; |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 17 | |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [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; |
Madan Jampani | 84382b9 | 2016-06-22 08:26:49 -0700 | [diff] [blame] | 22 | import com.google.common.collect.ImmutableSet; |
| 23 | import com.google.common.collect.Lists; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 24 | import com.google.common.collect.Maps; |
| 25 | import com.google.common.collect.Sets; |
Madan Jampani | 84382b9 | 2016-06-22 08:26:49 -0700 | [diff] [blame] | 26 | |
Yuta HIGUCHI | 6ee6b8c | 2017-05-09 14:44:30 -0700 | [diff] [blame] | 27 | import io.netty.buffer.ByteBuf; |
| 28 | import io.netty.buffer.Unpooled; |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 29 | import org.apache.felix.scr.annotations.Activate; |
| 30 | import org.apache.felix.scr.annotations.Component; |
| 31 | import org.apache.felix.scr.annotations.Deactivate; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 32 | import org.apache.felix.scr.annotations.Modified; |
| 33 | import org.apache.felix.scr.annotations.Property; |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 34 | import org.apache.felix.scr.annotations.Reference; |
| 35 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 36 | import org.onosproject.cfg.ComponentConfigService; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 37 | import org.onosproject.core.ApplicationId; |
| 38 | import org.onosproject.net.DeviceId; |
Rodrigo Duarte Sousa | e37d129 | 2017-08-29 17:01:24 -0300 | [diff] [blame] | 39 | import org.onosproject.net.driver.DefaultDriverData; |
| 40 | import org.onosproject.net.driver.DefaultDriverHandler; |
| 41 | import org.onosproject.net.driver.Driver; |
| 42 | import org.onosproject.net.driver.DriverHandler; |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 43 | import org.onosproject.net.driver.DriverService; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 44 | import org.onosproject.net.flow.CompletedBatchOperation; |
Srikanth Vavilapalli | 95810f5 | 2015-09-14 15:49:56 -0700 | [diff] [blame] | 45 | import org.onosproject.net.flow.DefaultTableStatisticsEntry; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 46 | import org.onosproject.net.flow.FlowEntry; |
| 47 | import org.onosproject.net.flow.FlowRule; |
Ray Milkey | 7bf273c | 2017-09-27 16:15:15 -0700 | [diff] [blame] | 48 | import org.onosproject.net.flow.oldbatch.FlowRuleBatchEntry; |
| 49 | import org.onosproject.net.flow.oldbatch.FlowRuleBatchOperation; |
Thomas Vachuska | a6c0d04 | 2015-04-23 10:17:37 -0700 | [diff] [blame] | 50 | import org.onosproject.net.flow.FlowRuleExtPayLoad; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 51 | import org.onosproject.net.flow.FlowRuleProvider; |
| 52 | import org.onosproject.net.flow.FlowRuleProviderRegistry; |
| 53 | import org.onosproject.net.flow.FlowRuleProviderService; |
Srikanth Vavilapalli | 95810f5 | 2015-09-14 15:49:56 -0700 | [diff] [blame] | 54 | import org.onosproject.net.flow.TableStatisticsEntry; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 55 | import org.onosproject.net.provider.AbstractProvider; |
| 56 | import org.onosproject.net.provider.ProviderId; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 57 | import org.onosproject.net.statistic.DefaultLoad; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 58 | import org.onosproject.openflow.controller.Dpid; |
| 59 | import org.onosproject.openflow.controller.OpenFlowController; |
| 60 | import org.onosproject.openflow.controller.OpenFlowEventListener; |
| 61 | import org.onosproject.openflow.controller.OpenFlowSwitch; |
| 62 | import org.onosproject.openflow.controller.OpenFlowSwitchListener; |
| 63 | import org.onosproject.openflow.controller.RoleState; |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 64 | import org.onosproject.openflow.controller.ThirdPartyMessage; |
Thomas Vachuska | 95caba3 | 2016-04-04 10:42:05 -0700 | [diff] [blame] | 65 | import org.onosproject.provider.of.flow.util.FlowEntryBuilder; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 66 | import org.osgi.service.component.ComponentContext; |
Thomas Vachuska | 3358af2 | 2015-05-19 18:40:34 -0700 | [diff] [blame] | 67 | import org.projectfloodlight.openflow.protocol.OFBadRequestCode; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 68 | import org.projectfloodlight.openflow.protocol.OFBarrierRequest; |
Laszlo Papp | edadbe2 | 2017-12-14 20:05:49 +0000 | [diff] [blame] | 69 | import org.projectfloodlight.openflow.protocol.OFCapabilities; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 70 | import org.projectfloodlight.openflow.protocol.OFErrorMsg; |
Cem Türker | 3baff67 | 2017-10-12 15:09:01 +0300 | [diff] [blame] | 71 | import org.projectfloodlight.openflow.protocol.OFFlowLightweightStatsReply; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 72 | import org.projectfloodlight.openflow.protocol.OFFlowMod; |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 73 | import org.projectfloodlight.openflow.protocol.OFFlowRemoved; |
alshabib | 5c370ff | 2014-09-18 10:12:14 -0700 | [diff] [blame] | 74 | import org.projectfloodlight.openflow.protocol.OFFlowStatsReply; |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 75 | import org.projectfloodlight.openflow.protocol.OFMessage; |
| 76 | import org.projectfloodlight.openflow.protocol.OFPortStatus; |
alshabib | 5c370ff | 2014-09-18 10:12:14 -0700 | [diff] [blame] | 77 | import org.projectfloodlight.openflow.protocol.OFStatsReply; |
sangho | 89bf6fb | 2015-02-09 09:33:13 -0800 | [diff] [blame] | 78 | import org.projectfloodlight.openflow.protocol.OFStatsType; |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 79 | import org.projectfloodlight.openflow.protocol.OFTableStatsEntry; |
| 80 | import org.projectfloodlight.openflow.protocol.OFTableStatsReply; |
Prince Pereira | 141ed81 | 2016-09-02 19:03:18 +0530 | [diff] [blame] | 81 | import org.projectfloodlight.openflow.protocol.OFType; |
| 82 | import org.projectfloodlight.openflow.protocol.OFVersion; |
Prince Pereira | 788797e | 2016-08-10 11:24:14 +0530 | [diff] [blame] | 83 | import org.projectfloodlight.openflow.protocol.errormsg.OFBadActionErrorMsg; |
| 84 | import org.projectfloodlight.openflow.protocol.errormsg.OFBadInstructionErrorMsg; |
| 85 | import org.projectfloodlight.openflow.protocol.errormsg.OFBadMatchErrorMsg; |
Thomas Vachuska | 3358af2 | 2015-05-19 18:40:34 -0700 | [diff] [blame] | 86 | import org.projectfloodlight.openflow.protocol.errormsg.OFBadRequestErrorMsg; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 87 | import org.projectfloodlight.openflow.protocol.errormsg.OFFlowModFailedErrorMsg; |
Prince Pereira | 141ed81 | 2016-09-02 19:03:18 +0530 | [diff] [blame] | 88 | import org.projectfloodlight.openflow.types.U16; |
| 89 | import org.projectfloodlight.openflow.types.U64; |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 90 | import org.slf4j.Logger; |
| 91 | |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 92 | import java.util.Collections; |
| 93 | import java.util.Dictionary; |
| 94 | import java.util.List; |
| 95 | import java.util.Map; |
Srikanth Vavilapalli | 95810f5 | 2015-09-14 15:49:56 -0700 | [diff] [blame] | 96 | import java.util.Objects; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 97 | import java.util.Optional; |
| 98 | import java.util.Set; |
pier | 809fd4d | 2020-01-09 13:10:04 +0100 | [diff] [blame^] | 99 | import java.util.concurrent.ScheduledExecutorService; |
| 100 | import java.util.concurrent.ScheduledThreadPoolExecutor; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 101 | import java.util.concurrent.TimeUnit; |
| 102 | import java.util.stream.Collectors; |
| 103 | |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 104 | import static com.google.common.base.Preconditions.checkNotNull; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 105 | import static com.google.common.base.Strings.isNullOrEmpty; |
pier | 809fd4d | 2020-01-09 13:10:04 +0100 | [diff] [blame^] | 106 | import static java.util.concurrent.Executors.newScheduledThreadPool; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 107 | import static org.onlab.util.Tools.get; |
pier | 809fd4d | 2020-01-09 13:10:04 +0100 | [diff] [blame^] | 108 | import static org.onlab.util.Tools.groupedThreads; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 109 | import static org.slf4j.LoggerFactory.getLogger; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 110 | |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 111 | /** |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 112 | * Provider which uses an OpenFlow controller to detect network end-station |
| 113 | * hosts. |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 114 | */ |
| 115 | @Component(immediate = true) |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 116 | public class OpenFlowRuleProvider extends AbstractProvider |
| 117 | implements FlowRuleProvider { |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 118 | |
| 119 | private final Logger log = getLogger(getClass()); |
| 120 | |
| 121 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 122 | protected FlowRuleProviderRegistry providerRegistry; |
| 123 | |
| 124 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 125 | protected OpenFlowController controller; |
| 126 | |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 127 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 128 | protected ComponentConfigService cfgService; |
| 129 | |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 130 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 131 | protected DriverService driverService; |
| 132 | |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 133 | private static final int DEFAULT_POLL_FREQUENCY = 5; |
Prince Pereira | 141ed81 | 2016-09-02 19:03:18 +0530 | [diff] [blame] | 134 | private static final int MIN_EXPECTED_BYTE_LEN = 56; |
| 135 | private static final int SKIP_BYTES = 4; |
| 136 | private static final boolean DEFAULT_ADAPTIVE_FLOW_SAMPLING = false; |
| 137 | |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 138 | @Property(name = "flowPollFrequency", intValue = DEFAULT_POLL_FREQUENCY, |
| 139 | label = "Frequency (in seconds) for polling flow statistics") |
| 140 | private int flowPollFrequency = DEFAULT_POLL_FREQUENCY; |
| 141 | |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 142 | @Property(name = "adaptiveFlowSampling", boolValue = DEFAULT_ADAPTIVE_FLOW_SAMPLING, |
| 143 | label = "Adaptive Flow Sampling is on or off") |
| 144 | private boolean adaptiveFlowSampling = DEFAULT_ADAPTIVE_FLOW_SAMPLING; |
| 145 | |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 146 | private FlowRuleProviderService providerService; |
| 147 | |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 148 | private final InternalFlowProvider listener = new InternalFlowProvider(); |
| 149 | |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 150 | private Cache<Long, InternalCacheEntry> pendingBatches; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 151 | |
pier | 809fd4d | 2020-01-09 13:10:04 +0100 | [diff] [blame^] | 152 | private ScheduledExecutorService executorService = newScheduledThreadPool(1, |
| 153 | groupedThreads("onos/of", "collector-%d", log)); |
Cem Türker | 3baff67 | 2017-10-12 15:09:01 +0300 | [diff] [blame] | 154 | |
Sangsik Yoon | b1b823f | 2016-05-16 18:55:39 +0900 | [diff] [blame] | 155 | // Old simple collector set |
Madan Jampani | 6b26610 | 2016-06-23 00:56:36 -0700 | [diff] [blame] | 156 | private final Map<Dpid, FlowStatsCollector> simpleCollectors = Maps.newConcurrentMap(); |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 157 | |
| 158 | // NewAdaptiveFlowStatsCollector Set |
Madan Jampani | 6b26610 | 2016-06-23 00:56:36 -0700 | [diff] [blame] | 159 | private final Map<Dpid, NewAdaptiveFlowStatsCollector> afsCollectors = Maps.newConcurrentMap(); |
| 160 | private final Map<Dpid, TableStatisticsCollector> tableStatsCollectors = Maps.newConcurrentMap(); |
alshabib | 3d643ec | 2014-10-22 18:33:00 -0700 | [diff] [blame] | 161 | |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 162 | /** |
| 163 | * Creates an OpenFlow host provider. |
| 164 | */ |
| 165 | public OpenFlowRuleProvider() { |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 166 | super(new ProviderId("of", "org.onosproject.provider.openflow")); |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | @Activate |
Thomas Vachuska | a394b95 | 2016-06-14 15:02:09 -0700 | [diff] [blame] | 170 | protected void activate(ComponentContext context) { |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 171 | cfgService.registerProperties(getClass()); |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 172 | providerService = providerRegistry.register(this); |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 173 | controller.addListener(listener); |
| 174 | controller.addEventListener(listener); |
pier | 809fd4d | 2020-01-09 13:10:04 +0100 | [diff] [blame^] | 175 | // Evicts the tasks if cancelled |
| 176 | ((ScheduledThreadPoolExecutor) executorService).setRemoveOnCancelPolicy(true); |
alshabib | 3d643ec | 2014-10-22 18:33:00 -0700 | [diff] [blame] | 177 | |
Antonio Marsico | 1c5ae1f | 2015-12-15 15:31:56 +0100 | [diff] [blame] | 178 | modified(context); |
| 179 | |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 180 | pendingBatches = createBatchCache(); |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 181 | |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 182 | createCollectors(); |
alshabib | 3d643ec | 2014-10-22 18:33:00 -0700 | [diff] [blame] | 183 | |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 184 | log.info("Started with flowPollFrequency = {}, adaptiveFlowSampling = {}", |
| 185 | flowPollFrequency, adaptiveFlowSampling); |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | @Deactivate |
Thomas Vachuska | a394b95 | 2016-06-14 15:02:09 -0700 | [diff] [blame] | 189 | protected void deactivate(ComponentContext context) { |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 190 | cfgService.unregisterProperties(getClass(), false); |
| 191 | stopCollectors(); |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 192 | providerRegistry.unregister(this); |
| 193 | providerService = null; |
pier | 809fd4d | 2020-01-09 13:10:04 +0100 | [diff] [blame^] | 194 | executorService.shutdown(); |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 195 | |
| 196 | log.info("Stopped"); |
| 197 | } |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 198 | |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 199 | @Modified |
Thomas Vachuska | a394b95 | 2016-06-14 15:02:09 -0700 | [diff] [blame] | 200 | protected void modified(ComponentContext context) { |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 201 | Dictionary<?, ?> properties = context.getProperties(); |
| 202 | int newFlowPollFrequency; |
| 203 | try { |
| 204 | String s = get(properties, "flowPollFrequency"); |
| 205 | newFlowPollFrequency = isNullOrEmpty(s) ? flowPollFrequency : Integer.parseInt(s.trim()); |
| 206 | |
| 207 | } catch (NumberFormatException | ClassCastException e) { |
| 208 | newFlowPollFrequency = flowPollFrequency; |
| 209 | } |
| 210 | |
| 211 | if (newFlowPollFrequency != flowPollFrequency) { |
| 212 | flowPollFrequency = newFlowPollFrequency; |
| 213 | adjustRate(); |
| 214 | } |
| 215 | |
| 216 | log.info("Settings: flowPollFrequency={}", flowPollFrequency); |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 217 | |
| 218 | boolean newAdaptiveFlowSampling; |
| 219 | String s = get(properties, "adaptiveFlowSampling"); |
| 220 | newAdaptiveFlowSampling = isNullOrEmpty(s) ? adaptiveFlowSampling : Boolean.parseBoolean(s.trim()); |
| 221 | |
| 222 | if (newAdaptiveFlowSampling != adaptiveFlowSampling) { |
| 223 | // stop previous collector |
| 224 | stopCollectors(); |
| 225 | adaptiveFlowSampling = newAdaptiveFlowSampling; |
| 226 | // create new collectors |
| 227 | createCollectors(); |
| 228 | } |
| 229 | |
| 230 | log.info("Settings: adaptiveFlowSampling={}", adaptiveFlowSampling); |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | private Cache<Long, InternalCacheEntry> createBatchCache() { |
| 234 | return CacheBuilder.newBuilder() |
| 235 | .expireAfterWrite(10, TimeUnit.SECONDS) |
| 236 | .removalListener((RemovalNotification<Long, InternalCacheEntry> notification) -> { |
| 237 | if (notification.getCause() == RemovalCause.EXPIRED) { |
| 238 | providerService.batchOperationCompleted(notification.getKey(), |
| 239 | notification.getValue().failedCompletion()); |
| 240 | } |
| 241 | }).build(); |
| 242 | } |
| 243 | |
| 244 | private void createCollectors() { |
| 245 | controller.getSwitches().forEach(this::createCollector); |
| 246 | } |
| 247 | |
| 248 | private void createCollector(OpenFlowSwitch sw) { |
Kavitha Alagesan | 6704df3 | 2016-08-18 15:15:31 +0530 | [diff] [blame] | 249 | if (sw == null) { |
| 250 | return; |
| 251 | } |
Laszlo Papp | 5817481 | 2018-01-16 13:29:47 +0000 | [diff] [blame] | 252 | if (sw.features().getCapabilities().contains(OFCapabilities.FLOW_STATS)) { |
| 253 | if (adaptiveFlowSampling) { |
| 254 | // NewAdaptiveFlowStatsCollector Constructor |
| 255 | NewAdaptiveFlowStatsCollector fsc = |
| 256 | new NewAdaptiveFlowStatsCollector(driverService, sw, flowPollFrequency); |
| 257 | stopCollectorIfNeeded(afsCollectors.put(new Dpid(sw.getId()), fsc)); |
| 258 | fsc.start(); |
| 259 | } else { |
pier | 809fd4d | 2020-01-09 13:10:04 +0100 | [diff] [blame^] | 260 | FlowStatsCollector fsc = new FlowStatsCollector(executorService, sw, flowPollFrequency); |
Laszlo Papp | 5817481 | 2018-01-16 13:29:47 +0000 | [diff] [blame] | 261 | stopCollectorIfNeeded(simpleCollectors.put(new Dpid(sw.getId()), fsc)); |
| 262 | fsc.start(); |
| 263 | } |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 264 | } |
Laszlo Papp | edadbe2 | 2017-12-14 20:05:49 +0000 | [diff] [blame] | 265 | if (sw.features().getCapabilities().contains(OFCapabilities.TABLE_STATS)) { |
pier | 809fd4d | 2020-01-09 13:10:04 +0100 | [diff] [blame^] | 266 | TableStatisticsCollector tsc = new TableStatisticsCollector(executorService, sw, flowPollFrequency); |
Laszlo Papp | edadbe2 | 2017-12-14 20:05:49 +0000 | [diff] [blame] | 267 | stopCollectorIfNeeded(tableStatsCollectors.put(new Dpid(sw.getId()), tsc)); |
| 268 | tsc.start(); |
| 269 | } |
Thomas Vachuska | a394b95 | 2016-06-14 15:02:09 -0700 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | private void stopCollectorIfNeeded(SwitchDataCollector collector) { |
| 273 | if (collector != null) { |
| 274 | collector.stop(); |
| 275 | } |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 276 | } |
| 277 | |
| 278 | private void stopCollectors() { |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 279 | if (adaptiveFlowSampling) { |
| 280 | // NewAdaptiveFlowStatsCollector Destructor |
| 281 | afsCollectors.values().forEach(NewAdaptiveFlowStatsCollector::stop); |
| 282 | afsCollectors.clear(); |
| 283 | } else { |
| 284 | simpleCollectors.values().forEach(FlowStatsCollector::stop); |
| 285 | simpleCollectors.clear(); |
| 286 | } |
Srikanth Vavilapalli | 95810f5 | 2015-09-14 15:49:56 -0700 | [diff] [blame] | 287 | tableStatsCollectors.values().forEach(TableStatisticsCollector::stop); |
| 288 | tableStatsCollectors.clear(); |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 289 | } |
| 290 | |
| 291 | private void adjustRate() { |
| 292 | DefaultLoad.setPollInterval(flowPollFrequency); |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 293 | if (adaptiveFlowSampling) { |
| 294 | // NewAdaptiveFlowStatsCollector calAndPollInterval |
| 295 | afsCollectors.values().forEach(fsc -> fsc.adjustCalAndPollInterval(flowPollFrequency)); |
| 296 | } else { |
| 297 | simpleCollectors.values().forEach(fsc -> fsc.adjustPollInterval(flowPollFrequency)); |
| 298 | } |
Srikanth Vavilapalli | 95810f5 | 2015-09-14 15:49:56 -0700 | [diff] [blame] | 299 | tableStatsCollectors.values().forEach(tsc -> tsc.adjustPollInterval(flowPollFrequency)); |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 300 | } |
| 301 | |
Jordan Halterman | 6de47ff | 2019-03-05 18:44:03 -0800 | [diff] [blame] | 302 | private void resetEvents(Dpid dpid) { |
| 303 | SwitchDataCollector collector; |
| 304 | if (adaptiveFlowSampling) { |
| 305 | collector = afsCollectors.get(dpid); |
| 306 | } else { |
| 307 | collector = simpleCollectors.get(dpid); |
| 308 | } |
| 309 | if (collector != null) { |
| 310 | collector.resetEvents(); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | private void recordEvent(Dpid dpid) { |
| 315 | recordEvents(dpid, 1); |
| 316 | } |
| 317 | |
| 318 | private void recordEvents(Dpid dpid, int events) { |
| 319 | SwitchDataCollector collector; |
| 320 | if (adaptiveFlowSampling) { |
| 321 | collector = afsCollectors.get(dpid); |
| 322 | } else { |
| 323 | collector = simpleCollectors.get(dpid); |
| 324 | } |
| 325 | if (collector != null) { |
| 326 | collector.recordEvents(events); |
| 327 | } |
| 328 | } |
| 329 | |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 330 | @Override |
| 331 | public void applyFlowRule(FlowRule... flowRules) { |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 332 | for (FlowRule flowRule : flowRules) { |
| 333 | applyRule(flowRule); |
alshabib | 35edb1a | 2014-09-16 17:44:44 -0700 | [diff] [blame] | 334 | } |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 335 | } |
| 336 | |
alshabib | 35edb1a | 2014-09-16 17:44:44 -0700 | [diff] [blame] | 337 | private void applyRule(FlowRule flowRule) { |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 338 | Dpid dpid = Dpid.dpid(flowRule.deviceId().uri()); |
| 339 | OpenFlowSwitch sw = controller.getSwitch(dpid); |
| 340 | |
Ray Milkey | 0ae473d | 2016-04-04 10:56:47 -0700 | [diff] [blame] | 341 | if (sw == null) { |
| 342 | return; |
| 343 | } |
| 344 | |
Thomas Vachuska | a6c0d04 | 2015-04-23 10:17:37 -0700 | [diff] [blame] | 345 | FlowRuleExtPayLoad flowRuleExtPayLoad = flowRule.payLoad(); |
| 346 | if (hasPayload(flowRuleExtPayLoad)) { |
| 347 | OFMessage msg = new ThirdPartyMessage(flowRuleExtPayLoad.payLoad()); |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 348 | sw.sendMsg(msg); |
| 349 | return; |
| 350 | } |
alshabib | bdcbb10 | 2015-04-22 14:16:38 -0700 | [diff] [blame] | 351 | sw.sendMsg(FlowModBuilder.builder(flowRule, sw.factory(), |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 352 | Optional.empty(), Optional.of(driverService)).buildFlowAdd()); |
Jordan Halterman | 6de47ff | 2019-03-05 18:44:03 -0800 | [diff] [blame] | 353 | |
| 354 | recordEvent(dpid); |
alshabib | 35edb1a | 2014-09-16 17:44:44 -0700 | [diff] [blame] | 355 | } |
| 356 | |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 357 | @Override |
| 358 | public void removeFlowRule(FlowRule... flowRules) { |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 359 | for (FlowRule flowRule : flowRules) { |
| 360 | removeRule(flowRule); |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 361 | } |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 362 | } |
| 363 | |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 364 | private void removeRule(FlowRule flowRule) { |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 365 | Dpid dpid = Dpid.dpid(flowRule.deviceId().uri()); |
| 366 | OpenFlowSwitch sw = controller.getSwitch(dpid); |
| 367 | |
Ray Milkey | 0ae473d | 2016-04-04 10:56:47 -0700 | [diff] [blame] | 368 | if (sw == null) { |
| 369 | return; |
| 370 | } |
| 371 | |
Thomas Vachuska | a6c0d04 | 2015-04-23 10:17:37 -0700 | [diff] [blame] | 372 | FlowRuleExtPayLoad flowRuleExtPayLoad = flowRule.payLoad(); |
| 373 | if (hasPayload(flowRuleExtPayLoad)) { |
| 374 | OFMessage msg = new ThirdPartyMessage(flowRuleExtPayLoad.payLoad()); |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 375 | sw.sendMsg(msg); |
| 376 | return; |
| 377 | } |
alshabib | bdcbb10 | 2015-04-22 14:16:38 -0700 | [diff] [blame] | 378 | sw.sendMsg(FlowModBuilder.builder(flowRule, sw.factory(), |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 379 | Optional.empty(), Optional.of(driverService)).buildFlowDel()); |
Jordan Halterman | 6de47ff | 2019-03-05 18:44:03 -0800 | [diff] [blame] | 380 | |
| 381 | recordEvent(dpid); |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 382 | } |
| 383 | |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 384 | @Override |
| 385 | public void removeRulesById(ApplicationId id, FlowRule... flowRules) { |
| 386 | // TODO: optimize using the ApplicationId |
| 387 | removeFlowRule(flowRules); |
| 388 | } |
| 389 | |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 390 | @Override |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 391 | public void executeBatch(FlowRuleBatchOperation batch) { |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 392 | checkNotNull(batch); |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 393 | |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 394 | Dpid dpid = Dpid.dpid(batch.deviceId().uri()); |
| 395 | OpenFlowSwitch sw = controller.getSwitch(dpid); |
Madan Jampani | 84382b9 | 2016-06-22 08:26:49 -0700 | [diff] [blame] | 396 | |
| 397 | // If switch no longer exists, simply return. |
| 398 | if (sw == null) { |
| 399 | Set<FlowRule> failures = ImmutableSet.copyOf(Lists.transform(batch.getOperations(), e -> e.target())); |
| 400 | providerService.batchOperationCompleted(batch.id(), |
| 401 | new CompletedBatchOperation(false, failures, batch.deviceId())); |
| 402 | return; |
| 403 | } |
| 404 | pendingBatches.put(batch.id(), new InternalCacheEntry(batch)); |
pier | b673adc | 2019-10-24 13:56:58 +0200 | [diff] [blame] | 405 | // Build a batch of flow mods - to reduce the number i/o asked to the SO |
| 406 | Set<OFFlowMod> mods = Sets.newHashSet(); |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 407 | OFFlowMod mod; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 408 | for (FlowRuleBatchEntry fbe : batch.getOperations()) { |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 409 | // flow is the third party privacy flow |
Thomas Vachuska | a6c0d04 | 2015-04-23 10:17:37 -0700 | [diff] [blame] | 410 | FlowRuleExtPayLoad flowRuleExtPayLoad = fbe.target().payLoad(); |
| 411 | if (hasPayload(flowRuleExtPayLoad)) { |
| 412 | OFMessage msg = new ThirdPartyMessage(flowRuleExtPayLoad.payLoad()); |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 413 | sw.sendMsg(msg); |
| 414 | continue; |
| 415 | } |
Thomas Vachuska | d07c092 | 2015-10-06 14:48:06 -0700 | [diff] [blame] | 416 | FlowModBuilder builder = |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 417 | FlowModBuilder.builder(fbe.target(), sw.factory(), |
| 418 | Optional.of(batch.id()), Optional.of(driverService)); |
Sho SHIMIZU | aba9d00 | 2015-01-29 14:51:04 -0800 | [diff] [blame] | 419 | switch (fbe.operator()) { |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 420 | case ADD: |
| 421 | mod = builder.buildFlowAdd(); |
| 422 | break; |
| 423 | case REMOVE: |
| 424 | mod = builder.buildFlowDel(); |
| 425 | break; |
| 426 | case MODIFY: |
| 427 | mod = builder.buildFlowMod(); |
| 428 | break; |
| 429 | default: |
| 430 | log.error("Unsupported batch operation {}; skipping flowmod {}", |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 431 | fbe.operator(), fbe); |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 432 | continue; |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 433 | } |
pier | b673adc | 2019-10-24 13:56:58 +0200 | [diff] [blame] | 434 | mods.add(mod); |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 435 | } |
pier | b673adc | 2019-10-24 13:56:58 +0200 | [diff] [blame] | 436 | // Build a list to mantain the order |
| 437 | List<OFMessage> modsTosend = Lists.newArrayList(mods); |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 438 | OFBarrierRequest.Builder builder = sw.factory().buildBarrierRequest() |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 439 | .setXid(batch.id()); |
pier | b673adc | 2019-10-24 13:56:58 +0200 | [diff] [blame] | 440 | // Adds finally the barrier request |
| 441 | modsTosend.add(builder.build()); |
| 442 | sw.sendMsg(modsTosend); |
| 443 | // Take into account also the barrier request |
| 444 | recordEvents(dpid, (batch.getOperations().size() + 1)); |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 445 | } |
| 446 | |
Thomas Vachuska | a6c0d04 | 2015-04-23 10:17:37 -0700 | [diff] [blame] | 447 | private boolean hasPayload(FlowRuleExtPayLoad flowRuleExtPayLoad) { |
| 448 | return flowRuleExtPayLoad != null && |
| 449 | flowRuleExtPayLoad.payLoad() != null && |
| 450 | flowRuleExtPayLoad.payLoad().length > 0; |
| 451 | } |
| 452 | |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 453 | private class InternalFlowProvider |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 454 | implements OpenFlowSwitchListener, OpenFlowEventListener { |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 455 | |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 456 | @Override |
| 457 | public void switchAdded(Dpid dpid) { |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 458 | createCollector(controller.getSwitch(dpid)); |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | @Override |
| 462 | public void switchRemoved(Dpid dpid) { |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 463 | if (adaptiveFlowSampling) { |
Thomas Vachuska | a394b95 | 2016-06-14 15:02:09 -0700 | [diff] [blame] | 464 | stopCollectorIfNeeded(afsCollectors.remove(dpid)); |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 465 | } else { |
Thomas Vachuska | a394b95 | 2016-06-14 15:02:09 -0700 | [diff] [blame] | 466 | stopCollectorIfNeeded(simpleCollectors.remove(dpid)); |
alshabib | dfc7afb | 2014-10-21 20:13:27 -0700 | [diff] [blame] | 467 | } |
Thomas Vachuska | a394b95 | 2016-06-14 15:02:09 -0700 | [diff] [blame] | 468 | stopCollectorIfNeeded(tableStatsCollectors.remove(dpid)); |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 469 | } |
| 470 | |
| 471 | @Override |
Ayaka Koshibe | 38594c2 | 2014-10-22 13:36:12 -0700 | [diff] [blame] | 472 | public void switchChanged(Dpid dpid) { |
| 473 | } |
| 474 | |
| 475 | @Override |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 476 | public void portChanged(Dpid dpid, OFPortStatus status) { |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 477 | // TODO: Decide whether to evict flows internal store. |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 478 | } |
| 479 | |
| 480 | @Override |
| 481 | public void handleMessage(Dpid dpid, OFMessage msg) { |
Ray Milkey | ada9e2d | 2016-04-05 16:42:35 -0700 | [diff] [blame] | 482 | if (providerService == null) { |
| 483 | // We are shutting down, nothing to be done |
| 484 | return; |
| 485 | } |
Jonathan Hart | e4e74f0 | 2016-03-03 12:57:40 -0800 | [diff] [blame] | 486 | DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid)); |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 487 | switch (msg.getType()) { |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 488 | case FLOW_REMOVED: |
| 489 | OFFlowRemoved removed = (OFFlowRemoved) msg; |
alshabib | 6b5cfec | 2014-09-18 17:42:18 -0700 | [diff] [blame] | 490 | |
Rodrigo Duarte Sousa | e37d129 | 2017-08-29 17:01:24 -0300 | [diff] [blame] | 491 | FlowEntry fr = new FlowEntryBuilder(deviceId, removed, getDriver(deviceId)).build(); |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 492 | providerService.flowRemoved(fr); |
| 493 | break; |
| 494 | case STATS_REPLY: |
| 495 | if (((OFStatsReply) msg).getStatsType() == OFStatsType.FLOW) { |
Jordan Halterman | 6de47ff | 2019-03-05 18:44:03 -0800 | [diff] [blame] | 496 | // Let's unblock first the collector |
| 497 | SwitchDataCollector collector; |
| 498 | if (adaptiveFlowSampling) { |
| 499 | collector = afsCollectors.get(dpid); |
| 500 | } else { |
| 501 | collector = simpleCollectors.get(dpid); |
| 502 | } |
| 503 | if (collector != null) { |
| 504 | collector.received(); |
| 505 | } |
Rodrigo Duarte Sousa | e37d129 | 2017-08-29 17:01:24 -0300 | [diff] [blame] | 506 | pushFlowMetrics(dpid, (OFFlowStatsReply) msg, getDriver(deviceId)); |
Srikanth Vavilapalli | 95810f5 | 2015-09-14 15:49:56 -0700 | [diff] [blame] | 507 | } else if (((OFStatsReply) msg).getStatsType() == OFStatsType.TABLE) { |
| 508 | pushTableStatistics(dpid, (OFTableStatsReply) msg); |
Cem Türker | 3baff67 | 2017-10-12 15:09:01 +0300 | [diff] [blame] | 509 | } else if (((OFStatsReply) msg).getStatsType() == OFStatsType.FLOW_LIGHTWEIGHT) { |
| 510 | pushFlowLightWeightMetrics(dpid, (OFFlowLightweightStatsReply) msg); |
sangho | 89bf6fb | 2015-02-09 09:33:13 -0800 | [diff] [blame] | 511 | } |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 512 | break; |
| 513 | case BARRIER_REPLY: |
| 514 | try { |
Thomas Vachuska | 3358af2 | 2015-05-19 18:40:34 -0700 | [diff] [blame] | 515 | InternalCacheEntry entry = pendingBatches.getIfPresent(msg.getXid()); |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 516 | if (entry != null) { |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 517 | providerService |
| 518 | .batchOperationCompleted(msg.getXid(), |
| 519 | entry.completed()); |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 520 | } else { |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 521 | log.warn("Received unknown Barrier Reply: {}", |
| 522 | msg.getXid()); |
| 523 | } |
| 524 | } finally { |
| 525 | pendingBatches.invalidate(msg.getXid()); |
| 526 | } |
| 527 | break; |
| 528 | case ERROR: |
Thomas Vachuska | 3358af2 | 2015-05-19 18:40:34 -0700 | [diff] [blame] | 529 | // TODO: This needs to get suppressed in a better way. |
| 530 | if (msg instanceof OFBadRequestErrorMsg && |
| 531 | ((OFBadRequestErrorMsg) msg).getCode() == OFBadRequestCode.BAD_TYPE) { |
| 532 | log.debug("Received error message {} from {}", msg, dpid); |
| 533 | } else { |
| 534 | log.warn("Received error message {} from {}", msg, dpid); |
| 535 | } |
Prince Pereira | 788797e | 2016-08-10 11:24:14 +0530 | [diff] [blame] | 536 | handleErrorMsg(deviceId, msg); |
Ray Milkey | 4fd3ceb | 2015-12-10 14:43:08 -0800 | [diff] [blame] | 537 | break; |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 538 | default: |
| 539 | log.debug("Unhandled message type: {}", msg.getType()); |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 540 | } |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 541 | } |
| 542 | |
Prince Pereira | 788797e | 2016-08-10 11:24:14 +0530 | [diff] [blame] | 543 | private void handleErrorMsg(DeviceId deviceId, OFMessage msg) { |
Prince Pereira | 141ed81 | 2016-09-02 19:03:18 +0530 | [diff] [blame] | 544 | InternalCacheEntry entry = pendingBatches.getIfPresent(msg.getXid()); |
Prince Pereira | 788797e | 2016-08-10 11:24:14 +0530 | [diff] [blame] | 545 | OFErrorMsg error = (OFErrorMsg) msg; |
| 546 | OFMessage ofMessage = null; |
| 547 | switch (error.getErrType()) { |
| 548 | case BAD_ACTION: |
| 549 | OFBadActionErrorMsg baErrorMsg = (OFBadActionErrorMsg) error; |
| 550 | if (baErrorMsg.getData().getParsedMessage().isPresent()) { |
| 551 | ofMessage = baErrorMsg.getData().getParsedMessage().get(); |
| 552 | } |
| 553 | break; |
| 554 | case BAD_INSTRUCTION: |
| 555 | OFBadInstructionErrorMsg biErrorMsg = (OFBadInstructionErrorMsg) error; |
| 556 | if (biErrorMsg.getData().getParsedMessage().isPresent()) { |
| 557 | ofMessage = biErrorMsg.getData().getParsedMessage().get(); |
| 558 | } |
| 559 | break; |
| 560 | case BAD_MATCH: |
| 561 | OFBadMatchErrorMsg bmErrorMsg = (OFBadMatchErrorMsg) error; |
| 562 | if (bmErrorMsg.getData().getParsedMessage().isPresent()) { |
| 563 | ofMessage = bmErrorMsg.getData().getParsedMessage().get(); |
| 564 | } |
| 565 | break; |
| 566 | case FLOW_MOD_FAILED: |
| 567 | OFFlowModFailedErrorMsg fmFailed = (OFFlowModFailedErrorMsg) error; |
| 568 | if (fmFailed.getData().getParsedMessage().isPresent()) { |
| 569 | ofMessage = fmFailed.getData().getParsedMessage().get(); |
| 570 | } |
| 571 | break; |
| 572 | default: |
| 573 | // Do nothing. |
| 574 | return; |
| 575 | } |
Prince Pereira | 141ed81 | 2016-09-02 19:03:18 +0530 | [diff] [blame] | 576 | |
Prince Pereira | 788797e | 2016-08-10 11:24:14 +0530 | [diff] [blame] | 577 | if (ofMessage != null) { |
Prince Pereira | 141ed81 | 2016-09-02 19:03:18 +0530 | [diff] [blame] | 578 | |
Prince Pereira | 788797e | 2016-08-10 11:24:14 +0530 | [diff] [blame] | 579 | if (entry != null) { |
| 580 | OFFlowMod ofFlowMod = (OFFlowMod) ofMessage; |
Rodrigo Duarte Sousa | e37d129 | 2017-08-29 17:01:24 -0300 | [diff] [blame] | 581 | entry.appendFailure(new FlowEntryBuilder(deviceId, ofFlowMod, getDriver(deviceId)).build()); |
Prince Pereira | 788797e | 2016-08-10 11:24:14 +0530 | [diff] [blame] | 582 | } else { |
| 583 | log.error("No matching batch for this error: {}", error); |
| 584 | } |
Prince Pereira | 141ed81 | 2016-09-02 19:03:18 +0530 | [diff] [blame] | 585 | |
Prince Pereira | 788797e | 2016-08-10 11:24:14 +0530 | [diff] [blame] | 586 | } else { |
Prince Pereira | 141ed81 | 2016-09-02 19:03:18 +0530 | [diff] [blame] | 587 | |
| 588 | U64 cookieId = readCookieIdFromOFErrorMsg(error, msg.getVersion()); |
| 589 | |
| 590 | if (cookieId != null) { |
| 591 | long flowId = cookieId.getValue(); |
| 592 | |
| 593 | if (entry != null) { |
| 594 | for (FlowRuleBatchEntry fbEntry : entry.operation.getOperations()) { |
| 595 | if (fbEntry.target().id().value() == flowId) { |
| 596 | entry.appendFailure(fbEntry.target()); |
| 597 | break; |
| 598 | } |
| 599 | } |
| 600 | } else { |
| 601 | log.error("No matching batch for this error: {}", error); |
| 602 | } |
| 603 | |
| 604 | } else { |
| 605 | log.error("Flow installation failed but switch " + |
| 606 | "didn't tell us which one."); |
| 607 | } |
Prince Pereira | 788797e | 2016-08-10 11:24:14 +0530 | [diff] [blame] | 608 | } |
| 609 | } |
| 610 | |
Prince Pereira | 141ed81 | 2016-09-02 19:03:18 +0530 | [diff] [blame] | 611 | /** |
| 612 | * Reading cookieId from OFErrorMsg. |
| 613 | * |
| 614 | * Loxigen OpenFlow API failed in parsing error messages because of |
| 615 | * 64 byte data truncation based on OpenFlow specs. The method written |
| 616 | * is a workaround to extract the cookieId from the packet till the |
| 617 | * issue is resolved in Loxigen OpenFlow code. |
| 618 | * Ref: https://groups.google.com/a/onosproject.org/forum/#!topic |
| 619 | * /onos-dev/_KwlHZDllLE |
| 620 | * |
| 621 | * @param msg OF error message |
| 622 | * @param ofVersion Openflow version |
| 623 | * @return cookieId |
| 624 | */ |
| 625 | private U64 readCookieIdFromOFErrorMsg(OFErrorMsg msg, |
| 626 | OFVersion ofVersion) { |
| 627 | |
| 628 | if (ofVersion.wireVersion < OFVersion.OF_13.wireVersion) { |
| 629 | log.debug("Unhandled error msg with OF version {} " + |
| 630 | "which is less than {}", |
| 631 | ofVersion, OFVersion.OF_13); |
| 632 | return null; |
| 633 | } |
| 634 | |
Yuta HIGUCHI | 6ee6b8c | 2017-05-09 14:44:30 -0700 | [diff] [blame] | 635 | ByteBuf bb = Unpooled.wrappedBuffer(msg.getData().getData()); |
Prince Pereira | 141ed81 | 2016-09-02 19:03:18 +0530 | [diff] [blame] | 636 | |
| 637 | if (bb.readableBytes() < MIN_EXPECTED_BYTE_LEN) { |
| 638 | log.debug("Wrong length: Expected to be >= {}, was: {}", |
| 639 | MIN_EXPECTED_BYTE_LEN, bb.readableBytes()); |
| 640 | return null; |
| 641 | } |
| 642 | |
| 643 | byte ofVer = bb.readByte(); |
| 644 | |
| 645 | if (ofVer != ofVersion.wireVersion) { |
| 646 | log.debug("Wrong version: Expected={}, got={}", |
| 647 | ofVersion.wireVersion, ofVer); |
| 648 | return null; |
| 649 | } |
| 650 | |
| 651 | byte type = bb.readByte(); |
| 652 | |
| 653 | if (type != OFType.FLOW_MOD.ordinal()) { |
| 654 | log.debug("Wrong type: Expected={}, got={}", |
| 655 | OFType.FLOW_MOD.ordinal(), type); |
| 656 | return null; |
| 657 | } |
| 658 | |
| 659 | int length = U16.f(bb.readShort()); |
| 660 | |
| 661 | if (length < MIN_EXPECTED_BYTE_LEN) { |
| 662 | log.debug("Wrong length: Expected to be >= {}, was: {}", |
| 663 | MIN_EXPECTED_BYTE_LEN, length); |
| 664 | return null; |
| 665 | } |
| 666 | |
| 667 | bb.skipBytes(SKIP_BYTES); |
| 668 | return U64.ofRaw(bb.readLong()); |
| 669 | } |
| 670 | |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 671 | @Override |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 672 | public void receivedRoleReply(Dpid dpid, RoleState requested, |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 673 | RoleState response) { |
Jordan Halterman | 6de47ff | 2019-03-05 18:44:03 -0800 | [diff] [blame] | 674 | if (response == RoleState.MASTER) { |
| 675 | resetEvents(dpid); |
| 676 | } |
Ayaka Koshibe | 3ef2b0d | 2014-10-31 13:58:27 -0700 | [diff] [blame] | 677 | } |
Ayaka Koshibe | ab91cc4 | 2014-09-25 10:20:52 -0700 | [diff] [blame] | 678 | |
Rodrigo Duarte Sousa | e37d129 | 2017-08-29 17:01:24 -0300 | [diff] [blame] | 679 | private DriverHandler getDriver(DeviceId devId) { |
| 680 | Driver driver = driverService.getDriver(devId); |
| 681 | DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, devId)); |
| 682 | return handler; |
| 683 | } |
| 684 | |
| 685 | private void pushFlowMetrics(Dpid dpid, OFFlowStatsReply replies, DriverHandler handler) { |
alshabib | 64def64 | 2014-12-02 23:27:37 -0800 | [diff] [blame] | 686 | |
alshabib | 54ce589 | 2014-09-23 17:50:51 -0700 | [diff] [blame] | 687 | DeviceId did = DeviceId.deviceId(Dpid.uri(dpid)); |
Sangsik Yoon | b1b823f | 2016-05-16 18:55:39 +0900 | [diff] [blame] | 688 | NewAdaptiveFlowStatsCollector afsc = afsCollectors.get(dpid); |
alshabib | 54ce589 | 2014-09-23 17:50:51 -0700 | [diff] [blame] | 689 | |
Sangsik Yoon | b1b823f | 2016-05-16 18:55:39 +0900 | [diff] [blame] | 690 | if (adaptiveFlowSampling && afsc != null) { |
pier | 7aceddf | 2019-12-19 16:04:23 +0100 | [diff] [blame] | 691 | Set<FlowEntry> flowEntries = replies.getEntries().stream() |
Rodrigo Duarte Sousa | e37d129 | 2017-08-29 17:01:24 -0300 | [diff] [blame] | 692 | .map(entry -> new FlowEntryBuilder(did, entry, handler).withSetAfsc(afsc).build()) |
pier | 7aceddf | 2019-12-19 16:04:23 +0100 | [diff] [blame] | 693 | .collect(Collectors.toSet()); |
alshabib | 54ce589 | 2014-09-23 17:50:51 -0700 | [diff] [blame] | 694 | |
Sangsik Yoon | b1b823f | 2016-05-16 18:55:39 +0900 | [diff] [blame] | 695 | // Check that OFFlowStatsReply Xid is same with the one of OFFlowStatsRequest? |
| 696 | if (afsc.getFlowMissingXid() != NewAdaptiveFlowStatsCollector.NO_FLOW_MISSING_XID) { |
| 697 | log.debug("OpenFlowRuleProvider:pushFlowMetrics, flowMissingXid={}, " |
| 698 | + "OFFlowStatsReply Xid={}, for {}", |
| 699 | afsc.getFlowMissingXid(), replies.getXid(), dpid); |
| 700 | if (afsc.getFlowMissingXid() == replies.getXid()) { |
| 701 | // call entire flow stats update with flowMissing synchronization. |
| 702 | // used existing pushFlowMetrics |
| 703 | providerService.pushFlowMetrics(did, flowEntries); |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 704 | } |
Sangsik Yoon | b1b823f | 2016-05-16 18:55:39 +0900 | [diff] [blame] | 705 | // reset flowMissingXid to NO_FLOW_MISSING_XID |
| 706 | afsc.setFlowMissingXid(NewAdaptiveFlowStatsCollector.NO_FLOW_MISSING_XID); |
| 707 | } else { |
| 708 | // call individual flow stats update |
| 709 | providerService.pushFlowMetricsWithoutFlowMissing(did, flowEntries); |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 710 | } |
| 711 | } else { |
pier | 7aceddf | 2019-12-19 16:04:23 +0100 | [diff] [blame] | 712 | Set<FlowEntry> flowEntries = replies.getEntries().stream() |
Rodrigo Duarte Sousa | e37d129 | 2017-08-29 17:01:24 -0300 | [diff] [blame] | 713 | .map(entry -> new FlowEntryBuilder(did, entry, handler).build()) |
pier | 7aceddf | 2019-12-19 16:04:23 +0100 | [diff] [blame] | 714 | .collect(Collectors.toSet()); |
Sangsik Yoon | b1b823f | 2016-05-16 18:55:39 +0900 | [diff] [blame] | 715 | |
ssyoon90 | 30fbcd9 | 2015-08-17 10:42:07 +0900 | [diff] [blame] | 716 | // call existing entire flow stats update with flowMissing synchronization |
| 717 | providerService.pushFlowMetrics(did, flowEntries); |
| 718 | } |
alshabib | 5c370ff | 2014-09-18 10:12:14 -0700 | [diff] [blame] | 719 | } |
Srikanth Vavilapalli | 95810f5 | 2015-09-14 15:49:56 -0700 | [diff] [blame] | 720 | |
| 721 | private void pushTableStatistics(Dpid dpid, OFTableStatsReply replies) { |
| 722 | |
| 723 | DeviceId did = DeviceId.deviceId(Dpid.uri(dpid)); |
| 724 | List<TableStatisticsEntry> tableStatsEntries = replies.getEntries().stream() |
| 725 | .map(entry -> buildTableStatistics(did, entry)) |
| 726 | .filter(Objects::nonNull) |
pier | 7aceddf | 2019-12-19 16:04:23 +0100 | [diff] [blame] | 727 | .distinct() |
Srikanth Vavilapalli | 95810f5 | 2015-09-14 15:49:56 -0700 | [diff] [blame] | 728 | .collect(Collectors.toList()); |
| 729 | providerService.pushTableStatistics(did, tableStatsEntries); |
| 730 | } |
| 731 | |
Cem Türker | 3baff67 | 2017-10-12 15:09:01 +0300 | [diff] [blame] | 732 | private void pushFlowLightWeightMetrics(Dpid dpid, OFFlowLightweightStatsReply replies) { |
| 733 | |
| 734 | DeviceId did = DeviceId.deviceId(Dpid.uri(dpid)); |
| 735 | NewAdaptiveFlowStatsCollector afsc = afsCollectors.get(dpid); |
| 736 | if (adaptiveFlowSampling && afsc != null) { |
pier | 7aceddf | 2019-12-19 16:04:23 +0100 | [diff] [blame] | 737 | Set<FlowEntry> flowEntries = replies.getEntries().stream() |
Cem Türker | 3baff67 | 2017-10-12 15:09:01 +0300 | [diff] [blame] | 738 | .map(entry -> new FlowEntryBuilder(did, entry, driverService).withSetAfsc(afsc).build()) |
pier | 7aceddf | 2019-12-19 16:04:23 +0100 | [diff] [blame] | 739 | .collect(Collectors.toSet()); |
Cem Türker | 3baff67 | 2017-10-12 15:09:01 +0300 | [diff] [blame] | 740 | |
| 741 | // Check that OFFlowStatsReply Xid is same with the one of OFFlowStatsRequest? |
| 742 | if (afsc.getFlowMissingXid() != NewAdaptiveFlowStatsCollector.NO_FLOW_MISSING_XID) { |
| 743 | log.debug("OpenFlowRuleProvider:pushFlowMetrics, flowMissingXid={}, " |
| 744 | + "OFFlowStatsReply Xid={}, for {}", |
| 745 | afsc.getFlowMissingXid(), replies.getXid(), dpid); |
| 746 | if (afsc.getFlowMissingXid() == replies.getXid()) { |
| 747 | // call entire flow stats update with flowMissing synchronization. |
| 748 | // used existing pushFlowMetrics |
| 749 | providerService.pushFlowMetrics(did, flowEntries); |
| 750 | } |
| 751 | // reset flowMissingXid to NO_FLOW_MISSING_XID |
| 752 | afsc.setFlowMissingXid(NewAdaptiveFlowStatsCollector.NO_FLOW_MISSING_XID); |
| 753 | } else { |
| 754 | // call individual flow stats update |
| 755 | providerService.pushFlowMetricsWithoutFlowMissing(did, flowEntries); |
| 756 | } |
| 757 | } else { |
pier | 7aceddf | 2019-12-19 16:04:23 +0100 | [diff] [blame] | 758 | Set<FlowEntry> flowEntries = replies.getEntries().stream() |
Cem Türker | 3baff67 | 2017-10-12 15:09:01 +0300 | [diff] [blame] | 759 | .map(entry -> new FlowEntryBuilder(did, entry, driverService).build()) |
pier | 7aceddf | 2019-12-19 16:04:23 +0100 | [diff] [blame] | 760 | .collect(Collectors.toSet()); |
Cem Türker | 3baff67 | 2017-10-12 15:09:01 +0300 | [diff] [blame] | 761 | // call existing entire flow stats update with flowMissing synchronization |
| 762 | providerService.pushFlowMetrics(did, flowEntries); |
| 763 | } |
| 764 | } |
| 765 | |
Srikanth Vavilapalli | 95810f5 | 2015-09-14 15:49:56 -0700 | [diff] [blame] | 766 | private TableStatisticsEntry buildTableStatistics(DeviceId deviceId, |
| 767 | OFTableStatsEntry ofEntry) { |
| 768 | TableStatisticsEntry entry = null; |
| 769 | if (ofEntry != null) { |
| 770 | entry = new DefaultTableStatisticsEntry(deviceId, |
| 771 | ofEntry.getTableId().getValue(), |
| 772 | ofEntry.getActiveCount(), |
| 773 | ofEntry.getLookupCount().getValue(), |
| 774 | ofEntry.getMatchedCount().getValue()); |
| 775 | } |
| 776 | |
| 777 | return entry; |
| 778 | |
| 779 | } |
alshabib | 8f1cf4a | 2014-09-17 14:44:48 -0700 | [diff] [blame] | 780 | } |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 781 | |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 782 | /** |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 783 | * The internal cache entry holding the original request as well as |
| 784 | * accumulating the any failures along the way. |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 785 | * <p/> |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 786 | * If this entry is evicted from the cache then the entire operation is |
| 787 | * considered failed. Otherwise, only the failures reported by the device |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 788 | * will be propagated up. |
| 789 | */ |
| 790 | private class InternalCacheEntry { |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 791 | |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 792 | private final FlowRuleBatchOperation operation; |
| 793 | private final Set<FlowRule> failures = Sets.newConcurrentHashSet(); |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 794 | |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 795 | public InternalCacheEntry(FlowRuleBatchOperation operation) { |
| 796 | this.operation = operation; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 797 | } |
| 798 | |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 799 | /** |
| 800 | * Appends a failed rule to the set of failed items. |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 801 | * |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 802 | * @param rule the failed rule |
| 803 | */ |
| 804 | public void appendFailure(FlowRule rule) { |
| 805 | failures.add(rule); |
Thomas Vachuska | 9b2da21 | 2014-11-10 19:30:25 -0800 | [diff] [blame] | 806 | } |
| 807 | |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 808 | /** |
| 809 | * Fails the entire batch and returns the failed operation. |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 810 | * |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 811 | * @return the failed operation |
| 812 | */ |
| 813 | public CompletedBatchOperation failedCompletion() { |
| 814 | Set<FlowRule> fails = operation.getOperations().stream() |
| 815 | .map(op -> op.target()).collect(Collectors.toSet()); |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 816 | return new CompletedBatchOperation(false, |
| 817 | Collections |
| 818 | .unmodifiableSet(fails), |
| 819 | operation.deviceId()); |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 820 | } |
| 821 | |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 822 | /** |
| 823 | * Returns the completed operation and whether the batch suceeded. |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 824 | * |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 825 | * @return the completed operation |
| 826 | */ |
| 827 | public CompletedBatchOperation completed() { |
jcc | 3d4e14a | 2015-04-21 11:32:05 +0800 | [diff] [blame] | 828 | return new CompletedBatchOperation( |
Thomas Vachuska | 75aaa67 | 2015-04-29 12:24:43 -0700 | [diff] [blame] | 829 | failures.isEmpty(), |
| 830 | Collections |
| 831 | .unmodifiableSet(failures), |
| 832 | operation.deviceId()); |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 833 | } |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 834 | } |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 835 | |
alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame] | 836 | } |