blob: 19fcf9061ee9b76e8105f15a67deea9aef617a29 [file] [log] [blame]
Jian Li0967cd72015-11-25 17:38:48 -08001/*
Jian Lie044d1a2016-01-25 09:01:20 -08002 * Copyright 2015-2016 Open Networking Laboratory
Jian Li0967cd72015-11-25 17:38:48 -08003 *
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 */
16package org.onosproject.cpman;
17
18import org.onosproject.cluster.NodeId;
19import org.onosproject.net.DeviceId;
20
21import java.util.Optional;
Jian Li85060ac2016-02-04 09:58:56 -080022import java.util.Set;
Jian Li23906cc2016-03-31 11:16:44 -070023import java.util.concurrent.CompletableFuture;
Jian Li85060ac2016-02-04 09:58:56 -080024
25import static org.onosproject.cpman.ControlResource.*;
Jian Li0967cd72015-11-25 17:38:48 -080026
27/**
28 * Control Plane Statistics Service Interface.
29 */
Jian Li60804322015-12-02 14:46:31 -080030public interface ControlPlaneMonitorService {
Jian Li0967cd72015-11-25 17:38:48 -080031
32 /**
Jian Li60804322015-12-02 14:46:31 -080033 * Adds a new control metric value with a certain update interval.
Jian Li0967cd72015-11-25 17:38:48 -080034 *
Jian Li23906cc2016-03-31 11:16:44 -070035 * @param controlMetric control plane metric (e.g., control
36 * message rate, cpu, memory, etc.)
37 * @param updateIntervalInMinutes value update interval (in minute)
38 * @param deviceId device identifier
Jian Li0967cd72015-11-25 17:38:48 -080039 */
Jian Lic5cb4a12016-02-03 23:24:42 -080040 void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes,
41 Optional<DeviceId> deviceId);
Jian Li0967cd72015-11-25 17:38:48 -080042
43 /**
Jian Lie044d1a2016-01-25 09:01:20 -080044 * Adds a new control metric value with a certain update interval.
45 *
Jian Li23906cc2016-03-31 11:16:44 -070046 * @param controlMetric control plane metric (e.g., disk and
47 * network metrics)
48 * @param updateIntervalInMinutes value update interval (in minute)
49 * @param resourceName resource name
Jian Lie044d1a2016-01-25 09:01:20 -080050 */
Jian Lic5cb4a12016-02-03 23:24:42 -080051 void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes,
52 String resourceName);
Jian Lie044d1a2016-01-25 09:01:20 -080053
54 /**
Jian Li23906cc2016-03-31 11:16:44 -070055 * Obtains local control plane load of a specific device.
Jian Li7d180c52016-02-01 21:53:08 -080056 * The metrics range from control messages and system metrics
57 * (e.g., CPU and memory info)
Jian Li0967cd72015-11-25 17:38:48 -080058 *
Jian Li23906cc2016-03-31 11:16:44 -070059 * @param type control metric type
60 * @param deviceId device identifier
Jian Li0967cd72015-11-25 17:38:48 -080061 * @return control plane load
62 */
Jian Li23906cc2016-03-31 11:16:44 -070063 ControlLoad getLocalLoad(ControlMetricType type, Optional<DeviceId> deviceId);
Jian Li0967cd72015-11-25 17:38:48 -080064
65 /**
Jian Li23906cc2016-03-31 11:16:44 -070066 * Obtains local control plane load of a specific resource.
Jian Lic5cb4a12016-02-03 23:24:42 -080067 * The metrics range from I/O device metrics
68 * (e.g., disk and network interface)
Jian Li0967cd72015-11-25 17:38:48 -080069 *
Jian Li23906cc2016-03-31 11:16:44 -070070 * @param type control metric type
71 * @param resourceName resource name
Jian Li0967cd72015-11-25 17:38:48 -080072 * @return control plane load
73 */
Jian Li23906cc2016-03-31 11:16:44 -070074 ControlLoad getLocalLoad(ControlMetricType type, String resourceName);
75
76 /**
77 * Obtains remote control plane load of a specific device.
78 *
79 * @param nodeId node identifier
80 * @param type control metric type
81 * @param deviceId device identifier
82 * @return completable future object of control load
83 */
84 CompletableFuture<ControlLoad> getRemoteLoad(NodeId nodeId,
85 ControlMetricType type,
86 Optional<DeviceId> deviceId);
87
88 /**
89 * Obtains remote control plane load of a specific resource.
90 *
91 * @param nodeId node identifier
92 * @param type control metric type
93 * @param resourceName resource name
94 * @return completable future object of control load
95 */
96 CompletableFuture<ControlLoad> getRemoteLoad(NodeId nodeId,
97 ControlMetricType type,
98 String resourceName);
Jian Li85060ac2016-02-04 09:58:56 -080099
100 /**
101 * Obtains a list of names of available resources.
102 *
Jian Li72b9b122016-02-11 15:58:51 -0800103 * @param resourceType resource type
Jian Li85060ac2016-02-04 09:58:56 -0800104 * @return a collection of names of available resources
105 */
106 Set<String> availableResources(Type resourceType);
Jian Li0967cd72015-11-25 17:38:48 -0800107}