blob: 32ccdd67d7aa74f6074d07c238ade0500756aaf0 [file] [log] [blame]
Jian Li0967cd72015-11-25 17:38:48 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present 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 Li67e1e152016-04-18 17:52:58 -070024import java.util.concurrent.TimeUnit;
Jian Li85060ac2016-02-04 09:58:56 -080025
Jian Li67e1e152016-04-18 17:52:58 -070026import static org.onosproject.cpman.ControlResource.Type;
Jian Li0967cd72015-11-25 17:38:48 -080027
28/**
29 * Control Plane Statistics Service Interface.
30 */
Jian Li60804322015-12-02 14:46:31 -080031public interface ControlPlaneMonitorService {
Jian Li0967cd72015-11-25 17:38:48 -080032
33 /**
Jian Li60804322015-12-02 14:46:31 -080034 * Adds a new control metric value with a certain update interval.
Jian Li0967cd72015-11-25 17:38:48 -080035 *
Jian Li23906cc2016-03-31 11:16:44 -070036 * @param controlMetric control plane metric (e.g., control
37 * message rate, cpu, memory, etc.)
38 * @param updateIntervalInMinutes value update interval (in minute)
39 * @param deviceId device identifier
Jian Li0967cd72015-11-25 17:38:48 -080040 */
Jian Lic5cb4a12016-02-03 23:24:42 -080041 void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes,
42 Optional<DeviceId> deviceId);
Jian Li0967cd72015-11-25 17:38:48 -080043
44 /**
Jian Lie044d1a2016-01-25 09:01:20 -080045 * Adds a new control metric value with a certain update interval.
46 *
Jian Li23906cc2016-03-31 11:16:44 -070047 * @param controlMetric control plane metric (e.g., disk and
48 * network metrics)
49 * @param updateIntervalInMinutes value update interval (in minute)
50 * @param resourceName resource name
Jian Lie044d1a2016-01-25 09:01:20 -080051 */
Jian Lic5cb4a12016-02-03 23:24:42 -080052 void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes,
53 String resourceName);
Jian Lie044d1a2016-01-25 09:01:20 -080054
55 /**
Jian Li67e1e152016-04-18 17:52:58 -070056 * Obtains snapshot of control plane load of a specific device.
Jian Li7d180c52016-02-01 21:53:08 -080057 * The metrics range from control messages and system metrics
Jian Li67e1e152016-04-18 17:52:58 -070058 * (e.g., CPU and memory info).
59 * If the device id is not specified, it returns system metrics, otherwise,
60 * it returns control message stats of the given device.
Jian Li23906cc2016-03-31 11:16:44 -070061 *
62 * @param nodeId node identifier
63 * @param type control metric type
64 * @param deviceId device identifier
Jian Li67e1e152016-04-18 17:52:58 -070065 * @return completable future object of control load snapshot
Jian Li23906cc2016-03-31 11:16:44 -070066 */
Jian Li67e1e152016-04-18 17:52:58 -070067 CompletableFuture<ControlLoadSnapshot> getLoad(NodeId nodeId,
68 ControlMetricType type,
69 Optional<DeviceId> deviceId);
Jian Li23906cc2016-03-31 11:16:44 -070070
71 /**
Jian Li67e1e152016-04-18 17:52:58 -070072 * Obtains snapshot of control plane load of a specific resource.
73 * The metrics include I/O device metrics (e.g., disk and network metrics).
Jian Li23906cc2016-03-31 11:16:44 -070074 *
75 * @param nodeId node identifier
76 * @param type control metric type
77 * @param resourceName resource name
Jian Li67e1e152016-04-18 17:52:58 -070078 * @return completable future object of control load snapshot
Jian Li23906cc2016-03-31 11:16:44 -070079 */
Jian Li67e1e152016-04-18 17:52:58 -070080 CompletableFuture<ControlLoadSnapshot> getLoad(NodeId nodeId,
81 ControlMetricType type,
82 String resourceName);
83
84 /**
85 * Obtains snapshot of control plane load of a specific device with the
86 * projected range.
87 *
88 * @param nodeId node identifier
89 * @param type control metric type
90 * @param duration projected duration
91 * @param unit projected time unit
92 * @param deviceId device identifier
93 * @return completable future object of control load snapshot
94 */
95 CompletableFuture<ControlLoadSnapshot> getLoad(NodeId nodeId,
96 ControlMetricType type,
97 int duration, TimeUnit unit,
98 Optional<DeviceId> deviceId);
99
100 /**
101 * Obtains snapshot of control plane load of a specific resource with the
102 * projected range.
103 *
104 * @param nodeId node identifier
105 * @param type control metric type
106 * @param duration projected duration
107 * @param unit projected time unit
108 * @param resourceName resource name
109 * @return completable future object of control load snapshot
110 */
111 CompletableFuture<ControlLoadSnapshot> getLoad(NodeId nodeId,
112 ControlMetricType type,
113 int duration, TimeUnit unit,
114 String resourceName);
Jian Li85060ac2016-02-04 09:58:56 -0800115
116 /**
117 * Obtains a list of names of available resources.
118 *
Jian Li72b9b122016-02-11 15:58:51 -0800119 * @param resourceType resource type
Jian Li85060ac2016-02-04 09:58:56 -0800120 * @return a collection of names of available resources
121 */
122 Set<String> availableResources(Type resourceType);
Jian Li0967cd72015-11-25 17:38:48 -0800123}