Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
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 | |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 18 | import org.onosproject.core.GroupId; |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 19 | import org.onosproject.net.PortNumber; |
| 20 | import org.onosproject.net.flow.TrafficTreatment; |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 21 | |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 22 | /** |
| 23 | * Group Bucket definition. A default group Bucket is collection of |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 24 | * Instructions that can be performed on a traffic flow. A failover |
| 25 | * group bucket is associated with a specific port or group that |
| 26 | * controls its liveness. A select group bucket contains optional |
| 27 | * weight field to define the weights among the buckets in the group. |
| 28 | */ |
| 29 | public interface GroupBucket { |
| 30 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 31 | * Returns group type of the bucket. |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 32 | * |
| 33 | * @return GroupType group type |
| 34 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 35 | GroupDescription.Type type(); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 36 | |
| 37 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 38 | * Returns list of Traffic instructions that are part of the bucket. |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 39 | * |
| 40 | * @return TrafficTreatment traffic instruction list |
| 41 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 42 | TrafficTreatment treatment(); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 43 | |
| 44 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 45 | * Returns weight of select group bucket. |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 46 | * |
| 47 | * @return short weight associated with a bucket |
| 48 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 49 | short weight(); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 50 | |
| 51 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 52 | * Returns port number used for liveness detection for a |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 53 | * failover bucket. |
| 54 | * |
| 55 | * @return PortNumber port number used for liveness detection |
| 56 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 57 | PortNumber watchPort(); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 58 | |
| 59 | /** |
Srikanth Vavilapalli | 0599d51 | 2015-01-30 12:57:56 -0800 | [diff] [blame] | 60 | * Returns group identifier used for liveness detection for a |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 61 | * failover bucket. |
| 62 | * |
| 63 | * @return GroupId group identifier to be used for liveness detection |
| 64 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 65 | GroupId watchGroup(); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 66 | |
Srikanth Vavilapalli | 10e75cd | 2015-04-13 16:21:24 -0700 | [diff] [blame] | 67 | /** |
| 68 | * Returns the number of packets processed by this group bucket. |
| 69 | * |
| 70 | * @return number of packets |
| 71 | */ |
| 72 | long packets(); |
| 73 | |
| 74 | /** |
| 75 | * Returns the number of bytes processed by this group bucket. |
| 76 | * |
| 77 | * @return number of bytes |
| 78 | */ |
| 79 | long bytes(); |
Victor Silva | df1eeae | 2016-08-12 15:28:57 -0300 | [diff] [blame] | 80 | |
| 81 | /** |
Ray Milkey | ef79434 | 2016-11-09 16:20:29 -0800 | [diff] [blame] | 82 | * Returns whether the given group bucket has the same parameters (weight, |
Victor Silva | df1eeae | 2016-08-12 15:28:57 -0300 | [diff] [blame] | 83 | * watchPort and watchGroup) as this. |
| 84 | * |
Ray Milkey | ef79434 | 2016-11-09 16:20:29 -0800 | [diff] [blame] | 85 | * @param other group bucket to compare |
| 86 | * @return true if this bucket has the same parameters as other, false otherwise |
Victor Silva | df1eeae | 2016-08-12 15:28:57 -0300 | [diff] [blame] | 87 | */ |
| 88 | boolean hasSameParameters(GroupBucket other); |
Srikanth Vavilapalli | 56db94f | 2015-01-22 22:30:17 -0800 | [diff] [blame] | 89 | } |