Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 19 | package org.onlab.onos.net.flow; |
| 20 | |
| 21 | import java.util.List; |
| 22 | |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 23 | import org.onlab.onos.net.PortNumber; |
alshabib | 55a55d9 | 2014-09-16 11:59:31 -0700 | [diff] [blame] | 24 | import org.onlab.onos.net.flow.instructions.Instruction; |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 25 | import org.onlab.packet.IpPrefix; |
| 26 | import org.onlab.packet.MacAddress; |
| 27 | import org.onlab.packet.VlanId; |
alshabib | 55a55d9 | 2014-09-16 11:59:31 -0700 | [diff] [blame] | 28 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 29 | /** |
| 30 | * Abstraction of network traffic treatment. |
| 31 | */ |
| 32 | public interface TrafficTreatment { |
| 33 | |
| 34 | /** |
| 35 | * Returns list of instructions on how to treat traffic. |
| 36 | * |
| 37 | * @return list of treatment instructions |
| 38 | */ |
| 39 | List<Instruction> instructions(); |
| 40 | |
| 41 | /** |
| 42 | * Builder of traffic treatment entities. |
| 43 | */ |
| 44 | public interface Builder { |
| 45 | |
| 46 | /** |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 47 | * Adds an instruction to the builder. |
| 48 | * @param instruction an instruction |
| 49 | * @return a treatment builder |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 50 | */ |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 51 | Builder add(Instruction instruction); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 52 | |
| 53 | /** |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 54 | * Adds a drop instruction and does not return a builder. |
| 55 | */ |
| 56 | public void drop(); |
| 57 | |
| 58 | /** |
| 59 | * Set the output port. |
| 60 | * @param number the out port |
| 61 | * @return a treatment builder |
| 62 | */ |
| 63 | public Builder setOutput(PortNumber number); |
| 64 | |
| 65 | /** |
| 66 | * Sets the src l2 address. |
| 67 | * @param addr a macaddress |
| 68 | * @return a treatment builder |
| 69 | */ |
| 70 | public Builder setEthSrc(MacAddress addr); |
| 71 | |
| 72 | /** |
| 73 | * Sets the dst l2 address. |
| 74 | * @param addr a macaddress |
| 75 | * @return a treatment builder |
| 76 | */ |
| 77 | public Builder setEthDst(MacAddress addr); |
| 78 | |
| 79 | /** |
| 80 | * Sets the vlan id. |
| 81 | * @param id a vlanid |
| 82 | * @return a treatment builder |
| 83 | */ |
| 84 | public Builder setVlanId(VlanId id); |
| 85 | |
| 86 | /** |
| 87 | * Sets the vlan priority. |
| 88 | * @param pcp a vlan priority |
| 89 | * @return a treatment builder |
| 90 | */ |
| 91 | public Builder setVlanPcp(Byte pcp); |
| 92 | |
| 93 | /** |
| 94 | * Sets the src l3 address. |
| 95 | * @param addr an ip |
| 96 | * @return a treatment builder |
| 97 | */ |
| 98 | public Builder setIpSrc(IpPrefix addr); |
| 99 | |
| 100 | /** |
| 101 | * Sets the dst l3 address. |
| 102 | * @param addr an ip |
| 103 | * @return a treatment builder |
| 104 | */ |
| 105 | public Builder setIpDst(IpPrefix addr); |
| 106 | |
| 107 | /** |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 108 | * Sets the optical channel ID or lambda. |
| 109 | * @param lambda optical channel ID |
| 110 | * @return a treatment builder |
| 111 | */ |
| 112 | public Builder setLambda(short lambda); |
| 113 | |
| 114 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 115 | * Builds an immutable traffic treatment descriptor. |
| 116 | * |
| 117 | * @return traffic treatment |
| 118 | */ |
| 119 | TrafficTreatment build(); |
| 120 | } |
| 121 | |
| 122 | } |