blob: 8a887d069035d43ae0d3b94f49aae846b05f8e83 [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 /**
Madan Jampani117aaae2014-10-23 10:04:05 -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.
61 * @param batchOperation batch of flow rules.
62 * @return Future response indicating success/failure of the batch operation
63 * all the way down to the device.
64 */
65 Future<CompletedBatchOperation> storeBatch(FlowRuleBatchOperation batchOperation);
66
67 /**
68 * Invoked on the completion of a storeBatch operation.
69 * @param result
70 */
71 void batchOperationComplete(FlowRuleBatchEvent event);
alshabib219ebaa2014-09-22 15:41:24 -070072
73 /**
alshabib1c319ff2014-10-04 20:29:09 -070074 * Marks a flow rule for deletion. Actual deletion will occur
75 * when the provider indicates that the flow has been removed.
alshabib219ebaa2014-09-22 15:41:24 -070076 *
77 * @param rule the flow rule to delete
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070078 * @return true if the rule should be handled locally
alshabib219ebaa2014-09-22 15:41:24 -070079 */
Madan Jampani117aaae2014-10-23 10:04:05 -070080 void deleteFlowRule(FlowRule rule);
tombe988312014-09-19 18:38:47 -070081
82 /**
83 * Stores a new flow rule, or updates an existing entry.
84 *
85 * @param rule the flow rule to add or update
86 * @return flow_added event, or null if just an update
87 */
alshabib1c319ff2014-10-04 20:29:09 -070088 FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070089
90 /**
alshabib1c319ff2014-10-04 20:29:09 -070091 * @param rule the flow entry to remove
tombe988312014-09-19 18:38:47 -070092 * @return flow_removed event, or null if nothing removed
93 */
alshabib1c319ff2014-10-04 20:29:09 -070094 FlowRuleEvent removeFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070095}