Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 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; |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 29 | import org.onosproject.net.flow.instructions.ExtensionInstruction; |
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 |
Sho SHIMIZU | 9a2b081 | 2015-06-30 10:02:22 -0700 | [diff] [blame] | 211 | * @deprecated in Drake Release |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 212 | */ |
alshabib | 7b808c5 | 2015-06-26 14:22:24 -0700 | [diff] [blame] | 213 | @Deprecated |
alshabib | 0ad4398 | 2015-05-07 13:43:13 -0700 | [diff] [blame] | 214 | Builder popMpls(int etherType); |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 215 | |
216 | /** | ||||
alshabib | 7b808c5 | 2015-06-26 14:22:24 -0700 | [diff] [blame] | 217 | * Pops MPLS ether type and set the new ethertype. |
218 | * | ||||
219 | * @param etherType an ether type | ||||
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 220 | * @return a treatment builder |
alshabib | 7b808c5 | 2015-06-26 14:22:24 -0700 | [diff] [blame] | 221 | */ |
222 | Builder popMpls(EthType etherType); | ||||
223 | |||||
224 | /** | ||||
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 225 | * Sets the mpls label. |
Thomas Vachuska | f4df005 | 2015-01-06 12:30:11 -0800 | [diff] [blame] | 226 | * |
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 227 | * @param mplsLabel MPLS label |
228 | * @return a treatment builder | ||||
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 229 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 230 | Builder setMpls(MplsLabel mplsLabel); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 231 | |
232 | /** | ||||
Saurav Das | 73a7dd4 | 2015-08-19 22:20:31 -0700 | [diff] [blame] | 233 | * Sets the mpls bottom-of-stack indicator bit. |
234 | * | ||||
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 235 | * @param mplsBos boolean to set BOS=1 (true) or BOS=0 (false) |
Saurav Das | 73a7dd4 | 2015-08-19 22:20:31 -0700 | [diff] [blame] | 236 | * @return a treatment builder. |
237 | */ | ||||
238 | Builder setMplsBos(boolean mplsBos); | ||||
239 | |||||
240 | /** | ||||
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 241 | * Decrement MPLS TTL. |
242 | * | ||||
243 | * @return a treatment builder | ||||
244 | */ | ||||
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 245 | Builder decMplsTtl(); |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 246 | |
247 | /** | ||||
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 248 | * Sets the optical channel ID or lambda. |
Sho SHIMIZU | bdaea83 | 2014-11-12 11:29:38 -0800 | [diff] [blame] | 249 | * |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 250 | * @param lambda optical channel ID |
251 | * @return a treatment builder | ||||
Sho SHIMIZU | 9553bb8 | 2015-06-30 16:02:45 -0700 | [diff] [blame] | 252 | * @deprecated in Drake Release |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 253 | */ |
Sho SHIMIZU | 9553bb8 | 2015-06-30 16:02:45 -0700 | [diff] [blame] | 254 | @Deprecated |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 255 | Builder setLambda(short lambda); |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 256 | |
257 | /** | ||||
sangho | 8995ac5 | 2015-02-04 11:29:03 -0800 | [diff] [blame] | 258 | * Sets the group ID. |
259 | * | ||||
260 | * @param groupId group ID | ||||
261 | * @return a treatment builder | ||||
262 | */ | ||||
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 263 | Builder group(GroupId groupId); |
sangho | 8995ac5 | 2015-02-04 11:29:03 -0800 | [diff] [blame] | 264 | |
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 265 | /** |
Steffen Gebert | bbfdaaa | 2015-09-29 11:01:46 +0200 | [diff] [blame] | 266 | * Sets the Queue ID. |
267 | * | ||||
268 | * @param queueId a queue ID | ||||
269 | * @return a treatment builder | ||||
270 | */ | ||||
271 | Builder setQueue(long queueId); | ||||
272 | |||||
273 | /** | ||||
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 274 | * Sets a meter to be used by this flow. |
275 | * | ||||
276 | * @param meterId a meter id | ||||
277 | * @return a treatment builder | ||||
278 | */ | ||||
279 | Builder meter(MeterId meterId); | ||||
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 280 | |
281 | /** | ||||
alshabib | d17abc2 | 2015-04-21 18:26:35 -0700 | [diff] [blame] | 282 | * Sets the next table id to transition to. |
283 | * | ||||
284 | * @param tableId the table table | ||||
285 | * @return a treatement builder | ||||
286 | */ | ||||
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 287 | Builder transition(Integer tableId); |
alshabib | d17abc2 | 2015-04-21 18:26:35 -0700 | [diff] [blame] | 288 | |
289 | |||||
290 | /** | ||||
Saurav Das | fbe25c5 | 2015-03-04 11:12:00 -0800 | [diff] [blame] | 291 | * Pops outermost VLAN tag. |
292 | * | ||||
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 293 | * @return a treatment builder |
Saurav Das | fbe25c5 | 2015-03-04 11:12:00 -0800 | [diff] [blame] | 294 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 295 | Builder popVlan(); |
Saurav Das | fbe25c5 | 2015-03-04 11:12:00 -0800 | [diff] [blame] | 296 | |
297 | /** | ||||
Jonathan Hart | 54b406b | 2015-03-06 16:24:14 -0800 | [diff] [blame] | 298 | * Pushes a new VLAN tag. |
299 | * | ||||
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 300 | * @return a treatment builder |
Jonathan Hart | 54b406b | 2015-03-06 16:24:14 -0800 | [diff] [blame] | 301 | */ |
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 302 | Builder pushVlan(); |
Jonathan Hart | 54b406b | 2015-03-06 16:24:14 -0800 | [diff] [blame] | 303 | |
304 | /** | ||||
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 305 | * Any instructions preceded by this method call will be deferred. |
306 | * @return a treatment builder | ||||
307 | */ | ||||
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 308 | Builder deferred(); |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 309 | |
310 | /** | ||||
311 | * Any instructions preceded by this method call will be immediate. | ||||
312 | * @return a treatment builder | ||||
313 | */ | ||||
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 314 | Builder immediate(); |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 315 | |
316 | |||||
317 | /** | ||||
318 | * Instructs the device to clear the deferred instructions set. | ||||
319 | * @return a treatment builder | ||||
320 | */ | ||||
Sho SHIMIZU | 79906e4 | 2015-05-04 18:27:31 -0700 | [diff] [blame] | 321 | Builder wipeDeferred(); |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 322 | |
323 | /** | ||||
Saurav Das | 86af8f1 | 2015-05-25 23:55:33 -0700 | [diff] [blame] | 324 | * Writes metadata to associate with a packet. |
325 | * <pre> | ||||
326 | * {@code | ||||
327 | * new_metadata = (old_metadata & ̃mask) | (value & mask) | ||||
328 | * } | ||||
329 | * </pre> | ||||
330 | * | ||||
331 | * @param value the metadata to write | ||||
332 | * @param mask the masked bits for the value | ||||
333 | * @return a treatment builder | ||||
334 | */ | ||||
335 | Builder writeMetadata(long value, long mask); | ||||
336 | |||||
337 | /** | ||||
Hyunsun Moon | a08c5d0 | 2015-07-14 17:53:00 -0700 | [diff] [blame] | 338 | * Sets the tunnel id. |
339 | * | ||||
Jonathan Hart | 3e59464 | 2015-10-20 17:31:24 -0700 | [diff] [blame] | 340 | * @param tunnelId a tunnel id |
341 | * @return a treatment builder | ||||
Hyunsun Moon | a08c5d0 | 2015-07-14 17:53:00 -0700 | [diff] [blame] | 342 | */ |
343 | Builder setTunnelId(long tunnelId); | ||||
344 | |||||
345 | /** | ||||
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 346 | * Sets the src TCP port. |
347 | * | ||||
348 | * @param port a port number | ||||
349 | * @return a treatment builder | ||||
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 350 | * @deprecated in Drake release |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 351 | */ |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 352 | @Deprecated |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 353 | Builder setTcpSrc(short port); |
354 | |||||
355 | /** | ||||
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 356 | * Sets the src TCP port. |
357 | * | ||||
358 | * @param port a port number | ||||
359 | * @return a treatment builder | ||||
360 | */ | ||||
361 | Builder setTcpSrc(TpPort port); | ||||
362 | |||||
363 | /** | ||||
364 | * Sets the dst TCP port. | ||||
365 | * | ||||
366 | * @param port a port number | ||||
367 | * @return a treatment builder | ||||
368 | * @deprecated in Drake release | ||||
369 | */ | ||||
370 | @Deprecated | ||||
371 | Builder setTcpDst(short port); | ||||
372 | |||||
373 | /** | ||||
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 374 | * Sets the dst TCP port. |
375 | * | ||||
376 | * @param port a port number | ||||
377 | * @return a treatment builder | ||||
378 | */ | ||||
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 379 | Builder setTcpDst(TpPort port); |
380 | |||||
381 | /** | ||||
382 | * Sets the src UDP port. | ||||
383 | * | ||||
384 | * @param port a port number | ||||
385 | * @return a treatment builder | ||||
386 | * @deprecated in Drake release | ||||
387 | */ | ||||
388 | @Deprecated | ||||
389 | Builder setUdpSrc(short port); | ||||
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 390 | |
391 | /** | ||||
392 | * Sets the src UDP port. | ||||
393 | * | ||||
394 | * @param port a port number | ||||
395 | * @return a treatment builder | ||||
396 | */ | ||||
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 397 | Builder setUdpSrc(TpPort port); |
398 | |||||
399 | /** | ||||
400 | * Sets the dst UDP port. | ||||
401 | * | ||||
402 | * @param port a port number | ||||
403 | * @return a treatment builder | ||||
404 | * @deprecated in Drake release | ||||
405 | */ | ||||
406 | @Deprecated | ||||
407 | Builder setUdpDst(short port); | ||||
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 408 | |
409 | /** | ||||
410 | * Sets the dst UDP port. | ||||
411 | * | ||||
412 | * @param port a port number | ||||
413 | * @return a treatment builder | ||||
414 | */ | ||||
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 415 | Builder setUdpDst(TpPort port); |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 416 | |
417 | /** | ||||
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 418 | * Uses an extension treatment. |
419 | * | ||||
420 | * @param extension extension treatment | ||||
421 | * @param deviceId device ID | ||||
422 | * @return a treatment builder | ||||
423 | */ | ||||
424 | Builder extension(ExtensionInstruction extension, DeviceId deviceId); | ||||
425 | |||||
426 | /** | ||||
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 427 | * Builds an immutable traffic treatment descriptor. |
Brian O'Connor | 6b52813 | 2015-03-10 16:39:52 -0700 | [diff] [blame] | 428 | * <p> |
429 | * If the treatment is empty when build() is called, it will add a default | ||||
430 | * drop rule automatically. For a treatment that is actually empty, use | ||||
431 | * {@link org.onosproject.net.flow.DefaultTrafficTreatment#emptyTreatment}. | ||||
432 | * </p> | ||||
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 433 | * |
434 | * @return traffic treatment | ||||
435 | */ | ||||
436 | TrafficTreatment build(); | ||||
Saurav Das | 86af8f1 | 2015-05-25 23:55:33 -0700 | [diff] [blame] | 437 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 438 | } |
Saurav Das | 86af8f1 | 2015-05-25 23:55:33 -0700 | [diff] [blame] | 439 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 440 | } |