blob: 1511d218dd957351760b86dbed1e0d0ff821291c [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present 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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.flow;
alshabibca5706c2014-10-04 20:29:41 -070017
18
Thiago Santos877914d2016-07-20 18:29:29 -030019import java.util.concurrent.TimeUnit;
20
alshabibca5706c2014-10-04 20:29:41 -070021/**
22 * Represents a generalized match & action pair to be applied to
23 * an infrastucture device.
24 */
25public interface FlowEntry extends FlowRule {
26
27
Sho SHIMIZU3310a342015-05-13 12:14:05 -070028 enum FlowEntryState {
alshabibca5706c2014-10-04 20:29:41 -070029
30 /**
31 * Indicates that this rule has been submitted for addition.
Sho SHIMIZU8f86bb22015-05-27 11:29:17 -070032 * Not necessarily in the flow table.
alshabibca5706c2014-10-04 20:29:41 -070033 */
34 PENDING_ADD,
35
36 /**
37 * Rule has been added which means it is in the flow table.
38 */
39 ADDED,
40
41 /**
42 * Flow has been marked for removal, might still be in flow table.
43 */
44 PENDING_REMOVE,
45
46 /**
47 * Flow has been removed from flow table and can be purged.
48 */
alshabib193525b2014-10-08 18:58:03 -070049 REMOVED,
50
51 /**
52 * Indicates that the installation of this flow has failed.
53 */
54 FAILED
alshabibca5706c2014-10-04 20:29:41 -070055 }
56
57 /**
58 * Returns the flow entry state.
59 *
60 * @return flow entry state
61 */
62 FlowEntryState state();
63
64 /**
Thiago Santos877914d2016-07-20 18:29:29 -030065 * Returns the number of seconds this flow rule has been applied.
alshabibca5706c2014-10-04 20:29:41 -070066 *
Thiago Santos877914d2016-07-20 18:29:29 -030067 * @return number of seconds
alshabibca5706c2014-10-04 20:29:41 -070068 */
69 long life();
70
71 /**
Thiago Santos877914d2016-07-20 18:29:29 -030072 * Returns the time this flow rule has been applied.
73 *
74 * @return time in the requested {@link TimeUnit}
75 */
76 long life(TimeUnit unit);
77
78 /**
alshabibca5706c2014-10-04 20:29:41 -070079 * Returns the number of packets this flow rule has matched.
80 *
81 * @return number of packets
82 */
83 long packets();
84
85 /**
86 * Returns the number of bytes this flow rule has matched.
87 *
88 * @return number of bytes
89 */
90 long bytes();
91
Yuta HIGUCHIf6f50a62014-10-19 15:58:49 -070092 // TODO: consider removing this attribute
alshabibca5706c2014-10-04 20:29:41 -070093 /**
94 * When this flow entry was last deemed active.
95 * @return epoch time of last activity
96 */
97 long lastSeen();
98
99 /**
alshabib193525b2014-10-08 18:58:03 -0700100 * Indicates the error type.
101 * @return an integer value of the error
102 */
103 int errType();
104
105 /**
106 * Indicates the error code.
107 * @return an integer value of the error
108 */
109 int errCode();
110
alshabibca5706c2014-10-04 20:29:41 -0700111}