blob: de598863d1af1cc96a07d8c455fa0a65368b4904 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
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 */
alshabiba43aa252014-10-21 21:36:41 -070016package org.onlab.onos.net.statistic;
17
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080018import org.onlab.onos.core.ApplicationId;
19import org.onlab.onos.core.GroupId;
alshabiba43aa252014-10-21 21:36:41 -070020import org.onlab.onos.net.ConnectPoint;
21import org.onlab.onos.net.Link;
22import org.onlab.onos.net.Path;
23import org.onlab.onos.net.flow.FlowRule;
24
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080025import java.util.Optional;
26
alshabiba43aa252014-10-21 21:36:41 -070027/**
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 */
32public interface StatisticService {
33
34 /**
35 * Obtain the load for a the ingress to the given link.
Sho SHIMIZUcf6090b2014-11-13 17:34:46 -080036 *
alshabiba43aa252014-10-21 21:36:41 -070037 * @param link the link to query.
38 * @return a {@link org.onlab.onos.net.statistic.Load Load}
39 */
40 Load load(Link link);
41
42 /**
43 * Obtain the load for the given port.
Sho SHIMIZUcf6090b2014-11-13 17:34:46 -080044 *
alshabiba43aa252014-10-21 21:36:41 -070045 * @param connectPoint the port to query
46 * @return a {@link org.onlab.onos.net.statistic.Load}
47 */
48 Load load(ConnectPoint connectPoint);
49
50 /**
51 * Find the most loaded link along a path.
Sho SHIMIZUcf6090b2014-11-13 17:34:46 -080052 *
alshabiba43aa252014-10-21 21:36:41 -070053 * @param path the path to search in
54 * @return the most loaded {@link org.onlab.onos.net.Link}.
55 */
56 Link max(Path path);
57
58 /**
59 * Find the least loaded link along a path.
Sho SHIMIZUcf6090b2014-11-13 17:34:46 -080060 *
alshabiba43aa252014-10-21 21:36:41 -070061 * @param path the path to search in
62 * @return the least loaded {@link org.onlab.onos.net.Link}.
63 */
64 Link min(Path path);
65
66 /**
alshabibc1c056b2014-10-21 21:42:51 -070067 * Returns the highest hitter (a flow rule) for a given port, ie. the
alshabiba43aa252014-10-21 21:36:41 -070068 * flow rule which is generating the most load.
Sho SHIMIZUcf6090b2014-11-13 17:34:46 -080069 *
alshabiba43aa252014-10-21 21:36:41 -070070 * @param connectPoint the port
71 * @return the flow rule
72 */
73 FlowRule highestHitter(ConnectPoint connectPoint);
74
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080075 /**
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);
alshabiba43aa252014-10-21 21:36:41 -070085}