blob: cece989364a18aaaa14ecc15c063ae8c5df84f8e [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska83e090e2014-10-22 14:25:35 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Thomas Vachuska83e090e2014-10-22 14:25:35 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Thomas Vachuska83e090e2014-10-22 14:25:35 -070015 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.flow;
tombe988312014-09-19 18:38:47 -070017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.net.DeviceId;
19import org.onosproject.store.Store;
tombe988312014-09-19 18:38:47 -070020
21/**
tome4729872014-09-23 00:37:37 -070022 * Manages inventory of flow rules; not intended for direct use.
tombe988312014-09-19 18:38:47 -070023 */
Madan Jampani117aaae2014-10-23 10:04:05 -070024public interface FlowRuleStore extends Store<FlowRuleBatchEvent, FlowRuleStoreDelegate> {
tombe988312014-09-19 18:38:47 -070025
26 /**
tom9b4030d2014-10-06 10:39:03 -070027 * Returns the number of flow rule in the store.
28 *
29 * @return number of flow rules
30 */
31 int getFlowRuleCount();
32
33 /**
alshabiba68eb962014-09-24 20:34:13 -070034 * Returns the stored flow.
tom9b4030d2014-10-06 10:39:03 -070035 *
alshabiba68eb962014-09-24 20:34:13 -070036 * @param rule the rule to look for
37 * @return a flow rule
38 */
alshabib1c319ff2014-10-04 20:29:09 -070039 FlowEntry getFlowEntry(FlowRule rule);
alshabiba68eb962014-09-24 20:34:13 -070040
41 /**
tombe988312014-09-19 18:38:47 -070042 * Returns the flow entries associated with a device.
43 *
44 * @param deviceId the device ID
45 * @return the flow entries
46 */
alshabib1c319ff2014-10-04 20:29:09 -070047 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
tombe988312014-09-19 18:38:47 -070048
49 /**
Thomas Vachuska4b420772014-10-30 16:46:17 -070050 * // TODO: Better description of method behavior.
alshabib219ebaa2014-09-22 15:41:24 -070051 * Stores a new flow rule without generating events.
tombe988312014-09-19 18:38:47 -070052 *
53 * @param rule the flow rule to add
Sho SHIMIZUbe63b232015-06-30 10:57:58 -070054 * @deprecated in Cardinal Release
tombe988312014-09-19 18:38:47 -070055 */
Brian O'Connor72cb19a2015-01-16 16:14:41 -080056 @Deprecated
Madan Jampani117aaae2014-10-23 10:04:05 -070057 void storeFlowRule(FlowRule rule);
58
59 /**
60 * Stores a batch of flow rules.
Thomas Vachuska4b420772014-10-30 16:46:17 -070061 *
Madan Jampani117aaae2014-10-23 10:04:05 -070062 * @param batchOperation batch of flow rules.
Yuta HIGUCHI885868f2014-11-13 19:12:07 -080063 * A batch can contain flow rules for a single device only.
Brian O'Connor72cb19a2015-01-16 16:14:41 -080064 *
Madan Jampani117aaae2014-10-23 10:04:05 -070065 */
Brian O'Connor72cb19a2015-01-16 16:14:41 -080066 void storeBatch(FlowRuleBatchOperation batchOperation);
Madan Jampani117aaae2014-10-23 10:04:05 -070067
68 /**
69 * Invoked on the completion of a storeBatch operation.
Thomas Vachuska4b420772014-10-30 16:46:17 -070070 *
71 * @param event flow rule batch event
Madan Jampani117aaae2014-10-23 10:04:05 -070072 */
73 void batchOperationComplete(FlowRuleBatchEvent event);
alshabib219ebaa2014-09-22 15:41:24 -070074
75 /**
alshabib1c319ff2014-10-04 20:29:09 -070076 * Marks a flow rule for deletion. Actual deletion will occur
77 * when the provider indicates that the flow has been removed.
alshabib219ebaa2014-09-22 15:41:24 -070078 *
79 * @param rule the flow rule to delete
80 */
Madan Jampani117aaae2014-10-23 10:04:05 -070081 void deleteFlowRule(FlowRule rule);
tombe988312014-09-19 18:38:47 -070082
83 /**
84 * Stores a new flow rule, or updates an existing entry.
85 *
86 * @param rule the flow rule to add or update
87 * @return flow_added event, or null if just an update
88 */
alshabib1c319ff2014-10-04 20:29:09 -070089 FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070090
91 /**
alshabib1c319ff2014-10-04 20:29:09 -070092 * @param rule the flow entry to remove
tombe988312014-09-19 18:38:47 -070093 * @return flow_removed event, or null if nothing removed
94 */
alshabib1c319ff2014-10-04 20:29:09 -070095 FlowRuleEvent removeFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070096}