Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.statistic; |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.core.ApplicationId; |
| 19 | import org.onosproject.core.GroupId; |
| 20 | import org.onosproject.net.ConnectPoint; |
| 21 | import org.onosproject.net.Link; |
| 22 | import org.onosproject.net.Path; |
| 23 | import org.onosproject.net.flow.FlowRule; |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 24 | |
Sho SHIMIZU | e3cc0b9 | 2014-11-20 16:18:29 -0800 | [diff] [blame] | 25 | import java.util.Optional; |
| 26 | |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 27 | /** |
| 28 | * Service for obtaining statistic information about link in the system. |
| 29 | * Statistics are obtained from the FlowRuleService in order to minimize the |
| 30 | * amount of hammering occuring at the dataplane. |
| 31 | */ |
| 32 | public interface StatisticService { |
| 33 | |
| 34 | /** |
| 35 | * Obtain the load for a the ingress to the given link. |
Sho SHIMIZU | cf6090b | 2014-11-13 17:34:46 -0800 | [diff] [blame] | 36 | * |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 37 | * @param link the link to query. |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 38 | * @return a {@link org.onosproject.net.statistic.Load Load} |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 39 | */ |
| 40 | Load load(Link link); |
| 41 | |
| 42 | /** |
| 43 | * Obtain the load for the given port. |
Sho SHIMIZU | cf6090b | 2014-11-13 17:34:46 -0800 | [diff] [blame] | 44 | * |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 45 | * @param connectPoint the port to query |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 46 | * @return a {@link org.onosproject.net.statistic.Load} |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 47 | */ |
| 48 | Load load(ConnectPoint connectPoint); |
| 49 | |
| 50 | /** |
| 51 | * Find the most loaded link along a path. |
Sho SHIMIZU | cf6090b | 2014-11-13 17:34:46 -0800 | [diff] [blame] | 52 | * |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 53 | * @param path the path to search in |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 54 | * @return the most loaded {@link org.onosproject.net.Link}. |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 55 | */ |
| 56 | Link max(Path path); |
| 57 | |
| 58 | /** |
| 59 | * Find the least loaded link along a path. |
Sho SHIMIZU | cf6090b | 2014-11-13 17:34:46 -0800 | [diff] [blame] | 60 | * |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 61 | * @param path the path to search in |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 62 | * @return the least loaded {@link org.onosproject.net.Link}. |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 63 | */ |
| 64 | Link min(Path path); |
| 65 | |
| 66 | /** |
alshabib | c1c056b | 2014-10-21 21:42:51 -0700 | [diff] [blame] | 67 | * Returns the highest hitter (a flow rule) for a given port, ie. the |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 68 | * flow rule which is generating the most load. |
Sho SHIMIZU | cf6090b | 2014-11-13 17:34:46 -0800 | [diff] [blame] | 69 | * |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 70 | * @param connectPoint the port |
| 71 | * @return the flow rule |
| 72 | */ |
| 73 | FlowRule highestHitter(ConnectPoint connectPoint); |
| 74 | |
Sho SHIMIZU | e3cc0b9 | 2014-11-20 16:18:29 -0800 | [diff] [blame] | 75 | /** |
| 76 | * Obtain the load for a the ingress to the given link used by |
| 77 | * the specified application ID and group ID. |
| 78 | * |
| 79 | * @param link link to query |
| 80 | * @param appId application ID to filter with |
| 81 | * @param groupId group ID to filter with |
| 82 | * @return {@link Load Load} |
| 83 | */ |
| 84 | Load load(Link link, ApplicationId appId, Optional<GroupId> groupId); |
alshabib | a43aa25 | 2014-10-21 21:36:41 -0700 | [diff] [blame] | 85 | } |