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 | */ |
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 | |
| 19 | /** |
| 20 | * Represents a generalized match & action pair to be applied to |
| 21 | * an infrastucture device. |
| 22 | */ |
| 23 | public interface FlowEntry extends FlowRule { |
| 24 | |
| 25 | |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 26 | enum FlowEntryState { |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Indicates that this rule has been submitted for addition. |
Sho SHIMIZU | 8f86bb2 | 2015-05-27 11:29:17 -0700 | [diff] [blame] | 30 | * Not necessarily in the flow table. |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 31 | */ |
| 32 | PENDING_ADD, |
| 33 | |
| 34 | /** |
| 35 | * Rule has been added which means it is in the flow table. |
| 36 | */ |
| 37 | ADDED, |
| 38 | |
| 39 | /** |
| 40 | * Flow has been marked for removal, might still be in flow table. |
| 41 | */ |
| 42 | PENDING_REMOVE, |
| 43 | |
| 44 | /** |
| 45 | * Flow has been removed from flow table and can be purged. |
| 46 | */ |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 47 | REMOVED, |
| 48 | |
| 49 | /** |
| 50 | * Indicates that the installation of this flow has failed. |
| 51 | */ |
| 52 | FAILED |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Returns the flow entry state. |
| 57 | * |
| 58 | * @return flow entry state |
| 59 | */ |
| 60 | FlowEntryState state(); |
| 61 | |
| 62 | /** |
| 63 | * Returns the number of milliseconds this flow rule has been applied. |
| 64 | * |
| 65 | * @return number of millis |
| 66 | */ |
| 67 | long life(); |
| 68 | |
| 69 | /** |
| 70 | * Returns the number of packets this flow rule has matched. |
| 71 | * |
| 72 | * @return number of packets |
| 73 | */ |
| 74 | long packets(); |
| 75 | |
| 76 | /** |
| 77 | * Returns the number of bytes this flow rule has matched. |
| 78 | * |
| 79 | * @return number of bytes |
| 80 | */ |
| 81 | long bytes(); |
| 82 | |
Yuta HIGUCHI | f6f50a6 | 2014-10-19 15:58:49 -0700 | [diff] [blame] | 83 | // TODO: consider removing this attribute |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 84 | /** |
| 85 | * When this flow entry was last deemed active. |
| 86 | * @return epoch time of last activity |
| 87 | */ |
| 88 | long lastSeen(); |
| 89 | |
| 90 | /** |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 91 | * Indicates the error type. |
| 92 | * @return an integer value of the error |
| 93 | */ |
| 94 | int errType(); |
| 95 | |
| 96 | /** |
| 97 | * Indicates the error code. |
| 98 | * @return an integer value of the error |
| 99 | */ |
| 100 | int errCode(); |
| 101 | |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 102 | } |