Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 3 | * |
| 4 | * 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 |
| 7 | * |
| 8 | * 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. |
Ray Milkey | 8526700 | 2016-11-16 11:06:35 -0800 | [diff] [blame] | 15 | * |
| 16 | * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology, China |
| 17 | * Advisers: Keqiu Li, Heng Qi and Haisheng Yu |
| 18 | * This work is supported by the State Key Program of National Natural Science of China(Grant No. 61432002) |
| 19 | * and Prospective Research Project on Future Networks in Jiangsu Future Networks Innovation Institute. |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 20 | */ |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 21 | package org.onosproject.acl; |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 22 | |
| 23 | import org.onosproject.net.DeviceId; |
| 24 | import org.onosproject.net.flow.FlowRule; |
| 25 | import org.onosproject.store.Store; |
| 26 | |
| 27 | import java.util.List; |
| 28 | import java.util.Set; |
| 29 | |
| 30 | /** |
| 31 | * Service interface exported by ACL distributed store. |
| 32 | */ |
| 33 | public interface AclStore extends Store { |
| 34 | |
| 35 | /** |
| 36 | * Gets a list containing all ACL rules. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 37 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 38 | * @return a list containing all ACL rules |
| 39 | */ |
| 40 | List<AclRule> getAclRules(); |
| 41 | |
| 42 | /** |
| 43 | * Adds a new ACL rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 44 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 45 | * @param rule new ACL rule |
| 46 | */ |
| 47 | void addAclRule(AclRule rule); |
| 48 | |
| 49 | /** |
| 50 | * Gets an existing ACL rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 51 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 52 | * @param ruleId ACL rule id |
| 53 | * @return ACL rule with the given id |
| 54 | */ |
| 55 | AclRule getAclRule(RuleId ruleId); |
| 56 | |
| 57 | /** |
| 58 | * Removes an existing ACL rule by rule id. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 59 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 60 | * @param ruleId ACL rule id |
| 61 | */ |
| 62 | void removeAclRule(RuleId ruleId); |
| 63 | |
| 64 | /** |
| 65 | * Clears ACL and reset all. |
| 66 | */ |
| 67 | void clearAcl(); |
| 68 | |
| 69 | /** |
| 70 | * Gets the current priority for new ACL flow rule by device id. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 71 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 72 | * @param deviceId device id |
| 73 | * @return new ACL flow rule's priority in the given device |
| 74 | */ |
| 75 | int getPriorityByDevice(DeviceId deviceId); |
| 76 | |
| 77 | /** |
| 78 | * 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] | 79 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 80 | * @param ruleId ACL rule id |
| 81 | * @return a set containing all ACL flow rules belonging to the given ACL rule |
| 82 | */ |
| 83 | Set<FlowRule> getFlowByRule(RuleId ruleId); |
| 84 | |
| 85 | /** |
| 86 | * Adds a new mapping from ACL rule to ACL flow rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 87 | * |
| 88 | * @param ruleId ACL rule id |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 89 | * @param flowRule ACL flow rule |
| 90 | */ |
| 91 | void addRuleToFlowMapping(RuleId ruleId, FlowRule flowRule); |
| 92 | |
| 93 | /** |
| 94 | * Removes an existing mapping from ACL rule to ACL flow rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 95 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 96 | * @param ruleId ACL rule id |
| 97 | */ |
| 98 | void removeRuleToFlowMapping(RuleId ruleId); |
| 99 | |
| 100 | /** |
| 101 | * 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] | 102 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 103 | * @param denyingRuleId denying ACL rule id |
| 104 | * @return a list containing all allowing ACL rules matching the given denying ACL rule |
| 105 | */ |
| 106 | List<RuleId> getAllowingRuleByDenyingRule(RuleId denyingRuleId); |
| 107 | |
| 108 | /** |
| 109 | * Adds a new mapping from denying ACL rule to allowing ACL rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 110 | * |
| 111 | * @param denyingRuleId denying ACL rule id |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 112 | * @param allowingRuleId allowing ACL rule id |
| 113 | */ |
| 114 | void addDenyToAllowMapping(RuleId denyingRuleId, RuleId allowingRuleId); |
| 115 | |
| 116 | /** |
| 117 | * Removes an exsiting mapping from denying ACL rule to allowing ACL rule. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 118 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 119 | * @param denyingRuleId denying ACL rule id |
| 120 | */ |
| 121 | void removeDenyToAllowMapping(RuleId denyingRuleId); |
| 122 | |
| 123 | /** |
| 124 | * Checks if an existing ACL rule already works in a given device. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 125 | * |
| 126 | * @param ruleId ACL rule id |
Ray Milkey | c108a6b | 2017-08-23 15:23:50 -0700 | [diff] [blame] | 127 | * @param deviceId device id |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 128 | * @return true if the given ACL rule works in the given device |
| 129 | */ |
| 130 | boolean checkIfRuleWorksInDevice(RuleId ruleId, DeviceId deviceId); |
| 131 | |
| 132 | /** |
| 133 | * Adds a new mapping from ACL rule to device. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 134 | * |
| 135 | * @param ruleId ACL rule id |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 136 | * @param deviceId device id |
| 137 | */ |
| 138 | void addRuleToDeviceMapping(RuleId ruleId, DeviceId deviceId); |
| 139 | |
| 140 | /** |
| 141 | * Removes an existing mapping from ACL rule to device. |
Thomas Vachuska | 9bb3235 | 2015-09-25 11:31:22 -0700 | [diff] [blame] | 142 | * |
Pengfei Lu | e0c02e2 | 2015-07-07 15:41:31 +0800 | [diff] [blame] | 143 | * @param ruleId ACL rule id |
| 144 | */ |
| 145 | void removeRuleToDeviceMapping(RuleId ruleId); |
| 146 | |
| 147 | } |