blob: 2ebc5a252b08fa4efe9ae039fb4d294a61c3c208 [file] [log] [blame]
tom8bb16062014-09-12 14:47:46 -07001package org.onlab.onos.net.flow;
2
alshabiba68eb962014-09-24 20:34:13 -07003import org.onlab.onos.ApplicationId;
tom8bb16062014-09-12 14:47:46 -07004import org.onlab.onos.net.DeviceId;
5
6/**
7 * Service for injecting flow rules into the environment and for obtaining
tom4d0c6632014-09-15 23:27:01 -07008 * information about flow rules already in the environment. This implements
9 * semantics of a distributed authoritative flow table where the master copy
10 * of the flow rules lies with the controller and the devices hold only the
11 * 'cached' copy.
tom8bb16062014-09-12 14:47:46 -070012 */
13public interface FlowRuleService {
14
15 /**
16 * Returns the collection of flow entries applied on the specified device.
tom4d0c6632014-09-15 23:27:01 -070017 * This will include flow rules which may not yet have been applied to
18 * the device.
tom8bb16062014-09-12 14:47:46 -070019 *
20 * @param deviceId device identifier
21 * @return collection of flow rules
22 */
alshabib1c319ff2014-10-04 20:29:09 -070023 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
tom8bb16062014-09-12 14:47:46 -070024
tom73d6d1e2014-09-17 20:08:01 -070025 // TODO: add createFlowRule factory method and execute operations method
26
tom8bb16062014-09-12 14:47:46 -070027 /**
tom4d0c6632014-09-15 23:27:01 -070028 * Applies the specified flow rules onto their respective devices. These
29 * flow rules will be retained by the system and re-applied anytime the
30 * device reconnects to the controller.
tom8bb16062014-09-12 14:47:46 -070031 *
32 * @param flowRules one or more flow rules
tom8bb16062014-09-12 14:47:46 -070033 */
alshabib219ebaa2014-09-22 15:41:24 -070034 void applyFlowRules(FlowRule... flowRules);
tom8bb16062014-09-12 14:47:46 -070035
36 /**
tom4d0c6632014-09-15 23:27:01 -070037 * Removes the specified flow rules from their respective devices. If the
38 * device is not presently connected to the controller, these flow will
39 * be removed once the device reconnects.
alshabib369d2942014-09-12 17:59:35 -070040 *
41 * @param flowRules one or more flow rules
42 * throws SomeKindOfException that indicates which ones were removed and
43 * which ones failed
44 */
45 void removeFlowRules(FlowRule... flowRules);
46
alshabiba68eb962014-09-24 20:34:13 -070047 /**
48 * Removes all rules by id.
49 *
50 * @param appId id to remove
51 */
52 void removeFlowRulesById(ApplicationId appId);
53
54 /**
55 * Returns a list of rules with this application id.
56 *
57 * @param id the id to look up
58 * @return collection of flow rules
59 */
60 Iterable<FlowRule> getFlowRulesById(ApplicationId id);
tom4d0c6632014-09-15 23:27:01 -070061
alshabib369d2942014-09-12 17:59:35 -070062 /**
tom8bb16062014-09-12 14:47:46 -070063 * Adds the specified flow rule listener.
64 *
65 * @param listener flow rule listener
66 */
67 void addListener(FlowRuleListener listener);
68
69 /**
70 * Removes the specified flow rule listener.
71 *
72 * @param listener flow rule listener
73 */
74 void removeListener(FlowRuleListener listener);
75
alshabiba68eb962014-09-24 20:34:13 -070076
77
tom8bb16062014-09-12 14:47:46 -070078}