blob: 71434c73b61fd3306991bf2195c070add119538a [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
26 /**
tom4d0c6632014-09-15 23:27:01 -070027 * Applies the specified flow rules onto their respective devices. These
28 * flow rules will be retained by the system and re-applied anytime the
29 * device reconnects to the controller.
tom8bb16062014-09-12 14:47:46 -070030 *
31 * @param flowRules one or more flow rules
32 * throws SomeKindOfException that indicates which ones were applied and
33 * which ones failed
34 */
Ayaka Koshibe08eabaa2014-09-17 14:59:25 -070035 List<FlowEntry> applyFlowRules(FlowRule... flowRules);
tom8bb16062014-09-12 14:47:46 -070036
37 /**
tom4d0c6632014-09-15 23:27:01 -070038 * Removes the specified flow rules from their respective devices. If the
39 * device is not presently connected to the controller, these flow will
40 * be removed once the device reconnects.
alshabib369d2942014-09-12 17:59:35 -070041 *
42 * @param flowRules one or more flow rules
43 * throws SomeKindOfException that indicates which ones were removed and
44 * which ones failed
45 */
46 void removeFlowRules(FlowRule... flowRules);
47
tom4d0c6632014-09-15 23:27:01 -070048
49 // void addInitialFlowContributor(InitialFlowContributor contributor);
50 // void removeInitialFlowContributor(InitialFlowContributor contributor);
51
alshabib369d2942014-09-12 17:59:35 -070052 /**
tom8bb16062014-09-12 14:47:46 -070053 * Adds the specified flow rule listener.
54 *
55 * @param listener flow rule listener
56 */
57 void addListener(FlowRuleListener listener);
58
59 /**
60 * Removes the specified flow rule listener.
61 *
62 * @param listener flow rule listener
63 */
64 void removeListener(FlowRuleListener listener);
65
66}