blob: 67dc1698f04689b4378a0b39fa4d99a9b4b24faf [file] [log] [blame]
Pengfei Lue0c02e22015-07-07 15:41:31 +08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Pengfei Lue0c02e22015-07-07 15:41:31 +08003 * Originally created by Pengfei Lu, Network and Cloud Computing Laboratory, Dalian University of Technology, China
Pengfei Lue53419b2015-08-29 10:11:02 +08004 * Advisers: Keqiu Li, Heng Qi and Haisheng Yu
Pengfei Lue0c02e22015-07-07 15:41:31 +08005 * 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 Vachuska9bb32352015-09-25 11:31:22 -070020package org.onosproject.acl;
Pengfei Lue0c02e22015-07-07 15:41:31 +080021
22import org.onosproject.net.DeviceId;
23import org.onosproject.net.flow.FlowRule;
24import org.onosproject.store.Store;
25
26import java.util.List;
27import java.util.Set;
28
29/**
30 * Service interface exported by ACL distributed store.
31 */
32public interface AclStore extends Store {
33
34 /**
35 * Gets a list containing all ACL rules.
Thomas Vachuska9bb32352015-09-25 11:31:22 -070036 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080037 * @return a list containing all ACL rules
38 */
39 List<AclRule> getAclRules();
40
41 /**
42 * Adds a new ACL rule.
Thomas Vachuska9bb32352015-09-25 11:31:22 -070043 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080044 * @param rule new ACL rule
45 */
46 void addAclRule(AclRule rule);
47
48 /**
49 * Gets an existing ACL rule.
Thomas Vachuska9bb32352015-09-25 11:31:22 -070050 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080051 * @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 Vachuska9bb32352015-09-25 11:31:22 -070058 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080059 * @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 Vachuska9bb32352015-09-25 11:31:22 -070070 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080071 * @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 Vachuska9bb32352015-09-25 11:31:22 -070078 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080079 * @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 Vachuska9bb32352015-09-25 11:31:22 -070086 *
87 * @param ruleId ACL rule id
Pengfei Lue0c02e22015-07-07 15:41:31 +080088 * @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 Vachuska9bb32352015-09-25 11:31:22 -070094 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080095 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700101 *
Pengfei Lue0c02e22015-07-07 15:41:31 +0800102 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700109 *
110 * @param denyingRuleId denying ACL rule id
Pengfei Lue0c02e22015-07-07 15:41:31 +0800111 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700117 *
Pengfei Lue0c02e22015-07-07 15:41:31 +0800118 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700124 *
125 * @param ruleId ACL rule id
Pengfei Lue0c02e22015-07-07 15:41:31 +0800126 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700133 *
134 * @param ruleId ACL rule id
Pengfei Lue0c02e22015-07-07 15:41:31 +0800135 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700141 *
Pengfei Lue0c02e22015-07-07 15:41:31 +0800142 * @param ruleId ACL rule id
143 */
144 void removeRuleToDeviceMapping(RuleId ruleId);
145
146}