blob: 88e49a73263531ba238df95608338f703044b6f4 [file] [log] [blame]
Pengfei Lue0c02e22015-07-07 15:41:31 +08001/*
2 * Copyright 2015 Open Networking Laboratory
3 * 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 */
20package org.onos.acl;
21
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.
36 * @return a list containing all ACL rules
37 */
38 List<AclRule> getAclRules();
39
40 /**
41 * Adds a new ACL rule.
42 * @param rule new ACL rule
43 */
44 void addAclRule(AclRule rule);
45
46 /**
47 * Gets an existing ACL rule.
48 * @param ruleId ACL rule id
49 * @return ACL rule with the given id
50 */
51 AclRule getAclRule(RuleId ruleId);
52
53 /**
54 * Removes an existing ACL rule by rule id.
55 * @param ruleId ACL rule id
56 */
57 void removeAclRule(RuleId ruleId);
58
59 /**
60 * Clears ACL and reset all.
61 */
62 void clearAcl();
63
64 /**
65 * Gets the current priority for new ACL flow rule by device id.
66 * @param deviceId device id
67 * @return new ACL flow rule's priority in the given device
68 */
69 int getPriorityByDevice(DeviceId deviceId);
70
71 /**
72 * Gets a set containing all ACL flow rules belonging to a given ACL rule.
73 * @param ruleId ACL rule id
74 * @return a set containing all ACL flow rules belonging to the given ACL rule
75 */
76 Set<FlowRule> getFlowByRule(RuleId ruleId);
77
78 /**
79 * Adds a new mapping from ACL rule to ACL flow rule.
80 * @param ruleId ACL rule id
81 * @param flowRule ACL flow rule
82 */
83 void addRuleToFlowMapping(RuleId ruleId, FlowRule flowRule);
84
85 /**
86 * Removes an existing mapping from ACL rule to ACL flow rule.
87 * @param ruleId ACL rule id
88 */
89 void removeRuleToFlowMapping(RuleId ruleId);
90
91 /**
92 * Gets a list containing all allowing ACL rules matching a given denying ACL rule.
93 * @param denyingRuleId denying ACL rule id
94 * @return a list containing all allowing ACL rules matching the given denying ACL rule
95 */
96 List<RuleId> getAllowingRuleByDenyingRule(RuleId denyingRuleId);
97
98 /**
99 * Adds a new mapping from denying ACL rule to allowing ACL rule.
100 * @param denyingRuleId denying ACL rule id
101 * @param allowingRuleId allowing ACL rule id
102 */
103 void addDenyToAllowMapping(RuleId denyingRuleId, RuleId allowingRuleId);
104
105 /**
106 * Removes an exsiting mapping from denying ACL rule to allowing ACL rule.
107 * @param denyingRuleId denying ACL rule id
108 */
109 void removeDenyToAllowMapping(RuleId denyingRuleId);
110
111 /**
112 * Checks if an existing ACL rule already works in a given device.
113 * @param ruleId ACL rule id
114 * @param deviceId devide id
115 * @return true if the given ACL rule works in the given device
116 */
117 boolean checkIfRuleWorksInDevice(RuleId ruleId, DeviceId deviceId);
118
119 /**
120 * Adds a new mapping from ACL rule to device.
121 * @param ruleId ACL rule id
122 * @param deviceId device id
123 */
124 void addRuleToDeviceMapping(RuleId ruleId, DeviceId deviceId);
125
126 /**
127 * Removes an existing mapping from ACL rule to device.
128 * @param ruleId ACL rule id
129 */
130 void removeRuleToDeviceMapping(RuleId ruleId);
131
132}