blob: 85c8bc03ef0be70b0b9789006b1bcaa75b963147 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska83e090e2014-10-22 14:25:35 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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 Vachuska83e090e2014-10-22 14:25:35 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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 Vachuska83e090e2014-10-22 14:25:35 -070015 */
tom8bb16062014-09-12 14:47:46 -070016package org.onlab.onos.net.flow;
17
18import java.util.List;
19
alshabib010c31d2014-09-26 10:01:12 -070020import org.onlab.onos.net.PortNumber;
alshabib55a55d92014-09-16 11:59:31 -070021import org.onlab.onos.net.flow.instructions.Instruction;
alshabib010c31d2014-09-26 10:01:12 -070022import org.onlab.packet.IpPrefix;
23import org.onlab.packet.MacAddress;
24import org.onlab.packet.VlanId;
alshabib55a55d92014-09-16 11:59:31 -070025
tom8bb16062014-09-12 14:47:46 -070026/**
27 * Abstraction of network traffic treatment.
28 */
29public interface TrafficTreatment {
30
31 /**
32 * Returns list of instructions on how to treat traffic.
33 *
34 * @return list of treatment instructions
35 */
36 List<Instruction> instructions();
37
38 /**
39 * Builder of traffic treatment entities.
40 */
41 public interface Builder {
42
43 /**
alshabib010c31d2014-09-26 10:01:12 -070044 * Adds an instruction to the builder.
45 * @param instruction an instruction
46 * @return a treatment builder
tom8bb16062014-09-12 14:47:46 -070047 */
alshabib369d2942014-09-12 17:59:35 -070048 Builder add(Instruction instruction);
tom8bb16062014-09-12 14:47:46 -070049
50 /**
alshabib010c31d2014-09-26 10:01:12 -070051 * Adds a drop instruction and does not return a builder.
52 */
53 public void drop();
54
55 /**
56 * Set the output port.
57 * @param number the out port
58 * @return a treatment builder
59 */
60 public Builder setOutput(PortNumber number);
61
62 /**
63 * Sets the src l2 address.
64 * @param addr a macaddress
65 * @return a treatment builder
66 */
67 public Builder setEthSrc(MacAddress addr);
68
69 /**
70 * Sets the dst l2 address.
71 * @param addr a macaddress
72 * @return a treatment builder
73 */
74 public Builder setEthDst(MacAddress addr);
75
76 /**
77 * Sets the vlan id.
78 * @param id a vlanid
79 * @return a treatment builder
80 */
81 public Builder setVlanId(VlanId id);
82
83 /**
84 * Sets the vlan priority.
85 * @param pcp a vlan priority
86 * @return a treatment builder
87 */
88 public Builder setVlanPcp(Byte pcp);
89
90 /**
91 * Sets the src l3 address.
92 * @param addr an ip
93 * @return a treatment builder
94 */
95 public Builder setIpSrc(IpPrefix addr);
96
97 /**
98 * Sets the dst l3 address.
99 * @param addr an ip
100 * @return a treatment builder
101 */
102 public Builder setIpDst(IpPrefix addr);
103
104 /**
Marc De Leenheer49087752014-10-23 13:54:09 -0700105 * Sets the optical channel ID or lambda.
106 * @param lambda optical channel ID
107 * @return a treatment builder
108 */
109 public Builder setLambda(short lambda);
110
111 /**
tom8bb16062014-09-12 14:47:46 -0700112 * Builds an immutable traffic treatment descriptor.
113 *
114 * @return traffic treatment
115 */
116 TrafficTreatment build();
117 }
118
119}