blob: 9b135baa0647ccf439face731d6af987a536d309 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
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 */
tom8bb16062014-09-12 14:47:46 -070019package org.onlab.onos.net.flow;
20
21import java.util.List;
22
alshabib010c31d2014-09-26 10:01:12 -070023import org.onlab.onos.net.PortNumber;
alshabib55a55d92014-09-16 11:59:31 -070024import org.onlab.onos.net.flow.instructions.Instruction;
alshabib010c31d2014-09-26 10:01:12 -070025import org.onlab.packet.IpPrefix;
26import org.onlab.packet.MacAddress;
27import org.onlab.packet.VlanId;
alshabib55a55d92014-09-16 11:59:31 -070028
tom8bb16062014-09-12 14:47:46 -070029/**
30 * Abstraction of network traffic treatment.
31 */
32public 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 /**
alshabib010c31d2014-09-26 10:01:12 -070047 * Adds an instruction to the builder.
48 * @param instruction an instruction
49 * @return a treatment builder
tom8bb16062014-09-12 14:47:46 -070050 */
alshabib369d2942014-09-12 17:59:35 -070051 Builder add(Instruction instruction);
tom8bb16062014-09-12 14:47:46 -070052
53 /**
alshabib010c31d2014-09-26 10:01:12 -070054 * 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 Leenheer49087752014-10-23 13:54:09 -0700108 * 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 /**
tom8bb16062014-09-12 14:47:46 -0700115 * Builds an immutable traffic treatment descriptor.
116 *
117 * @return traffic treatment
118 */
119 TrafficTreatment build();
120 }
121
122}