blob: a8b9ea00086e1fdd41edfe259233968300b9992b [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska83e090e2014-10-22 14:25:35 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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 Vachuska83e090e2014-10-22 14:25:35 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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 Vachuska83e090e2014-10-22 14:25:35 -070015 */
alshabibca5706c2014-10-04 20:29:41 -070016package org.onlab.onos.net.flow;
17
18
19/**
20 * Represents a generalized match & action pair to be applied to
21 * an infrastucture device.
22 */
23public interface FlowEntry extends FlowRule {
24
25
26 public enum FlowEntryState {
27
28 /**
29 * Indicates that this rule has been submitted for addition.
30 * Not necessarily in the flow table.
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 */
alshabib193525b2014-10-08 18:58:03 -070047 REMOVED,
48
49 /**
50 * Indicates that the installation of this flow has failed.
51 */
52 FAILED
alshabibca5706c2014-10-04 20:29:41 -070053 }
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 HIGUCHIf6f50a62014-10-19 15:58:49 -070083 // TODO: consider removing this attribute
alshabibca5706c2014-10-04 20:29:41 -070084 /**
85 * When this flow entry was last deemed active.
86 * @return epoch time of last activity
87 */
88 long lastSeen();
89
90 /**
alshabib193525b2014-10-08 18:58:03 -070091 * 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
alshabibca5706c2014-10-04 20:29:41 -0700102}