Bharat saraswal
Committed by Ray Milkey

[ONOS-3116] Flow classifier for service function chain.

Change-Id: Iad6f548c190a96a0b2a79a2bd9b90d0a96f3c179
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
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.
15 + */
16 +package org.onosproject.vtnrsc;
17 +
18 +import org.onlab.packet.IpPrefix;
19 +
20 +/**
21 + * Abstraction of an entity which provides flow classifier for service function chain.
22 + * FlowClassifier classify the traffic based on the criteria defined in the request.
23 + * The classification can be based on port range or source and destination IP address or
24 + * other flow classifier elements.
25 + */
26 +public interface FlowClassifier {
27 +
28 + /**
29 + * Returns flow classifier ID.
30 + *
31 + * @return flow classifier id
32 + */
33 + FlowClassifierId flowClassifierId();
34 +
35 + /**
36 + * Returns Tenant ID.
37 + *
38 + * @return tenant Id
39 + */
40 + TenantId tenantId();
41 +
42 + /**
43 + * Returns flow classifier name.
44 + *
45 + * @return flow classifier name
46 + */
47 + String name();
48 +
49 + /**
50 + * Returns flow classifier description.
51 + *
52 + * @return flow classifier description
53 + */
54 + String description();
55 +
56 + /**
57 + * Returns EtherType.
58 + *
59 + * @return EtherType
60 + */
61 + String etherType();
62 +
63 + /**
64 + * Returns IP Protocol.
65 + *
66 + * @return IP protocol
67 + */
68 + String protocol();
69 +
70 + /**
71 + * Returns minimum source port range.
72 + *
73 + * @return minimum source port range
74 + */
75 + int minSrcPortRange();
76 +
77 + /**
78 + * Returns maximum source port range.
79 + *
80 + * @return maximum source port range
81 + */
82 + int maxSrcPortRange();
83 +
84 + /**
85 + * Returns minimum destination port range.
86 + *
87 + * @return minimum destination port range
88 + */
89 + int minDstPortRange();
90 +
91 + /**
92 + * Returns maximum destination port range.
93 + *
94 + * @return maximum destination port range.
95 + */
96 + int maxDstPortRange();
97 +
98 + /**
99 + * Returns Source IP prefix.
100 + *
101 + * @return Source IP prefix
102 + */
103 + IpPrefix srcIpPrefix();
104 +
105 + /**
106 + * Returns Destination IP prefix.
107 + *
108 + * @return Destination IP prefix
109 + */
110 + IpPrefix dstIpPrefix();
111 +
112 + /**
113 + * Returns Source virtual port.
114 + *
115 + * @return Source virtual port
116 + */
117 + VirtualPortId srcPort();
118 +
119 + /**
120 + * Returns Destination virtual port.
121 + *
122 + * @return Destination virtual port
123 + */
124 + VirtualPortId dstPort();
125 +
126 + /**
127 + * Returns whether this Flow classifier is an exact match to the
128 + * Flow classifier given in the argument.
129 + *
130 + * @param flowClassifier other flowClassifier to match against
131 + * @return true if the flowClassifiers are an exact match, otherwise false
132 + */
133 + boolean exactMatch(FlowClassifier flowClassifier);
134 +
135 + /**
136 + * Builder for flow Classifier.
137 + */
138 + interface Builder {
139 +
140 + /**
141 + * Returns Flow Classifier.
142 + *
143 + * @return flow classifier.
144 + */
145 + FlowClassifier build();
146 +
147 + /**
148 + * Sets Flow Classifier ID.
149 + *
150 + * @param flowClassifierId flow classifier id.
151 + * @return Builder object by setting flow classifier Id.
152 + */
153 + Builder setFlowClassifierId(FlowClassifierId flowClassifierId);
154 +
155 + /**
156 + * Sets Tenant ID.
157 + *
158 + * @param tenantId tenant id.
159 + * @return Builder object by setting Tenant ID.
160 + */
161 + Builder setTenantId(TenantId tenantId);
162 +
163 + /**
164 + * Sets Flow classifier name.
165 + *
166 + * @param name flow classifier name
167 + * @return builder object by setting flow classifier name
168 + */
169 + Builder setName(String name);
170 +
171 + /**
172 + * Sets flow classifier description.
173 + *
174 + * @param description flow classifier description
175 + * @return flow classifier description
176 + */
177 + Builder setDescription(String description);
178 +
179 + /**
180 + * Sets EtherType.
181 + *
182 + * @param etherType EtherType
183 + * @return EtherType
184 + */
185 + Builder setEtherType(String etherType);
186 +
187 + /**
188 + * Sets IP protocol.
189 + *
190 + * @param protocol IP protocol
191 + * @return builder object by setting IP protocol
192 + */
193 + Builder setProtocol(String protocol);
194 +
195 + /**
196 + * Set minimum source port range.
197 + *
198 + * @param minRange minimum source port range
199 + * @return builder object by setting minimum source port range
200 + */
201 + Builder setMinSrcPortRange(int minRange);
202 +
203 + /**
204 + * Sets maximum source port range.
205 + *
206 + * @param maxRange maximum source port range
207 + * @return builder object by setting maximum source port range
208 + */
209 + Builder setMaxSrcPortRange(int maxRange);
210 +
211 + /**
212 + * Sets minimum destination port range.
213 + *
214 + * @param minRange minimum destination port range
215 + * @return builder object by setting minimum destination port range
216 + */
217 + Builder setMinDstPortRange(int minRange);
218 +
219 + /**
220 + * Sets maximum destination port range.
221 + *
222 + * @param maxRange maximum destination port range.
223 + * @return builder object by setting maximum destination port range.
224 + */
225 + Builder setMaxDstPortRange(int maxRange);
226 +
227 + /**
228 + * Sets Source IP prefix.
229 + *
230 + * @param srcIpPrefix Source IP prefix
231 + * @return builder object by setting Source IP prefix
232 + */
233 + Builder setSrcIpPrefix(IpPrefix srcIpPrefix);
234 +
235 + /**
236 + * Sets Destination IP prefix.
237 + *
238 + * @param dstIpPrefix Destination IP prefix
239 + * @return builder object by setting Destination IP prefix
240 + */
241 + Builder setDstIpPrefix(IpPrefix dstIpPrefix);
242 +
243 + /**
244 + * Sets Source virtual port.
245 + *
246 + * @param srcPort Source virtual port
247 + * @return builder object by setting Source virtual port
248 + */
249 + Builder setSrcPort(VirtualPortId srcPort);
250 +
251 + /**
252 + * Sets Destination virtual port.
253 + *
254 + * @param dstPort Destination virtual port
255 + * @return builder object by setting Destination virtual port
256 + */
257 + Builder setDstPort(VirtualPortId dstPort);
258 + }
259 +}