blob: d3aebba13266f197df14f3a0810e53778c130410 [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 */
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
tombe988312014-09-19 18:38:47 -070054 */
Brian O'Connor72cb19a2015-01-16 16:14:41 -080055 @Deprecated
Madan Jampani117aaae2014-10-23 10:04:05 -070056 void storeFlowRule(FlowRule rule);
57
58 /**
59 * Stores a batch of flow rules.
Thomas Vachuska4b420772014-10-30 16:46:17 -070060 *
Madan Jampani117aaae2014-10-23 10:04:05 -070061 * @param batchOperation batch of flow rules.
Yuta HIGUCHI885868f2014-11-13 19:12:07 -080062 * A batch can contain flow rules for a single device only.
Brian O'Connor72cb19a2015-01-16 16:14:41 -080063 *
Madan Jampani117aaae2014-10-23 10:04:05 -070064 */
Brian O'Connor72cb19a2015-01-16 16:14:41 -080065 void storeBatch(FlowRuleBatchOperation batchOperation);
Madan Jampani117aaae2014-10-23 10:04:05 -070066
67 /**
68 * Invoked on the completion of a storeBatch operation.
Thomas Vachuska4b420772014-10-30 16:46:17 -070069 *
70 * @param event flow rule batch event
Madan Jampani117aaae2014-10-23 10:04:05 -070071 */
72 void batchOperationComplete(FlowRuleBatchEvent event);
alshabib219ebaa2014-09-22 15:41:24 -070073
74 /**
alshabib1c319ff2014-10-04 20:29:09 -070075 * Marks a flow rule for deletion. Actual deletion will occur
76 * when the provider indicates that the flow has been removed.
alshabib219ebaa2014-09-22 15:41:24 -070077 *
78 * @param rule the flow rule to delete
79 */
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}