Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 3 | * |
| 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 | */ |
| 16 | package org.onosproject.net.group; |
| 17 | |
| 18 | import org.onosproject.core.GroupId; |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 19 | import org.onosproject.net.pi.service.PiTranslatable; |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * ONOS representation of group that is stored in the system. |
| 23 | */ |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 24 | public interface Group extends GroupDescription, PiTranslatable { |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 25 | /** |
| 26 | * State of the group object in ONOS. |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 27 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 28 | enum GroupState { |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 29 | /** |
Srikanth Vavilapalli | 45c27c8 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 30 | * Group create request is queued as group AUDIT is in progress. |
| 31 | */ |
| 32 | WAITING_AUDIT_COMPLETE, |
| 33 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 34 | * Group create request is processed by ONOS and not yet |
| 35 | * received the confirmation from data plane. |
| 36 | */ |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 37 | PENDING_ADD, |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 38 | /** |
Srikanth Vavilapalli | 5428b6c | 2015-05-14 20:22:47 -0700 | [diff] [blame] | 39 | * Group is missing in data plane and retrying GROUP ADD request. |
| 40 | */ |
| 41 | PENDING_ADD_RETRY, |
| 42 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 43 | * Group is created in the data plane. |
| 44 | */ |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 45 | ADDED, |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 46 | /** |
| 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 Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 51 | PENDING_UPDATE, |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 52 | /** |
| 53 | * Group delete request is processed by ONOS and not |
| 54 | * received the confirmation from data plane. |
| 55 | */ |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 56 | PENDING_DELETE |
| 57 | } |
| 58 | |
| 59 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 60 | * Returns group identifier associated with a group object. |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 61 | * |
| 62 | * @return GroupId Group Identifier |
| 63 | */ |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 64 | GroupId id(); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 65 | |
| 66 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 67 | * Returns current state of a group object. |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 68 | * |
| 69 | * @return GroupState Group State |
| 70 | */ |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 71 | GroupState state(); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 72 | |
| 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 Vavilapalli | 45c27c8 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 93 | |
| 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(); |
alshabib | b028599 | 2016-03-28 23:30:37 -0700 | [diff] [blame] | 100 | |
| 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 Das | 137f27f | 2018-06-11 17:02:31 -0700 | [diff] [blame] | 108 | |
| 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 Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 116 | } |