blob: ba75ae9d8605374ed5053af1a9935c3172c78b55 [file] [log] [blame]
tom8bb16062014-09-12 14:47:46 -07001package org.onlab.onos.net.flow;
2
Ayaka Koshibe08eabaa2014-09-17 14:59:25 -07003import java.util.List;
4
tom8bb16062014-09-12 14:47:46 -07005import org.onlab.onos.net.DeviceId;
6
7/**
8 * Service for injecting flow rules into the environment and for obtaining
tom4d0c6632014-09-15 23:27:01 -07009 * information about flow rules already in the environment. This implements
10 * semantics of a distributed authoritative flow table where the master copy
11 * of the flow rules lies with the controller and the devices hold only the
12 * 'cached' copy.
tom8bb16062014-09-12 14:47:46 -070013 */
14public interface FlowRuleService {
15
16 /**
17 * Returns the collection of flow entries applied on the specified device.
tom4d0c6632014-09-15 23:27:01 -070018 * This will include flow rules which may not yet have been applied to
19 * the device.
tom8bb16062014-09-12 14:47:46 -070020 *
21 * @param deviceId device identifier
22 * @return collection of flow rules
23 */
24 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
25
tom73d6d1e2014-09-17 20:08:01 -070026 // TODO: add createFlowRule factory method and execute operations method
27
tom8bb16062014-09-12 14:47:46 -070028 /**
tom4d0c6632014-09-15 23:27:01 -070029 * Applies the specified flow rules onto their respective devices. These
30 * flow rules will be retained by the system and re-applied anytime the
31 * device reconnects to the controller.
tom8bb16062014-09-12 14:47:46 -070032 *
33 * @param flowRules one or more flow rules
34 * throws SomeKindOfException that indicates which ones were applied and
35 * which ones failed
36 */
Ayaka Koshibe08eabaa2014-09-17 14:59:25 -070037 List<FlowEntry> applyFlowRules(FlowRule... flowRules);
tom8bb16062014-09-12 14:47:46 -070038
39 /**
tom4d0c6632014-09-15 23:27:01 -070040 * Removes the specified flow rules from their respective devices. If the
41 * device is not presently connected to the controller, these flow will
42 * be removed once the device reconnects.
alshabib369d2942014-09-12 17:59:35 -070043 *
44 * @param flowRules one or more flow rules
45 * throws SomeKindOfException that indicates which ones were removed and
46 * which ones failed
47 */
48 void removeFlowRules(FlowRule... flowRules);
49
tom4d0c6632014-09-15 23:27:01 -070050
alshabib369d2942014-09-12 17:59:35 -070051 /**
tom8bb16062014-09-12 14:47:46 -070052 * Adds the specified flow rule listener.
53 *
54 * @param listener flow rule listener
55 */
56 void addListener(FlowRuleListener listener);
57
58 /**
59 * Removes the specified flow rule listener.
60 *
61 * @param listener flow rule listener
62 */
63 void removeListener(FlowRuleListener listener);
64
65}