Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
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 | |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 18 | import java.util.List; |
| 19 | |
alshabib | 7b808c5 | 2015-06-26 14:22:24 -0700 | [diff] [blame] | 20 | import org.onlab.packet.EthType; |
Pavlin Radoslavov | 855ea2d | 2014-10-30 15:32:39 -0700 | [diff] [blame] | 21 | import org.onlab.packet.IpAddress; |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 22 | import org.onlab.packet.MacAddress; |
Michele Santuari | 4b6019e | 2014-12-19 11:31:45 +0100 | [diff] [blame] | 23 | import org.onlab.packet.MplsLabel; |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 24 | import org.onlab.packet.TpPort; |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 25 | import org.onlab.packet.VlanId; |
Jonathan Hart | 54b406b | 2015-03-06 16:24:14 -0800 | [diff] [blame] | 26 | import org.onosproject.core.GroupId; |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 27 | import org.onosproject.net.DeviceId; |
Jonathan Hart | 54b406b | 2015-03-06 16:24:14 -0800 | [diff] [blame] | 28 | import org.onosproject.net.PortNumber; |
alshabib | 880b644 | 2015-11-23 22:13:04 -0800 | [diff] [blame] | 29 | import org.onosproject.net.flow.instructions.ExtensionTreatment; |
Jonathan Hart | 54b406b | 2015-03-06 16:24:14 -0800 | [diff] [blame] | 30 | import org.onosproject.net.flow.instructions.Instruction; |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 31 | import org.onosproject.net.flow.instructions.Instructions; |
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 32 | import org.onosproject.net.meter.MeterId; |
alshabib | 55a55d9 | 2014-09-16 11:59:31 -0700 | [diff] [blame] | 33 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 34 | /** |
| 35 | * Abstraction of network traffic treatment. |
| 36 | */ |
| 37 | public interface TrafficTreatment { |
| 38 | |
| 39 | /** |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 40 | * Returns the list of treatment instructions that will be applied |
| 41 | * further down the pipeline. |
| 42 | * @return list of treatment instructions |
| 43 | */ |
| 44 | List<Instruction> deferred(); |
| 45 | |
| 46 | /** |
| 47 | * Returns the list of treatment instructions that will be applied |
| 48 | * immediately. |
| 49 | * @return list of treatment instructions |
| 50 | */ |
| 51 | List<Instruction> immediate(); |
| 52 | |
| 53 | /** |
Jonathan Hart | 8ef6d3b | 2015-03-08 21:21:27 -0700 | [diff] [blame] | 54 | * Returns the list of all instructions in the treatment, both immediate and |
| 55 | * deferred. |
| 56 | * |
| 57 | * @return list of treatment instructions |
| 58 | */ |
| 59 | List<Instruction> allInstructions(); |
| 60 | |
| 61 | /** |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 62 | * Returns the next table in the pipeline. |
| 63 | * @return a table transition; may be null. |
| 64 | */ |
| 65 | Instructions.TableTypeTransition tableTransition(); |
| 66 | |
| 67 | /** |
| 68 | * Whether the deferred treatment instructions will be cleared |
| 69 | * by the device. |
| 70 | * @return a boolean |
| 71 | */ |
Jonathan Hart | 4a0ba56 | 2015-03-23 17:23:33 -0700 | [diff] [blame] | 72 | boolean clearedDeferred(); |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 73 | |
| 74 | /** |
Saurav Das | 86af8f1 | 2015-05-25 23:55:33 -0700 | [diff] [blame] | 75 | * Returns the metadata instruction if there is one. |
| 76 | * |
| 77 | * @return a metadata instruction that may be null |
| 78 | */ |
| 79 | Instructions.MetadataInstruction writeMetadata(); |
| 80 | |
| 81 | /** |
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 82 | * Returns the meter instruction if there is one. |
| 83 | * |
| 84 | * @return a meter instruction that may be null |
| 85 | */ |
| 86 | Instructions.MeterInstruction metered(); |
| 87 | |
| 88 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 89 | * Builder of traffic treatment entities. |
| 90 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 91 | interface Builder { |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 92 | |
| 93 | /** |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 94 | * Adds an instruction to the builder. |
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 instruction an instruction |
| 97 | * @return a treatment builder |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 98 | */ |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 99 | Builder add(Instruction instruction); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 100 | |
| 101 | /** |
Thomas Vachuska | f4df005 | 2015-01-06 12:30:11 -0800 | [diff] [blame] | 102 | * Adds a drop instruction. |
| 103 | * |
| 104 | * @return a treatment builder |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 105 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 106 | Builder drop(); |
Thomas Vachuska | f4df005 | 2015-01-06 12:30:11 -0800 | [diff] [blame] | 107 | |
| 108 | /** |
| 109 | * Adds a punt-to-controller instruction. |
| 110 | * |
| 111 | * @return a treatment builder |
| 112 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 113 | Builder punt(); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 114 | |
| 115 | /** |
| 116 | * Set the output port. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 117 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 118 | * @param number the out port |
| 119 | * @return a treatment builder |
| 120 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 121 | Builder setOutput(PortNumber number); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 122 | |
| 123 | /** |
| 124 | * Sets the src l2 address. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 125 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 126 | * @param addr a macaddress |
| 127 | * @return a treatment builder |
| 128 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 129 | Builder setEthSrc(MacAddress addr); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 130 | |
| 131 | /** |
| 132 | * Sets the dst l2 address. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 133 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 134 | * @param addr a macaddress |
| 135 | * @return a treatment builder |
| 136 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 137 | Builder setEthDst(MacAddress addr); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 138 | |
| 139 | /** |
| 140 | * Sets the vlan id. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 141 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 142 | * @param id a vlanid |
| 143 | * @return a treatment builder |
| 144 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 145 | Builder setVlanId(VlanId id); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 146 | |
| 147 | /** |
| 148 | * Sets the vlan priority. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 149 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 150 | * @param pcp a vlan priority |
| 151 | * @return a treatment builder |
| 152 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 153 | Builder setVlanPcp(Byte pcp); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 154 | |
| 155 | /** |
| 156 | * Sets the src l3 address. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 157 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 158 | * @param addr an ip |
| 159 | * @return a treatment builder |
| 160 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 161 | Builder setIpSrc(IpAddress addr); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 162 | |
| 163 | /** |
| 164 | * Sets the dst l3 address. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 165 | * |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 166 | * @param addr an ip |
| 167 | * @return a treatment builder |
| 168 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 169 | Builder setIpDst(IpAddress addr); |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 170 | |
| 171 | /** |
Pavlin Radoslavov | febe82c | 2015-02-11 19:08:15 -0800 | [diff] [blame] | 172 | * Decrement the TTL in IP header by one. |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 173 | * |
| 174 | * @return a treatment builder |
| 175 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 176 | Builder decNwTtl(); |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 177 | |
| 178 | /** |
| 179 | * Copy the TTL to outer protocol layer. |
| 180 | * |
| 181 | * @return a treatment builder |
| 182 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 183 | Builder copyTtlOut(); |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 184 | |
| 185 | /** |
| 186 | * Copy the TTL to inner protocol layer. |
| 187 | * |
| 188 | * @return a treatment builder |
| 189 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 190 | Builder copyTtlIn(); |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 191 | |
| 192 | /** |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 193 | * Push MPLS ether type. |
Thomas Vachuska | f4df005 | 2015-01-06 12:30:11 -0800 | [diff] [blame] | 194 | * |
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 195 | * @return a treatment builder |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 196 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 197 | Builder pushMpls(); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 198 | |
| 199 | /** |
| 200 | * Pops MPLS ether type. |
Thomas Vachuska | f4df005 | 2015-01-06 12:30:11 -0800 | [diff] [blame] | 201 | * |
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 202 | * @return a treatment builder |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 203 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 204 | Builder popMpls(); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 205 | |
| 206 | /** |
Michele Santuari | 4b6019e | 2014-12-19 11:31:45 +0100 | [diff] [blame] | 207 | * Pops MPLS ether type and set the new ethertype. |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 208 | * |
Michele Santuari | 4b6019e | 2014-12-19 11:31:45 +0100 | [diff] [blame] | 209 | * @param etherType an ether type |
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 210 | * @return a treatment builder |
alshabib | 7b808c5 | 2015-06-26 14:22:24 -0700 | [diff] [blame] | 211 | */ |
| 212 | Builder popMpls(EthType etherType); |
| 213 | |
| 214 | /** |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 215 | * Sets the mpls label. |
Thomas Vachuska | f4df005 | 2015-01-06 12:30:11 -0800 | [diff] [blame] | 216 | * |
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 217 | * @param mplsLabel MPLS label |
| 218 | * @return a treatment builder |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 219 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 220 | Builder setMpls(MplsLabel mplsLabel); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 221 | |
| 222 | /** |
Saurav Das | 73a7dd4 | 2015-08-19 22:20:31 -0700 | [diff] [blame] | 223 | * Sets the mpls bottom-of-stack indicator bit. |
| 224 | * |
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 225 | * @param mplsBos boolean to set BOS=1 (true) or BOS=0 (false) |
Saurav Das | 73a7dd4 | 2015-08-19 22:20:31 -0700 | [diff] [blame] | 226 | * @return a treatment builder. |
| 227 | */ |
| 228 | Builder setMplsBos(boolean mplsBos); |
| 229 | |
| 230 | /** |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 231 | * Decrement MPLS TTL. |
| 232 | * |
| 233 | * @return a treatment builder |
| 234 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 235 | Builder decMplsTtl(); |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 236 | |
| 237 | /** |
sangho | 8995ac5 | 2015-02-04 11:29:03 -0800 | [diff] [blame] | 238 | * Sets the group ID. |
| 239 | * |
| 240 | * @param groupId group ID |
| 241 | * @return a treatment builder |
| 242 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 243 | Builder group(GroupId groupId); |
sangho | 8995ac5 | 2015-02-04 11:29:03 -0800 | [diff] [blame] | 244 | |
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 245 | /** |
Steffen Gebert | bbfdaaa | 2015-09-29 11:01:46 +0200 | [diff] [blame] | 246 | * Sets the Queue ID. |
| 247 | * |
| 248 | * @param queueId a queue ID |
| 249 | * @return a treatment builder |
| 250 | */ |
| 251 | Builder setQueue(long queueId); |
| 252 | |
| 253 | /** |
Steffen Gebert | ba2d3b7 | 2015-10-22 11:14:31 +0200 | [diff] [blame] | 254 | * Sets the Queue ID for a specific port. |
| 255 | * |
| 256 | * @param queueId a queue ID |
| 257 | * @param port a port number |
| 258 | * @return a treatment builder |
| 259 | */ |
| 260 | Builder setQueue(long queueId, PortNumber port); |
| 261 | |
| 262 | /** |
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 263 | * Sets a meter to be used by this flow. |
| 264 | * |
| 265 | * @param meterId a meter id |
| 266 | * @return a treatment builder |
| 267 | */ |
| 268 | Builder meter(MeterId meterId); |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 269 | |
| 270 | /** |
alshabib | d17abc2 | 2015-04-21 18:26:35 -0700 | [diff] [blame] | 271 | * Sets the next table id to transition to. |
| 272 | * |
| 273 | * @param tableId the table table |
| 274 | * @return a treatement builder |
| 275 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 276 | Builder transition(Integer tableId); |
alshabib | d17abc2 | 2015-04-21 18:26:35 -0700 | [diff] [blame] | 277 | |
| 278 | |
| 279 | /** |
Saurav Das | fbe25c5 | 2015-03-04 11:12:00 -0800 | [diff] [blame] | 280 | * Pops outermost VLAN tag. |
| 281 | * |
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 282 | * @return a treatment builder |
Saurav Das | fbe25c5 | 2015-03-04 11:12:00 -0800 | [diff] [blame] | 283 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 284 | Builder popVlan(); |
Saurav Das | fbe25c5 | 2015-03-04 11:12:00 -0800 | [diff] [blame] | 285 | |
| 286 | /** |
Jonathan Hart | 54b406b | 2015-03-06 16:24:14 -0800 | [diff] [blame] | 287 | * Pushes a new VLAN tag. |
| 288 | * |
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 289 | * @return a treatment builder |
Jonathan Hart | 54b406b | 2015-03-06 16:24:14 -0800 | [diff] [blame] | 290 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 291 | Builder pushVlan(); |
Jonathan Hart | 54b406b | 2015-03-06 16:24:14 -0800 | [diff] [blame] | 292 | |
| 293 | /** |
Konstantinos Kanonakis | 9215ff2 | 2016-11-04 13:28:11 -0500 | [diff] [blame] | 294 | * Pushes a new VLAN tag using the supplied Ethernet type. |
| 295 | * |
Ray Milkey | ef79434 | 2016-11-09 16:20:29 -0800 | [diff] [blame] | 296 | * @param ethType ethernet type |
Konstantinos Kanonakis | 9215ff2 | 2016-11-04 13:28:11 -0500 | [diff] [blame] | 297 | * @return a treatment builder |
| 298 | */ |
| 299 | Builder pushVlan(EthType ethType); |
| 300 | |
| 301 | /** |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 302 | * Any instructions preceded by this method call will be deferred. |
| 303 | * @return a treatment builder |
| 304 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 305 | Builder deferred(); |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 306 | |
| 307 | /** |
| 308 | * Any instructions preceded by this method call will be immediate. |
| 309 | * @return a treatment builder |
| 310 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 311 | Builder immediate(); |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 312 | |
| 313 | |
| 314 | /** |
| 315 | * Instructs the device to clear the deferred instructions set. |
| 316 | * @return a treatment builder |
| 317 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 318 | Builder wipeDeferred(); |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 319 | |
| 320 | /** |
Saurav Das | 86af8f1 | 2015-05-25 23:55:33 -0700 | [diff] [blame] | 321 | * Writes metadata to associate with a packet. |
| 322 | * <pre> |
| 323 | * {@code |
| 324 | * new_metadata = (old_metadata & ̃mask) | (value & mask) |
| 325 | * } |
| 326 | * </pre> |
| 327 | * |
| 328 | * @param value the metadata to write |
| 329 | * @param mask the masked bits for the value |
| 330 | * @return a treatment builder |
| 331 | */ |
| 332 | Builder writeMetadata(long value, long mask); |
| 333 | |
| 334 | /** |
Hyunsun Moon | a08c5d0 | 2015-07-14 17:53:00 -0700 | [diff] [blame] | 335 | * Sets the tunnel id. |
| 336 | * |
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 337 | * @param tunnelId a tunnel id |
| 338 | * @return a treatment builder |
Hyunsun Moon | a08c5d0 | 2015-07-14 17:53:00 -0700 | [diff] [blame] | 339 | */ |
| 340 | Builder setTunnelId(long tunnelId); |
| 341 | |
| 342 | /** |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 343 | * Sets the src TCP port. |
| 344 | * |
| 345 | * @param port a port number |
| 346 | * @return a treatment builder |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 347 | */ |
| 348 | Builder setTcpSrc(TpPort port); |
| 349 | |
| 350 | /** |
| 351 | * Sets the dst TCP port. |
| 352 | * |
| 353 | * @param port a port number |
| 354 | * @return a treatment builder |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 355 | */ |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 356 | Builder setTcpDst(TpPort port); |
| 357 | |
| 358 | /** |
| 359 | * Sets the src UDP port. |
| 360 | * |
| 361 | * @param port a port number |
| 362 | * @return a treatment builder |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 363 | */ |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 364 | Builder setUdpSrc(TpPort port); |
| 365 | |
| 366 | /** |
| 367 | * Sets the dst UDP port. |
| 368 | * |
| 369 | * @param port a port number |
| 370 | * @return a treatment builder |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 371 | */ |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 372 | Builder setUdpDst(TpPort port); |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 373 | |
| 374 | /** |
lishuai | 3cce60b | 2015-12-01 19:35:16 +0800 | [diff] [blame] | 375 | * Sets the arp src ip address. |
| 376 | * |
| 377 | * @param addr an ip |
| 378 | * @return a treatment builder |
| 379 | */ |
| 380 | Builder setArpSpa(IpAddress addr); |
| 381 | |
| 382 | /** |
| 383 | * Sets the arp src mac address. |
| 384 | * |
| 385 | * @param addr a macaddress |
| 386 | * @return a treatment builder |
| 387 | */ |
| 388 | Builder setArpSha(MacAddress addr); |
| 389 | |
| 390 | /** |
| 391 | * Sets the arp operation. |
| 392 | * |
| 393 | * @param op the value of arp operation. |
| 394 | * @return a treatment builder. |
| 395 | */ |
| 396 | Builder setArpOp(short op); |
| 397 | |
| 398 | /** |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 399 | * Uses an extension treatment. |
| 400 | * |
| 401 | * @param extension extension treatment |
| 402 | * @param deviceId device ID |
| 403 | * @return a treatment builder |
| 404 | */ |
alshabib | 880b644 | 2015-11-23 22:13:04 -0800 | [diff] [blame] | 405 | Builder extension(ExtensionTreatment extension, DeviceId deviceId); |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 406 | |
| 407 | /** |
Yi Tseng | 2a81c9d | 2016-09-14 10:14:24 -0700 | [diff] [blame] | 408 | * Add all instructions from another treatment. |
| 409 | * |
| 410 | * @param treatment another treatment |
| 411 | * @return a treatment builder |
| 412 | */ |
| 413 | Builder addTreatment(TrafficTreatment treatment); |
| 414 | |
| 415 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 416 | * Builds an immutable traffic treatment descriptor. |
Brian O'Connor | 6b52813 | 2015-03-10 16:39:52 -0700 | [diff] [blame] | 417 | * <p> |
| 418 | * If the treatment is empty when build() is called, it will add a default |
| 419 | * drop rule automatically. For a treatment that is actually empty, use |
| 420 | * {@link org.onosproject.net.flow.DefaultTrafficTreatment#emptyTreatment}. |
| 421 | * </p> |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 422 | * |
| 423 | * @return traffic treatment |
| 424 | */ |
| 425 | TrafficTreatment build(); |
Saurav Das | 86af8f1 | 2015-05-25 23:55:33 -0700 | [diff] [blame] | 426 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 427 | } |
Saurav Das | 86af8f1 | 2015-05-25 23:55:33 -0700 | [diff] [blame] | 428 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 429 | } |