Jian Li | 0967cd7 | 2015-11-25 17:38:48 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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; |
| 22 | import java.util.concurrent.TimeUnit; |
| 23 | |
| 24 | /** |
| 25 | * Control Plane Statistics Service Interface. |
| 26 | */ |
| 27 | public interface ControlPlaneStatsService { |
| 28 | |
| 29 | /** |
| 30 | * Add a new control plane metric value with a certain update interval. |
| 31 | * |
| 32 | * @param cpm control plane metric (e.g., control message rate, cpu, memory, etc.) |
| 33 | * @param updateInterval value update interval (time unit will be in minute) |
| 34 | */ |
| 35 | void updateMetric(ControlPlaneMetric cpm, int updateInterval); |
| 36 | |
| 37 | /** |
| 38 | * Obtain the control plane load of a specific device. |
| 39 | * |
| 40 | * @param nodeId node id {@link org.onosproject.cluster.NodeId} |
| 41 | * @param type control metric type |
| 42 | * @param deviceId device id {@link org.onosproject.net.DeviceId} |
| 43 | * @return control plane load |
| 44 | */ |
| 45 | ControlPlaneLoad getLoad(NodeId nodeId, ControlMetricType type, Optional<DeviceId> deviceId); |
| 46 | |
| 47 | /** |
| 48 | * Obtain the control plane load of a specific device with a specific time duration. |
| 49 | * |
| 50 | * @param nodeId node id {@link org.onosproject.cluster.NodeId} |
| 51 | * @param type control metric type |
| 52 | * @param duration time duration |
| 53 | * @param unit time unit |
| 54 | * @param deviceId device id {@link org.onosproject.net.Device} |
| 55 | * @return control plane load |
| 56 | */ |
| 57 | ControlPlaneLoad getLoad(NodeId nodeId, ControlMetricType type, Optional<DeviceId> deviceId, |
| 58 | int duration, TimeUnit unit); |
| 59 | } |