Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 1 | /* |
Jian Li | e044d1a | 2016-01-25 09:01:20 -0800 | [diff] [blame] | 2 | * Copyright 2015-2016 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 | 85060ac | 2016-02-04 09:58:56 -0800 | [diff] [blame] | 24 | |
| 25 | import static org.onosproject.cpman.ControlResource.*; |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 26 | |
| 27 | /** |
| 28 | * Control Plane Statistics Service Interface. |
| 29 | */ |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 30 | public interface ControlPlaneMonitorService { |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 31 | |
| 32 | /** |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 33 | * Adds a new control metric value with a certain update interval. |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 34 | * |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 35 | * @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 Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 39 | */ |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 40 | void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes, |
| 41 | Optional<DeviceId> deviceId); |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 42 | |
| 43 | /** |
Jian Li | e044d1a | 2016-01-25 09:01:20 -0800 | [diff] [blame] | 44 | * Adds a new control metric value with a certain update interval. |
| 45 | * |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 46 | * @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 Li | e044d1a | 2016-01-25 09:01:20 -0800 | [diff] [blame] | 50 | */ |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 51 | void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes, |
| 52 | String resourceName); |
Jian Li | e044d1a | 2016-01-25 09:01:20 -0800 | [diff] [blame] | 53 | |
| 54 | /** |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 55 | * Obtains local control plane load of a specific device. |
Jian Li | 7d180c5 | 2016-02-01 21:53:08 -0800 | [diff] [blame] | 56 | * The metrics range from control messages and system metrics |
| 57 | * (e.g., CPU and memory info) |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 58 | * |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 59 | * @param type control metric type |
| 60 | * @param deviceId device identifier |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 61 | * @return control plane load |
| 62 | */ |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 63 | ControlLoad getLocalLoad(ControlMetricType type, Optional<DeviceId> deviceId); |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 64 | |
| 65 | /** |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 66 | * Obtains local control plane load of a specific resource. |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 67 | * The metrics range from I/O device metrics |
| 68 | * (e.g., disk and network interface) |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 69 | * |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 70 | * @param type control metric type |
| 71 | * @param resourceName resource name |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 72 | * @return control plane load |
| 73 | */ |
Jian Li | 23906cc | 2016-03-31 11:16:44 -0700 | [diff] [blame] | 74 | 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 Li | 85060ac | 2016-02-04 09:58:56 -0800 | [diff] [blame] | 99 | |
| 100 | /** |
| 101 | * Obtains a list of names of available resources. |
| 102 | * |
Jian Li | 72b9b12 | 2016-02-11 15:58:51 -0800 | [diff] [blame] | 103 | * @param resourceType resource type |
Jian Li | 85060ac | 2016-02-04 09:58:56 -0800 | [diff] [blame] | 104 | * @return a collection of names of available resources |
| 105 | */ |
| 106 | Set<String> availableResources(Type resourceType); |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 107 | } |