Clean code and refine javadocs for control plane manager
Change-Id: Ieaaebde69ce2ab54cb819cfad1baa34ee97a7d66
diff --git a/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlMetric.java b/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlMetric.java
index 3dde40c..24f8b93 100644
--- a/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlMetric.java
+++ b/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlMetric.java
@@ -23,15 +23,32 @@
private final ControlMetricType metricType;
private final MetricValue metricValue;
+ /**
+ * Constructs a control metric using the given control metric type and
+ * metric value.
+ *
+ * @param metricType metric type reference
+ * @param metricValue metric value reference
+ */
public ControlMetric(ControlMetricType metricType, MetricValue metricValue) {
this.metricType = metricType;
this.metricValue = metricValue;
}
+ /**
+ * Returns metric type reference.
+ *
+ * @return metric type reference
+ */
public ControlMetricType metricType() {
return metricType;
}
+ /**
+ * Returns metric value reference.
+ *
+ * @return metric value reference
+ */
public MetricValue metricValue() {
return metricValue;
}
diff --git a/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlPlaneMonitorService.java b/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlPlaneMonitorService.java
index 64222e8..75d4501 100644
--- a/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlPlaneMonitorService.java
+++ b/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlPlaneMonitorService.java
@@ -28,40 +28,46 @@
/**
* Adds a new control metric value with a certain update interval.
*
- * @param controlMetric control plane metric (e.g., control message rate, cpu, memory, etc.)
- * @param updateInterval value update interval (time unit will be in minute)
- * @param deviceId {@link org.onosproject.net.DeviceId}
+ * @param controlMetric control plane metric (e.g., control
+ * message rate, cpu, memory, etc.)
+ * @param updateIntervalInMinutes value update interval (in minute)
+ * @param deviceId device identifier
*/
- void updateMetric(ControlMetric controlMetric, Integer updateInterval, Optional<DeviceId> deviceId);
+ void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes,
+ Optional<DeviceId> deviceId);
/**
* Adds a new control metric value with a certain update interval.
*
- * @param controlMetric control plane metric (e.g., disk and network metrics)
- * @param updateInterval value update interval (time unit will be in minute)
- * @param resourceName resource name
+ * @param controlMetric control plane metric (e.g., disk and
+ * network metrics)
+ * @param updateIntervalInMinutes value update interval (in minute)
+ * @param resourceName resource name
*/
- void updateMetric(ControlMetric controlMetric, Integer updateInterval, String resourceName);
+ void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes,
+ String resourceName);
/**
* Obtains the control plane load of a specific device.
* The metrics range from control messages and system metrics
* (e.g., CPU and memory info)
*
- * @param nodeId node id {@link org.onosproject.cluster.NodeId}
- * @param type control metric type
- * @param deviceId device id {@link org.onosproject.net.DeviceId}
+ * @param nodeId node identifier
+ * @param type control metric type
+ * @param deviceId device identifier
* @return control plane load
*/
- ControlLoad getLoad(NodeId nodeId, ControlMetricType type, Optional<DeviceId> deviceId);
+ ControlLoad getLoad(NodeId nodeId, ControlMetricType type,
+ Optional<DeviceId> deviceId);
/**
* Obtains the control plane load of a specific device.
- * The metrics range from I/O device metrics (e.g., disk and network interface)
+ * The metrics range from I/O device metrics
+ * (e.g., disk and network interface)
*
- * @param nodeId node id {@link org.onosproject.cluster.NodeId}
- * @param type control metric type
- * @param resourceName resource name
+ * @param nodeId node identifier
+ * @param type control metric type
+ * @param resourceName resource name
* @return control plane load
*/
ControlLoad getLoad(NodeId nodeId, ControlMetricType type, String resourceName);
diff --git a/apps/cpman/api/src/main/java/org/onosproject/cpman/MetricValue.java b/apps/cpman/api/src/main/java/org/onosproject/cpman/MetricValue.java
index c853ef1..88abdf9 100644
--- a/apps/cpman/api/src/main/java/org/onosproject/cpman/MetricValue.java
+++ b/apps/cpman/api/src/main/java/org/onosproject/cpman/MetricValue.java
@@ -27,7 +27,7 @@
private final long count;
/**
- * Constructor.
+ * Constructs a metric value using the given rate, load and count.
*
* @param rate rate
* @param load load
diff --git a/apps/cpman/api/src/main/java/org/onosproject/cpman/MetricsDatabase.java b/apps/cpman/api/src/main/java/org/onosproject/cpman/MetricsDatabase.java
index da9e2ea..9d4ce08 100644
--- a/apps/cpman/api/src/main/java/org/onosproject/cpman/MetricsDatabase.java
+++ b/apps/cpman/api/src/main/java/org/onosproject/cpman/MetricsDatabase.java
@@ -32,34 +32,34 @@
/**
* Update metric value by specifying metric type.
*
- * @param metricType metric type (e.g., load, usage, etc.)
- * @param value metric value
+ * @param metricType metric type (e.g., load, usage, etc.)
+ * @param value metric value
*/
void updateMetric(String metricType, double value);
/**
* Update metric value by specifying metric type in a certain time.
*
- * @param metricType metric type (e.g., load, usage, etc.)
- * @param value metric value
- * @param time update time in seconds
+ * @param metricType metric type (e.g., load, usage, etc.)
+ * @param value metric value
+ * @param time update time in seconds
*/
void updateMetric(String metricType, double value, long time);
/**
* Update metric values of a collection of metric types.
*
- * @param metrics a collection of metrics which consists of a pair of
- * metric type and metric value
- * @param time update time in seconds
+ * @param metrics a collection of metrics which consists of a pair of
+ * metric type and metric value
+ * @param time update time in seconds
*/
void updateMetrics(Map<String, Double> metrics, long time);
/**
* Update metric values of a collection of metric types.
*
- * @param metrics a collection of metrics which consists of a pair of
- * metric type and metric value
+ * @param metrics a collection of metrics which consists of a pair of
+ * metric type and metric value
*/
void updateMetrics(Map<String, Double> metrics);
@@ -74,9 +74,9 @@
/**
* Return most recent metric values of a given metric type for a given period.
*
- * @param metricType metric type
- * @param duration duration
- * @param unit time unit
+ * @param metricType metric type
+ * @param duration duration
+ * @param unit time unit
* @return a collection of metric value
*/
double[] recentMetrics(String metricType, int duration, TimeUnit unit);
@@ -84,7 +84,7 @@
/**
* Returns minimum metric value of a given metric type.
*
- * @param metricType metric type
+ * @param metricType metric type
* @return metric value
*/
double minMetric(String metricType);
@@ -92,7 +92,7 @@
/**
* Returns maximum metric value of a given metric type.
*
- * @param metricType metric type
+ * @param metricType metric type
* @return metric value
*/
double maxMetric(String metricType);
@@ -100,7 +100,7 @@
/**
* Returns a collection of metric values of a given metric type for a day.
*
- * @param metricType metric type
+ * @param metricType metric type
* @return a collection of metric value
*/
double[] metrics(String metricType);
@@ -109,9 +109,9 @@
* Returns a collection of metric values of a given metric type for
* a given period.
*
- * @param metricType metric type
- * @param startTime start time
- * @param endTime end time
+ * @param metricType metric type
+ * @param startTime start time
+ * @param endTime end time
* @return a collection of metric value
*/
double[] metrics(String metricType, long startTime, long endTime);
@@ -119,7 +119,7 @@
/**
* Returns the latest metric update time.
*
- * @param metricType metric type
+ * @param metricType metric type
* @return timestamp
*/
long lastUpdate(String metricType);
@@ -145,9 +145,9 @@
Builder addMetricType(String metricType);
/**
- * Builds a MetricDatabase instance.
+ * Builds a metric database instance.
*
- * @return MetricDatabase instance
+ * @return metric database instance
*/
MetricsDatabase build();
}