blob: 4d05be1b27ba7cde86938069f2114d5628fa68ba [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;
Sho SHIMIZUefc2e282015-05-04 15:26:23 -070019import org.onosproject.net.IndexedLambda;
Sho SHIMIZU084c4ca2015-05-04 11:52:51 -070020import org.onosproject.net.Lambda;
21import org.onosproject.net.OchSignal;
Brian O'Connorabafb502014-12-02 22:26:20 -080022import org.onosproject.net.PortNumber;
23import org.onosproject.net.flow.criteria.Criterion.Type;
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -070024import org.onlab.packet.IpPrefix;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080025import org.onlab.packet.Ip6Address;
Ayaka Koshibea9c199f2014-09-16 16:21:40 -070026import org.onlab.packet.MacAddress;
Michele Santuari4b6019e2014-12-19 11:31:45 +010027import org.onlab.packet.MplsLabel;
Ayaka Koshibea9c199f2014-09-16 16:21:40 -070028import org.onlab.packet.VlanId;
Sho SHIMIZU585bed92015-05-13 11:08:45 -070029import org.onosproject.net.OchSignalType;
alshabib7b795492014-09-16 14:38:39 -070030
tom8bb16062014-09-12 14:47:46 -070031/**
32 * Factory class to create various traffic selection criteria.
33 */
34public final class Criteria {
35
alshabib7b795492014-09-16 14:38:39 -070036 //TODO: incomplete type implementation. Need to implement complete list from Criterion
37
tom8bb16062014-09-12 14:47:46 -070038 // Ban construction
39 private Criteria() {
40 }
41
42 /**
alshabib7b795492014-09-16 14:38:39 -070043 * Creates a match on IN_PORT field using the specified value.
44 *
45 * @param port inport value
46 * @return match criterion
47 */
48 public static Criterion matchInPort(PortNumber port) {
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -080049 return new PortCriterion(port, Type.IN_PORT);
50 }
51
52 /**
53 * Creates a match on IN_PHY_PORT field using the specified value.
54 *
55 * @param port inport value
56 * @return match criterion
57 */
58 public static Criterion matchInPhyPort(PortNumber port) {
59 return new PortCriterion(port, Type.IN_PHY_PORT);
60 }
61
62 /**
63 * Creates a match on METADATA field using the specified value.
64 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -080065 * @param metadata metadata value (64 bits data)
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -080066 * @return match criterion
67 */
Pavlin Radoslavov5e4f7542015-02-06 18:18:21 -080068 public static Criterion matchMetadata(long metadata) {
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -080069 return new MetadataCriterion(metadata);
alshabib7b795492014-09-16 14:38:39 -070070 }
71
72 /**
alshabib369d2942014-09-12 17:59:35 -070073 * Creates a match on ETH_DST field using the specified value. This value
74 * may be a wildcard mask.
75 *
tomc104d282014-09-19 10:57:55 -070076 * @param mac MAC address value or wildcard mask
alshabib369d2942014-09-12 17:59:35 -070077 * @return match criterion
78 */
Ayaka Koshibea9c199f2014-09-16 16:21:40 -070079 public static Criterion matchEthDst(MacAddress mac) {
alshabib7b795492014-09-16 14:38:39 -070080 return new EthCriterion(mac, Type.ETH_DST);
81 }
82
83 /**
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080084 * Creates a match on ETH_SRC field using the specified value. This value
85 * may be a wildcard mask.
86 *
87 * @param mac MAC address value or wildcard mask
88 * @return match criterion
89 */
90 public static Criterion matchEthSrc(MacAddress mac) {
91 return new EthCriterion(mac, Type.ETH_SRC);
92 }
93
94 /**
alshabib7b795492014-09-16 14:38:39 -070095 * Creates a match on ETH_TYPE field using the specified value.
96 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -080097 * @param ethType eth type value (16 bits unsigned integer)
alshabib7b795492014-09-16 14:38:39 -070098 * @return match criterion
99 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800100 public static Criterion matchEthType(int ethType) {
alshabib7b795492014-09-16 14:38:39 -0700101 return new EthTypeCriterion(ethType);
102 }
103
104 /**
alshabibcaf1ca22015-06-25 15:18:16 -0700105 * Creates a match on ETH_TYPE field using the specified value.
106 *
107 * @param ethType eth type value
108 * @return match criterion
109 */
110 public static Criterion matchEthType(EthType ethType) {
111 return new EthTypeCriterion(ethType);
112 }
113
114 /**
alshabib7b795492014-09-16 14:38:39 -0700115 * Creates a match on VLAN ID field using the specified value.
116 *
117 * @param vlanId vlan id value
118 * @return match criterion
119 */
Ayaka Koshibea9c199f2014-09-16 16:21:40 -0700120 public static Criterion matchVlanId(VlanId vlanId) {
alshabib7b795492014-09-16 14:38:39 -0700121 return new VlanIdCriterion(vlanId);
122 }
123
124 /**
125 * Creates a match on VLAN PCP field using the specified value.
126 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800127 * @param vlanPcp vlan pcp value (3 bits)
alshabib7b795492014-09-16 14:38:39 -0700128 * @return match criterion
129 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800130 public static Criterion matchVlanPcp(byte vlanPcp) {
alshabib7b795492014-09-16 14:38:39 -0700131 return new VlanPcpCriterion(vlanPcp);
132 }
133
134 /**
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800135 * Creates a match on IP DSCP field using the specified value.
136 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800137 * @param ipDscp ip dscp value (6 bits)
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800138 * @return match criterion
139 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800140 public static Criterion matchIPDscp(byte ipDscp) {
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800141 return new IPDscpCriterion(ipDscp);
142 }
143
144 /**
145 * Creates a match on IP ECN field using the specified value.
146 *
Pavlin Radoslavovab8553a2015-02-20 14:13:50 -0800147 * @param ipEcn ip ecn value (2 bits)
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800148 * @return match criterion
149 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800150 public static Criterion matchIPEcn(byte ipEcn) {
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800151 return new IPEcnCriterion(ipEcn);
152 }
153
154 /**
alshabib7b795492014-09-16 14:38:39 -0700155 * Creates a match on IP proto field using the specified value.
156 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800157 * @param proto ip protocol value (8 bits unsigned integer)
alshabib7b795492014-09-16 14:38:39 -0700158 * @return match criterion
159 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800160 public static Criterion matchIPProtocol(short proto) {
alshabib7b795492014-09-16 14:38:39 -0700161 return new IPProtocolCriterion(proto);
162 }
163
164 /**
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800165 * Creates a match on IPv4 source field using the specified value.
alshabib7b795492014-09-16 14:38:39 -0700166 *
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800167 * @param ip ipv4 source value
alshabib7b795492014-09-16 14:38:39 -0700168 * @return match criterion
169 */
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -0700170 public static Criterion matchIPSrc(IpPrefix ip) {
alshabib7b795492014-09-16 14:38:39 -0700171 return new IPCriterion(ip, Type.IPV4_SRC);
172 }
173
174 /**
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800175 * Creates a match on IPv4 destination field using the specified value.
alshabib7b795492014-09-16 14:38:39 -0700176 *
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800177 * @param ip ipv4 source value
alshabib7b795492014-09-16 14:38:39 -0700178 * @return match criterion
179 */
Ayaka Koshibe1d56fe42014-09-19 16:51:58 -0700180 public static Criterion matchIPDst(IpPrefix ip) {
alshabib7b795492014-09-16 14:38:39 -0700181 return new IPCriterion(ip, Type.IPV4_DST);
alshabib369d2942014-09-12 17:59:35 -0700182 }
183
Toshio Koide9c44c9a2014-10-09 11:44:36 -0700184 /**
185 * Creates a match on TCP source port field using the specified value.
186 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800187 * @param tcpPort TCP source port (16 bits unsigned integer)
Toshio Koide9c44c9a2014-10-09 11:44:36 -0700188 * @return match criterion
189 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800190 public static Criterion matchTcpSrc(int tcpPort) {
Toshio Koide9c44c9a2014-10-09 11:44:36 -0700191 return new TcpPortCriterion(tcpPort, Type.TCP_SRC);
192 }
193
194 /**
195 * Creates a match on TCP destination port field using the specified value.
196 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800197 * @param tcpPort TCP destination port (16 bits unsigned integer)
Toshio Koide9c44c9a2014-10-09 11:44:36 -0700198 * @return match criterion
199 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800200 public static Criterion matchTcpDst(int tcpPort) {
Toshio Koide9c44c9a2014-10-09 11:44:36 -0700201 return new TcpPortCriterion(tcpPort, Type.TCP_DST);
202 }
alshabib369d2942014-09-12 17:59:35 -0700203
Marc De Leenheer49087752014-10-23 13:54:09 -0700204 /**
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800205 * Creates a match on UDP source port field using the specified value.
206 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800207 * @param udpPort UDP source port (16 bits unsigned integer)
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800208 * @return match criterion
209 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800210 public static Criterion matchUdpSrc(int udpPort) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800211 return new UdpPortCriterion(udpPort, Type.UDP_SRC);
212 }
213
214 /**
215 * Creates a match on UDP destination port field using the specified value.
216 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800217 * @param udpPort UDP destination port (16 bits unsigned integer)
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800218 * @return match criterion
219 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800220 public static Criterion matchUdpDst(int udpPort) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800221 return new UdpPortCriterion(udpPort, Type.UDP_DST);
222 }
223
224 /**
225 * Creates a match on SCTP source port field using the specified value.
226 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800227 * @param sctpPort SCTP source port (16 bits unsigned integer)
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800228 * @return match criterion
229 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800230 public static Criterion matchSctpSrc(int sctpPort) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800231 return new SctpPortCriterion(sctpPort, Type.SCTP_SRC);
232 }
233
234 /**
235 * Creates a match on SCTP destination port field using the specified
236 * value.
237 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800238 * @param sctpPort SCTP destination port (16 bits unsigned integer)
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800239 * @return match criterion
240 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800241 public static Criterion matchSctpDst(int sctpPort) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800242 return new SctpPortCriterion(sctpPort, Type.SCTP_DST);
243 }
244
245 /**
246 * Creates a match on ICMP type field using the specified value.
247 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800248 * @param icmpType ICMP type (8 bits unsigned integer)
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800249 * @return match criterion
250 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800251 public static Criterion matchIcmpType(short icmpType) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800252 return new IcmpTypeCriterion(icmpType);
253 }
254
255 /**
256 * Creates a match on ICMP code field using the specified value.
257 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800258 * @param icmpCode ICMP code (8 bits unsigned integer)
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800259 * @return match criterion
260 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800261 public static Criterion matchIcmpCode(short icmpCode) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800262 return new IcmpCodeCriterion(icmpCode);
263 }
264
265 /**
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800266 * Creates a match on IPv6 source field using the specified value.
267 *
268 * @param ip ipv6 source value
269 * @return match criterion
270 */
271 public static Criterion matchIPv6Src(IpPrefix ip) {
272 return new IPCriterion(ip, Type.IPV6_SRC);
273 }
274
275 /**
276 * Creates a match on IPv6 destination field using the specified value.
277 *
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800278 * @param ip ipv6 destination value
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800279 * @return match criterion
280 */
281 public static Criterion matchIPv6Dst(IpPrefix ip) {
282 return new IPCriterion(ip, Type.IPV6_DST);
283 }
284
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800285 /**
286 * Creates a match on IPv6 flow label field using the specified value.
287 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800288 * @param flowLabel IPv6 flow label (20 bits)
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800289 * @return match criterion
290 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800291 public static Criterion matchIPv6FlowLabel(int flowLabel) {
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800292 return new IPv6FlowLabelCriterion(flowLabel);
293 }
294
295 /**
Kunihiro Ishiguro0f9aba82015-01-15 17:14:17 -0800296 * Creates a match on ICMPv6 type field using the specified value.
297 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800298 * @param icmpv6Type ICMPv6 type (8 bits unsigned integer)
Kunihiro Ishiguro0f9aba82015-01-15 17:14:17 -0800299 * @return match criterion
300 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800301 public static Criterion matchIcmpv6Type(short icmpv6Type) {
Kunihiro Ishiguro0f9aba82015-01-15 17:14:17 -0800302 return new Icmpv6TypeCriterion(icmpv6Type);
303 }
304
305 /**
306 * Creates a match on ICMPv6 code field using the specified value.
307 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800308 * @param icmpv6Code ICMPv6 code (8 bits unsigned integer)
Kunihiro Ishiguro0f9aba82015-01-15 17:14:17 -0800309 * @return match criterion
310 */
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800311 public static Criterion matchIcmpv6Code(short icmpv6Code) {
Kunihiro Ishiguro0f9aba82015-01-15 17:14:17 -0800312 return new Icmpv6CodeCriterion(icmpv6Code);
313 }
314
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800315 /**
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800316 * Creates a match on IPv6 Neighbor Discovery target address using the
317 * specified value.
318 *
319 * @param targetAddress IPv6 Neighbor Discovery target address
320 * @return match criterion
321 */
322 public static Criterion matchIPv6NDTargetAddress(Ip6Address targetAddress) {
323 return new IPv6NDTargetAddressCriterion(targetAddress);
324 }
325
326 /**
327 * Creates a match on IPv6 Neighbor Discovery source link-layer address
328 * using the specified value.
329 *
330 * @param mac IPv6 Neighbor Discovery source link-layer address
331 * @return match criterion
332 */
333 public static Criterion matchIPv6NDSourceLinkLayerAddress(MacAddress mac) {
334 return new IPv6NDLinkLayerAddressCriterion(mac, Type.IPV6_ND_SLL);
335 }
336
337 /**
338 * Creates a match on IPv6 Neighbor Discovery target link-layer address
339 * using the specified value.
340 *
341 * @param mac IPv6 Neighbor Discovery target link-layer address
342 * @return match criterion
343 */
344 public static Criterion matchIPv6NDTargetLinkLayerAddress(MacAddress mac) {
345 return new IPv6NDLinkLayerAddressCriterion(mac, Type.IPV6_ND_TLL);
346 }
347
348 /**
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800349 * Creates a match on MPLS label.
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800350 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800351 * @param mplsLabel MPLS label (20 bits)
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800352 * @return match criterion
353 */
Michele Santuari4b6019e2014-12-19 11:31:45 +0100354 public static Criterion matchMplsLabel(MplsLabel mplsLabel) {
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800355 return new MplsCriterion(mplsLabel);
356 }
357
358 /**
Saurav Dasffc5bbc2015-08-18 23:30:19 -0700359 * Creates a match on MPLS Bottom-of-Stack indicator bit.
360 *
361 * @param mplsBos boolean value indicating true (BOS=1) or false (BOS=0)
362 * @return match criterion
363 */
364 public static Criterion matchMplsLabel(boolean mplsBos) {
365 return new MplsBosCriterion(mplsBos);
366 }
367
368 /**
Hyunsun Moona08c5d02015-07-14 17:53:00 -0700369 * Creates a match on Tunnel ID.
370 *
371 * @param tunnelId Tunnel ID (64 bits)
372 * @return match criterion
373 */
374 public static Criterion matchTunnelId(long tunnelId) {
375 return new TunnelIdCriterion(tunnelId);
376 }
377
378 /**
Pavlin Radoslavov5e4f7542015-02-06 18:18:21 -0800379 * Creates a match on IPv6 Extension Header pseudo-field fiags.
380 * Those are defined in Criterion.IPv6ExthdrFlags.
381 *
382 * @param exthdrFlags IPv6 Extension Header pseudo-field flags (16 bits)
383 * @return match criterion
384 */
385 public static Criterion matchIPv6ExthdrFlags(int exthdrFlags) {
386 return new IPv6ExthdrFlagsCriterion(exthdrFlags);
387 }
388
389 /**
Marc De Leenheer49087752014-10-23 13:54:09 -0700390 * Creates a match on lambda field using the specified value.
391 *
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800392 * @param lambda lambda to match on (16 bits unsigned integer)
Marc De Leenheer49087752014-10-23 13:54:09 -0700393 * @return match criterion
Sho SHIMIZU2a9c3af2015-05-06 10:45:42 -0700394 * @deprecated in Cardinal Release. Use {@link #matchLambda(Lambda)} instead.
Marc De Leenheer49087752014-10-23 13:54:09 -0700395 */
Sho SHIMIZUefc2e282015-05-04 15:26:23 -0700396 @Deprecated
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800397 public static Criterion matchLambda(int lambda) {
Marc De Leenheer49087752014-10-23 13:54:09 -0700398 return new LambdaCriterion(lambda, Type.OCH_SIGID);
399 }
400
401 /**
Sho SHIMIZU084c4ca2015-05-04 11:52:51 -0700402 * Creates a match on lambda using the specified value.
403 *
404 * @param lambda lambda
405 * @return match criterion
406 */
407 public static Criterion matchLambda(Lambda lambda) {
Sho SHIMIZUefc2e282015-05-04 15:26:23 -0700408 if (lambda instanceof IndexedLambda) {
409 return new IndexedLambdaCriterion((IndexedLambda) lambda);
410 } else if (lambda instanceof OchSignal) {
Sho SHIMIZU084c4ca2015-05-04 11:52:51 -0700411 return new OchSignalCriterion((OchSignal) lambda);
412 } else {
413 throw new UnsupportedOperationException(String.format("Unsupported type of Lambda: %s", lambda));
414 }
415 }
416
417 /**
Sho SHIMIZUa66cb122014-12-02 18:11:15 -0800418 * Creates a match on optical signal type using the specified value.
Praseed Balakrishnan64369da2014-10-23 15:55:20 -0700419 *
Pavlin Radoslavov5e4f7542015-02-06 18:18:21 -0800420 * @param sigType optical signal type (8 bits unsigned integer)
Praseed Balakrishnan64369da2014-10-23 15:55:20 -0700421 * @return match criterion
Sho SHIMIZU9a2b0812015-06-30 10:02:22 -0700422 * @deprecated in Cardinal Release
Praseed Balakrishnan64369da2014-10-23 15:55:20 -0700423 */
Marc De Leenheerd24420f2015-05-27 09:40:59 -0700424 @Deprecated
Pavlin Radoslavov5e4f7542015-02-06 18:18:21 -0800425 public static Criterion matchOpticalSignalType(short sigType) {
Praseed Balakrishnan2dd5abd2014-11-03 14:56:28 -0800426 return new OpticalSignalTypeCriterion(sigType, Type.OCH_SIGTYPE);
Praseed Balakrishnan64369da2014-10-23 15:55:20 -0700427 }
428
Sho SHIMIZUb5e6de62015-05-04 12:13:44 -0700429 /**
430 * Create a match on OCh (Optical Channel) signal type.
431 *
432 * @param signalType OCh signal type
433 * @return match criterion
434 */
435 public static Criterion matchOchSignalType(OchSignalType signalType) {
436 return new OchSignalTypeCriterion(signalType);
437 }
438
alshabiba3a476d2015-04-10 14:35:38 -0700439 public static Criterion dummy() {
440 return new DummyCriterion();
441 }
442
Praseed Balakrishnan64369da2014-10-23 15:55:20 -0700443 /**
alshabiba3a476d2015-04-10 14:35:38 -0700444 * Dummy Criterion used with @see{FilteringObjective}.
445 */
446 private static class DummyCriterion implements Criterion {
447
448 @Override
449 public Type type() {
450 return Type.DUMMY;
451 }
452 }
tom8bb16062014-09-12 14:47:46 -0700453}