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