blob: 1e6ce52dbb9ee78fa3807d2b63396e490bde042d [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
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 */
alshabibca5706c2014-10-04 20:29:41 -070019package org.onlab.onos.net.flow;
20
21
22/**
23 * Represents a generalized match & action pair to be applied to
24 * an infrastucture device.
25 */
26public 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 */
alshabib193525b2014-10-08 18:58:03 -070050 REMOVED,
51
52 /**
53 * Indicates that the installation of this flow has failed.
54 */
55 FAILED
alshabibca5706c2014-10-04 20:29:41 -070056 }
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 HIGUCHIf6f50a62014-10-19 15:58:49 -070086 // TODO: consider removing this attribute
alshabibca5706c2014-10-04 20:29:41 -070087 /**
88 * When this flow entry was last deemed active.
89 * @return epoch time of last activity
90 */
91 long lastSeen();
92
93 /**
alshabib193525b2014-10-08 18:58:03 -070094 * 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
alshabibca5706c2014-10-04 20:29:41 -0700105}