blob: c431c7a0efe01c44398aca77179e420163889488 [file] [log] [blame]
Phaneendra Manda1ea49142015-10-26 22:33:06 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Phaneendra Manda1ea49142015-10-26 22:33:06 +05303 *
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.
15 */
16package org.onosproject.vtnrsc;
17
18import java.util.List;
Phaneendra Manda329a1272016-02-10 22:57:00 +053019import java.util.Set;
Phaneendra Manda1ea49142015-10-26 22:33:06 +053020
Phaneendra Mandaab7fdfa2016-04-19 01:24:09 +053021import org.onosproject.net.DeviceId;
22
Phaneendra Manda1ea49142015-10-26 22:33:06 +053023/**
24 * Abstraction of an entity providing Port Chain information.
25 * A Port Chain (Service Function Path) consists of
26 * a set of Neutron ports, to define the sequence of service functions
27 * a set of flow classifiers, to specify the classified traffic flows to enter the chain
28 */
29public interface PortChain {
30
31 /**
32 * Returns the ID of this port chain.
33 *
34 * @return the port chain id
35 */
36 PortChainId portChainId();
37
38 /**
39 * Returns the tenant id of this port chain.
40 *
41 * @return the tenant id
42 */
43 TenantId tenantId();
44
45 /**
46 * Returns the name of this port chain.
47 *
48 * @return name of port chain
49 */
50 String name();
51
52 /**
53 * Returns the description of this port chain.
54 *
55 * @return description of port chain
56 */
57 String description();
58
59 /**
60 * Returns the list of port pair groups associated with
61 * this port chain.
62 *
63 * @return list of port pair groups
64 */
65 List<PortPairGroupId> portPairGroups();
66
67 /**
68 * Returns the list of flow classifiers associated with
69 * this port chain.
70 *
71 * @return list of flow classifiers
72 */
73 List<FlowClassifierId> flowClassifiers();
74
75 /**
Phaneendra Manda8db7d092016-06-04 00:17:24 +053076 * Returns the old port chain.
77 *
78 * @return old port chain
79 */
80 PortChain oldPortChain();
81
82 /**
Phaneendra Manda329a1272016-02-10 22:57:00 +053083 * Adds a new load balanced path.
84 *
85 * @param fiveTuple five tuple from the packet
86 * @param id load balance path identifier
87 * @param path load balanced path of list of port pairs
88 */
89 void addLoadBalancePath(FiveTuple fiveTuple, LoadBalanceId id,
90 List<PortPairId> path);
91
92 /**
Phaneendra Mandaab7fdfa2016-04-19 01:24:09 +053093 * Adds sfc classifiers to the given load balance id for a port chain.
94 *
95 * @param id load balance path identifier
96 * @param classifierList list of classifier devices
97 */
98 void addSfcClassifiers(LoadBalanceId id, List<DeviceId> classifierList);
99
100 /**
101 * Adds sfc forwarders to the given load balance id for a port chain.
102 *
103 * @param id load balance path identifier
104 * @param forwarderList list of forwarder devices
105 */
106 void addSfcForwarders(LoadBalanceId id, List<DeviceId> forwarderList);
107
108 /**
109 * Removes sfc classifiers to the given load balance id for a port chain.
110 *
111 * @param id load balance path identifier
112 * @param classifierList list of classifier devices
113 */
114 void removeSfcClassifiers(LoadBalanceId id, List<DeviceId> classifierList);
115
116 /**
117 * Removes sfc forwarders to the given load balance id for a port chain.
118 *
119 * @param id load balance path identifier
120 * @param forwarderList list of forwarder devices
121 */
122 void removeSfcForwarders(LoadBalanceId id, List<DeviceId> forwarderList);
123
124 /**
125 * Returns sfc classifiers to the given load balance id for a port chain.
126 *
127 * @param id load balance path identifier
128 * @return list of classifier devices
129 */
130 List<DeviceId> getSfcClassifiers(LoadBalanceId id);
131
132 /**
133 * Returns sfc forwarders to the given load balance id for a port chain.
134 *
135 * @param id load balance path identifier
136 * @return list of forwarder devices
137 */
138 List<DeviceId> getSfcForwarders(LoadBalanceId id);
139
140 /**
141 * Returns the load balance id from five tuple.
Phaneendra Manda329a1272016-02-10 22:57:00 +0530142 *
143 * @param fiveTuple five tuple from the packet
144 * @return load balance identifier for the given packet
145 */
146 LoadBalanceId getLoadBalanceId(FiveTuple fiveTuple);
147
148 /**
Phaneendra Mandaab7fdfa2016-04-19 01:24:09 +0530149 * Returns the keys set from load balance id map.
Phaneendra Manda329a1272016-02-10 22:57:00 +0530150 *
151 * @return set of five tuple info
152 */
153 Set<FiveTuple> getLoadBalanceIdMapKeys();
154
155 /**
Phaneendra Mandaab7fdfa2016-04-19 01:24:09 +0530156 * Returns the keys set from load balance path map.
157 *
158 * @return set of load balance id's
159 */
160 Set<LoadBalanceId> getLoadBalancePathMapKeys();
161
162 /**
163 * Returns the load balanced path from load balance Id.
Phaneendra Manda329a1272016-02-10 22:57:00 +0530164 *
165 * @param id load balance id.
166 * @return path containing list of port pairs
167 */
168 List<PortPairId> getLoadBalancePath(LoadBalanceId id);
169
170 /**
Phaneendra Mandaab7fdfa2016-04-19 01:24:09 +0530171 * Returns the load balanced path from five tuple.
Phaneendra Manda329a1272016-02-10 22:57:00 +0530172 *
173 * @param fiveTuple five tuple from the packet
174 * @return path containing list of port pairs
175 */
176 List<PortPairId> getLoadBalancePath(FiveTuple fiveTuple);
177
178 /**
Phaneendra Mandaab7fdfa2016-04-19 01:24:09 +0530179 * Returns the no of load balance paths created.
Phaneendra Manda275ff0c2016-02-25 11:50:24 +0530180 *
181 * @return size of load balanced paths
182 */
183 int getLoadBalancePathSize();
184
185 /**
Phaneendra Manda329a1272016-02-10 22:57:00 +0530186 * Match the given path with existing load balanced paths.
187 *
188 * @param path load balanced path
189 * @return load balance id if the path matches, null otherwise.
190 */
Phaneendra Manda8db7d092016-06-04 00:17:24 +0530191 LoadBalanceId matchPath(List<PortPairId> path);
Phaneendra Manda329a1272016-02-10 22:57:00 +0530192
193 /**
Phaneendra Manda1ea49142015-10-26 22:33:06 +0530194 * Returns whether this port chain is an exact match to the port chain given
195 * in the argument.
196 * <p>
197 * Exact match means the port pair groups and flow classifiers match
198 * with the given port chain. It does not consider the port chain id, name
199 * and description.
200 * </p>
201 *
202 * @param portChain other port chain to match against
203 * @return true if the port chains are an exact match, otherwise false
204 */
205 boolean exactMatch(PortChain portChain);
206
207 /**
208 * A port chain builder..
209 */
210 interface Builder {
211
212 /**
213 * Assigns the port chain id to this object.
214 *
215 * @param portChainId the port chain id
216 * @return this the builder object
217 */
218 Builder setId(PortChainId portChainId);
219
220 /**
221 * Assigns tenant id to this object.
222 *
223 * @param tenantId tenant id of the port chain
224 * @return this the builder object
225 */
226 Builder setTenantId(TenantId tenantId);
227
228 /**
229 * Assigns the name to this object.
230 *
231 * @param name name of the port chain
232 * @return this the builder object
233 */
234 Builder setName(String name);
235
236 /**
237 * Assigns the description to this object.
238 *
239 * @param description description of the port chain
240 * @return this the builder object
241 */
242 Builder setDescription(String description);
243
244 /**
245 * Assigns the port pair groups associated with the port chain
246 * to this object.
247 *
248 * @param portPairGroups list of port pair groups
249 * @return this the builder object
250 */
251 Builder setPortPairGroups(List<PortPairGroupId> portPairGroups);
252
253 /**
254 * Assigns the flow classifiers associated with the port chain
255 * to this object.
256 *
257 * @param flowClassifiers list of flow classifiers
258 * @return this the builder object
259 */
260 Builder setFlowClassifiers(List<FlowClassifierId> flowClassifiers);
261
262 /**
263 * Builds a port chain object.
264 *
265 * @return a port chain.
266 */
267 PortChain build();
268 }
269}