Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame^] | 1 | /* |
| 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 | */ |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 19 | package org.onlab.onos.net.flow; |
| 20 | |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 21 | import org.onlab.onos.ApplicationId; |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 22 | import org.onlab.onos.net.DeviceId; |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 23 | import org.onlab.onos.store.Store; |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 24 | |
| 25 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 26 | * Manages inventory of flow rules; not intended for direct use. |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 27 | */ |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 28 | public interface FlowRuleStore extends Store<FlowRuleEvent, FlowRuleStoreDelegate> { |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 29 | |
| 30 | /** |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 31 | * Returns the number of flow rule in the store. |
| 32 | * |
| 33 | * @return number of flow rules |
| 34 | */ |
| 35 | int getFlowRuleCount(); |
| 36 | |
| 37 | /** |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 38 | * Returns the stored flow. |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 39 | * |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 40 | * @param rule the rule to look for |
| 41 | * @return a flow rule |
| 42 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 43 | FlowEntry getFlowEntry(FlowRule rule); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 44 | |
| 45 | /** |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 46 | * Returns the flow entries associated with a device. |
| 47 | * |
| 48 | * @param deviceId the device ID |
| 49 | * @return the flow entries |
| 50 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 51 | Iterable<FlowEntry> getFlowEntries(DeviceId deviceId); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 52 | |
| 53 | /** |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 54 | * Returns the flow entries associated with an application. |
| 55 | * |
| 56 | * @param appId the application id |
| 57 | * @return the flow entries |
| 58 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 59 | Iterable<FlowRule> getFlowRulesByAppId(ApplicationId appId); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 60 | |
| 61 | /** |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 62 | * Stores a new flow rule without generating events. |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 63 | * |
| 64 | * @param rule the flow rule to add |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 65 | * @return true if the rule should be handled locally |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 66 | */ |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 67 | boolean storeFlowRule(FlowRule rule); |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 68 | |
| 69 | /** |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 70 | * Marks a flow rule for deletion. Actual deletion will occur |
| 71 | * when the provider indicates that the flow has been removed. |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 72 | * |
| 73 | * @param rule the flow rule to delete |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 74 | * @return true if the rule should be handled locally |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 75 | */ |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 76 | boolean deleteFlowRule(FlowRule rule); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 77 | |
| 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 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 84 | FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 85 | |
| 86 | /** |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 87 | * @param rule the flow entry to remove |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 88 | * @return flow_removed event, or null if nothing removed |
| 89 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 90 | FlowRuleEvent removeFlowRule(FlowEntry rule); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 91 | } |