Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.flow; |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 17 | |
| 18 | |
Thiago Santos | 877914d | 2016-07-20 18:29:29 -0300 | [diff] [blame] | 19 | import java.util.concurrent.TimeUnit; |
| 20 | |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 21 | /** |
| 22 | * Represents a generalized match & action pair to be applied to |
Yuta HIGUCHI | 852fecd | 2016-09-22 18:39:25 -0700 | [diff] [blame] | 23 | * an infrastructure device. |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 24 | */ |
| 25 | public interface FlowEntry extends FlowRule { |
| 26 | |
| 27 | |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 28 | enum FlowEntryState { |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 29 | |
| 30 | /** |
| 31 | * Indicates that this rule has been submitted for addition. |
Sho SHIMIZU | 8f86bb2 | 2015-05-27 11:29:17 -0700 | [diff] [blame] | 32 | * Not necessarily in the flow table. |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 33 | */ |
| 34 | PENDING_ADD, |
| 35 | |
| 36 | /** |
| 37 | * Rule has been added which means it is in the flow table. |
| 38 | */ |
| 39 | ADDED, |
| 40 | |
| 41 | /** |
| 42 | * Flow has been marked for removal, might still be in flow table. |
| 43 | */ |
| 44 | PENDING_REMOVE, |
| 45 | |
| 46 | /** |
| 47 | * Flow has been removed from flow table and can be purged. |
| 48 | */ |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 49 | REMOVED, |
| 50 | |
| 51 | /** |
| 52 | * Indicates that the installation of this flow has failed. |
| 53 | */ |
| 54 | FAILED |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Returns the flow entry state. |
| 59 | * |
| 60 | * @return flow entry state |
| 61 | */ |
| 62 | FlowEntryState state(); |
| 63 | |
| 64 | /** |
Thiago Santos | 877914d | 2016-07-20 18:29:29 -0300 | [diff] [blame] | 65 | * Returns the number of seconds this flow rule has been applied. |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 66 | * |
Thiago Santos | 877914d | 2016-07-20 18:29:29 -0300 | [diff] [blame] | 67 | * @return number of seconds |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 68 | */ |
| 69 | long life(); |
| 70 | |
| 71 | /** |
Thiago Santos | 877914d | 2016-07-20 18:29:29 -0300 | [diff] [blame] | 72 | * Returns the time this flow rule has been applied. |
| 73 | * |
Ray Milkey | bb23e0b | 2016-08-02 17:00:21 -0700 | [diff] [blame] | 74 | * @param unit time unit the result will be converted to |
Thiago Santos | 877914d | 2016-07-20 18:29:29 -0300 | [diff] [blame] | 75 | * @return time in the requested {@link TimeUnit} |
| 76 | */ |
| 77 | long life(TimeUnit unit); |
| 78 | |
| 79 | /** |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 80 | * Returns the number of packets this flow rule has matched. |
| 81 | * |
| 82 | * @return number of packets |
| 83 | */ |
| 84 | long packets(); |
| 85 | |
| 86 | /** |
| 87 | * Returns the number of bytes this flow rule has matched. |
| 88 | * |
| 89 | * @return number of bytes |
| 90 | */ |
| 91 | long bytes(); |
| 92 | |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 93 | // TODO: consider removing this attribute |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 94 | /** |
| 95 | * When this flow entry was last deemed active. |
| 96 | * @return epoch time of last activity |
| 97 | */ |
| 98 | long lastSeen(); |
| 99 | |
| 100 | /** |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 101 | * Indicates the error type. |
| 102 | * @return an integer value of the error |
| 103 | */ |
| 104 | int errType(); |
| 105 | |
| 106 | /** |
| 107 | * Indicates the error code. |
| 108 | * @return an integer value of the error |
| 109 | */ |
| 110 | int errCode(); |
| 111 | |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 112 | } |