blob: bba5a3c2103a0cb275c09ea1e23ed24dabe636a9 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 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 */
tombe988312014-09-19 18:38:47 -070016package org.onlab.onos.net.flow;
17
Madan Jampani117aaae2014-10-23 10:04:05 -070018import java.util.concurrent.Future;
19
tombe988312014-09-19 18:38:47 -070020import org.onlab.onos.net.DeviceId;
tomc78acee2014-09-24 15:16:55 -070021import org.onlab.onos.store.Store;
tombe988312014-09-19 18:38:47 -070022
23/**
tome4729872014-09-23 00:37:37 -070024 * Manages inventory of flow rules; not intended for direct use.
tombe988312014-09-19 18:38:47 -070025 */
Madan Jampani117aaae2014-10-23 10:04:05 -070026public interface FlowRuleStore extends Store<FlowRuleBatchEvent, FlowRuleStoreDelegate> {
tombe988312014-09-19 18:38:47 -070027
28 /**
tom9b4030d2014-10-06 10:39:03 -070029 * Returns the number of flow rule in the store.
30 *
31 * @return number of flow rules
32 */
33 int getFlowRuleCount();
34
35 /**
alshabiba68eb962014-09-24 20:34:13 -070036 * Returns the stored flow.
tom9b4030d2014-10-06 10:39:03 -070037 *
alshabiba68eb962014-09-24 20:34:13 -070038 * @param rule the rule to look for
39 * @return a flow rule
40 */
alshabib1c319ff2014-10-04 20:29:09 -070041 FlowEntry getFlowEntry(FlowRule rule);
alshabiba68eb962014-09-24 20:34:13 -070042
43 /**
tombe988312014-09-19 18:38:47 -070044 * Returns the flow entries associated with a device.
45 *
46 * @param deviceId the device ID
47 * @return the flow entries
48 */
alshabib1c319ff2014-10-04 20:29:09 -070049 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
tombe988312014-09-19 18:38:47 -070050
51 /**
Thomas Vachuska4b420772014-10-30 16:46:17 -070052 * // TODO: Better description of method behavior.
alshabib219ebaa2014-09-22 15:41:24 -070053 * Stores a new flow rule without generating events.
tombe988312014-09-19 18:38:47 -070054 *
55 * @param rule the flow rule to add
tombe988312014-09-19 18:38:47 -070056 */
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.
Madan Jampani117aaae2014-10-23 10:04:05 -070064 * @return Future response indicating success/failure of the batch operation
Thomas Vachuska4b420772014-10-30 16:46:17 -070065 * all the way down to the device.
Madan Jampani117aaae2014-10-23 10:04:05 -070066 */
67 Future<CompletedBatchOperation> storeBatch(FlowRuleBatchOperation batchOperation);
68
69 /**
70 * Invoked on the completion of a storeBatch operation.
Thomas Vachuska4b420772014-10-30 16:46:17 -070071 *
72 * @param event flow rule batch event
Madan Jampani117aaae2014-10-23 10:04:05 -070073 */
74 void batchOperationComplete(FlowRuleBatchEvent event);
alshabib219ebaa2014-09-22 15:41:24 -070075
76 /**
alshabib1c319ff2014-10-04 20:29:09 -070077 * Marks a flow rule for deletion. Actual deletion will occur
78 * when the provider indicates that the flow has been removed.
alshabib219ebaa2014-09-22 15:41:24 -070079 *
80 * @param rule the flow rule to delete
81 */
Madan Jampani117aaae2014-10-23 10:04:05 -070082 void deleteFlowRule(FlowRule rule);
tombe988312014-09-19 18:38:47 -070083
84 /**
85 * Stores a new flow rule, or updates an existing entry.
86 *
87 * @param rule the flow rule to add or update
88 * @return flow_added event, or null if just an update
89 */
alshabib1c319ff2014-10-04 20:29:09 -070090 FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070091
92 /**
alshabib1c319ff2014-10-04 20:29:09 -070093 * @param rule the flow entry to remove
tombe988312014-09-19 18:38:47 -070094 * @return flow_removed event, or null if nothing removed
95 */
alshabib1c319ff2014-10-04 20:29:09 -070096 FlowRuleEvent removeFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070097}