blob: fe213283aa8cb484020fb78cdb5588bf3a358af3 [file] [log] [blame]
tom8bb16062014-09-12 14:47:46 -07001package org.onlab.onos.net.flow;
2
3import java.util.List;
4
alshabib010c31d2014-09-26 10:01:12 -07005import org.onlab.onos.net.PortNumber;
alshabib55a55d92014-09-16 11:59:31 -07006import org.onlab.onos.net.flow.instructions.Instruction;
alshabib010c31d2014-09-26 10:01:12 -07007import org.onlab.packet.IpPrefix;
8import org.onlab.packet.MacAddress;
9import org.onlab.packet.VlanId;
alshabib55a55d92014-09-16 11:59:31 -070010
tom8bb16062014-09-12 14:47:46 -070011/**
12 * Abstraction of network traffic treatment.
13 */
14public interface TrafficTreatment {
15
16 /**
17 * Returns list of instructions on how to treat traffic.
18 *
19 * @return list of treatment instructions
20 */
21 List<Instruction> instructions();
22
23 /**
24 * Builder of traffic treatment entities.
25 */
26 public interface Builder {
27
28 /**
alshabib010c31d2014-09-26 10:01:12 -070029 * Adds an instruction to the builder.
30 * @param instruction an instruction
31 * @return a treatment builder
tom8bb16062014-09-12 14:47:46 -070032 */
alshabib369d2942014-09-12 17:59:35 -070033 Builder add(Instruction instruction);
tom8bb16062014-09-12 14:47:46 -070034
35 /**
alshabib010c31d2014-09-26 10:01:12 -070036 * Adds a drop instruction and does not return a builder.
37 */
38 public void drop();
39
40 /**
41 * Set the output port.
42 * @param number the out port
43 * @return a treatment builder
44 */
45 public Builder setOutput(PortNumber number);
46
47 /**
48 * Sets the src l2 address.
49 * @param addr a macaddress
50 * @return a treatment builder
51 */
52 public Builder setEthSrc(MacAddress addr);
53
54 /**
55 * Sets the dst l2 address.
56 * @param addr a macaddress
57 * @return a treatment builder
58 */
59 public Builder setEthDst(MacAddress addr);
60
61 /**
62 * Sets the vlan id.
63 * @param id a vlanid
64 * @return a treatment builder
65 */
66 public Builder setVlanId(VlanId id);
67
68 /**
69 * Sets the vlan priority.
70 * @param pcp a vlan priority
71 * @return a treatment builder
72 */
73 public Builder setVlanPcp(Byte pcp);
74
75 /**
76 * Sets the src l3 address.
77 * @param addr an ip
78 * @return a treatment builder
79 */
80 public Builder setIpSrc(IpPrefix addr);
81
82 /**
83 * Sets the dst l3 address.
84 * @param addr an ip
85 * @return a treatment builder
86 */
87 public Builder setIpDst(IpPrefix addr);
88
89 /**
tom8bb16062014-09-12 14:47:46 -070090 * Builds an immutable traffic treatment descriptor.
91 *
92 * @return traffic treatment
93 */
94 TrafficTreatment build();
95 }
96
97}