Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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; |
| 19 | |
| 20 | /** |
| 21 | * ONOS representation of group that is stored in the system. |
| 22 | */ |
| 23 | public interface Group extends GroupDescription { |
| 24 | /** |
| 25 | * State of the group object in ONOS. |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 26 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 27 | enum GroupState { |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 28 | /** |
Srikanth Vavilapalli | 45c27c8 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 29 | * Group create request is queued as group AUDIT is in progress. |
| 30 | */ |
| 31 | WAITING_AUDIT_COMPLETE, |
| 32 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 33 | * Group create request is processed by ONOS and not yet |
| 34 | * received the confirmation from data plane. |
| 35 | */ |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 36 | PENDING_ADD, |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 37 | /** |
Srikanth Vavilapalli | 5428b6c | 2015-05-14 20:22:47 -0700 | [diff] [blame] | 38 | * Group is missing in data plane and retrying GROUP ADD request. |
| 39 | */ |
| 40 | PENDING_ADD_RETRY, |
| 41 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 42 | * Group is created in the data plane. |
| 43 | */ |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 44 | ADDED, |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 45 | /** |
| 46 | * Group update request is processed by ONOS and not |
| 47 | * received the confirmation from data plane post which |
| 48 | * state moves to ADDED state. |
| 49 | */ |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 50 | PENDING_UPDATE, |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 51 | /** |
| 52 | * Group delete request is processed by ONOS and not |
| 53 | * received the confirmation from data plane. |
| 54 | */ |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 55 | PENDING_DELETE |
| 56 | } |
| 57 | |
| 58 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 59 | * Returns group identifier associated with a group object. |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 60 | * |
| 61 | * @return GroupId Group Identifier |
| 62 | */ |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 63 | GroupId id(); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 64 | |
| 65 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 66 | * Returns current state of a group object. |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 67 | * |
| 68 | * @return GroupState Group State |
| 69 | */ |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 70 | GroupState state(); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * Returns the number of milliseconds this group has been alive. |
| 74 | * |
| 75 | * @return number of millis |
| 76 | */ |
| 77 | long life(); |
| 78 | |
| 79 | /** |
| 80 | * Returns the number of packets processed by this group. |
| 81 | * |
| 82 | * @return number of packets |
| 83 | */ |
| 84 | long packets(); |
| 85 | |
| 86 | /** |
| 87 | * Returns the number of bytes processed by this group. |
| 88 | * |
| 89 | * @return number of bytes |
| 90 | */ |
| 91 | long bytes(); |
Srikanth Vavilapalli | 45c27c8 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 92 | |
| 93 | /** |
| 94 | * Returns the number of flow rules or other groups reference this group. |
| 95 | * |
| 96 | * @return number of flow rules or other groups pointing to this group |
| 97 | */ |
| 98 | long referenceCount(); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 99 | } |