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; |
| 23 | |
| 24 | import static org.onosproject.cpman.ControlResource.*; |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * Control Plane Statistics Service Interface. |
| 28 | */ |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 29 | public interface ControlPlaneMonitorService { |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 30 | |
| 31 | /** |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 32 | * Adds a new control metric value with a certain update interval. |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 33 | * |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 34 | * @param controlMetric control plane metric (e.g., control |
| 35 | * message rate, cpu, memory, etc.) |
| 36 | * @param updateIntervalInMinutes value update interval (in minute) |
| 37 | * @param deviceId device identifier |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 38 | */ |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 39 | void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes, |
| 40 | Optional<DeviceId> deviceId); |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 41 | |
| 42 | /** |
Jian Li | e044d1a | 2016-01-25 09:01:20 -0800 | [diff] [blame] | 43 | * Adds a new control metric value with a certain update interval. |
| 44 | * |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 45 | * @param controlMetric control plane metric (e.g., disk and |
| 46 | * network metrics) |
| 47 | * @param updateIntervalInMinutes value update interval (in minute) |
| 48 | * @param resourceName resource name |
Jian Li | e044d1a | 2016-01-25 09:01:20 -0800 | [diff] [blame] | 49 | */ |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 50 | void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes, |
| 51 | String resourceName); |
Jian Li | e044d1a | 2016-01-25 09:01:20 -0800 | [diff] [blame] | 52 | |
| 53 | /** |
Jian Li | 6080432 | 2015-12-02 14:46:31 -0800 | [diff] [blame] | 54 | * Obtains the control plane load of a specific device. |
Jian Li | 7d180c5 | 2016-02-01 21:53:08 -0800 | [diff] [blame] | 55 | * The metrics range from control messages and system metrics |
| 56 | * (e.g., CPU and memory info) |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 57 | * |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 58 | * @param nodeId node identifier |
| 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 | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 63 | ControlLoad getLoad(NodeId nodeId, ControlMetricType type, |
| 64 | Optional<DeviceId> deviceId); |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 65 | |
| 66 | /** |
Jian Li | 7d180c5 | 2016-02-01 21:53:08 -0800 | [diff] [blame] | 67 | * Obtains the control plane load of a specific device. |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 68 | * The metrics range from I/O device metrics |
| 69 | * (e.g., disk and network interface) |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 70 | * |
Jian Li | c5cb4a1 | 2016-02-03 23:24:42 -0800 | [diff] [blame] | 71 | * @param nodeId node identifier |
| 72 | * @param type control metric type |
| 73 | * @param resourceName resource name |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 74 | * @return control plane load |
| 75 | */ |
Jian Li | 7d180c5 | 2016-02-01 21:53:08 -0800 | [diff] [blame] | 76 | ControlLoad getLoad(NodeId nodeId, ControlMetricType type, String resourceName); |
Jian Li | 85060ac | 2016-02-04 09:58:56 -0800 | [diff] [blame] | 77 | |
| 78 | /** |
| 79 | * Obtains a list of names of available resources. |
| 80 | * |
Jian Li | 72b9b12 | 2016-02-11 15:58:51 -0800 | [diff] [blame] | 81 | * @param resourceType resource type |
Jian Li | 85060ac | 2016-02-04 09:58:56 -0800 | [diff] [blame] | 82 | * @return a collection of names of available resources |
| 83 | */ |
| 84 | Set<String> availableResources(Type resourceType); |
Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 85 | } |