alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.flow; |
| 2 | |
| 3 | |
| 4 | /** |
| 5 | * Represents a generalized match & action pair to be applied to |
| 6 | * an infrastucture device. |
| 7 | */ |
| 8 | public interface FlowEntry extends FlowRule { |
| 9 | |
| 10 | |
| 11 | public enum FlowEntryState { |
| 12 | |
| 13 | /** |
| 14 | * Indicates that this rule has been submitted for addition. |
| 15 | * Not necessarily in the flow table. |
| 16 | */ |
| 17 | PENDING_ADD, |
| 18 | |
| 19 | /** |
| 20 | * Rule has been added which means it is in the flow table. |
| 21 | */ |
| 22 | ADDED, |
| 23 | |
| 24 | /** |
| 25 | * Flow has been marked for removal, might still be in flow table. |
| 26 | */ |
| 27 | PENDING_REMOVE, |
| 28 | |
| 29 | /** |
| 30 | * Flow has been removed from flow table and can be purged. |
| 31 | */ |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame^] | 32 | REMOVED, |
| 33 | |
| 34 | /** |
| 35 | * Indicates that the installation of this flow has failed. |
| 36 | */ |
| 37 | FAILED |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Returns the flow entry state. |
| 42 | * |
| 43 | * @return flow entry state |
| 44 | */ |
| 45 | FlowEntryState state(); |
| 46 | |
| 47 | /** |
| 48 | * Returns the number of milliseconds this flow rule has been applied. |
| 49 | * |
| 50 | * @return number of millis |
| 51 | */ |
| 52 | long life(); |
| 53 | |
| 54 | /** |
| 55 | * Returns the number of packets this flow rule has matched. |
| 56 | * |
| 57 | * @return number of packets |
| 58 | */ |
| 59 | long packets(); |
| 60 | |
| 61 | /** |
| 62 | * Returns the number of bytes this flow rule has matched. |
| 63 | * |
| 64 | * @return number of bytes |
| 65 | */ |
| 66 | long bytes(); |
| 67 | |
| 68 | /** |
| 69 | * When this flow entry was last deemed active. |
| 70 | * @return epoch time of last activity |
| 71 | */ |
| 72 | long lastSeen(); |
| 73 | |
| 74 | /** |
| 75 | * Sets the last active epoch time. |
| 76 | */ |
| 77 | void setLastSeen(); |
| 78 | |
| 79 | /** |
| 80 | * Sets the new state for this entry. |
| 81 | * @param newState new flow entry state. |
| 82 | */ |
| 83 | void setState(FlowEntryState newState); |
| 84 | |
| 85 | /** |
| 86 | * Sets how long this entry has been entered in the system. |
| 87 | * @param life epoch time |
| 88 | */ |
| 89 | void setLife(long life); |
| 90 | |
| 91 | /** |
| 92 | * Number of packets seen by this entry. |
| 93 | * @param packets a long value |
| 94 | */ |
| 95 | void setPackets(long packets); |
| 96 | |
| 97 | /** |
| 98 | * Number of bytes seen by this rule. |
| 99 | * @param bytes a long value |
| 100 | */ |
| 101 | void setBytes(long bytes); |
| 102 | |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame^] | 103 | /** |
| 104 | * Indicates the error type. |
| 105 | * @return an integer value of the error |
| 106 | */ |
| 107 | int errType(); |
| 108 | |
| 109 | /** |
| 110 | * Indicates the error code. |
| 111 | * @return an integer value of the error |
| 112 | */ |
| 113 | int errCode(); |
| 114 | |
alshabib | ca5706c | 2014-10-04 20:29:41 -0700 | [diff] [blame] | 115 | } |