Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 2 | * Copyright 2014 Open Networking Laboratory |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 4 | * 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 Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 8 | * 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 Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 15 | */ |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 16 | package org.onlab.onos.net.flow; |
| 17 | |
| 18 | import org.onlab.onos.net.DeviceId; |
| 19 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 20 | /** |
| 21 | * Represents a generalized match & action pair to be applied to |
| 22 | * an infrastucture device. |
| 23 | */ |
alshabib | 902d41b | 2014-10-07 16:52:05 -0700 | [diff] [blame] | 24 | public interface FlowRule extends BatchOperationTarget { |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 25 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 26 | static final int MAX_TIMEOUT = 60; |
alshabib | a0e0498 | 2014-10-03 13:03:19 -0700 | [diff] [blame] | 27 | static final int MIN_PRIORITY = 0; |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 28 | |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 29 | //TODO: build cookie value |
Ayaka Koshibe | d4e53e1 | 2014-09-18 14:24:55 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Returns the ID of this flow. |
| 32 | * |
| 33 | * @return the flow ID |
| 34 | */ |
| 35 | FlowId id(); |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 36 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 37 | /** |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 38 | * Returns the application id of this flow. |
| 39 | * |
| 40 | * @return an applicationId |
| 41 | */ |
alshabib | 92c65ad | 2014-10-08 21:56:05 -0700 | [diff] [blame] | 42 | short appId(); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
alshabib | 28204e5 | 2014-11-12 18:29:45 -0800 | [diff] [blame] | 45 | * Returns the group id of this flow. |
| 46 | * |
| 47 | * @return an groupId |
| 48 | */ |
| 49 | short groupId(); |
| 50 | |
| 51 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 52 | * Returns the flow rule priority given in natural order; higher numbers |
| 53 | * mean higher priorities. |
| 54 | * |
| 55 | * @return flow rule priority |
| 56 | */ |
| 57 | int priority(); |
| 58 | |
| 59 | /** |
| 60 | * Returns the identity of the device where this rule applies. |
| 61 | * |
| 62 | * @return device identifier |
| 63 | */ |
| 64 | DeviceId deviceId(); |
| 65 | |
| 66 | /** |
| 67 | * Returns the traffic selector that identifies what traffic this |
| 68 | * rule should apply to. |
| 69 | * |
| 70 | * @return traffic selector |
| 71 | */ |
| 72 | TrafficSelector selector(); |
| 73 | |
| 74 | /** |
| 75 | * Returns the traffic treatment that applies to selected traffic. |
| 76 | * |
| 77 | * @return traffic treatment |
| 78 | */ |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 79 | TrafficTreatment treatment(); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 80 | |
Ayaka Koshibe | d4e53e1 | 2014-09-18 14:24:55 -0700 | [diff] [blame] | 81 | /** |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 82 | * Returns the timeout for this flow requested by an application. |
Jonathan Hart | bc4a793 | 2014-10-21 11:46:00 -0700 | [diff] [blame] | 83 | * |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 84 | * @return integer value of the timeout |
alshabib | 6eb438a | 2014-10-01 16:39:37 -0700 | [diff] [blame] | 85 | */ |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 86 | int timeout(); |
alshabib | 6eb438a | 2014-10-01 16:39:37 -0700 | [diff] [blame] | 87 | |
Jonathan Hart | bc4a793 | 2014-10-21 11:46:00 -0700 | [diff] [blame] | 88 | /** |
| 89 | * Returns whether the flow is permanent i.e. does not time out. |
| 90 | * |
| 91 | * @return true if the flow is permanent, otherwise false |
| 92 | */ |
| 93 | boolean isPermanent(); |
| 94 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 95 | } |