blob: 249d1f9c1dcb526ce0bf47f33b50fcc1c575bbbe [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;
alshabib7410fea2014-09-16 13:48:39 -07006import org.onlab.onos.net.flow.criteria.Criterion;
alshabib010c31d2014-09-26 10:01:12 -07007import org.onlab.packet.IpPrefix;
8import org.onlab.packet.MacAddress;
9import org.onlab.packet.VlanId;
alshabib7410fea2014-09-16 13:48:39 -070010
tom8bb16062014-09-12 14:47:46 -070011/**
12 * Abstraction of a slice of network traffic.
13 */
14public interface TrafficSelector {
15
16 /**
17 * Returns selection criteria as an ordered list.
18 *
19 * @return list of criteria
20 */
21 List<Criterion> criteria();
22
23 /**
24 * Builder of traffic selector entities.
25 */
26 public interface Builder {
27
28 /**
29 * Adds a traffic selection criterion. If a same type criterion has
30 * already been added, it will be replaced by this one.
31 *
32 * @param criterion new criterion
alshabib369d2942014-09-12 17:59:35 -070033 * @return self
tom8bb16062014-09-12 14:47:46 -070034 */
alshabib369d2942014-09-12 17:59:35 -070035 Builder add(Criterion criterion);
tom8bb16062014-09-12 14:47:46 -070036
37 /**
alshabib010c31d2014-09-26 10:01:12 -070038 * Matches an inport.
39 * @param port the inport
40 * @return a selection builder
41 */
42 public Builder matchInport(PortNumber port);
43
44 /**
45 * Matches a l2 src address.
46 * @param addr a l2 address
47 * @return a selection builder
48 */
49 public Builder matchEthSrc(MacAddress addr);
50
51 /**
52 * Matches a l2 dst address.
53 * @param addr a l2 address
54 * @return a selection builder
55 */
56 public Builder matchEthDst(MacAddress addr);
57
58 /**
59 * Matches the ethernet type.
60 * @param ethType an ethernet type
61 * @return a selection builder
62 */
63 public Builder matchEthType(short ethType);
64
65 /**
66 * Matches the vlan id.
67 * @param vlanId a vlan id
68 * @return a selection builder
69 */
70 public Builder matchVlanId(VlanId vlanId);
71
72 /**
73 * Matches a vlan priority.
74 * @param vlanPcp a vlan priority
75 * @return a selection builder
76 */
77 public Builder matchVlanPcp(Byte vlanPcp);
78
79 /**
80 * Matches the l3 protocol.
81 * @param proto a l3 protocol
82 * @return a selection builder
83 */
84 public Builder matchIPProtocol(Byte proto);
85
86 /**
87 * Matches a l3 address.
88 * @param ip a l3 address
89 * @return a selection builder
90 */
91 public Builder matchIPSrc(IpPrefix ip);
92
93 /**
94 * Matches a l3 address.
95 * @param ip a l3 address
96 * @return a selection builder
97 */
98 public Builder matchIPDst(IpPrefix ip);
99
100 /**
tom8bb16062014-09-12 14:47:46 -0700101 * Builds an immutable traffic selector.
102 *
103 * @return traffic selector
104 */
105 TrafficSelector build();
106 }
107
108}