blob: dd2aa630485cc20c06dafa18d0298e0867d72716 [file] [log] [blame]
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -08003 *
4 * 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
7 *
8 * 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.
15 */
16package org.onosproject.net.group;
17
18import org.onosproject.core.GroupId;
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080019import org.onosproject.net.pi.service.PiTranslatable;
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080020
21/**
22 * ONOS representation of group that is stored in the system.
23 */
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080024public interface Group extends GroupDescription, PiTranslatable {
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080025 /**
26 * State of the group object in ONOS.
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080027 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070028 enum GroupState {
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080029 /**
Srikanth Vavilapalli45c27c82015-01-30 12:57:56 -080030 * Group create request is queued as group AUDIT is in progress.
31 */
32 WAITING_AUDIT_COMPLETE,
33 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080034 * Group create request is processed by ONOS and not yet
35 * received the confirmation from data plane.
36 */
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080037 PENDING_ADD,
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080038 /**
Srikanth Vavilapalli5428b6c2015-05-14 20:22:47 -070039 * Group is missing in data plane and retrying GROUP ADD request.
40 */
41 PENDING_ADD_RETRY,
42 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080043 * Group is created in the data plane.
44 */
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080045 ADDED,
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080046 /**
47 * Group update request is processed by ONOS and not
48 * received the confirmation from data plane post which
49 * state moves to ADDED state.
50 */
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080051 PENDING_UPDATE,
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080052 /**
53 * Group delete request is processed by ONOS and not
54 * received the confirmation from data plane.
55 */
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080056 PENDING_DELETE
57 }
58
59 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080060 * Returns group identifier associated with a group object.
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080061 *
62 * @return GroupId Group Identifier
63 */
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080064 GroupId id();
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080065
66 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080067 * Returns current state of a group object.
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080068 *
69 * @return GroupState Group State
70 */
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080071 GroupState state();
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080072
73 /**
74 * Returns the number of milliseconds this group has been alive.
75 *
76 * @return number of millis
77 */
78 long life();
79
80 /**
81 * Returns the number of packets processed by this group.
82 *
83 * @return number of packets
84 */
85 long packets();
86
87 /**
88 * Returns the number of bytes processed by this group.
89 *
90 * @return number of bytes
91 */
92 long bytes();
Srikanth Vavilapalli45c27c82015-01-30 12:57:56 -080093
94 /**
95 * Returns the number of flow rules or other groups reference this group.
96 *
97 * @return number of flow rules or other groups pointing to this group
98 */
99 long referenceCount();
alshabibb0285992016-03-28 23:30:37 -0700100
101 /**
102 * Obtains the age of a group. The age reflects the number of polling rounds
103 * the group has had a reference count of zero.
104 *
105 * @return the age of the group as an integer
106 */
107 int age();
Saurav Das137f27f2018-06-11 17:02:31 -0700108
109 /**
110 * Returns the count for the number of attempts at programming a failed
111 * group.
112 *
113 * @return the count for the number of failed attempts at programming this group
114 */
115 int failedRetryCount();
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -0800116}