Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Foundation |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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. |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.flow; |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 17 | |
Frank Wang | df38321 | 2017-06-23 09:17:41 +0800 | [diff] [blame] | 18 | import com.google.common.annotations.Beta; |
BitOhenry | b2f8e81 | 2015-11-17 19:19:53 +0800 | [diff] [blame] | 19 | import org.onlab.packet.Ip4Address; |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 20 | import org.onlab.packet.Ip6Address; |
| 21 | import org.onlab.packet.IpPrefix; |
| 22 | import org.onlab.packet.MacAddress; |
| 23 | import org.onlab.packet.MplsLabel; |
| 24 | import org.onlab.packet.TpPort; |
| 25 | import org.onlab.packet.VlanId; |
Jonathan Hart | 26a8d95 | 2015-12-02 15:16:35 -0800 | [diff] [blame] | 26 | import org.onosproject.net.DeviceId; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 27 | import org.onosproject.net.PortNumber; |
| 28 | import org.onosproject.net.flow.criteria.Criterion; |
Jonathan Hart | 26a8d95 | 2015-12-02 15:16:35 -0800 | [diff] [blame] | 29 | import org.onosproject.net.flow.criteria.ExtensionSelector; |
Frank Wang | df38321 | 2017-06-23 09:17:41 +0800 | [diff] [blame] | 30 | import org.onosproject.net.flow.criteria.PiCriterion; |
Jonathan Hart | 26a8d95 | 2015-12-02 15:16:35 -0800 | [diff] [blame] | 31 | |
| 32 | import java.util.Set; |
alshabib | 7410fea | 2014-09-16 13:48:39 -0700 | [diff] [blame] | 33 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 34 | /** |
| 35 | * Abstraction of a slice of network traffic. |
| 36 | */ |
| 37 | public interface TrafficSelector { |
| 38 | |
| 39 | /** |
| 40 | * Returns selection criteria as an ordered list. |
| 41 | * |
| 42 | * @return list of criteria |
| 43 | */ |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 44 | Set<Criterion> criteria(); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
Jonathan Hart | 936c49d | 2014-10-23 16:38:59 -0700 | [diff] [blame] | 47 | * Returns the selection criterion for a particular type, if it exists in |
| 48 | * this traffic selector. |
| 49 | * |
| 50 | * @param type criterion type to look up |
| 51 | * @return the criterion of the specified type if one exists, otherwise null |
| 52 | */ |
| 53 | Criterion getCriterion(Criterion.Type type); |
| 54 | |
| 55 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 56 | * Builder of traffic selector entities. |
| 57 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 58 | interface Builder { |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 59 | |
| 60 | /** |
| 61 | * Adds a traffic selection criterion. If a same type criterion has |
| 62 | * already been added, it will be replaced by this one. |
| 63 | * |
| 64 | * @param criterion new criterion |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 65 | * @return self |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 66 | */ |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 67 | Builder add(Criterion criterion); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 68 | |
| 69 | /** |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 70 | * Matches an inport. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 71 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 72 | * @param port the inport |
| 73 | * @return a selection builder |
| 74 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 75 | Builder matchInPort(PortNumber port); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 76 | |
| 77 | /** |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 78 | * Matches a physical inport. |
| 79 | * |
| 80 | * @param port the physical inport |
| 81 | * @return a selection builder |
| 82 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 83 | Builder matchInPhyPort(PortNumber port); |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 84 | |
| 85 | /** |
| 86 | * Matches a metadata. |
| 87 | * |
| 88 | * @param metadata the metadata |
| 89 | * @return a selection builder |
| 90 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 91 | Builder matchMetadata(long metadata); |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 92 | |
| 93 | /** |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 94 | * Matches a l2 dst address. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 95 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 96 | * @param addr a l2 address |
| 97 | * @return a selection builder |
| 98 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 99 | Builder matchEthDst(MacAddress addr); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 100 | |
| 101 | /** |
Saurav Das | 9d6c86b | 2016-02-19 09:01:07 -0800 | [diff] [blame] | 102 | * Matches a l2 dst address with mask. |
| 103 | * |
| 104 | * @param addr a l2 address |
| 105 | * @param mask a mask for an l2 address |
| 106 | * @return a selection builder |
| 107 | */ |
| 108 | Builder matchEthDstMasked(MacAddress addr, MacAddress mask); |
| 109 | |
| 110 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 111 | * Matches a l2 src address. |
| 112 | * |
| 113 | * @param addr a l2 address |
| 114 | * @return a selection builder |
| 115 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 116 | Builder matchEthSrc(MacAddress addr); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 117 | |
| 118 | /** |
Saurav Das | 9d6c86b | 2016-02-19 09:01:07 -0800 | [diff] [blame] | 119 | * Matches a l2 src address with mask. |
| 120 | * |
| 121 | * @param addr a l2 address |
| 122 | * @param mask a mask for an l2 address |
| 123 | * @return a selection builder |
| 124 | */ |
| 125 | Builder matchEthSrcMasked(MacAddress addr, MacAddress mask); |
| 126 | |
| 127 | /** |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 128 | * Matches the ethernet type. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 129 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 130 | * @param ethType an ethernet type |
| 131 | * @return a selection builder |
| 132 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 133 | Builder matchEthType(short ethType); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 134 | |
| 135 | /** |
| 136 | * Matches the vlan id. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 137 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 138 | * @param vlanId a vlan id |
| 139 | * @return a selection builder |
| 140 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 141 | Builder matchVlanId(VlanId vlanId); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 142 | |
| 143 | /** |
| 144 | * Matches a vlan priority. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 145 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 146 | * @param vlanPcp a vlan priority |
| 147 | * @return a selection builder |
| 148 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 149 | Builder matchVlanPcp(byte vlanPcp); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 150 | |
| 151 | /** |
alshabib | fa0dc66 | 2016-01-13 11:23:53 -0800 | [diff] [blame] | 152 | * Matches the inner vlan id. |
| 153 | * |
| 154 | * @param vlanId a vlan id |
| 155 | * @return a selection builder |
| 156 | */ |
| 157 | Builder matchInnerVlanId(VlanId vlanId); |
| 158 | |
| 159 | /** |
| 160 | * Matches a vlan priority. |
| 161 | * |
| 162 | * @param vlanPcp a vlan priority |
| 163 | * @return a selection builder |
| 164 | */ |
| 165 | Builder matchInnerVlanPcp(byte vlanPcp); |
| 166 | |
| 167 | /** |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 168 | * Matches an IP DSCP (6 bits in ToS field). |
| 169 | * |
| 170 | * @param ipDscp an IP DSCP value |
| 171 | * @return a selection builder |
| 172 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 173 | Builder matchIPDscp(byte ipDscp); |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 174 | |
| 175 | /** |
| 176 | * Matches an IP ECN (2 bits in ToS field). |
| 177 | * |
| 178 | * @param ipEcn an IP ECN value |
| 179 | * @return a selection builder |
| 180 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 181 | Builder matchIPEcn(byte ipEcn); |
Pavlin Radoslavov | d0fd841 | 2015-02-04 13:57:00 -0800 | [diff] [blame] | 182 | |
| 183 | /** |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 184 | * Matches the l3 protocol. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 185 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 186 | * @param proto a l3 protocol |
| 187 | * @return a selection builder |
| 188 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 189 | Builder matchIPProtocol(byte proto); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 190 | |
| 191 | /** |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 192 | * Matches a l3 IPv4 address. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 193 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 194 | * @param ip a l3 address |
| 195 | * @return a selection builder |
| 196 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 197 | Builder matchIPSrc(IpPrefix ip); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 198 | |
| 199 | /** |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 200 | * Matches a l3 IPv4 address. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 201 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 202 | * @param ip a l3 address |
| 203 | * @return a selection builder |
| 204 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 205 | Builder matchIPDst(IpPrefix ip); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 206 | |
| 207 | /** |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 208 | * Matches a TCP source port number. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 209 | * |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 210 | * @param tcpPort a TCP source port number |
| 211 | * @return a selection builder |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 212 | */ |
| 213 | Builder matchTcpSrc(TpPort tcpPort); |
| 214 | |
| 215 | /** |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 216 | * Matches a TCP source port number with mask. |
| 217 | * |
| 218 | * @param tcpPort a TCP source port number |
| 219 | * @param mask a mask for a TCP source port number |
| 220 | * @return a selection builder |
| 221 | */ |
| 222 | Builder matchTcpSrcMasked(TpPort tcpPort, TpPort mask); |
| 223 | |
| 224 | /** |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 225 | * Matches a TCP destination port number. |
| 226 | * |
| 227 | * @param tcpPort a TCP destination port number |
| 228 | * @return a selection builder |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 229 | */ |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 230 | Builder matchTcpDst(TpPort tcpPort); |
| 231 | |
| 232 | /** |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 233 | * Matches a TCP destination port number with mask. |
| 234 | * |
| 235 | * @param tcpPort a TCP destination port number |
| 236 | * @param mask a mask for a TCP destination port number |
| 237 | * @return a selection builder |
| 238 | */ |
| 239 | Builder matchTcpDstMasked(TpPort tcpPort, TpPort mask); |
| 240 | |
| 241 | /** |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 242 | * Matches an UDP source port number. |
| 243 | * |
| 244 | * @param udpPort an UDP source port number |
| 245 | * @return a selection builder |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 246 | */ |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 247 | Builder matchUdpSrc(TpPort udpPort); |
| 248 | |
| 249 | /** |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 250 | * Matches a UDP source port number with mask. |
| 251 | * |
| 252 | * @param udpPort a UDP source port number |
| 253 | * @param mask a mask for a UDP source port number |
| 254 | * @return a selection builder |
| 255 | */ |
| 256 | Builder matchUdpSrcMasked(TpPort udpPort, TpPort mask); |
| 257 | |
| 258 | /** |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 259 | * Matches an UDP destination port number. |
| 260 | * |
| 261 | * @param udpPort an UDP destination port number |
| 262 | * @return a selection builder |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 263 | */ |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 264 | Builder matchUdpDst(TpPort udpPort); |
| 265 | |
| 266 | /** |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 267 | * Matches a UDP destination port number with mask. |
| 268 | * |
| 269 | * @param udpPort a UDP destination port number |
| 270 | * @param mask a mask for a UDP destination port number |
| 271 | * @return a selection builder |
| 272 | */ |
| 273 | Builder matchUdpDstMasked(TpPort udpPort, TpPort mask); |
| 274 | |
| 275 | /** |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 276 | * Matches a SCTP source port number. |
| 277 | * |
| 278 | * @param sctpPort a SCTP source port number |
| 279 | * @return a selection builder |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 280 | */ |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 281 | Builder matchSctpSrc(TpPort sctpPort); |
| 282 | |
| 283 | /** |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 284 | * Matches a SCTP source port number with mask. |
| 285 | * |
| 286 | * @param sctpPort a SCTP source port number |
| 287 | * @param mask a mask for a SCTP source port number |
| 288 | * @return a selection builder |
| 289 | */ |
| 290 | Builder matchSctpSrcMasked(TpPort sctpPort, TpPort mask); |
| 291 | |
| 292 | /** |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 293 | * Matches a SCTP destination port number. |
| 294 | * |
| 295 | * @param sctpPort a SCTP destination port number |
| 296 | * @return a selection builder |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 297 | */ |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 298 | Builder matchSctpDst(TpPort sctpPort); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 299 | |
| 300 | /** |
Andreas Gilbert | 75b882f7 | 2017-02-03 09:58:07 +0100 | [diff] [blame] | 301 | * Matches a SCTP destination port number with mask. |
| 302 | * |
| 303 | * @param sctpPort a SCTP destination port number |
| 304 | * @param mask a mask for a SCTP destination port number |
| 305 | * @return a selection builder |
| 306 | */ |
| 307 | Builder matchSctpDstMasked(TpPort sctpPort, TpPort mask); |
| 308 | |
| 309 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 310 | * Matches an ICMP type. |
| 311 | * |
| 312 | * @param icmpType an ICMP type |
| 313 | * @return a selection builder |
| 314 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 315 | Builder matchIcmpType(byte icmpType); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 316 | |
| 317 | /** |
| 318 | * Matches an ICMP code. |
| 319 | * |
| 320 | * @param icmpCode an ICMP code |
| 321 | * @return a selection builder |
| 322 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 323 | Builder matchIcmpCode(byte icmpCode); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 324 | |
| 325 | /** |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 326 | * Matches a l3 IPv6 address. |
| 327 | * |
| 328 | * @param ip a l3 IPv6 address |
| 329 | * @return a selection builder |
| 330 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 331 | Builder matchIPv6Src(IpPrefix ip); |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 332 | |
| 333 | /** |
| 334 | * Matches a l3 IPv6 address. |
| 335 | * |
| 336 | * @param ip a l3 IPv6 address |
| 337 | * @return a selection builder |
| 338 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 339 | Builder matchIPv6Dst(IpPrefix ip); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 340 | |
| 341 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 342 | * Matches an IPv6 flow label. |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 343 | * |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 344 | * @param flowLabel an IPv6 flow label |
| 345 | * @return a selection builder |
| 346 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 347 | Builder matchIPv6FlowLabel(int flowLabel); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 348 | |
| 349 | /** |
| 350 | * Matches an ICMPv6 type. |
| 351 | * |
| 352 | * @param icmpv6Type an ICMPv6 type |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 353 | * @return a selection builder |
| 354 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 355 | Builder matchIcmpv6Type(byte icmpv6Type); |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 356 | |
| 357 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 358 | * Matches an ICMPv6 code. |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 359 | * |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 360 | * @param icmpv6Code an ICMPv6 code |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 361 | * @return a selection builder |
| 362 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 363 | Builder matchIcmpv6Code(byte icmpv6Code); |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 364 | |
| 365 | /** |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 366 | * Matches an IPv6 Neighbor Discovery target address. |
| 367 | * |
| 368 | * @param targetAddress an IPv6 Neighbor Discovery target address |
| 369 | * @return a selection builder |
| 370 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 371 | Builder matchIPv6NDTargetAddress(Ip6Address targetAddress); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 372 | |
| 373 | /** |
| 374 | * Matches an IPv6 Neighbor Discovery source link-layer address. |
| 375 | * |
| 376 | * @param mac an IPv6 Neighbor Discovery source link-layer address |
| 377 | * @return a selection builder |
| 378 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 379 | Builder matchIPv6NDSourceLinkLayerAddress(MacAddress mac); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 380 | |
| 381 | /** |
| 382 | * Matches an IPv6 Neighbor Discovery target link-layer address. |
| 383 | * |
| 384 | * @param mac an IPv6 Neighbor Discovery target link-layer address |
| 385 | * @return a selection builder |
| 386 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 387 | Builder matchIPv6NDTargetLinkLayerAddress(MacAddress mac); |
Pavlin Radoslavov | 320e6c9 | 2015-02-02 16:51:58 -0800 | [diff] [blame] | 388 | |
| 389 | /** |
| 390 | * Matches on a MPLS label. |
| 391 | * |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 392 | * @param mplsLabel a MPLS label. |
| 393 | * @return a selection builder |
| 394 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 395 | Builder matchMplsLabel(MplsLabel mplsLabel); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 396 | |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 397 | /** |
Saurav Das | ffc5bbc | 2015-08-18 23:30:19 -0700 | [diff] [blame] | 398 | * Matches on a MPLS Bottom-of-Stack indicator bit. |
| 399 | * |
| 400 | * @param mplsBos boolean value indicating BOS=1 (true) or BOS=0 (false). |
| 401 | * @return a selection builder |
| 402 | */ |
| 403 | Builder matchMplsBos(boolean mplsBos); |
| 404 | |
| 405 | /** |
Hyunsun Moon | a08c5d0 | 2015-07-14 17:53:00 -0700 | [diff] [blame] | 406 | * Matches a tunnel id. |
| 407 | * |
| 408 | * @param tunnelId a tunnel id |
| 409 | * @return a selection builder |
| 410 | */ |
| 411 | Builder matchTunnelId(long tunnelId); |
| 412 | |
| 413 | /** |
Sho SHIMIZU | 60f1214 | 2015-05-06 14:22:03 -0700 | [diff] [blame] | 414 | * Matches on IPv6 Extension Header pseudo-field flags. |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 415 | * |
Sho SHIMIZU | 60f1214 | 2015-05-06 14:22:03 -0700 | [diff] [blame] | 416 | * @param exthdrFlags the IPv6 Extension Header pseudo-field flags |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 417 | * @return a selection builder |
| 418 | */ |
Sho SHIMIZU | 15c3800 | 2015-04-28 19:00:37 -0700 | [diff] [blame] | 419 | Builder matchIPv6ExthdrFlags(short exthdrFlags); |
Pavlin Radoslavov | 5e4f754 | 2015-02-06 18:18:21 -0800 | [diff] [blame] | 420 | |
| 421 | /** |
BitOhenry | b2f8e81 | 2015-11-17 19:19:53 +0800 | [diff] [blame] | 422 | * Matches a arp IPv4 destination address. |
| 423 | * |
| 424 | * @param addr a arp IPv4 destination address |
| 425 | * @return a selection builder |
| 426 | */ |
| 427 | Builder matchArpTpa(Ip4Address addr); |
| 428 | |
| 429 | /** |
BitOhenry | 08c7294 | 2015-11-18 14:44:29 +0800 | [diff] [blame] | 430 | * Matches a arp IPv4 source address. |
| 431 | * |
| 432 | * @param addr a arp IPv4 source address |
| 433 | * @return a selection builder |
| 434 | */ |
| 435 | Builder matchArpSpa(Ip4Address addr); |
| 436 | |
| 437 | /** |
BitOhenry | 914c7ad | 2015-11-16 14:58:53 +0800 | [diff] [blame] | 438 | * Matches a arp_eth_dst address. |
| 439 | * |
| 440 | * @param addr a arp_eth_dst address |
| 441 | * @return a selection builder |
| 442 | */ |
| 443 | Builder matchArpTha(MacAddress addr); |
| 444 | |
| 445 | /** |
BitOhenry | e330cf0 | 2015-11-17 18:59:33 +0800 | [diff] [blame] | 446 | * Matches a arp_eth_src address. |
| 447 | * |
| 448 | * @param addr a arp_eth_src address |
| 449 | * @return a selection builder |
| 450 | */ |
| 451 | Builder matchArpSha(MacAddress addr); |
| 452 | |
| 453 | /** |
BitOhenry | b40129a | 2015-11-30 12:41:18 +0800 | [diff] [blame] | 454 | * Matches a arp operation type. |
| 455 | * |
| 456 | * @param arpOp a arp operation type |
| 457 | * @return a selection builder |
| 458 | */ |
| 459 | Builder matchArpOp(int arpOp); |
| 460 | |
| 461 | /** |
Frank Wang | df38321 | 2017-06-23 09:17:41 +0800 | [diff] [blame] | 462 | * Matches protocol independent fields. |
| 463 | * |
| 464 | * @param piCriterion protocol-independent criterion |
| 465 | * @return a selection builder |
| 466 | */ |
| 467 | @Beta |
| 468 | Builder matchPi(PiCriterion piCriterion); |
| 469 | |
| 470 | /** |
Jonathan Hart | 26a8d95 | 2015-12-02 15:16:35 -0800 | [diff] [blame] | 471 | * Uses an extension selector. |
| 472 | * |
| 473 | * @param extensionSelector extension selector |
| 474 | * @param deviceId device ID |
| 475 | * @return a selection builder |
| 476 | */ |
| 477 | Builder extension(ExtensionSelector extensionSelector, DeviceId deviceId); |
| 478 | |
| 479 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 480 | * Builds an immutable traffic selector. |
| 481 | * |
| 482 | * @return traffic selector |
| 483 | */ |
| 484 | TrafficSelector build(); |
| 485 | } |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 486 | } |