Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 19 | package org.onlab.onos.net.flow; |
| 20 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 21 | import java.util.Set; |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 22 | |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 23 | import org.onlab.onos.net.PortNumber; |
alshabib | 7410fea | 2014-09-16 13:48:39 -0700 | [diff] [blame] | 24 | import org.onlab.onos.net.flow.criteria.Criterion; |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 25 | import org.onlab.packet.IpPrefix; |
| 26 | import org.onlab.packet.MacAddress; |
| 27 | import org.onlab.packet.VlanId; |
alshabib | 7410fea | 2014-09-16 13:48:39 -0700 | [diff] [blame] | 28 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 29 | /** |
| 30 | * Abstraction of a slice of network traffic. |
| 31 | */ |
| 32 | public interface TrafficSelector { |
| 33 | |
| 34 | /** |
| 35 | * Returns selection criteria as an ordered list. |
| 36 | * |
| 37 | * @return list of criteria |
| 38 | */ |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 39 | Set<Criterion> criteria(); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * Builder of traffic selector entities. |
| 43 | */ |
| 44 | public interface Builder { |
| 45 | |
| 46 | /** |
| 47 | * Adds a traffic selection criterion. If a same type criterion has |
| 48 | * already been added, it will be replaced by this one. |
| 49 | * |
| 50 | * @param criterion new criterion |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 51 | * @return self |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 52 | */ |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 53 | Builder add(Criterion criterion); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 54 | |
| 55 | /** |
alshabib | 010c31d | 2014-09-26 10:01:12 -0700 | [diff] [blame] | 56 | * Matches an inport. |
| 57 | * @param port the inport |
| 58 | * @return a selection builder |
| 59 | */ |
| 60 | public Builder matchInport(PortNumber port); |
| 61 | |
| 62 | /** |
| 63 | * Matches a l2 src address. |
| 64 | * @param addr a l2 address |
| 65 | * @return a selection builder |
| 66 | */ |
| 67 | public Builder matchEthSrc(MacAddress addr); |
| 68 | |
| 69 | /** |
| 70 | * Matches a l2 dst address. |
| 71 | * @param addr a l2 address |
| 72 | * @return a selection builder |
| 73 | */ |
| 74 | public Builder matchEthDst(MacAddress addr); |
| 75 | |
| 76 | /** |
| 77 | * Matches the ethernet type. |
| 78 | * @param ethType an ethernet type |
| 79 | * @return a selection builder |
| 80 | */ |
| 81 | public Builder matchEthType(short ethType); |
| 82 | |
| 83 | /** |
| 84 | * Matches the vlan id. |
| 85 | * @param vlanId a vlan id |
| 86 | * @return a selection builder |
| 87 | */ |
| 88 | public Builder matchVlanId(VlanId vlanId); |
| 89 | |
| 90 | /** |
| 91 | * Matches a vlan priority. |
| 92 | * @param vlanPcp a vlan priority |
| 93 | * @return a selection builder |
| 94 | */ |
| 95 | public Builder matchVlanPcp(Byte vlanPcp); |
| 96 | |
| 97 | /** |
| 98 | * Matches the l3 protocol. |
| 99 | * @param proto a l3 protocol |
| 100 | * @return a selection builder |
| 101 | */ |
| 102 | public Builder matchIPProtocol(Byte proto); |
| 103 | |
| 104 | /** |
| 105 | * Matches a l3 address. |
| 106 | * @param ip a l3 address |
| 107 | * @return a selection builder |
| 108 | */ |
| 109 | public Builder matchIPSrc(IpPrefix ip); |
| 110 | |
| 111 | /** |
| 112 | * Matches a l3 address. |
| 113 | * @param ip a l3 address |
| 114 | * @return a selection builder |
| 115 | */ |
| 116 | public Builder matchIPDst(IpPrefix ip); |
| 117 | |
| 118 | /** |
Toshio Koide | 9c44c9a | 2014-10-09 11:44:36 -0700 | [diff] [blame] | 119 | * Matches a TCP source port number. |
| 120 | * @param tcpPort a TCP source port number |
| 121 | * @return a selection builder |
| 122 | */ |
| 123 | public Builder matchTcpSrc(Short tcpPort); |
| 124 | |
| 125 | /** |
| 126 | * Matches a TCP destination port number. |
| 127 | * @param tcpPort a TCP destination port number |
| 128 | * @return a selection builder |
| 129 | */ |
| 130 | public Builder matchTcpDst(Short tcpPort); |
| 131 | |
| 132 | /** |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 133 | * Matches an optical signal ID or lambda. |
| 134 | * @param lambda |
| 135 | * @return a selection builder |
| 136 | */ |
Praseed Balakrishnan | 64369da | 2014-10-23 15:55:20 -0700 | [diff] [blame] | 137 | public Builder matchLambda(Short lambda); |
| 138 | |
| 139 | /** |
| 140 | * Matches an optical Signal Type. |
| 141 | * @param signalType |
| 142 | * @return a selection builder |
| 143 | */ |
| 144 | public Builder matchOpticalSignalType(Byte signalType); |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 145 | |
| 146 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 147 | * Builds an immutable traffic selector. |
| 148 | * |
| 149 | * @return traffic selector |
| 150 | */ |
| 151 | TrafficSelector build(); |
| 152 | } |
| 153 | |
| 154 | } |