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