blob: 736dc9de98d550d015fbd8fc3efc7d3285849acc [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
tombe988312014-09-19 18:38:47 -070019package org.onlab.onos.net.flow;
20
Madan Jampani117aaae2014-10-23 10:04:05 -070021import java.util.concurrent.Future;
22
tombe988312014-09-19 18:38:47 -070023import org.onlab.onos.net.DeviceId;
tomc78acee2014-09-24 15:16:55 -070024import org.onlab.onos.store.Store;
tombe988312014-09-19 18:38:47 -070025
26/**
tome4729872014-09-23 00:37:37 -070027 * Manages inventory of flow rules; not intended for direct use.
tombe988312014-09-19 18:38:47 -070028 */
Madan Jampani117aaae2014-10-23 10:04:05 -070029public interface FlowRuleStore extends Store<FlowRuleBatchEvent, FlowRuleStoreDelegate> {
tombe988312014-09-19 18:38:47 -070030
31 /**
tom9b4030d2014-10-06 10:39:03 -070032 * Returns the number of flow rule in the store.
33 *
34 * @return number of flow rules
35 */
36 int getFlowRuleCount();
37
38 /**
alshabiba68eb962014-09-24 20:34:13 -070039 * Returns the stored flow.
tom9b4030d2014-10-06 10:39:03 -070040 *
alshabiba68eb962014-09-24 20:34:13 -070041 * @param rule the rule to look for
42 * @return a flow rule
43 */
alshabib1c319ff2014-10-04 20:29:09 -070044 FlowEntry getFlowEntry(FlowRule rule);
alshabiba68eb962014-09-24 20:34:13 -070045
46 /**
tombe988312014-09-19 18:38:47 -070047 * Returns the flow entries associated with a device.
48 *
49 * @param deviceId the device ID
50 * @return the flow entries
51 */
alshabib1c319ff2014-10-04 20:29:09 -070052 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
tombe988312014-09-19 18:38:47 -070053
54 /**
Madan Jampani117aaae2014-10-23 10:04:05 -070055 // TODO: Better description of method behavior.
alshabib219ebaa2014-09-22 15:41:24 -070056 * Stores a new flow rule without generating events.
tombe988312014-09-19 18:38:47 -070057 *
58 * @param rule the flow rule to add
tombe988312014-09-19 18:38:47 -070059 */
Madan Jampani117aaae2014-10-23 10:04:05 -070060 void storeFlowRule(FlowRule rule);
61
62 /**
63 * Stores a batch of flow rules.
64 * @param batchOperation batch of flow rules.
65 * @return Future response indicating success/failure of the batch operation
66 * all the way down to the device.
67 */
68 Future<CompletedBatchOperation> storeBatch(FlowRuleBatchOperation batchOperation);
69
70 /**
71 * Invoked on the completion of a storeBatch operation.
72 * @param result
73 */
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
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070081 * @return true if the rule should be handled locally
alshabib219ebaa2014-09-22 15:41:24 -070082 */
Madan Jampani117aaae2014-10-23 10:04:05 -070083 void deleteFlowRule(FlowRule rule);
tombe988312014-09-19 18:38:47 -070084
85 /**
86 * Stores a new flow rule, or updates an existing entry.
87 *
88 * @param rule the flow rule to add or update
89 * @return flow_added event, or null if just an update
90 */
alshabib1c319ff2014-10-04 20:29:09 -070091 FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070092
93 /**
alshabib1c319ff2014-10-04 20:29:09 -070094 * @param rule the flow entry to remove
tombe988312014-09-19 18:38:47 -070095 * @return flow_removed event, or null if nothing removed
96 */
alshabib1c319ff2014-10-04 20:29:09 -070097 FlowRuleEvent removeFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070098}