blob: ae940bdc232fe217650197ac4c4bfefbc6a02127 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska83e090e2014-10-22 14:25:35 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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
Thomas Vachuska83e090e2014-10-22 14:25:35 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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.
Thomas Vachuska83e090e2014-10-22 14:25:35 -070015 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.flow.criteria;
tom8bb16062014-09-12 14:47:46 -070017
alshabibcaf1ca22015-06-25 15:18:16 -070018import org.onlab.packet.EthType;
Hyunsun Mooncf732fb2015-08-22 21:04:23 -070019import org.onlab.packet.Ip6Address;
20import org.onlab.packet.IpPrefix;
21import org.onlab.packet.MacAddress;
22import org.onlab.packet.MplsLabel;
23import org.onlab.packet.TpPort;
24import org.onlab.packet.VlanId;
Sho SHIMIZUefc2e282015-05-04 15:26:23 -070025import org.onosproject.net.IndexedLambda;
Sho SHIMIZU084c4ca2015-05-04 11:52:51 -070026import org.onosproject.net.Lambda;
27import org.onosproject.net.OchSignal;
Yafit Hadar52d81552015-10-07 12:26:52 +030028import org.onosproject.net.OduSignalId;
29import org.onosproject.net.OduSignalType;
Brian O'Connorabafb502014-12-02 22:26:20 -080030import org.onosproject.net.PortNumber;
31import org.onosproject.net.flow.criteria.Criterion.Type;
Sho SHIMIZU585bed92015-05-13 11:08:45 -070032import org.onosproject.net.OchSignalType;
alshabib7b795492014-09-16 14:38:39 -070033
tom8bb16062014-09-12 14:47:46 -070034/**
35 * Factory class to create various traffic selection criteria.
36 */
37public final class Criteria {
38
alshabib7b795492014-09-16 14:38:39 -070039 //TODO: incomplete type implementation. Need to implement complete list from Criterion
40
tom8bb16062014-09-12 14:47:46 -070041 // Ban construction
42 private Criteria() {
43 }
44
45 /**
alshabib7b795492014-09-16 14:38:39 -070046 * Creates a match on IN_PORT field using the specified value.
47 *
48 * @param port inport value
49 * @return match criterion
50 */
51 public static Criterion matchInPort(PortNumber port) {
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -080052 return new PortCriterion(port, Type.IN_PORT);
53 }
54
55 /**
56 * Creates a match on IN_PHY_PORT field using the specified value.
57 *
58 * @param port inport value
59 * @return match criterion
60 */
61 public static Criterion matchInPhyPort(PortNumber port) {
62 return new PortCriterion(port, Type.IN_PHY_PORT);
63 }
64
65 /**
66 * Creates a match on METADATA field using the specified value.
67 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -080068 * @param metadata metadata value (64 bits data)
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -080069 * @return match criterion
70 */
Pavlin Radoslavov5e4f7542015-02-06 18:18:21 -080071 public static Criterion matchMetadata(long metadata) {
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -080072 return new MetadataCriterion(metadata);
alshabib7b795492014-09-16 14:38:39 -070073 }
74
75 /**
alshabib369d2942014-09-12 17:59:35 -070076 * Creates a match on ETH_DST field using the specified value. This value
77 * may be a wildcard mask.
78 *
tomc104d282014-09-19 10:57:55 -070079 * @param mac MAC address value or wildcard mask
alshabib369d2942014-09-12 17:59:35 -070080 * @return match criterion
81 */
Ayaka Koshibea9c199f2014-09-16 16:21:40 -070082 public static Criterion matchEthDst(MacAddress mac) {
alshabib7b795492014-09-16 14:38:39 -070083 return new EthCriterion(mac, Type.ETH_DST);
84 }
85
86 /**
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080087 * Creates a match on ETH_SRC field using the specified value. This value
88 * may be a wildcard mask.
89 *
90 * @param mac MAC address value or wildcard mask
91 * @return match criterion
92 */
93 public static Criterion matchEthSrc(MacAddress mac) {
94 return new EthCriterion(mac, Type.ETH_SRC);
95 }
96
97 /**
alshabib7b795492014-09-16 14:38:39 -070098 * Creates a match on ETH_TYPE field using the specified value.
99 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800100 * @param ethType eth type value (16 bits unsigned integer)
alshabib7b795492014-09-16 14:38:39 -0700101 * @return match criterion
102 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800103 public static Criterion matchEthType(int ethType) {
alshabib7b795492014-09-16 14:38:39 -0700104 return new EthTypeCriterion(ethType);
105 }
106
107 /**
alshabibcaf1ca22015-06-25 15:18:16 -0700108 * Creates a match on ETH_TYPE field using the specified value.
109 *
110 * @param ethType eth type value
111 * @return match criterion
112 */
113 public static Criterion matchEthType(EthType ethType) {
114 return new EthTypeCriterion(ethType);
115 }
116
117 /**
alshabib7b795492014-09-16 14:38:39 -0700118 * Creates a match on VLAN ID field using the specified value.
119 *
120 * @param vlanId vlan id value
121 * @return match criterion
122 */
Ayaka Koshibea9c199f2014-09-16 16:21:40 -0700123 public static Criterion matchVlanId(VlanId vlanId) {
alshabib7b795492014-09-16 14:38:39 -0700124 return new VlanIdCriterion(vlanId);
125 }
126
127 /**
128 * Creates a match on VLAN PCP field using the specified value.
129 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800130 * @param vlanPcp vlan pcp value (3 bits)
alshabib7b795492014-09-16 14:38:39 -0700131 * @return match criterion
132 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800133 public static Criterion matchVlanPcp(byte vlanPcp) {
alshabib7b795492014-09-16 14:38:39 -0700134 return new VlanPcpCriterion(vlanPcp);
135 }
136
137 /**
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800138 * Creates a match on IP DSCP field using the specified value.
139 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800140 * @param ipDscp ip dscp value (6 bits)
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800141 * @return match criterion
142 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800143 public static Criterion matchIPDscp(byte ipDscp) {
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800144 return new IPDscpCriterion(ipDscp);
145 }
146
147 /**
148 * Creates a match on IP ECN field using the specified value.
149 *
Pavlin Radoslavovab8553a2015-02-20 14:13:50 -0800150 * @param ipEcn ip ecn value (2 bits)
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800151 * @return match criterion
152 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800153 public static Criterion matchIPEcn(byte ipEcn) {
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800154 return new IPEcnCriterion(ipEcn);
155 }
156
157 /**
alshabib7b795492014-09-16 14:38:39 -0700158 * Creates a match on IP proto field using the specified value.
159 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800160 * @param proto ip protocol value (8 bits unsigned integer)
alshabib7b795492014-09-16 14:38:39 -0700161 * @return match criterion
162 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800163 public static Criterion matchIPProtocol(short proto) {
alshabib7b795492014-09-16 14:38:39 -0700164 return new IPProtocolCriterion(proto);
165 }
166
167 /**
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800168 * Creates a match on IPv4 source field using the specified value.
alshabib7b795492014-09-16 14:38:39 -0700169 *
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800170 * @param ip ipv4 source value
alshabib7b795492014-09-16 14:38:39 -0700171 * @return match criterion
172 */
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -0700173 public static Criterion matchIPSrc(IpPrefix ip) {
alshabib7b795492014-09-16 14:38:39 -0700174 return new IPCriterion(ip, Type.IPV4_SRC);
175 }
176
177 /**
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800178 * Creates a match on IPv4 destination field using the specified value.
alshabib7b795492014-09-16 14:38:39 -0700179 *
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800180 * @param ip ipv4 source value
alshabib7b795492014-09-16 14:38:39 -0700181 * @return match criterion
182 */
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -0700183 public static Criterion matchIPDst(IpPrefix ip) {
alshabib7b795492014-09-16 14:38:39 -0700184 return new IPCriterion(ip, Type.IPV4_DST);
alshabib369d2942014-09-12 17:59:35 -0700185 }
186
Toshio Koide9c44c9a2014-10-09 11:44:36 -0700187 /**
188 * Creates a match on TCP source port field using the specified value.
189 *
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700190 * @param tcpPort TCP source port
191 * @return match criterion
192 * @deprecated in Drake release
193 */
194 @Deprecated
195 public static Criterion matchTcpSrc(short tcpPort) {
196 return new TcpPortCriterion(TpPort.tpPort(tcpPort), Type.TCP_SRC);
197 }
198
199 /**
200 * Creates a match on TCP source port field using the specified value.
201 *
202 * @param tcpPort TCP source port
Toshio Koide9c44c9a2014-10-09 11:44:36 -0700203 * @return match criterion
204 */
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700205 public static Criterion matchTcpSrc(TpPort tcpPort) {
Toshio Koide9c44c9a2014-10-09 11:44:36 -0700206 return new TcpPortCriterion(tcpPort, Type.TCP_SRC);
207 }
208
209 /**
210 * Creates a match on TCP destination port field using the specified value.
211 *
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700212 * @param tcpPort TCP destination port
213 * @return match criterion
214 * @deprecated in Drake release
215 */
216 @Deprecated
217 public static Criterion matchTcpDst(short tcpPort) {
218 return new TcpPortCriterion(TpPort.tpPort(tcpPort), Type.TCP_DST);
219 }
220
221 /**
222 * Creates a match on TCP destination port field using the specified value.
223 *
224 * @param tcpPort TCP destination port
Toshio Koide9c44c9a2014-10-09 11:44:36 -0700225 * @return match criterion
226 */
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700227 public static Criterion matchTcpDst(TpPort tcpPort) {
Toshio Koide9c44c9a2014-10-09 11:44:36 -0700228 return new TcpPortCriterion(tcpPort, Type.TCP_DST);
229 }
alshabib369d2942014-09-12 17:59:35 -0700230
Marc De Leenheer49087752014-10-23 13:54:09 -0700231 /**
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800232 * Creates a match on UDP source port field using the specified value.
233 *
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700234 * @param udpPort UDP source port
235 * @return match criterion
236 * @deprecated in Drake release
237 */
238 @Deprecated
239 public static Criterion matchUdpSrc(short udpPort) {
240 return new UdpPortCriterion(TpPort.tpPort(udpPort), Type.UDP_SRC);
241 }
242
243 /**
244 * Creates a match on UDP source port field using the specified value.
245 *
246 * @param udpPort UDP source port
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800247 * @return match criterion
248 */
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700249 public static Criterion matchUdpSrc(TpPort udpPort) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800250 return new UdpPortCriterion(udpPort, Type.UDP_SRC);
251 }
252
253 /**
254 * Creates a match on UDP destination port field using the specified value.
255 *
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700256 * @param udpPort UDP destination port
257 * @return match criterion
258 * @deprecated in Drake release
259 */
260 @Deprecated
261 public static Criterion matchUdpDst(short udpPort) {
262 return new UdpPortCriterion(TpPort.tpPort(udpPort), Type.UDP_DST);
263 }
264
265 /**
266 * Creates a match on UDP destination port field using the specified value.
267 *
268 * @param udpPort UDP destination port
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800269 * @return match criterion
270 */
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700271 public static Criterion matchUdpDst(TpPort udpPort) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800272 return new UdpPortCriterion(udpPort, Type.UDP_DST);
273 }
274
275 /**
276 * Creates a match on SCTP source port field using the specified value.
277 *
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700278 * @param sctpPort SCTP source port
279 * @return match criterion
280 * @deprecated in Drake release
281 */
282 @Deprecated
283 public static Criterion matchSctpSrc(short sctpPort) {
284 return new SctpPortCriterion(TpPort.tpPort(sctpPort), Type.SCTP_SRC);
285 }
286
287 /**
288 * Creates a match on SCTP source port field using the specified value.
289 *
290 * @param sctpPort SCTP source port
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800291 * @return match criterion
292 */
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700293 public static Criterion matchSctpSrc(TpPort sctpPort) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800294 return new SctpPortCriterion(sctpPort, Type.SCTP_SRC);
295 }
296
297 /**
298 * Creates a match on SCTP destination port field using the specified
299 * value.
300 *
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700301 * @param sctpPort SCTP destination port
302 * @return match criterion
303 * @deprecated in Drake release
304 */
305 @Deprecated
306 public static Criterion matchSctpDst(short sctpPort) {
307 return new SctpPortCriterion(TpPort.tpPort(sctpPort), Type.SCTP_DST);
308 }
309
310 /**
311 * Creates a match on SCTP destination port field using the specified
312 * value.
313 *
314 * @param sctpPort SCTP destination port
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800315 * @return match criterion
316 */
Hyunsun Mooncf732fb2015-08-22 21:04:23 -0700317 public static Criterion matchSctpDst(TpPort sctpPort) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800318 return new SctpPortCriterion(sctpPort, Type.SCTP_DST);
319 }
320
321 /**
322 * Creates a match on ICMP type field using the specified value.
323 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800324 * @param icmpType ICMP type (8 bits unsigned integer)
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800325 * @return match criterion
326 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800327 public static Criterion matchIcmpType(short icmpType) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800328 return new IcmpTypeCriterion(icmpType);
329 }
330
331 /**
332 * Creates a match on ICMP code field using the specified value.
333 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800334 * @param icmpCode ICMP code (8 bits unsigned integer)
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800335 * @return match criterion
336 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800337 public static Criterion matchIcmpCode(short icmpCode) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800338 return new IcmpCodeCriterion(icmpCode);
339 }
340
341 /**
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800342 * Creates a match on IPv6 source field using the specified value.
343 *
344 * @param ip ipv6 source value
345 * @return match criterion
346 */
347 public static Criterion matchIPv6Src(IpPrefix ip) {
348 return new IPCriterion(ip, Type.IPV6_SRC);
349 }
350
351 /**
352 * Creates a match on IPv6 destination field using the specified value.
353 *
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800354 * @param ip ipv6 destination value
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800355 * @return match criterion
356 */
357 public static Criterion matchIPv6Dst(IpPrefix ip) {
358 return new IPCriterion(ip, Type.IPV6_DST);
359 }
360
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800361 /**
362 * Creates a match on IPv6 flow label field using the specified value.
363 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800364 * @param flowLabel IPv6 flow label (20 bits)
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800365 * @return match criterion
366 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800367 public static Criterion matchIPv6FlowLabel(int flowLabel) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800368 return new IPv6FlowLabelCriterion(flowLabel);
369 }
370
371 /**
Kunihiro Ishiguro0f9aba82015-01-15 17:14:17 -0800372 * Creates a match on ICMPv6 type field using the specified value.
373 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800374 * @param icmpv6Type ICMPv6 type (8 bits unsigned integer)
Kunihiro Ishiguro0f9aba82015-01-15 17:14:17 -0800375 * @return match criterion
376 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800377 public static Criterion matchIcmpv6Type(short icmpv6Type) {
Kunihiro Ishiguro0f9aba82015-01-15 17:14:17 -0800378 return new Icmpv6TypeCriterion(icmpv6Type);
379 }
380
381 /**
382 * Creates a match on ICMPv6 code field using the specified value.
383 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800384 * @param icmpv6Code ICMPv6 code (8 bits unsigned integer)
Kunihiro Ishiguro0f9aba82015-01-15 17:14:17 -0800385 * @return match criterion
386 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800387 public static Criterion matchIcmpv6Code(short icmpv6Code) {
Kunihiro Ishiguro0f9aba82015-01-15 17:14:17 -0800388 return new Icmpv6CodeCriterion(icmpv6Code);
389 }
390
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800391 /**
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800392 * Creates a match on IPv6 Neighbor Discovery target address using the
393 * specified value.
394 *
395 * @param targetAddress IPv6 Neighbor Discovery target address
396 * @return match criterion
397 */
398 public static Criterion matchIPv6NDTargetAddress(Ip6Address targetAddress) {
399 return new IPv6NDTargetAddressCriterion(targetAddress);
400 }
401
402 /**
403 * Creates a match on IPv6 Neighbor Discovery source link-layer address
404 * using the specified value.
405 *
406 * @param mac IPv6 Neighbor Discovery source link-layer address
407 * @return match criterion
408 */
409 public static Criterion matchIPv6NDSourceLinkLayerAddress(MacAddress mac) {
410 return new IPv6NDLinkLayerAddressCriterion(mac, Type.IPV6_ND_SLL);
411 }
412
413 /**
414 * Creates a match on IPv6 Neighbor Discovery target link-layer address
415 * using the specified value.
416 *
417 * @param mac IPv6 Neighbor Discovery target link-layer address
418 * @return match criterion
419 */
420 public static Criterion matchIPv6NDTargetLinkLayerAddress(MacAddress mac) {
421 return new IPv6NDLinkLayerAddressCriterion(mac, Type.IPV6_ND_TLL);
422 }
423
424 /**
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800425 * Creates a match on MPLS label.
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800426 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800427 * @param mplsLabel MPLS label (20 bits)
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800428 * @return match criterion
429 */
Michele Santuari4b6019e2014-12-19 11:31:45 +0100430 public static Criterion matchMplsLabel(MplsLabel mplsLabel) {
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800431 return new MplsCriterion(mplsLabel);
432 }
433
434 /**
Saurav Dasffc5bbc2015-08-18 23:30:19 -0700435 * Creates a match on MPLS Bottom-of-Stack indicator bit.
436 *
437 * @param mplsBos boolean value indicating true (BOS=1) or false (BOS=0)
438 * @return match criterion
439 */
440 public static Criterion matchMplsLabel(boolean mplsBos) {
441 return new MplsBosCriterion(mplsBos);
442 }
443
444 /**
Hyunsun Moona08c5d02015-07-14 17:53:00 -0700445 * Creates a match on Tunnel ID.
446 *
447 * @param tunnelId Tunnel ID (64 bits)
448 * @return match criterion
449 */
450 public static Criterion matchTunnelId(long tunnelId) {
451 return new TunnelIdCriterion(tunnelId);
452 }
453
454 /**
Pavlin Radoslavov5e4f7542015-02-06 18:18:21 -0800455 * Creates a match on IPv6 Extension Header pseudo-field fiags.
456 * Those are defined in Criterion.IPv6ExthdrFlags.
457 *
458 * @param exthdrFlags IPv6 Extension Header pseudo-field flags (16 bits)
459 * @return match criterion
460 */
461 public static Criterion matchIPv6ExthdrFlags(int exthdrFlags) {
462 return new IPv6ExthdrFlagsCriterion(exthdrFlags);
463 }
464
465 /**
Sho SHIMIZU084c4ca2015-05-04 11:52:51 -0700466 * Creates a match on lambda using the specified value.
467 *
468 * @param lambda lambda
469 * @return match criterion
470 */
471 public static Criterion matchLambda(Lambda lambda) {
Sho SHIMIZUefc2e282015-05-04 15:26:23 -0700472 if (lambda instanceof IndexedLambda) {
473 return new IndexedLambdaCriterion((IndexedLambda) lambda);
474 } else if (lambda instanceof OchSignal) {
Sho SHIMIZU084c4ca2015-05-04 11:52:51 -0700475 return new OchSignalCriterion((OchSignal) lambda);
476 } else {
477 throw new UnsupportedOperationException(String.format("Unsupported type of Lambda: %s", lambda));
478 }
479 }
480
481 /**
Sho SHIMIZUb5e6de62015-05-04 12:13:44 -0700482 * Create a match on OCh (Optical Channel) signal type.
483 *
484 * @param signalType OCh signal type
485 * @return match criterion
486 */
487 public static Criterion matchOchSignalType(OchSignalType signalType) {
488 return new OchSignalTypeCriterion(signalType);
489 }
490
Yafit Hadar52d81552015-10-07 12:26:52 +0300491 /**
492 * Creates a match on ODU (Optical channel Data Unit) signal ID using the specified value.
493 *
494 * @param oduSignalId ODU Signal Id
495 * @return match criterion
496 */
497 public static Criterion matchOduSignalId(OduSignalId oduSignalId) {
498 return new OduSignalIdCriterion(oduSignalId);
499 }
500
501 /**
502 * Creates a match on ODU (Optical channel Data Unit) signal Type using the specified value.
503 *
504 * @param signalType ODU Signal Type
505 * @return match criterion
506 */
507 public static Criterion matchOduSignalType(OduSignalType signalType) {
508 return new OduSignalTypeCriterion(signalType);
509 }
510
alshabiba3a476d2015-04-10 14:35:38 -0700511 public static Criterion dummy() {
512 return new DummyCriterion();
513 }
514
Praseed Balakrishnan64369da2014-10-23 15:55:20 -0700515 /**
alshabiba3a476d2015-04-10 14:35:38 -0700516 * Dummy Criterion used with @see{FilteringObjective}.
517 */
518 private static class DummyCriterion implements Criterion {
519
520 @Override
521 public Type type() {
522 return Type.DUMMY;
523 }
524 }
tom8bb16062014-09-12 14:47:46 -0700525}