tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.flow; |
| 2 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 3 | import java.util.Set; |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 4 | |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 5 | import org.onlab.onos.net.PortNumber; |
alshabib | 7410fea | 2014-09-16 13:48:39 -0700 | [diff] [blame] | 6 | import org.onlab.onos.net.flow.criteria.Criterion; |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 7 | import org.onlab.packet.IpPrefix; |
| 8 | import org.onlab.packet.MacAddress; |
| 9 | import org.onlab.packet.VlanId; |
alshabib | 7410fea | 2014-09-16 13:48:39 -0700 | [diff] [blame] | 10 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 11 | /** |
| 12 | * Abstraction of a slice of network traffic. |
| 13 | */ |
| 14 | public interface TrafficSelector { |
| 15 | |
| 16 | /** |
| 17 | * Returns selection criteria as an ordered list. |
| 18 | * |
| 19 | * @return list of criteria |
| 20 | */ |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 21 | Set<Criterion> criteria(); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 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 |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 33 | * @return self |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 34 | */ |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 35 | Builder add(Criterion criterion); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 36 | |
| 37 | /** |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 38 | * 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 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 101 | * Builds an immutable traffic selector. |
| 102 | * |
| 103 | * @return traffic selector |
| 104 | */ |
| 105 | TrafficSelector build(); |
| 106 | } |
| 107 | |
| 108 | } |