blob: a235786450b99891faa7e89df3abdea487de2af7 [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
Yuta HIGUCHI852fecd2016-09-22 18:39:25 -070023 * an infrastructure device.
alshabibca5706c2014-10-04 20:29:41 -070024 */
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 *
Ray Milkeybb23e0b2016-08-02 17:00:21 -070074 * @param unit time unit the result will be converted to
Thiago Santos877914d2016-07-20 18:29:29 -030075 * @return time in the requested {@link TimeUnit}
76 */
77 long life(TimeUnit unit);
78
79 /**
alshabibca5706c2014-10-04 20:29:41 -070080 * Returns the number of packets this flow rule has matched.
81 *
82 * @return number of packets
83 */
84 long packets();
85
86 /**
87 * Returns the number of bytes this flow rule has matched.
88 *
89 * @return number of bytes
90 */
91 long bytes();
92
Yuta HIGUCHIf6f50a62014-10-19 15:58:49 -070093 // TODO: consider removing this attribute
alshabibca5706c2014-10-04 20:29:41 -070094 /**
95 * When this flow entry was last deemed active.
96 * @return epoch time of last activity
97 */
98 long lastSeen();
99
100 /**
alshabib193525b2014-10-08 18:58:03 -0700101 * Indicates the error type.
102 * @return an integer value of the error
103 */
104 int errType();
105
106 /**
107 * Indicates the error code.
108 * @return an integer value of the error
109 */
110 int errCode();
111
alshabibca5706c2014-10-04 20:29:41 -0700112}