blob: 80c5c03bc772fe0286021e5377f870c26984fe80 [file] [log] [blame]
Pengfei Lue0c02e22015-07-07 15:41:31 +08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Pengfei Lue0c02e22015-07-07 15:41:31 +08003 *
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 Milkey85267002016-11-16 11:06:35 -080015 *
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 Lue0c02e22015-07-07 15:41:31 +080020 */
Thomas Vachuska9bb32352015-09-25 11:31:22 -070021package org.onosproject.acl;
Pengfei Lue0c02e22015-07-07 15:41:31 +080022
23import org.onosproject.net.DeviceId;
24import org.onosproject.net.flow.FlowRule;
25import org.onosproject.store.Store;
26
27import java.util.List;
28import java.util.Set;
29
30/**
31 * Service interface exported by ACL distributed store.
32 */
33public interface AclStore extends Store {
34
35 /**
36 * Gets a list containing all ACL rules.
Thomas Vachuska9bb32352015-09-25 11:31:22 -070037 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080038 * @return a list containing all ACL rules
39 */
40 List<AclRule> getAclRules();
41
42 /**
43 * Adds a new ACL rule.
Thomas Vachuska9bb32352015-09-25 11:31:22 -070044 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080045 * @param rule new ACL rule
46 */
47 void addAclRule(AclRule rule);
48
49 /**
50 * Gets an existing ACL rule.
Thomas Vachuska9bb32352015-09-25 11:31:22 -070051 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080052 * @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 Vachuska9bb32352015-09-25 11:31:22 -070059 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080060 * @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 Vachuska9bb32352015-09-25 11:31:22 -070071 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080072 * @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 Vachuska9bb32352015-09-25 11:31:22 -070079 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080080 * @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 Vachuska9bb32352015-09-25 11:31:22 -070087 *
88 * @param ruleId ACL rule id
Pengfei Lue0c02e22015-07-07 15:41:31 +080089 * @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 Vachuska9bb32352015-09-25 11:31:22 -070095 *
Pengfei Lue0c02e22015-07-07 15:41:31 +080096 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700102 *
Pengfei Lue0c02e22015-07-07 15:41:31 +0800103 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700110 *
111 * @param denyingRuleId denying ACL rule id
Pengfei Lue0c02e22015-07-07 15:41:31 +0800112 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700118 *
Pengfei Lue0c02e22015-07-07 15:41:31 +0800119 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700125 *
126 * @param ruleId ACL rule id
Pengfei Lue0c02e22015-07-07 15:41:31 +0800127 * @param deviceId devide id
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 Vachuska9bb32352015-09-25 11:31:22 -0700134 *
135 * @param ruleId ACL rule id
Pengfei Lue0c02e22015-07-07 15:41:31 +0800136 * @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 Vachuska9bb32352015-09-25 11:31:22 -0700142 *
Pengfei Lue0c02e22015-07-07 15:41:31 +0800143 * @param ruleId ACL rule id
144 */
145 void removeRuleToDeviceMapping(RuleId ruleId);
146
147}