Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 3 | * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology, China |
Pengfei Lu | e53419b | 2015-08-29 10:11:02 +0800 | [diff] [blame] | 4 | * Advisers: Keqiu Li, Heng Qi and Haisheng Yu |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 5 | * This work is supported by the State Key Program of National Natural Science of China(Grant No. 61432002) |
| 6 | * and Prospective Research Project on Future Networks in Jiangsu Future Networks Innovation Institute. |
| 7 | * |
| 8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | * you may not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at |
| 11 | * |
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | * |
| 14 | * Unless required by applicable law or agreed to in writing, software |
| 15 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | * See the License for the specific language governing permissions and |
| 18 | * limitations under the License. |
| 19 | */ |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 20 | package org.onosproject.acl; |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 21 | |
| 22 | import org.onosproject.net.DeviceId; |
| 23 | import org.onosproject.net.flow.FlowRule; |
| 24 | import org.onosproject.store.Store; |
| 25 | |
| 26 | import java.util.List; |
| 27 | import java.util.Set; |
| 28 | |
| 29 | /** |
| 30 | * Service interface exported by ACL distributed store. |
| 31 | */ |
| 32 | public interface AclStore extends Store { |
| 33 | |
| 34 | /** |
| 35 | * Gets a list containing all ACL rules. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 36 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 37 | * @return a list containing all ACL rules |
| 38 | */ |
| 39 | List<AclRule> getAclRules(); |
| 40 | |
| 41 | /** |
| 42 | * Adds a new ACL rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 43 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 44 | * @param rule new ACL rule |
| 45 | */ |
| 46 | void addAclRule(AclRule rule); |
| 47 | |
| 48 | /** |
| 49 | * Gets an existing ACL rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 50 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 51 | * @param ruleId ACL rule id |
| 52 | * @return ACL rule with the given id |
| 53 | */ |
| 54 | AclRule getAclRule(RuleId ruleId); |
| 55 | |
| 56 | /** |
| 57 | * Removes an existing ACL rule by rule id. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 58 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 59 | * @param ruleId ACL rule id |
| 60 | */ |
| 61 | void removeAclRule(RuleId ruleId); |
| 62 | |
| 63 | /** |
| 64 | * Clears ACL and reset all. |
| 65 | */ |
| 66 | void clearAcl(); |
| 67 | |
| 68 | /** |
| 69 | * Gets the current priority for new ACL flow rule by device id. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 70 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 71 | * @param deviceId device id |
| 72 | * @return new ACL flow rule's priority in the given device |
| 73 | */ |
| 74 | int getPriorityByDevice(DeviceId deviceId); |
| 75 | |
| 76 | /** |
| 77 | * Gets a set containing all ACL flow rules belonging to a given ACL rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 78 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 79 | * @param ruleId ACL rule id |
| 80 | * @return a set containing all ACL flow rules belonging to the given ACL rule |
| 81 | */ |
| 82 | Set<FlowRule> getFlowByRule(RuleId ruleId); |
| 83 | |
| 84 | /** |
| 85 | * Adds a new mapping from ACL rule to ACL flow rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 86 | * |
| 87 | * @param ruleId ACL rule id |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 88 | * @param flowRule ACL flow rule |
| 89 | */ |
| 90 | void addRuleToFlowMapping(RuleId ruleId, FlowRule flowRule); |
| 91 | |
| 92 | /** |
| 93 | * Removes an existing mapping from ACL rule to ACL flow rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 94 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 95 | * @param ruleId ACL rule id |
| 96 | */ |
| 97 | void removeRuleToFlowMapping(RuleId ruleId); |
| 98 | |
| 99 | /** |
| 100 | * Gets a list containing all allowing ACL rules matching a given denying ACL rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 101 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 102 | * @param denyingRuleId denying ACL rule id |
| 103 | * @return a list containing all allowing ACL rules matching the given denying ACL rule |
| 104 | */ |
| 105 | List<RuleId> getAllowingRuleByDenyingRule(RuleId denyingRuleId); |
| 106 | |
| 107 | /** |
| 108 | * Adds a new mapping from denying ACL rule to allowing ACL rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 109 | * |
| 110 | * @param denyingRuleId denying ACL rule id |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 111 | * @param allowingRuleId allowing ACL rule id |
| 112 | */ |
| 113 | void addDenyToAllowMapping(RuleId denyingRuleId, RuleId allowingRuleId); |
| 114 | |
| 115 | /** |
| 116 | * Removes an exsiting mapping from denying ACL rule to allowing ACL rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 117 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 118 | * @param denyingRuleId denying ACL rule id |
| 119 | */ |
| 120 | void removeDenyToAllowMapping(RuleId denyingRuleId); |
| 121 | |
| 122 | /** |
| 123 | * Checks if an existing ACL rule already works in a given device. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 124 | * |
| 125 | * @param ruleId ACL rule id |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 126 | * @param deviceId devide id |
| 127 | * @return true if the given ACL rule works in the given device |
| 128 | */ |
| 129 | boolean checkIfRuleWorksInDevice(RuleId ruleId, DeviceId deviceId); |
| 130 | |
| 131 | /** |
| 132 | * Adds a new mapping from ACL rule to device. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 133 | * |
| 134 | * @param ruleId ACL rule id |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 135 | * @param deviceId device id |
| 136 | */ |
| 137 | void addRuleToDeviceMapping(RuleId ruleId, DeviceId deviceId); |
| 138 | |
| 139 | /** |
| 140 | * Removes an existing mapping from ACL rule to device. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 141 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 142 | * @param ruleId ACL rule id |
| 143 | */ |
| 144 | void removeRuleToDeviceMapping(RuleId ruleId); |
| 145 | |
| 146 | } |