Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -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.cpman; |
| 17 | |
| 18 | import org.onosproject.cluster.NodeId; |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | |
| 21 | import java.util.Optional; |
Jian Li | 85060ac | 2016-02-04 09:58:56 -0800 | [diff] [blame] | 22 | import java.util.Set; |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 23 | import java.util.concurrent.CompletableFuture; |
Jian Li | 67e1e15 | 2016-04-18 17:52:58 -0700 | [diff] [blame^] | 24 | import java.util.concurrent.TimeUnit; |
Jian Li | 85060ac | 2016-02-04 09:58:56 -0800 | [diff] [blame] | 25 | |
Jian Li | 67e1e15 | 2016-04-18 17:52:58 -0700 | [diff] [blame^] | 26 | import static org.onosproject.cpman.ControlResource.Type; |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Control Plane Statistics Service Interface. |
| 30 | */ |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 31 | public interface ControlPlaneMonitorService { |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 32 | |
| 33 | /** |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 34 | * Adds a new control metric value with a certain update interval. |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 35 | * |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 36 | * @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 Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 40 | */ |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 41 | void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes, |
| 42 | Optional<DeviceId> deviceId); |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 43 | |
| 44 | /** |
Jian Li | e044d1a | 2016-01-25 09:01:20 -0800 | [diff] [blame] | 45 | * Adds a new control metric value with a certain update interval. |
| 46 | * |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 47 | * @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 Li | e044d1a | 2016-01-25 09:01:20 -0800 | [diff] [blame] | 51 | */ |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 52 | void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes, |
| 53 | String resourceName); |
Jian Li | e044d1a | 2016-01-25 09:01:20 -0800 | [diff] [blame] | 54 | |
| 55 | /** |
Jian Li | 67e1e15 | 2016-04-18 17:52:58 -0700 | [diff] [blame^] | 56 | * Obtains snapshot of control plane load of a specific device. |
Jian Li | 7d180c5 | 2016-02-01 21:53:08 -0800 | [diff] [blame] | 57 | * The metrics range from control messages and system metrics |
Jian Li | 67e1e15 | 2016-04-18 17:52:58 -0700 | [diff] [blame^] | 58 | * (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 Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 61 | * |
| 62 | * @param nodeId node identifier |
| 63 | * @param type control metric type |
| 64 | * @param deviceId device identifier |
Jian Li | 67e1e15 | 2016-04-18 17:52:58 -0700 | [diff] [blame^] | 65 | * @return completable future object of control load snapshot |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 66 | */ |
Jian Li | 67e1e15 | 2016-04-18 17:52:58 -0700 | [diff] [blame^] | 67 | CompletableFuture<ControlLoadSnapshot> getLoad(NodeId nodeId, |
| 68 | ControlMetricType type, |
| 69 | Optional<DeviceId> deviceId); |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 70 | |
| 71 | /** |
Jian Li | 67e1e15 | 2016-04-18 17:52:58 -0700 | [diff] [blame^] | 72 | * 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 Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 74 | * |
| 75 | * @param nodeId node identifier |
| 76 | * @param type control metric type |
| 77 | * @param resourceName resource name |
Jian Li | 67e1e15 | 2016-04-18 17:52:58 -0700 | [diff] [blame^] | 78 | * @return completable future object of control load snapshot |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 79 | */ |
Jian Li | 67e1e15 | 2016-04-18 17:52:58 -0700 | [diff] [blame^] | 80 | 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 Li | 85060ac | 2016-02-04 09:58:56 -0800 | [diff] [blame] | 115 | |
| 116 | /** |
| 117 | * Obtains a list of names of available resources. |
| 118 | * |
Jian Li | 72b9b12 | 2016-02-11 15:58:51 -0800 | [diff] [blame] | 119 | * @param resourceType resource type |
Jian Li | 85060ac | 2016-02-04 09:58:56 -0800 | [diff] [blame] | 120 | * @return a collection of names of available resources |
| 121 | */ |
| 122 | Set<String> availableResources(Type resourceType); |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 123 | } |