tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.flow.impl; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 2 | |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 3 | import static com.google.common.base.Preconditions.checkNotNull; |
| 4 | import static org.slf4j.LoggerFactory.getLogger; |
Yuta HIGUCHI | 9def047 | 2014-10-23 15:51:10 -0700 | [diff] [blame] | 5 | import static org.onlab.util.Tools.namedThreads; |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 6 | |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 7 | import java.util.List; |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 8 | import java.util.Map; |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 9 | import java.util.Set; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 10 | import java.util.concurrent.CancellationException; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 11 | import java.util.concurrent.ExecutionException; |
Yuta HIGUCHI | 9def047 | 2014-10-23 15:51:10 -0700 | [diff] [blame] | 12 | import java.util.concurrent.ExecutorService; |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 13 | import java.util.concurrent.Executors; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 14 | import java.util.concurrent.Future; |
| 15 | import java.util.concurrent.TimeUnit; |
| 16 | import java.util.concurrent.TimeoutException; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 17 | import java.util.concurrent.atomic.AtomicReference; |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 18 | |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 19 | import org.apache.felix.scr.annotations.Activate; |
| 20 | import org.apache.felix.scr.annotations.Component; |
| 21 | import org.apache.felix.scr.annotations.Deactivate; |
| 22 | import org.apache.felix.scr.annotations.Reference; |
| 23 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 24 | import org.apache.felix.scr.annotations.Service; |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 25 | import org.onlab.onos.ApplicationId; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 26 | import org.onlab.onos.event.AbstractListenerRegistry; |
| 27 | import org.onlab.onos.event.EventDeliveryService; |
| 28 | import org.onlab.onos.net.Device; |
| 29 | import org.onlab.onos.net.DeviceId; |
| 30 | import org.onlab.onos.net.device.DeviceService; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 31 | import org.onlab.onos.net.flow.CompletedBatchOperation; |
alshabib | cf36991 | 2014-10-13 14:16:42 -0700 | [diff] [blame] | 32 | import org.onlab.onos.net.flow.DefaultFlowEntry; |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 33 | import org.onlab.onos.net.flow.FlowEntry; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 34 | import org.onlab.onos.net.flow.FlowRule; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 35 | import org.onlab.onos.net.flow.FlowRuleBatchEntry; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 36 | import org.onlab.onos.net.flow.FlowRuleBatchEntry.FlowRuleOperation; |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 37 | import org.onlab.onos.net.flow.FlowRuleBatchEvent; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 38 | import org.onlab.onos.net.flow.FlowRuleBatchOperation; |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 39 | import org.onlab.onos.net.flow.FlowRuleBatchRequest; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 40 | import org.onlab.onos.net.flow.FlowRuleEvent; |
| 41 | import org.onlab.onos.net.flow.FlowRuleListener; |
| 42 | import org.onlab.onos.net.flow.FlowRuleProvider; |
| 43 | import org.onlab.onos.net.flow.FlowRuleProviderRegistry; |
| 44 | import org.onlab.onos.net.flow.FlowRuleProviderService; |
| 45 | import org.onlab.onos.net.flow.FlowRuleService; |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 46 | import org.onlab.onos.net.flow.FlowRuleStore; |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 47 | import org.onlab.onos.net.flow.FlowRuleStoreDelegate; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 48 | import org.onlab.onos.net.provider.AbstractProviderRegistry; |
| 49 | import org.onlab.onos.net.provider.AbstractProviderService; |
| 50 | import org.slf4j.Logger; |
| 51 | |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 52 | import com.google.common.collect.ArrayListMultimap; |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 53 | import com.google.common.collect.Lists; |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 54 | import com.google.common.collect.Maps; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 55 | import com.google.common.collect.Multimap; |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 56 | import com.google.common.collect.Sets; |
| 57 | import com.google.common.util.concurrent.Futures; |
| 58 | import com.google.common.util.concurrent.ListenableFuture; |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 59 | |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 60 | /** |
| 61 | * Provides implementation of the flow NB & SB APIs. |
| 62 | */ |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 63 | @Component(immediate = true) |
| 64 | @Service |
tom | 202175a | 2014-09-19 19:00:11 -0700 | [diff] [blame] | 65 | public class FlowRuleManager |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 66 | extends AbstractProviderRegistry<FlowRuleProvider, FlowRuleProviderService> |
| 67 | implements FlowRuleService, FlowRuleProviderRegistry { |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 68 | |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 69 | enum BatchState { STARTED, FINISHED, CANCELLED }; |
| 70 | |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 71 | public static final String FLOW_RULE_NULL = "FlowRule cannot be null"; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 72 | private final Logger log = getLogger(getClass()); |
| 73 | |
| 74 | private final AbstractListenerRegistry<FlowRuleEvent, FlowRuleListener> |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 75 | listenerRegistry = new AbstractListenerRegistry<>(); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 76 | |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 77 | private final FlowRuleStoreDelegate delegate = new InternalStoreDelegate(); |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 78 | |
Thomas Vachuska | 8ac922d | 2014-10-23 16:17:03 -0700 | [diff] [blame] | 79 | private final ExecutorService futureListeners = |
| 80 | Executors.newCachedThreadPool(namedThreads("provider-future-listeners")); |
Yuta HIGUCHI | 9def047 | 2014-10-23 15:51:10 -0700 | [diff] [blame] | 81 | |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 82 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 83 | protected FlowRuleStore store; |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 84 | |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 85 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Ayaka Koshibe | b55524f | 2014-09-18 09:59:24 -0700 | [diff] [blame] | 86 | protected EventDeliveryService eventDispatcher; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 87 | |
| 88 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Ayaka Koshibe | b55524f | 2014-09-18 09:59:24 -0700 | [diff] [blame] | 89 | protected DeviceService deviceService; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 90 | |
| 91 | @Activate |
| 92 | public void activate() { |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 93 | store.setDelegate(delegate); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 94 | eventDispatcher.addSink(FlowRuleEvent.class, listenerRegistry); |
| 95 | log.info("Started"); |
| 96 | } |
| 97 | |
| 98 | @Deactivate |
| 99 | public void deactivate() { |
Yuta HIGUCHI | 9def047 | 2014-10-23 15:51:10 -0700 | [diff] [blame] | 100 | futureListeners.shutdownNow(); |
| 101 | |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 102 | store.unsetDelegate(delegate); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 103 | eventDispatcher.removeSink(FlowRuleEvent.class); |
| 104 | log.info("Stopped"); |
| 105 | } |
| 106 | |
| 107 | @Override |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 108 | public int getFlowRuleCount() { |
| 109 | return store.getFlowRuleCount(); |
| 110 | } |
| 111 | |
| 112 | @Override |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 113 | public Iterable<FlowEntry> getFlowEntries(DeviceId deviceId) { |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 114 | return store.getFlowEntries(deviceId); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | @Override |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 118 | public void applyFlowRules(FlowRule... flowRules) { |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 119 | for (int i = 0; i < flowRules.length; i++) { |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 120 | FlowRule f = flowRules[i]; |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 121 | store.storeFlowRule(f); |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 122 | } |
| 123 | } |
| 124 | |
| 125 | private void applyFlowRulesToProviders(FlowRule... flowRules) { |
| 126 | DeviceId did = null; |
| 127 | FlowRuleProvider frp = null; |
| 128 | for (FlowRule f : flowRules) { |
| 129 | if (!f.deviceId().equals(did)) { |
| 130 | did = f.deviceId(); |
| 131 | final Device device = deviceService.getDevice(did); |
| 132 | frp = getProvider(device.providerId()); |
| 133 | } |
| 134 | if (frp != null) { |
| 135 | frp.applyFlowRule(f); |
| 136 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 137 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | @Override |
| 141 | public void removeFlowRules(FlowRule... flowRules) { |
alshabib | bb8b128 | 2014-09-22 17:00:18 -0700 | [diff] [blame] | 142 | FlowRule f; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 143 | for (int i = 0; i < flowRules.length; i++) { |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 144 | f = flowRules[i]; |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 145 | store.deleteFlowRule(f); |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 146 | } |
| 147 | } |
| 148 | |
| 149 | private void removeFlowRulesFromProviders(FlowRule... flowRules) { |
| 150 | DeviceId did = null; |
| 151 | FlowRuleProvider frp = null; |
| 152 | for (FlowRule f : flowRules) { |
| 153 | if (!f.deviceId().equals(did)) { |
| 154 | did = f.deviceId(); |
| 155 | final Device device = deviceService.getDevice(did); |
tom | 7951b23 | 2014-10-06 13:35:30 -0700 | [diff] [blame] | 156 | frp = getProvider(device.providerId()); |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 157 | } |
| 158 | if (frp != null) { |
tom | 7951b23 | 2014-10-06 13:35:30 -0700 | [diff] [blame] | 159 | frp.removeFlowRule(f); |
| 160 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 161 | } |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 162 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 163 | |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 164 | @Override |
| 165 | public void removeFlowRulesById(ApplicationId id) { |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 166 | Iterable<FlowRule> rules = getFlowRulesById(id); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 167 | FlowRuleProvider frp; |
| 168 | Device device; |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 169 | |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 170 | for (FlowRule f : rules) { |
| 171 | store.deleteFlowRule(f); |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 172 | // FIXME: only accept request and push to provider on internal event |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 173 | device = deviceService.getDevice(f.deviceId()); |
| 174 | frp = getProvider(device.providerId()); |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 175 | // FIXME: flows removed from store and flows removed from might diverge |
| 176 | // get rid of #removeRulesById? |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 177 | frp.removeRulesById(id, f); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | @Override |
| 182 | public Iterable<FlowRule> getFlowRulesById(ApplicationId id) { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 183 | return store.getFlowRulesByAppId(id); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | @Override |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 187 | public Future<CompletedBatchOperation> applyBatch( |
| 188 | FlowRuleBatchOperation batch) { |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 189 | Multimap<DeviceId, FlowRuleBatchEntry> perDeviceBatches = |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 190 | ArrayListMultimap.create(); |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 191 | List<Future<CompletedBatchOperation>> futures = Lists.newArrayList(); |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 192 | for (FlowRuleBatchEntry fbe : batch.getOperations()) { |
| 193 | final FlowRule f = fbe.getTarget(); |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 194 | perDeviceBatches.put(f.deviceId(), fbe); |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 195 | } |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 196 | |
| 197 | for (DeviceId deviceId : perDeviceBatches.keySet()) { |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 198 | FlowRuleBatchOperation b = |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 199 | new FlowRuleBatchOperation(perDeviceBatches.get(deviceId)); |
| 200 | Future<CompletedBatchOperation> future = store.storeBatch(b); |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 201 | futures.add(future); |
| 202 | } |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 203 | return new FlowRuleBatchFuture(futures, perDeviceBatches); |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | @Override |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 207 | public void addListener(FlowRuleListener listener) { |
| 208 | listenerRegistry.addListener(listener); |
| 209 | } |
| 210 | |
| 211 | @Override |
| 212 | public void removeListener(FlowRuleListener listener) { |
| 213 | listenerRegistry.removeListener(listener); |
| 214 | } |
| 215 | |
| 216 | @Override |
| 217 | protected FlowRuleProviderService createProviderService( |
| 218 | FlowRuleProvider provider) { |
| 219 | return new InternalFlowRuleProviderService(provider); |
| 220 | } |
| 221 | |
| 222 | private class InternalFlowRuleProviderService |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 223 | extends AbstractProviderService<FlowRuleProvider> |
| 224 | implements FlowRuleProviderService { |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 225 | |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 226 | final Map<FlowEntry, Long> lastSeen = Maps.newConcurrentMap(); |
| 227 | |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 228 | protected InternalFlowRuleProviderService(FlowRuleProvider provider) { |
| 229 | super(provider); |
| 230 | } |
| 231 | |
| 232 | @Override |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 233 | public void flowRemoved(FlowEntry flowEntry) { |
| 234 | checkNotNull(flowEntry, FLOW_RULE_NULL); |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 235 | checkValidity(); |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 236 | lastSeen.remove(flowEntry); |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 237 | FlowEntry stored = store.getFlowEntry(flowEntry); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 238 | if (stored == null) { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 239 | log.info("Rule already evicted from store: {}", flowEntry); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 240 | return; |
| 241 | } |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 242 | Device device = deviceService.getDevice(flowEntry.deviceId()); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 243 | FlowRuleProvider frp = getProvider(device.providerId()); |
| 244 | FlowRuleEvent event = null; |
| 245 | switch (stored.state()) { |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 246 | case ADDED: |
| 247 | case PENDING_ADD: |
alshabib | 6eb438a | 2014-10-01 16:39:37 -0700 | [diff] [blame] | 248 | frp.applyFlowRule(stored); |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 249 | break; |
| 250 | case PENDING_REMOVE: |
| 251 | case REMOVED: |
| 252 | event = store.removeFlowRule(stored); |
| 253 | break; |
| 254 | default: |
| 255 | break; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 256 | |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 257 | } |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 258 | if (event != null) { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 259 | log.debug("Flow {} removed", flowEntry); |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 260 | post(event); |
| 261 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 262 | } |
| 263 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 264 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 265 | private void flowMissing(FlowEntry flowRule) { |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 266 | checkNotNull(flowRule, FLOW_RULE_NULL); |
| 267 | checkValidity(); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 268 | Device device = deviceService.getDevice(flowRule.deviceId()); |
| 269 | FlowRuleProvider frp = getProvider(device.providerId()); |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 270 | FlowRuleEvent event = null; |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 271 | switch (flowRule.state()) { |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 272 | case PENDING_REMOVE: |
| 273 | case REMOVED: |
| 274 | event = store.removeFlowRule(flowRule); |
| 275 | frp.removeFlowRule(flowRule); |
| 276 | break; |
| 277 | case ADDED: |
| 278 | case PENDING_ADD: |
| 279 | frp.applyFlowRule(flowRule); |
| 280 | break; |
| 281 | default: |
| 282 | log.debug("Flow {} has not been installed.", flowRule); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 283 | } |
| 284 | |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 285 | if (event != null) { |
| 286 | log.debug("Flow {} removed", flowRule); |
| 287 | post(event); |
| 288 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 289 | |
| 290 | } |
| 291 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 292 | |
| 293 | private void extraneousFlow(FlowRule flowRule) { |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 294 | checkNotNull(flowRule, FLOW_RULE_NULL); |
| 295 | checkValidity(); |
alshabib | 2374fc9 | 2014-10-22 11:03:23 -0700 | [diff] [blame] | 296 | FlowRuleProvider frp = getProvider(flowRule.deviceId()); |
| 297 | frp.removeFlowRule(flowRule); |
alshabib | 54ce589 | 2014-09-23 17:50:51 -0700 | [diff] [blame] | 298 | log.debug("Flow {} is on switch but not in store.", flowRule); |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 299 | } |
| 300 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 301 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 302 | private void flowAdded(FlowEntry flowEntry) { |
| 303 | checkNotNull(flowEntry, FLOW_RULE_NULL); |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 304 | checkValidity(); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 305 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 306 | if (checkRuleLiveness(flowEntry, store.getFlowEntry(flowEntry))) { |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 307 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 308 | FlowRuleEvent event = store.addOrUpdateFlowRule(flowEntry); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 309 | if (event == null) { |
| 310 | log.debug("No flow store event generated."); |
| 311 | } else { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 312 | log.debug("Flow {} {}", flowEntry, event.type()); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 313 | post(event); |
| 314 | } |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 315 | } else { |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 316 | log.info("Removing flow rules...."); |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 317 | removeFlowRules(flowEntry); |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 318 | } |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 319 | |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 320 | } |
| 321 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 322 | private boolean checkRuleLiveness(FlowEntry swRule, FlowEntry storedRule) { |
| 323 | if (storedRule == null) { |
| 324 | return false; |
| 325 | } |
Jonathan Hart | bc4a793 | 2014-10-21 11:46:00 -0700 | [diff] [blame] | 326 | if (storedRule.isPermanent()) { |
| 327 | return true; |
| 328 | } |
| 329 | |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 330 | final long timeout = storedRule.timeout() * 1000; |
| 331 | final long currentTime = System.currentTimeMillis(); |
alshabib | 85c4197 | 2014-10-03 13:48:39 -0700 | [diff] [blame] | 332 | if (storedRule.packets() != swRule.packets()) { |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 333 | lastSeen.put(storedRule, currentTime); |
alshabib | 85c4197 | 2014-10-03 13:48:39 -0700 | [diff] [blame] | 334 | return true; |
| 335 | } |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 336 | if (!lastSeen.containsKey(storedRule)) { |
| 337 | // checking for the first time |
| 338 | lastSeen.put(storedRule, storedRule.lastSeen()); |
| 339 | // Use following if lastSeen attr. was removed. |
| 340 | //lastSeen.put(storedRule, currentTime); |
| 341 | } |
| 342 | Long last = lastSeen.get(storedRule); |
| 343 | if (last == null) { |
| 344 | // concurrently removed? let the liveness check fail |
| 345 | return false; |
| 346 | } |
alshabib | 85c4197 | 2014-10-03 13:48:39 -0700 | [diff] [blame] | 347 | |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 348 | if ((currentTime - last) <= timeout) { |
alshabib | c274c90 | 2014-10-03 14:58:27 -0700 | [diff] [blame] | 349 | return true; |
| 350 | } |
| 351 | return false; |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 352 | } |
| 353 | |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 354 | // Posts the specified event to the local event dispatcher. |
| 355 | private void post(FlowRuleEvent event) { |
| 356 | if (event != null) { |
| 357 | eventDispatcher.post(event); |
| 358 | } |
| 359 | } |
alshabib | 5c370ff | 2014-09-18 10:12:14 -0700 | [diff] [blame] | 360 | |
| 361 | @Override |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 362 | public void pushFlowMetrics(DeviceId deviceId, Iterable<FlowEntry> flowEntries) { |
| 363 | List<FlowEntry> storedRules = Lists.newLinkedList(store.getFlowEntries(deviceId)); |
alshabib | bb8b128 | 2014-09-22 17:00:18 -0700 | [diff] [blame] | 364 | |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 365 | for (FlowEntry rule : flowEntries) { |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 366 | if (storedRules.remove(rule)) { |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 367 | // we both have the rule, let's update some info then. |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 368 | flowAdded(rule); |
| 369 | } else { |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 370 | // the device has a rule the store does not have |
| 371 | extraneousFlow(rule); |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 372 | } |
| 373 | } |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 374 | for (FlowEntry rule : storedRules) { |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 375 | // there are rules in the store that aren't on the switch |
| 376 | flowMissing(rule); |
alshabib | 54ce589 | 2014-09-23 17:50:51 -0700 | [diff] [blame] | 377 | |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 378 | } |
alshabib | 5c370ff | 2014-09-18 10:12:14 -0700 | [diff] [blame] | 379 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 380 | } |
| 381 | |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 382 | // Store delegate to re-post events emitted from the store. |
| 383 | private class InternalStoreDelegate implements FlowRuleStoreDelegate { |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 384 | // TODO: Right now we only dispatch events at individual flowEntry level. |
| 385 | // It may be more efficient for also dispatch events as a batch. |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 386 | @Override |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 387 | public void notify(FlowRuleBatchEvent event) { |
| 388 | final FlowRuleBatchRequest request = event.subject(); |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 389 | switch (event.type()) { |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 390 | case BATCH_OPERATION_REQUESTED: |
Madan Jampani | 31961c1 | 2014-10-23 12:06:58 -0700 | [diff] [blame] | 391 | for (FlowEntry entry : request.toAdd()) { |
| 392 | eventDispatcher.post(new FlowRuleEvent(FlowRuleEvent.Type.RULE_ADD_REQUESTED, entry)); |
| 393 | } |
| 394 | for (FlowEntry entry : request.toRemove()) { |
| 395 | eventDispatcher.post(new FlowRuleEvent(FlowRuleEvent.Type.RULE_REMOVE_REQUESTED, entry)); |
| 396 | } |
| 397 | // FIXME: what about op.equals(FlowRuleOperation.MODIFY) ? |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 398 | |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 399 | FlowRuleBatchOperation batchOperation = request.asBatchOperation(); |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 400 | |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 401 | FlowRuleProvider flowRuleProvider = |
| 402 | getProvider(batchOperation.getOperations().get(0).getTarget().deviceId()); |
| 403 | final ListenableFuture<CompletedBatchOperation> result = |
| 404 | flowRuleProvider.executeBatch(batchOperation); |
| 405 | result.addListener(new Runnable() { |
| 406 | @Override |
| 407 | public void run() { |
Thomas Vachuska | 8ac922d | 2014-10-23 16:17:03 -0700 | [diff] [blame] | 408 | store.batchOperationComplete(FlowRuleBatchEvent.completed(request, |
| 409 | Futures.getUnchecked(result))); |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 410 | } |
Yuta HIGUCHI | 9def047 | 2014-10-23 15:51:10 -0700 | [diff] [blame] | 411 | }, futureListeners); |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 412 | |
| 413 | break; |
| 414 | case BATCH_OPERATION_COMPLETED: |
| 415 | Set<FlowEntry> failedItems = event.result().failedItems(); |
| 416 | for (FlowEntry entry : request.toAdd()) { |
| 417 | if (!failedItems.contains(entry)) { |
| 418 | eventDispatcher.post(new FlowRuleEvent(FlowRuleEvent.Type.RULE_ADDED, entry)); |
| 419 | } |
| 420 | } |
| 421 | for (FlowEntry entry : request.toRemove()) { |
| 422 | if (!failedItems.contains(entry)) { |
| 423 | eventDispatcher.post(new FlowRuleEvent(FlowRuleEvent.Type.RULE_REMOVED, entry)); |
| 424 | } |
| 425 | } |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 426 | break; |
| 427 | default: |
| 428 | break; |
| 429 | } |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 430 | } |
| 431 | } |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 432 | |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 433 | private class FlowRuleBatchFuture implements Future<CompletedBatchOperation> { |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 434 | |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 435 | private final List<Future<CompletedBatchOperation>> futures; |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 436 | private final Multimap<DeviceId, FlowRuleBatchEntry> batches; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 437 | private final AtomicReference<BatchState> state; |
| 438 | private CompletedBatchOperation overall; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 439 | |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 440 | public FlowRuleBatchFuture(List<Future<CompletedBatchOperation>> futures, |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 441 | Multimap<DeviceId, FlowRuleBatchEntry> batches) { |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 442 | this.futures = futures; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 443 | this.batches = batches; |
| 444 | state = new AtomicReference<FlowRuleManager.BatchState>(); |
| 445 | state.set(BatchState.STARTED); |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 446 | } |
| 447 | |
| 448 | @Override |
| 449 | public boolean cancel(boolean mayInterruptIfRunning) { |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 450 | if (state.get() == BatchState.FINISHED) { |
| 451 | return false; |
| 452 | } |
| 453 | if (!state.compareAndSet(BatchState.STARTED, BatchState.CANCELLED)) { |
| 454 | return false; |
| 455 | } |
| 456 | cleanUpBatch(); |
| 457 | for (Future<CompletedBatchOperation> f : futures) { |
| 458 | f.cancel(mayInterruptIfRunning); |
| 459 | } |
| 460 | return true; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | @Override |
| 464 | public boolean isCancelled() { |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 465 | return state.get() == BatchState.CANCELLED; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | @Override |
| 469 | public boolean isDone() { |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 470 | return state.get() == BatchState.FINISHED; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 471 | } |
| 472 | |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 473 | |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 474 | @Override |
| 475 | public CompletedBatchOperation get() throws InterruptedException, |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 476 | ExecutionException { |
| 477 | |
| 478 | if (isDone()) { |
| 479 | return overall; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 480 | } |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 481 | |
| 482 | boolean success = true; |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 483 | Set<FlowEntry> failed = Sets.newHashSet(); |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 484 | CompletedBatchOperation completed; |
| 485 | for (Future<CompletedBatchOperation> future : futures) { |
| 486 | completed = future.get(); |
alshabib | 3effd04 | 2014-10-17 12:00:31 -0700 | [diff] [blame] | 487 | success = validateBatchOperation(failed, completed); |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | return finalizeBatchOperation(success, failed); |
| 491 | |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 492 | } |
| 493 | |
| 494 | @Override |
| 495 | public CompletedBatchOperation get(long timeout, TimeUnit unit) |
| 496 | throws InterruptedException, ExecutionException, |
| 497 | TimeoutException { |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 498 | |
| 499 | if (isDone()) { |
| 500 | return overall; |
| 501 | } |
| 502 | boolean success = true; |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 503 | Set<FlowEntry> failed = Sets.newHashSet(); |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 504 | CompletedBatchOperation completed; |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 505 | long start = System.nanoTime(); |
| 506 | long end = start + unit.toNanos(timeout); |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 507 | |
| 508 | for (Future<CompletedBatchOperation> future : futures) { |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 509 | long now = System.nanoTime(); |
| 510 | long thisTimeout = end - now; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 511 | completed = future.get(thisTimeout, TimeUnit.NANOSECONDS); |
alshabib | 3effd04 | 2014-10-17 12:00:31 -0700 | [diff] [blame] | 512 | success = validateBatchOperation(failed, completed); |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 513 | } |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 514 | return finalizeBatchOperation(success, failed); |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 515 | } |
| 516 | |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 517 | private boolean validateBatchOperation(Set<FlowEntry> failed, |
alshabib | 3effd04 | 2014-10-17 12:00:31 -0700 | [diff] [blame] | 518 | CompletedBatchOperation completed) { |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 519 | |
| 520 | if (isCancelled()) { |
| 521 | throw new CancellationException(); |
| 522 | } |
| 523 | if (!completed.isSuccess()) { |
| 524 | failed.addAll(completed.failedItems()); |
| 525 | cleanUpBatch(); |
| 526 | cancelAllSubBatches(); |
| 527 | return false; |
| 528 | } |
| 529 | return true; |
| 530 | } |
| 531 | |
| 532 | private void cancelAllSubBatches() { |
| 533 | for (Future<CompletedBatchOperation> f : futures) { |
| 534 | f.cancel(true); |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | private CompletedBatchOperation finalizeBatchOperation(boolean success, |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame] | 539 | Set<FlowEntry> failed) { |
alshabib | 2683458 | 2014-10-08 20:15:46 -0700 | [diff] [blame] | 540 | synchronized (this) { |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 541 | if (!state.compareAndSet(BatchState.STARTED, BatchState.FINISHED)) { |
| 542 | if (state.get() == BatchState.FINISHED) { |
| 543 | return overall; |
| 544 | } |
| 545 | throw new CancellationException(); |
| 546 | } |
| 547 | overall = new CompletedBatchOperation(success, failed); |
| 548 | return overall; |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | private void cleanUpBatch() { |
| 553 | for (FlowRuleBatchEntry fbe : batches.values()) { |
| 554 | if (fbe.getOperator() == FlowRuleOperation.ADD || |
| 555 | fbe.getOperator() == FlowRuleOperation.MODIFY) { |
| 556 | store.deleteFlowRule(fbe.getTarget()); |
| 557 | } else if (fbe.getOperator() == FlowRuleOperation.REMOVE) { |
alshabib | cf36991 | 2014-10-13 14:16:42 -0700 | [diff] [blame] | 558 | store.removeFlowRule(new DefaultFlowEntry(fbe.getTarget())); |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 559 | store.storeFlowRule(fbe.getTarget()); |
| 560 | } |
| 561 | } |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 562 | } |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 563 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 564 | } |