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 | */ |
| 32 | REMOVED |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Returns the flow entry state. |
| 37 | * |
| 38 | * @return flow entry state |
| 39 | */ |
| 40 | FlowEntryState state(); |
| 41 | |
| 42 | /** |
| 43 | * Returns the number of milliseconds this flow rule has been applied. |
| 44 | * |
| 45 | * @return number of millis |
| 46 | */ |
| 47 | long life(); |
| 48 | |
| 49 | /** |
| 50 | * Returns the number of packets this flow rule has matched. |
| 51 | * |
| 52 | * @return number of packets |
| 53 | */ |
| 54 | long packets(); |
| 55 | |
| 56 | /** |
| 57 | * Returns the number of bytes this flow rule has matched. |
| 58 | * |
| 59 | * @return number of bytes |
| 60 | */ |
| 61 | long bytes(); |
| 62 | |
| 63 | /** |
| 64 | * When this flow entry was last deemed active. |
| 65 | * @return epoch time of last activity |
| 66 | */ |
| 67 | long lastSeen(); |
| 68 | |
| 69 | /** |
| 70 | * Sets the last active epoch time. |
| 71 | */ |
| 72 | void setLastSeen(); |
| 73 | |
| 74 | /** |
| 75 | * Sets the new state for this entry. |
| 76 | * @param newState new flow entry state. |
| 77 | */ |
| 78 | void setState(FlowEntryState newState); |
| 79 | |
| 80 | /** |
| 81 | * Sets how long this entry has been entered in the system. |
| 82 | * @param life epoch time |
| 83 | */ |
| 84 | void setLife(long life); |
| 85 | |
| 86 | /** |
| 87 | * Number of packets seen by this entry. |
| 88 | * @param packets a long value |
| 89 | */ |
| 90 | void setPackets(long packets); |
| 91 | |
| 92 | /** |
| 93 | * Number of bytes seen by this rule. |
| 94 | * @param bytes a long value |
| 95 | */ |
| 96 | void setBytes(long bytes); |
| 97 | |
| 98 | } |