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; |
| 5 | |
| 6 | import java.util.Iterator; |
| 7 | import java.util.List; |
| 8 | |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 9 | import org.apache.felix.scr.annotations.Activate; |
| 10 | import org.apache.felix.scr.annotations.Component; |
| 11 | import org.apache.felix.scr.annotations.Deactivate; |
| 12 | import org.apache.felix.scr.annotations.Reference; |
| 13 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 14 | import org.apache.felix.scr.annotations.Service; |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 15 | import org.onlab.onos.ApplicationId; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 16 | import org.onlab.onos.event.AbstractListenerRegistry; |
| 17 | import org.onlab.onos.event.EventDeliveryService; |
| 18 | import org.onlab.onos.net.Device; |
| 19 | import org.onlab.onos.net.DeviceId; |
| 20 | import org.onlab.onos.net.device.DeviceService; |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 21 | import org.onlab.onos.net.flow.FlowEntry; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 22 | import org.onlab.onos.net.flow.FlowRule; |
| 23 | import org.onlab.onos.net.flow.FlowRuleEvent; |
| 24 | import org.onlab.onos.net.flow.FlowRuleListener; |
| 25 | import org.onlab.onos.net.flow.FlowRuleProvider; |
| 26 | import org.onlab.onos.net.flow.FlowRuleProviderRegistry; |
| 27 | import org.onlab.onos.net.flow.FlowRuleProviderService; |
| 28 | import org.onlab.onos.net.flow.FlowRuleService; |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 29 | import org.onlab.onos.net.flow.FlowRuleStore; |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 30 | import org.onlab.onos.net.flow.FlowRuleStoreDelegate; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 31 | import org.onlab.onos.net.provider.AbstractProviderRegistry; |
| 32 | import org.onlab.onos.net.provider.AbstractProviderService; |
| 33 | import org.slf4j.Logger; |
| 34 | |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 35 | import com.google.common.collect.Lists; |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 36 | |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 37 | /** |
| 38 | * Provides implementation of the flow NB & SB APIs. |
| 39 | */ |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 40 | @Component(immediate = true) |
| 41 | @Service |
tom | 202175a | 2014-09-19 19:00:11 -0700 | [diff] [blame] | 42 | public class FlowRuleManager |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame^] | 43 | extends AbstractProviderRegistry<FlowRuleProvider, FlowRuleProviderService> |
| 44 | implements FlowRuleService, FlowRuleProviderRegistry { |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 45 | |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 46 | public static final String FLOW_RULE_NULL = "FlowRule cannot be null"; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 47 | private final Logger log = getLogger(getClass()); |
| 48 | |
| 49 | private final AbstractListenerRegistry<FlowRuleEvent, FlowRuleListener> |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame^] | 50 | listenerRegistry = new AbstractListenerRegistry<>(); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 51 | |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 52 | private final FlowRuleStoreDelegate delegate = new InternalStoreDelegate(); |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 53 | |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 54 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 55 | protected FlowRuleStore store; |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 56 | |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 57 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Ayaka Koshibe | b55524f | 2014-09-18 09:59:24 -0700 | [diff] [blame] | 58 | protected EventDeliveryService eventDispatcher; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 59 | |
| 60 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
Ayaka Koshibe | b55524f | 2014-09-18 09:59:24 -0700 | [diff] [blame] | 61 | protected DeviceService deviceService; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 62 | |
| 63 | @Activate |
| 64 | public void activate() { |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 65 | store.setDelegate(delegate); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 66 | eventDispatcher.addSink(FlowRuleEvent.class, listenerRegistry); |
| 67 | log.info("Started"); |
| 68 | } |
| 69 | |
| 70 | @Deactivate |
| 71 | public void deactivate() { |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 72 | store.unsetDelegate(delegate); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 73 | eventDispatcher.removeSink(FlowRuleEvent.class); |
| 74 | log.info("Stopped"); |
| 75 | } |
| 76 | |
| 77 | @Override |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame^] | 78 | public int getFlowRuleCount() { |
| 79 | return store.getFlowRuleCount(); |
| 80 | } |
| 81 | |
| 82 | @Override |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 83 | public Iterable<FlowEntry> getFlowEntries(DeviceId deviceId) { |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 84 | return store.getFlowEntries(deviceId); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | @Override |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 88 | public void applyFlowRules(FlowRule... flowRules) { |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 89 | for (int i = 0; i < flowRules.length; i++) { |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 90 | FlowRule f = flowRules[i]; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 91 | final Device device = deviceService.getDevice(f.deviceId()); |
| 92 | final FlowRuleProvider frp = getProvider(device.providerId()); |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 93 | store.storeFlowRule(f); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 94 | frp.applyFlowRule(f); |
| 95 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | @Override |
| 99 | public void removeFlowRules(FlowRule... flowRules) { |
alshabib | bb8b128 | 2014-09-22 17:00:18 -0700 | [diff] [blame] | 100 | FlowRule f; |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 101 | FlowRuleProvider frp; |
| 102 | Device device; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 103 | for (int i = 0; i < flowRules.length; i++) { |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 104 | f = flowRules[i]; |
| 105 | device = deviceService.getDevice(f.deviceId()); |
| 106 | frp = getProvider(device.providerId()); |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 107 | store.deleteFlowRule(f); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 108 | frp.removeFlowRule(f); |
| 109 | } |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 110 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 111 | |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 112 | @Override |
| 113 | public void removeFlowRulesById(ApplicationId id) { |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame^] | 114 | Iterable<FlowRule> rules = getFlowRulesById(id); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 115 | FlowRuleProvider frp; |
| 116 | Device device; |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 117 | |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 118 | for (FlowRule f : rules) { |
| 119 | store.deleteFlowRule(f); |
| 120 | device = deviceService.getDevice(f.deviceId()); |
| 121 | frp = getProvider(device.providerId()); |
| 122 | frp.removeRulesById(id, f); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | @Override |
| 127 | public Iterable<FlowRule> getFlowRulesById(ApplicationId id) { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 128 | return store.getFlowRulesByAppId(id); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | @Override |
| 132 | public void addListener(FlowRuleListener listener) { |
| 133 | listenerRegistry.addListener(listener); |
| 134 | } |
| 135 | |
| 136 | @Override |
| 137 | public void removeListener(FlowRuleListener listener) { |
| 138 | listenerRegistry.removeListener(listener); |
| 139 | } |
| 140 | |
| 141 | @Override |
| 142 | protected FlowRuleProviderService createProviderService( |
| 143 | FlowRuleProvider provider) { |
| 144 | return new InternalFlowRuleProviderService(provider); |
| 145 | } |
| 146 | |
| 147 | private class InternalFlowRuleProviderService |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame^] | 148 | extends AbstractProviderService<FlowRuleProvider> |
| 149 | implements FlowRuleProviderService { |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 150 | |
| 151 | protected InternalFlowRuleProviderService(FlowRuleProvider provider) { |
| 152 | super(provider); |
| 153 | } |
| 154 | |
| 155 | @Override |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 156 | public void flowRemoved(FlowEntry flowEntry) { |
| 157 | checkNotNull(flowEntry, FLOW_RULE_NULL); |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 158 | checkValidity(); |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 159 | FlowEntry stored = store.getFlowEntry(flowEntry); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 160 | if (stored == null) { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 161 | log.info("Rule already evicted from store: {}", flowEntry); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 162 | return; |
| 163 | } |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 164 | Device device = deviceService.getDevice(flowEntry.deviceId()); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 165 | FlowRuleProvider frp = getProvider(device.providerId()); |
| 166 | FlowRuleEvent event = null; |
| 167 | switch (stored.state()) { |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame^] | 168 | case ADDED: |
| 169 | case PENDING_ADD: |
alshabib | 6eb438a | 2014-10-01 16:39:37 -0700 | [diff] [blame] | 170 | frp.applyFlowRule(stored); |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame^] | 171 | break; |
| 172 | case PENDING_REMOVE: |
| 173 | case REMOVED: |
| 174 | event = store.removeFlowRule(stored); |
| 175 | break; |
| 176 | default: |
| 177 | break; |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 178 | |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 179 | } |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 180 | if (event != null) { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 181 | log.debug("Flow {} removed", flowEntry); |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 182 | post(event); |
| 183 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 184 | } |
| 185 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 186 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 187 | private void flowMissing(FlowEntry flowRule) { |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 188 | checkNotNull(flowRule, FLOW_RULE_NULL); |
| 189 | checkValidity(); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 190 | Device device = deviceService.getDevice(flowRule.deviceId()); |
| 191 | FlowRuleProvider frp = getProvider(device.providerId()); |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 192 | FlowRuleEvent event = null; |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 193 | switch (flowRule.state()) { |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame^] | 194 | case PENDING_REMOVE: |
| 195 | case REMOVED: |
| 196 | event = store.removeFlowRule(flowRule); |
| 197 | frp.removeFlowRule(flowRule); |
| 198 | break; |
| 199 | case ADDED: |
| 200 | case PENDING_ADD: |
| 201 | frp.applyFlowRule(flowRule); |
| 202 | break; |
| 203 | default: |
| 204 | log.debug("Flow {} has not been installed.", flowRule); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 205 | } |
| 206 | |
alshabib | bb42cad | 2014-09-25 11:43:05 -0700 | [diff] [blame] | 207 | if (event != null) { |
| 208 | log.debug("Flow {} removed", flowRule); |
| 209 | post(event); |
| 210 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 211 | |
| 212 | } |
| 213 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 214 | |
| 215 | private void extraneousFlow(FlowRule flowRule) { |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 216 | checkNotNull(flowRule, FLOW_RULE_NULL); |
| 217 | checkValidity(); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 218 | removeFlowRules(flowRule); |
alshabib | 54ce589 | 2014-09-23 17:50:51 -0700 | [diff] [blame] | 219 | log.debug("Flow {} is on switch but not in store.", flowRule); |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 220 | } |
| 221 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 222 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 223 | private void flowAdded(FlowEntry flowEntry) { |
| 224 | checkNotNull(flowEntry, FLOW_RULE_NULL); |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 225 | checkValidity(); |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 226 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 227 | if (checkRuleLiveness(flowEntry, store.getFlowEntry(flowEntry))) { |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 228 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 229 | FlowRuleEvent event = store.addOrUpdateFlowRule(flowEntry); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 230 | if (event == null) { |
| 231 | log.debug("No flow store event generated."); |
| 232 | } else { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 233 | log.debug("Flow {} {}", flowEntry, event.type()); |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 234 | post(event); |
| 235 | } |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 236 | } else { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 237 | removeFlowRules(flowEntry); |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 238 | } |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 239 | |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 240 | } |
| 241 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 242 | private boolean checkRuleLiveness(FlowEntry swRule, FlowEntry storedRule) { |
| 243 | if (storedRule == null) { |
| 244 | return false; |
| 245 | } |
alshabib | 85c4197 | 2014-10-03 13:48:39 -0700 | [diff] [blame] | 246 | long timeout = storedRule.timeout() * 1000; |
| 247 | Long currentTime = System.currentTimeMillis(); |
| 248 | if (storedRule.packets() != swRule.packets()) { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 249 | storedRule.setLastSeen(); |
alshabib | 85c4197 | 2014-10-03 13:48:39 -0700 | [diff] [blame] | 250 | return true; |
| 251 | } |
alshabib | 85c4197 | 2014-10-03 13:48:39 -0700 | [diff] [blame] | 252 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 253 | if ((currentTime - storedRule.lastSeen()) <= timeout) { |
alshabib | c274c90 | 2014-10-03 14:58:27 -0700 | [diff] [blame] | 254 | return true; |
| 255 | } |
| 256 | return false; |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 257 | } |
| 258 | |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 259 | // Posts the specified event to the local event dispatcher. |
| 260 | private void post(FlowRuleEvent event) { |
| 261 | if (event != null) { |
| 262 | eventDispatcher.post(event); |
| 263 | } |
| 264 | } |
alshabib | 5c370ff | 2014-09-18 10:12:14 -0700 | [diff] [blame] | 265 | |
| 266 | @Override |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 267 | public void pushFlowMetrics(DeviceId deviceId, Iterable<FlowEntry> flowEntries) { |
| 268 | List<FlowEntry> storedRules = Lists.newLinkedList(store.getFlowEntries(deviceId)); |
alshabib | bb8b128 | 2014-09-22 17:00:18 -0700 | [diff] [blame] | 269 | |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 270 | Iterator<FlowEntry> switchRulesIterator = flowEntries.iterator(); |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 271 | |
| 272 | while (switchRulesIterator.hasNext()) { |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 273 | FlowEntry rule = switchRulesIterator.next(); |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 274 | if (storedRules.remove(rule)) { |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 275 | // we both have the rule, let's update some info then. |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 276 | flowAdded(rule); |
| 277 | } else { |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 278 | // the device has a rule the store does not have |
| 279 | extraneousFlow(rule); |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 280 | } |
| 281 | } |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 282 | for (FlowEntry rule : storedRules) { |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 283 | // there are rules in the store that aren't on the switch |
| 284 | flowMissing(rule); |
alshabib | 54ce589 | 2014-09-23 17:50:51 -0700 | [diff] [blame] | 285 | |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 286 | } |
alshabib | 5c370ff | 2014-09-18 10:12:14 -0700 | [diff] [blame] | 287 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 288 | } |
| 289 | |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 290 | // Store delegate to re-post events emitted from the store. |
| 291 | private class InternalStoreDelegate implements FlowRuleStoreDelegate { |
| 292 | @Override |
| 293 | public void notify(FlowRuleEvent event) { |
| 294 | eventDispatcher.post(event); |
| 295 | } |
| 296 | } |
alshabib | 57044ba | 2014-09-16 15:58:01 -0700 | [diff] [blame] | 297 | } |