blob: 63b7f776095dd04a46b4e1c1bfceae05d2a16519 [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
alshabiba68eb962014-09-24 20:34:13 -070021import org.onlab.onos.ApplicationId;
tombe988312014-09-19 18:38:47 -070022import org.onlab.onos.net.DeviceId;
tomc78acee2014-09-24 15:16:55 -070023import org.onlab.onos.store.Store;
tombe988312014-09-19 18:38:47 -070024
25/**
tome4729872014-09-23 00:37:37 -070026 * Manages inventory of flow rules; not intended for direct use.
tombe988312014-09-19 18:38:47 -070027 */
tomc78acee2014-09-24 15:16:55 -070028public interface FlowRuleStore extends Store<FlowRuleEvent, FlowRuleStoreDelegate> {
tombe988312014-09-19 18:38:47 -070029
30 /**
tom9b4030d2014-10-06 10:39:03 -070031 * Returns the number of flow rule in the store.
32 *
33 * @return number of flow rules
34 */
35 int getFlowRuleCount();
36
37 /**
alshabiba68eb962014-09-24 20:34:13 -070038 * Returns the stored flow.
tom9b4030d2014-10-06 10:39:03 -070039 *
alshabiba68eb962014-09-24 20:34:13 -070040 * @param rule the rule to look for
41 * @return a flow rule
42 */
alshabib1c319ff2014-10-04 20:29:09 -070043 FlowEntry getFlowEntry(FlowRule rule);
alshabiba68eb962014-09-24 20:34:13 -070044
45 /**
tombe988312014-09-19 18:38:47 -070046 * Returns the flow entries associated with a device.
47 *
48 * @param deviceId the device ID
49 * @return the flow entries
50 */
alshabib1c319ff2014-10-04 20:29:09 -070051 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
tombe988312014-09-19 18:38:47 -070052
53 /**
alshabiba68eb962014-09-24 20:34:13 -070054 * Returns the flow entries associated with an application.
55 *
56 * @param appId the application id
57 * @return the flow entries
58 */
alshabib1c319ff2014-10-04 20:29:09 -070059 Iterable<FlowRule> getFlowRulesByAppId(ApplicationId appId);
alshabiba68eb962014-09-24 20:34:13 -070060
61 /**
alshabib219ebaa2014-09-22 15:41:24 -070062 * Stores a new flow rule without generating events.
tombe988312014-09-19 18:38:47 -070063 *
64 * @param rule the flow rule to add
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070065 * @return true if the rule should be handled locally
tombe988312014-09-19 18:38:47 -070066 */
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070067 boolean storeFlowRule(FlowRule rule);
alshabib219ebaa2014-09-22 15:41:24 -070068
69 /**
alshabib1c319ff2014-10-04 20:29:09 -070070 * Marks a flow rule for deletion. Actual deletion will occur
71 * when the provider indicates that the flow has been removed.
alshabib219ebaa2014-09-22 15:41:24 -070072 *
73 * @param rule the flow rule to delete
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070074 * @return true if the rule should be handled locally
alshabib219ebaa2014-09-22 15:41:24 -070075 */
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070076 boolean deleteFlowRule(FlowRule rule);
tombe988312014-09-19 18:38:47 -070077
78 /**
79 * Stores a new flow rule, or updates an existing entry.
80 *
81 * @param rule the flow rule to add or update
82 * @return flow_added event, or null if just an update
83 */
alshabib1c319ff2014-10-04 20:29:09 -070084 FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070085
86 /**
alshabib1c319ff2014-10-04 20:29:09 -070087 * @param rule the flow entry to remove
tombe988312014-09-19 18:38:47 -070088 * @return flow_removed event, or null if nothing removed
89 */
alshabib1c319ff2014-10-04 20:29:09 -070090 FlowRuleEvent removeFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070091}