Committed by
Ray Milkey
Clean code and refine javadocs for control plane manager
Change-Id: Ieaaebde69ce2ab54cb819cfad1baa34ee97a7d66
Showing
11 changed files
with
275 additions
and
81 deletions
... | @@ -23,15 +23,32 @@ public class ControlMetric { | ... | @@ -23,15 +23,32 @@ public class ControlMetric { |
23 | private final ControlMetricType metricType; | 23 | private final ControlMetricType metricType; |
24 | private final MetricValue metricValue; | 24 | private final MetricValue metricValue; |
25 | 25 | ||
26 | + /** | ||
27 | + * Constructs a control metric using the given control metric type and | ||
28 | + * metric value. | ||
29 | + * | ||
30 | + * @param metricType metric type reference | ||
31 | + * @param metricValue metric value reference | ||
32 | + */ | ||
26 | public ControlMetric(ControlMetricType metricType, MetricValue metricValue) { | 33 | public ControlMetric(ControlMetricType metricType, MetricValue metricValue) { |
27 | this.metricType = metricType; | 34 | this.metricType = metricType; |
28 | this.metricValue = metricValue; | 35 | this.metricValue = metricValue; |
29 | } | 36 | } |
30 | 37 | ||
38 | + /** | ||
39 | + * Returns metric type reference. | ||
40 | + * | ||
41 | + * @return metric type reference | ||
42 | + */ | ||
31 | public ControlMetricType metricType() { | 43 | public ControlMetricType metricType() { |
32 | return metricType; | 44 | return metricType; |
33 | } | 45 | } |
34 | 46 | ||
47 | + /** | ||
48 | + * Returns metric value reference. | ||
49 | + * | ||
50 | + * @return metric value reference | ||
51 | + */ | ||
35 | public MetricValue metricValue() { | 52 | public MetricValue metricValue() { |
36 | return metricValue; | 53 | return metricValue; |
37 | } | 54 | } | ... | ... |
... | @@ -28,40 +28,46 @@ public interface ControlPlaneMonitorService { | ... | @@ -28,40 +28,46 @@ public interface ControlPlaneMonitorService { |
28 | /** | 28 | /** |
29 | * Adds a new control metric value with a certain update interval. | 29 | * Adds a new control metric value with a certain update interval. |
30 | * | 30 | * |
31 | - * @param controlMetric control plane metric (e.g., control message rate, cpu, memory, etc.) | 31 | + * @param controlMetric control plane metric (e.g., control |
32 | - * @param updateInterval value update interval (time unit will be in minute) | 32 | + * message rate, cpu, memory, etc.) |
33 | - * @param deviceId {@link org.onosproject.net.DeviceId} | 33 | + * @param updateIntervalInMinutes value update interval (in minute) |
34 | + * @param deviceId device identifier | ||
34 | */ | 35 | */ |
35 | - void updateMetric(ControlMetric controlMetric, Integer updateInterval, Optional<DeviceId> deviceId); | 36 | + void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes, |
37 | + Optional<DeviceId> deviceId); | ||
36 | 38 | ||
37 | /** | 39 | /** |
38 | * Adds a new control metric value with a certain update interval. | 40 | * Adds a new control metric value with a certain update interval. |
39 | * | 41 | * |
40 | - * @param controlMetric control plane metric (e.g., disk and network metrics) | 42 | + * @param controlMetric control plane metric (e.g., disk and |
41 | - * @param updateInterval value update interval (time unit will be in minute) | 43 | + * network metrics) |
42 | - * @param resourceName resource name | 44 | + * @param updateIntervalInMinutes value update interval (in minute) |
45 | + * @param resourceName resource name | ||
43 | */ | 46 | */ |
44 | - void updateMetric(ControlMetric controlMetric, Integer updateInterval, String resourceName); | 47 | + void updateMetric(ControlMetric controlMetric, int updateIntervalInMinutes, |
48 | + String resourceName); | ||
45 | 49 | ||
46 | /** | 50 | /** |
47 | * Obtains the control plane load of a specific device. | 51 | * Obtains the control plane load of a specific device. |
48 | * The metrics range from control messages and system metrics | 52 | * The metrics range from control messages and system metrics |
49 | * (e.g., CPU and memory info) | 53 | * (e.g., CPU and memory info) |
50 | * | 54 | * |
51 | - * @param nodeId node id {@link org.onosproject.cluster.NodeId} | 55 | + * @param nodeId node identifier |
52 | - * @param type control metric type | 56 | + * @param type control metric type |
53 | - * @param deviceId device id {@link org.onosproject.net.DeviceId} | 57 | + * @param deviceId device identifier |
54 | * @return control plane load | 58 | * @return control plane load |
55 | */ | 59 | */ |
56 | - ControlLoad getLoad(NodeId nodeId, ControlMetricType type, Optional<DeviceId> deviceId); | 60 | + ControlLoad getLoad(NodeId nodeId, ControlMetricType type, |
61 | + Optional<DeviceId> deviceId); | ||
57 | 62 | ||
58 | /** | 63 | /** |
59 | * Obtains the control plane load of a specific device. | 64 | * Obtains the control plane load of a specific device. |
60 | - * The metrics range from I/O device metrics (e.g., disk and network interface) | 65 | + * The metrics range from I/O device metrics |
66 | + * (e.g., disk and network interface) | ||
61 | * | 67 | * |
62 | - * @param nodeId node id {@link org.onosproject.cluster.NodeId} | 68 | + * @param nodeId node identifier |
63 | - * @param type control metric type | 69 | + * @param type control metric type |
64 | - * @param resourceName resource name | 70 | + * @param resourceName resource name |
65 | * @return control plane load | 71 | * @return control plane load |
66 | */ | 72 | */ |
67 | ControlLoad getLoad(NodeId nodeId, ControlMetricType type, String resourceName); | 73 | ControlLoad getLoad(NodeId nodeId, ControlMetricType type, String resourceName); | ... | ... |
... | @@ -27,7 +27,7 @@ public final class MetricValue { | ... | @@ -27,7 +27,7 @@ public final class MetricValue { |
27 | private final long count; | 27 | private final long count; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | - * Constructor. | 30 | + * Constructs a metric value using the given rate, load and count. |
31 | * | 31 | * |
32 | * @param rate rate | 32 | * @param rate rate |
33 | * @param load load | 33 | * @param load load | ... | ... |
... | @@ -32,34 +32,34 @@ public interface MetricsDatabase { | ... | @@ -32,34 +32,34 @@ public interface MetricsDatabase { |
32 | /** | 32 | /** |
33 | * Update metric value by specifying metric type. | 33 | * Update metric value by specifying metric type. |
34 | * | 34 | * |
35 | - * @param metricType metric type (e.g., load, usage, etc.) | 35 | + * @param metricType metric type (e.g., load, usage, etc.) |
36 | - * @param value metric value | 36 | + * @param value metric value |
37 | */ | 37 | */ |
38 | void updateMetric(String metricType, double value); | 38 | void updateMetric(String metricType, double value); |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Update metric value by specifying metric type in a certain time. | 41 | * Update metric value by specifying metric type in a certain time. |
42 | * | 42 | * |
43 | - * @param metricType metric type (e.g., load, usage, etc.) | 43 | + * @param metricType metric type (e.g., load, usage, etc.) |
44 | - * @param value metric value | 44 | + * @param value metric value |
45 | - * @param time update time in seconds | 45 | + * @param time update time in seconds |
46 | */ | 46 | */ |
47 | void updateMetric(String metricType, double value, long time); | 47 | void updateMetric(String metricType, double value, long time); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Update metric values of a collection of metric types. | 50 | * Update metric values of a collection of metric types. |
51 | * | 51 | * |
52 | - * @param metrics a collection of metrics which consists of a pair of | 52 | + * @param metrics a collection of metrics which consists of a pair of |
53 | - * metric type and metric value | 53 | + * metric type and metric value |
54 | - * @param time update time in seconds | 54 | + * @param time update time in seconds |
55 | */ | 55 | */ |
56 | void updateMetrics(Map<String, Double> metrics, long time); | 56 | void updateMetrics(Map<String, Double> metrics, long time); |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Update metric values of a collection of metric types. | 59 | * Update metric values of a collection of metric types. |
60 | * | 60 | * |
61 | - * @param metrics a collection of metrics which consists of a pair of | 61 | + * @param metrics a collection of metrics which consists of a pair of |
62 | - * metric type and metric value | 62 | + * metric type and metric value |
63 | */ | 63 | */ |
64 | void updateMetrics(Map<String, Double> metrics); | 64 | void updateMetrics(Map<String, Double> metrics); |
65 | 65 | ||
... | @@ -74,9 +74,9 @@ public interface MetricsDatabase { | ... | @@ -74,9 +74,9 @@ public interface MetricsDatabase { |
74 | /** | 74 | /** |
75 | * Return most recent metric values of a given metric type for a given period. | 75 | * Return most recent metric values of a given metric type for a given period. |
76 | * | 76 | * |
77 | - * @param metricType metric type | 77 | + * @param metricType metric type |
78 | - * @param duration duration | 78 | + * @param duration duration |
79 | - * @param unit time unit | 79 | + * @param unit time unit |
80 | * @return a collection of metric value | 80 | * @return a collection of metric value |
81 | */ | 81 | */ |
82 | double[] recentMetrics(String metricType, int duration, TimeUnit unit); | 82 | double[] recentMetrics(String metricType, int duration, TimeUnit unit); |
... | @@ -84,7 +84,7 @@ public interface MetricsDatabase { | ... | @@ -84,7 +84,7 @@ public interface MetricsDatabase { |
84 | /** | 84 | /** |
85 | * Returns minimum metric value of a given metric type. | 85 | * Returns minimum metric value of a given metric type. |
86 | * | 86 | * |
87 | - * @param metricType metric type | 87 | + * @param metricType metric type |
88 | * @return metric value | 88 | * @return metric value |
89 | */ | 89 | */ |
90 | double minMetric(String metricType); | 90 | double minMetric(String metricType); |
... | @@ -92,7 +92,7 @@ public interface MetricsDatabase { | ... | @@ -92,7 +92,7 @@ public interface MetricsDatabase { |
92 | /** | 92 | /** |
93 | * Returns maximum metric value of a given metric type. | 93 | * Returns maximum metric value of a given metric type. |
94 | * | 94 | * |
95 | - * @param metricType metric type | 95 | + * @param metricType metric type |
96 | * @return metric value | 96 | * @return metric value |
97 | */ | 97 | */ |
98 | double maxMetric(String metricType); | 98 | double maxMetric(String metricType); |
... | @@ -100,7 +100,7 @@ public interface MetricsDatabase { | ... | @@ -100,7 +100,7 @@ public interface MetricsDatabase { |
100 | /** | 100 | /** |
101 | * Returns a collection of metric values of a given metric type for a day. | 101 | * Returns a collection of metric values of a given metric type for a day. |
102 | * | 102 | * |
103 | - * @param metricType metric type | 103 | + * @param metricType metric type |
104 | * @return a collection of metric value | 104 | * @return a collection of metric value |
105 | */ | 105 | */ |
106 | double[] metrics(String metricType); | 106 | double[] metrics(String metricType); |
... | @@ -109,9 +109,9 @@ public interface MetricsDatabase { | ... | @@ -109,9 +109,9 @@ public interface MetricsDatabase { |
109 | * Returns a collection of metric values of a given metric type for | 109 | * Returns a collection of metric values of a given metric type for |
110 | * a given period. | 110 | * a given period. |
111 | * | 111 | * |
112 | - * @param metricType metric type | 112 | + * @param metricType metric type |
113 | - * @param startTime start time | 113 | + * @param startTime start time |
114 | - * @param endTime end time | 114 | + * @param endTime end time |
115 | * @return a collection of metric value | 115 | * @return a collection of metric value |
116 | */ | 116 | */ |
117 | double[] metrics(String metricType, long startTime, long endTime); | 117 | double[] metrics(String metricType, long startTime, long endTime); |
... | @@ -119,7 +119,7 @@ public interface MetricsDatabase { | ... | @@ -119,7 +119,7 @@ public interface MetricsDatabase { |
119 | /** | 119 | /** |
120 | * Returns the latest metric update time. | 120 | * Returns the latest metric update time. |
121 | * | 121 | * |
122 | - * @param metricType metric type | 122 | + * @param metricType metric type |
123 | * @return timestamp | 123 | * @return timestamp |
124 | */ | 124 | */ |
125 | long lastUpdate(String metricType); | 125 | long lastUpdate(String metricType); |
... | @@ -145,9 +145,9 @@ public interface MetricsDatabase { | ... | @@ -145,9 +145,9 @@ public interface MetricsDatabase { |
145 | Builder addMetricType(String metricType); | 145 | Builder addMetricType(String metricType); |
146 | 146 | ||
147 | /** | 147 | /** |
148 | - * Builds a MetricDatabase instance. | 148 | + * Builds a metric database instance. |
149 | * | 149 | * |
150 | - * @return MetricDatabase instance | 150 | + * @return metric database instance |
151 | */ | 151 | */ |
152 | MetricsDatabase build(); | 152 | MetricsDatabase build(); |
153 | } | 153 | } | ... | ... |
... | @@ -67,6 +67,12 @@ public final class ControlMetricsFactory { | ... | @@ -67,6 +67,12 @@ public final class ControlMetricsFactory { |
67 | private Set<String> diskPartitions = Sets.newConcurrentHashSet(); | 67 | private Set<String> diskPartitions = Sets.newConcurrentHashSet(); |
68 | private Set<String> nwInterfaces = Sets.newConcurrentHashSet(); | 68 | private Set<String> nwInterfaces = Sets.newConcurrentHashSet(); |
69 | 69 | ||
70 | + /** | ||
71 | + * Constructs a control metrics factory using the given metrics and device services. | ||
72 | + * | ||
73 | + * @param metricsService metric service reference | ||
74 | + * @param deviceService device service reference | ||
75 | + */ | ||
70 | private ControlMetricsFactory(MetricsService metricsService, DeviceService deviceService) { | 76 | private ControlMetricsFactory(MetricsService metricsService, DeviceService deviceService) { |
71 | this.metricsService = metricsService; | 77 | this.metricsService = metricsService; |
72 | registerMetrics(); | 78 | registerMetrics(); |
... | @@ -76,6 +82,13 @@ public final class ControlMetricsFactory { | ... | @@ -76,6 +82,13 @@ public final class ControlMetricsFactory { |
76 | addAllControlMessageMetrics(deviceIds); | 82 | addAllControlMessageMetrics(deviceIds); |
77 | } | 83 | } |
78 | 84 | ||
85 | + /** | ||
86 | + * Obtains the unique instance of ControlMetricsFactory. | ||
87 | + * | ||
88 | + * @param metricsService metric service | ||
89 | + * @param deviceService device service | ||
90 | + * @return instance of ControlMetricsFactory | ||
91 | + */ | ||
79 | public static ControlMetricsFactory getInstance(MetricsService metricsService, | 92 | public static ControlMetricsFactory getInstance(MetricsService metricsService, |
80 | DeviceService deviceService) { | 93 | DeviceService deviceService) { |
81 | if (uniqueInstance == null) { | 94 | if (uniqueInstance == null) { |
... | @@ -102,7 +115,7 @@ public final class ControlMetricsFactory { | ... | @@ -102,7 +115,7 @@ public final class ControlMetricsFactory { |
102 | /** | 115 | /** |
103 | * Adds control metrics of a new device. | 116 | * Adds control metrics of a new device. |
104 | * | 117 | * |
105 | - * @param deviceId {@link org.onosproject.net.DeviceId} | 118 | + * @param deviceId device identifier |
106 | */ | 119 | */ |
107 | public void addControlMessageMetricsByDeviceId(DeviceId deviceId) { | 120 | public void addControlMessageMetricsByDeviceId(DeviceId deviceId) { |
108 | MetricsAggregator inbound = new MetricsAggregator(metricsService, | 121 | MetricsAggregator inbound = new MetricsAggregator(metricsService, |
... | @@ -171,7 +184,7 @@ public final class ControlMetricsFactory { | ... | @@ -171,7 +184,7 @@ public final class ControlMetricsFactory { |
171 | /** | 184 | /** |
172 | * Removes control metrics of an existing device. | 185 | * Removes control metrics of an existing device. |
173 | * | 186 | * |
174 | - * @param deviceId {@link org.onosproject.net.DeviceId} | 187 | + * @param deviceId device identifier |
175 | */ | 188 | */ |
176 | public void removeControlMessageMetricsByDeviceId(DeviceId deviceId) { | 189 | public void removeControlMessageMetricsByDeviceId(DeviceId deviceId) { |
177 | inboundPacket.remove(deviceId); | 190 | inboundPacket.remove(deviceId); |
... | @@ -211,9 +224,9 @@ public final class ControlMetricsFactory { | ... | @@ -211,9 +224,9 @@ public final class ControlMetricsFactory { |
211 | } | 224 | } |
212 | 225 | ||
213 | /** | 226 | /** |
214 | - * Returns all device ids. | 227 | + * Returns all device identifiers. |
215 | * | 228 | * |
216 | - * @return a collection of device id | 229 | + * @return a collection of device identifiers |
217 | */ | 230 | */ |
218 | public Set<DeviceId> getDeviceIds() { | 231 | public Set<DeviceId> getDeviceIds() { |
219 | return ImmutableSet.copyOf(this.deviceIds); | 232 | return ImmutableSet.copyOf(this.deviceIds); |
... | @@ -222,7 +235,7 @@ public final class ControlMetricsFactory { | ... | @@ -222,7 +235,7 @@ public final class ControlMetricsFactory { |
222 | /** | 235 | /** |
223 | * Returns all disk partition names. | 236 | * Returns all disk partition names. |
224 | * | 237 | * |
225 | - * @return a collection of disk partition. | 238 | + * @return a collection of disk partitions. |
226 | */ | 239 | */ |
227 | public Set<String> getDiskPartitions() { | 240 | public Set<String> getDiskPartitions() { |
228 | return ImmutableSet.copyOf(this.diskPartitions); | 241 | return ImmutableSet.copyOf(this.diskPartitions); |
... | @@ -231,7 +244,7 @@ public final class ControlMetricsFactory { | ... | @@ -231,7 +244,7 @@ public final class ControlMetricsFactory { |
231 | /** | 244 | /** |
232 | * Returns all network interface names. | 245 | * Returns all network interface names. |
233 | * | 246 | * |
234 | - * @return a collection of network interface. | 247 | + * @return a collection of network interfaces. |
235 | */ | 248 | */ |
236 | public Set<String> getNetworkInterfaces() { | 249 | public Set<String> getNetworkInterfaces() { |
237 | return ImmutableSet.copyOf(this.nwInterfaces); | 250 | return ImmutableSet.copyOf(this.nwInterfaces); |
... | @@ -240,7 +253,7 @@ public final class ControlMetricsFactory { | ... | @@ -240,7 +253,7 @@ public final class ControlMetricsFactory { |
240 | /** | 253 | /** |
241 | * Adds control metrics for all devices. | 254 | * Adds control metrics for all devices. |
242 | * | 255 | * |
243 | - * @param deviceIds a set of deviceIds | 256 | + * @param deviceIds a set of device identifiers |
244 | */ | 257 | */ |
245 | public void addAllControlMessageMetrics(Set<DeviceId> deviceIds) { | 258 | public void addAllControlMessageMetrics(Set<DeviceId> deviceIds) { |
246 | deviceIds.forEach(v -> addControlMessageMetricsByDeviceId(v)); | 259 | deviceIds.forEach(v -> addControlMessageMetricsByDeviceId(v)); |
... | @@ -330,102 +343,239 @@ public final class ControlMetricsFactory { | ... | @@ -330,102 +343,239 @@ public final class ControlMetricsFactory { |
330 | replyPacket.clear(); | 343 | replyPacket.clear(); |
331 | } | 344 | } |
332 | 345 | ||
346 | + /** | ||
347 | + * Returns CPU load metric aggregator. | ||
348 | + * | ||
349 | + * @return metric aggregator | ||
350 | + */ | ||
333 | public MetricsAggregator cpuLoadMetric() { | 351 | public MetricsAggregator cpuLoadMetric() { |
334 | return cpuLoad; | 352 | return cpuLoad; |
335 | } | 353 | } |
336 | 354 | ||
355 | + /** | ||
356 | + * Returns total CPU time metric aggregator. | ||
357 | + * | ||
358 | + * @return metric aggregator | ||
359 | + */ | ||
337 | public MetricsAggregator totalCpuTimeMetric() { | 360 | public MetricsAggregator totalCpuTimeMetric() { |
338 | return totalCpuTime; | 361 | return totalCpuTime; |
339 | } | 362 | } |
340 | 363 | ||
364 | + /** | ||
365 | + * Returns system CPU time metric aggregator. | ||
366 | + * | ||
367 | + * @return metric aggregator | ||
368 | + */ | ||
341 | public MetricsAggregator sysCpuTimeMetric() { | 369 | public MetricsAggregator sysCpuTimeMetric() { |
342 | return sysCpuTime; | 370 | return sysCpuTime; |
343 | } | 371 | } |
344 | 372 | ||
373 | + /** | ||
374 | + * Returns user CPU time metric aggregator. | ||
375 | + * | ||
376 | + * @return metric aggregator | ||
377 | + */ | ||
345 | public MetricsAggregator userCpuTime() { | 378 | public MetricsAggregator userCpuTime() { |
346 | return userCpuTime; | 379 | return userCpuTime; |
347 | } | 380 | } |
348 | 381 | ||
382 | + /** | ||
383 | + * Returns CPU idle time metric aggregator. | ||
384 | + * | ||
385 | + * @return metric aggregator | ||
386 | + */ | ||
349 | public MetricsAggregator cpuIdleTime() { | 387 | public MetricsAggregator cpuIdleTime() { |
350 | return cpuIdleTime; | 388 | return cpuIdleTime; |
351 | } | 389 | } |
352 | 390 | ||
391 | + /** | ||
392 | + * Returns free memory ratio metric aggregator. | ||
393 | + * | ||
394 | + * @return metric aggregator | ||
395 | + */ | ||
353 | public MetricsAggregator memoryFreeRatio() { | 396 | public MetricsAggregator memoryFreeRatio() { |
354 | return memoryFreeRatio; | 397 | return memoryFreeRatio; |
355 | } | 398 | } |
356 | 399 | ||
400 | + /** | ||
401 | + * Returns used memory ratio metric aggregator. | ||
402 | + * | ||
403 | + * @return metric aggregator | ||
404 | + */ | ||
357 | public MetricsAggregator memoryUsedRatio() { | 405 | public MetricsAggregator memoryUsedRatio() { |
358 | return memoryUsedRatio; | 406 | return memoryUsedRatio; |
359 | } | 407 | } |
360 | 408 | ||
361 | - public MetricsAggregator diskReadBytes(String partitionName) { | 409 | + /** |
362 | - return diskReadBytes.get(partitionName); | 410 | + * Returns disk read bytes metric aggregator. |
411 | + * | ||
412 | + * @param resourceName name of disk resource | ||
413 | + * @return metric aggregator | ||
414 | + */ | ||
415 | + public MetricsAggregator diskReadBytes(String resourceName) { | ||
416 | + return diskReadBytes.get(resourceName); | ||
363 | } | 417 | } |
364 | 418 | ||
365 | - public MetricsAggregator diskWriteBytes(String partitionName) { | 419 | + /** |
366 | - return diskWriteBytes.get(partitionName); | 420 | + * Returns disk write bytes metric aggregator. |
421 | + * | ||
422 | + * @param resourceName name of disk resource | ||
423 | + * @return metric aggregator | ||
424 | + */ | ||
425 | + public MetricsAggregator diskWriteBytes(String resourceName) { | ||
426 | + return diskWriteBytes.get(resourceName); | ||
367 | } | 427 | } |
368 | 428 | ||
429 | + /** | ||
430 | + * Returns incoming bytes metric aggregator. | ||
431 | + * | ||
432 | + * @param interfaceName name of network interface | ||
433 | + * @return metric aggregator | ||
434 | + */ | ||
369 | public MetricsAggregator nwIncomingBytes(String interfaceName) { | 435 | public MetricsAggregator nwIncomingBytes(String interfaceName) { |
370 | return nwIncomingBytes.get(interfaceName); | 436 | return nwIncomingBytes.get(interfaceName); |
371 | } | 437 | } |
372 | 438 | ||
439 | + /** | ||
440 | + * Returns outgoing bytes metric aggregator. | ||
441 | + * | ||
442 | + * @param interfaceName name of network interface | ||
443 | + * @return metric aggregator | ||
444 | + */ | ||
373 | public MetricsAggregator nwOutgoingBytes(String interfaceName) { | 445 | public MetricsAggregator nwOutgoingBytes(String interfaceName) { |
374 | return nwOutgoingBytes.get(interfaceName); | 446 | return nwOutgoingBytes.get(interfaceName); |
375 | } | 447 | } |
376 | 448 | ||
449 | + /** | ||
450 | + * Returns incoming packets metric aggregator. | ||
451 | + * | ||
452 | + * @param interfaceName name of network interface | ||
453 | + * @return metric aggregator | ||
454 | + */ | ||
377 | public MetricsAggregator nwIncomingPackets(String interfaceName) { | 455 | public MetricsAggregator nwIncomingPackets(String interfaceName) { |
378 | return nwIncomingPackets.get(interfaceName); | 456 | return nwIncomingPackets.get(interfaceName); |
379 | } | 457 | } |
380 | 458 | ||
459 | + /** | ||
460 | + * Returns outgoing packets metric aggregator. | ||
461 | + * | ||
462 | + * @param interfaceName name of network interface | ||
463 | + * @return metric aggregator | ||
464 | + */ | ||
381 | public MetricsAggregator nwOutgoingPackets(String interfaceName) { | 465 | public MetricsAggregator nwOutgoingPackets(String interfaceName) { |
382 | return nwOutgoingPackets.get(interfaceName); | 466 | return nwOutgoingPackets.get(interfaceName); |
383 | } | 467 | } |
384 | 468 | ||
469 | + /** | ||
470 | + * Returns inbound packet metric aggregator of all devices. | ||
471 | + * | ||
472 | + * @return metric aggregator | ||
473 | + */ | ||
385 | public Map<DeviceId, MetricsAggregator> inboundPacket() { | 474 | public Map<DeviceId, MetricsAggregator> inboundPacket() { |
386 | return ImmutableMap.copyOf(inboundPacket); | 475 | return ImmutableMap.copyOf(inboundPacket); |
387 | } | 476 | } |
388 | 477 | ||
478 | + /** | ||
479 | + * Returns outgoing packet metric aggregator of all devices. | ||
480 | + * | ||
481 | + * @return metric aggregator | ||
482 | + */ | ||
389 | public Map<DeviceId, MetricsAggregator> outboundPacket() { | 483 | public Map<DeviceId, MetricsAggregator> outboundPacket() { |
390 | return ImmutableMap.copyOf(outboundPacket); | 484 | return ImmutableMap.copyOf(outboundPacket); |
391 | } | 485 | } |
392 | 486 | ||
487 | + /** | ||
488 | + * Returns flow-mod packet metric aggregator of all devices. | ||
489 | + * | ||
490 | + * @return metric aggregator | ||
491 | + */ | ||
393 | public Map<DeviceId, MetricsAggregator> flowmodPacket() { | 492 | public Map<DeviceId, MetricsAggregator> flowmodPacket() { |
394 | return ImmutableMap.copyOf(flowmodPacket); | 493 | return ImmutableMap.copyOf(flowmodPacket); |
395 | } | 494 | } |
396 | 495 | ||
496 | + /** | ||
497 | + * Returns flow-removed packet metric aggregator of all devices. | ||
498 | + * | ||
499 | + * @return metric aggregator | ||
500 | + */ | ||
397 | public Map<DeviceId, MetricsAggregator> flowrmvPacket() { | 501 | public Map<DeviceId, MetricsAggregator> flowrmvPacket() { |
398 | return ImmutableMap.copyOf(flowrmvPacket); | 502 | return ImmutableMap.copyOf(flowrmvPacket); |
399 | } | 503 | } |
400 | 504 | ||
505 | + /** | ||
506 | + * Returns request packet metric aggregator of all devices. | ||
507 | + * | ||
508 | + * @return metric aggregator | ||
509 | + */ | ||
401 | public Map<DeviceId, MetricsAggregator> requestPacket() { | 510 | public Map<DeviceId, MetricsAggregator> requestPacket() { |
402 | return ImmutableMap.copyOf(requestPacket); | 511 | return ImmutableMap.copyOf(requestPacket); |
403 | } | 512 | } |
404 | 513 | ||
514 | + /** | ||
515 | + * Returns reply packet metric aggregator of all devices. | ||
516 | + * | ||
517 | + * @return metric aggregator | ||
518 | + */ | ||
405 | public Map<DeviceId, MetricsAggregator> replyPacket() { | 519 | public Map<DeviceId, MetricsAggregator> replyPacket() { |
406 | return ImmutableMap.copyOf(replyPacket); | 520 | return ImmutableMap.copyOf(replyPacket); |
407 | } | 521 | } |
408 | 522 | ||
523 | + /** | ||
524 | + * Returns inbound packet metric aggregator of a specified device. | ||
525 | + * | ||
526 | + * @param deviceId device identifier | ||
527 | + * @return metric aggregator | ||
528 | + */ | ||
409 | public MetricsAggregator inboundPacket(DeviceId deviceId) { | 529 | public MetricsAggregator inboundPacket(DeviceId deviceId) { |
410 | return inboundPacket.get(deviceId); | 530 | return inboundPacket.get(deviceId); |
411 | } | 531 | } |
412 | 532 | ||
533 | + /** | ||
534 | + * Returns outbound packet metric aggregator of a specified device. | ||
535 | + * | ||
536 | + * @param deviceId device identifier | ||
537 | + * @return metric aggregator | ||
538 | + */ | ||
413 | public MetricsAggregator outboundPacket(DeviceId deviceId) { | 539 | public MetricsAggregator outboundPacket(DeviceId deviceId) { |
414 | return outboundPacket.get(deviceId); | 540 | return outboundPacket.get(deviceId); |
415 | } | 541 | } |
416 | 542 | ||
543 | + /** | ||
544 | + * Returns flow-mod packet metric aggregator of a specified device. | ||
545 | + * | ||
546 | + * @param deviceId device identifier | ||
547 | + * @return metric aggregator | ||
548 | + */ | ||
417 | public MetricsAggregator flowmodPacket(DeviceId deviceId) { | 549 | public MetricsAggregator flowmodPacket(DeviceId deviceId) { |
418 | return flowmodPacket.get(deviceId); | 550 | return flowmodPacket.get(deviceId); |
419 | } | 551 | } |
420 | 552 | ||
553 | + /** | ||
554 | + * Returns flow-removed packet metric aggregator of a specified device. | ||
555 | + * | ||
556 | + * @param deviceId device identifier | ||
557 | + * @return metric aggregator | ||
558 | + */ | ||
421 | public MetricsAggregator flowrmvPacket(DeviceId deviceId) { | 559 | public MetricsAggregator flowrmvPacket(DeviceId deviceId) { |
422 | return flowrmvPacket.get(deviceId); | 560 | return flowrmvPacket.get(deviceId); |
423 | } | 561 | } |
424 | 562 | ||
563 | + /** | ||
564 | + * Returns request packet metric aggregator of a specified device. | ||
565 | + * | ||
566 | + * @param deviceId device identifier | ||
567 | + * @return metric aggregator | ||
568 | + */ | ||
425 | public MetricsAggregator requestPacket(DeviceId deviceId) { | 569 | public MetricsAggregator requestPacket(DeviceId deviceId) { |
426 | return requestPacket.get(deviceId); | 570 | return requestPacket.get(deviceId); |
427 | } | 571 | } |
428 | 572 | ||
573 | + /** | ||
574 | + * Returns reply packet metric aggregator of a specified device. | ||
575 | + * | ||
576 | + * @param deviceId device identifier | ||
577 | + * @return metric aggregator | ||
578 | + */ | ||
429 | public MetricsAggregator replyPacket(DeviceId deviceId) { | 579 | public MetricsAggregator replyPacket(DeviceId deviceId) { |
430 | return replyPacket.get(deviceId); | 580 | return replyPacket.get(deviceId); |
431 | } | 581 | } | ... | ... |
... | @@ -28,7 +28,7 @@ public interface ControlMetricsObserver { | ... | @@ -28,7 +28,7 @@ public interface ControlMetricsObserver { |
28 | * Feeds the extracted value from MetricAggregator to back-end storage. | 28 | * Feeds the extracted value from MetricAggregator to back-end storage. |
29 | * | 29 | * |
30 | * @param metricsAggregator metric aggregator | 30 | * @param metricsAggregator metric aggregator |
31 | - * @param deviceId device id {@link org.onosproject.net.DeviceId} | 31 | + * @param deviceId device identification |
32 | */ | 32 | */ |
33 | void feedMetrics(MetricsAggregator metricsAggregator, Optional<DeviceId> deviceId); | 33 | void feedMetrics(MetricsAggregator metricsAggregator, Optional<DeviceId> deviceId); |
34 | 34 | ... | ... |
... | @@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory; | ... | @@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory; |
36 | 36 | ||
37 | import java.util.Map; | 37 | import java.util.Map; |
38 | import java.util.Optional; | 38 | import java.util.Optional; |
39 | +import java.util.Set; | ||
39 | import java.util.concurrent.ConcurrentHashMap; | 40 | import java.util.concurrent.ConcurrentHashMap; |
40 | 41 | ||
41 | import static org.onosproject.cpman.ControlMetricType.CPU_IDLE_TIME; | 42 | import static org.onosproject.cpman.ControlMetricType.CPU_IDLE_TIME; |
... | @@ -83,18 +84,18 @@ public class ControlPlaneMonitor implements ControlPlaneMonitorService { | ... | @@ -83,18 +84,18 @@ public class ControlPlaneMonitor implements ControlPlaneMonitorService { |
83 | private static final String DISK = "Disk"; | 84 | private static final String DISK = "Disk"; |
84 | private static final String NETWORK = "Network"; | 85 | private static final String NETWORK = "Network"; |
85 | 86 | ||
86 | - private static final ImmutableSet<ControlMetricType> CPU_METRICS = | 87 | + private static final Set<ControlMetricType> CPU_METRICS = |
87 | ImmutableSet.of(CPU_IDLE_TIME, CPU_LOAD, SYS_CPU_TIME, | 88 | ImmutableSet.of(CPU_IDLE_TIME, CPU_LOAD, SYS_CPU_TIME, |
88 | USER_CPU_TIME, TOTAL_CPU_TIME); | 89 | USER_CPU_TIME, TOTAL_CPU_TIME); |
89 | - private static final ImmutableSet<ControlMetricType> MEMORY_METRICS = | 90 | + private static final Set<ControlMetricType> MEMORY_METRICS = |
90 | ImmutableSet.of(MEMORY_FREE, MEMORY_FREE_RATIO, MEMORY_USED, | 91 | ImmutableSet.of(MEMORY_FREE, MEMORY_FREE_RATIO, MEMORY_USED, |
91 | MEMORY_USED_RATIO); | 92 | MEMORY_USED_RATIO); |
92 | - private static final ImmutableSet<ControlMetricType> DISK_METRICS = | 93 | + private static final Set<ControlMetricType> DISK_METRICS = |
93 | ImmutableSet.of(DISK_READ_BYTES, DISK_WRITE_BYTES); | 94 | ImmutableSet.of(DISK_READ_BYTES, DISK_WRITE_BYTES); |
94 | - private static final ImmutableSet<ControlMetricType> NETWORK_METRICS = | 95 | + private static final Set<ControlMetricType> NETWORK_METRICS = |
95 | ImmutableSet.of(NW_INCOMING_BYTES, NW_OUTGOING_BYTES, | 96 | ImmutableSet.of(NW_INCOMING_BYTES, NW_OUTGOING_BYTES, |
96 | NW_INCOMING_PACKETS, NW_OUTGOING_PACKETS); | 97 | NW_INCOMING_PACKETS, NW_OUTGOING_PACKETS); |
97 | - private static final ImmutableSet<ControlMetricType> CTRL_MSGS = | 98 | + private static final Set<ControlMetricType> CTRL_MSGS = |
98 | ImmutableSet.of(INBOUND_PACKET, OUTBOUND_PACKET, FLOW_MOD_PACKET, | 99 | ImmutableSet.of(INBOUND_PACKET, OUTBOUND_PACKET, FLOW_MOD_PACKET, |
99 | FLOW_REMOVED_PACKET, REQUEST_PACKET, REPLY_PACKET); | 100 | FLOW_REMOVED_PACKET, REQUEST_PACKET, REPLY_PACKET); |
100 | private Map<ControlMetricType, Double> cpuBuf; | 101 | private Map<ControlMetricType, Double> cpuBuf; |
... | @@ -134,7 +135,7 @@ public class ControlPlaneMonitor implements ControlPlaneMonitorService { | ... | @@ -134,7 +135,7 @@ public class ControlPlaneMonitor implements ControlPlaneMonitorService { |
134 | } | 135 | } |
135 | 136 | ||
136 | @Override | 137 | @Override |
137 | - public void updateMetric(ControlMetric cm, Integer updateInterval, | 138 | + public void updateMetric(ControlMetric cm, int updateIntervalInMinutes, |
138 | Optional<DeviceId> deviceId) { | 139 | Optional<DeviceId> deviceId) { |
139 | if (deviceId.isPresent()) { | 140 | if (deviceId.isPresent()) { |
140 | 141 | ||
... | @@ -180,7 +181,7 @@ public class ControlPlaneMonitor implements ControlPlaneMonitorService { | ... | @@ -180,7 +181,7 @@ public class ControlPlaneMonitor implements ControlPlaneMonitorService { |
180 | } | 181 | } |
181 | 182 | ||
182 | @Override | 183 | @Override |
183 | - public void updateMetric(ControlMetric cm, Integer updateInterval, | 184 | + public void updateMetric(ControlMetric cm, int updateIntervalInMinutes, |
184 | String resourceName) { | 185 | String resourceName) { |
185 | // update disk metrics | 186 | // update disk metrics |
186 | if (DISK_METRICS.contains(cm.metricType())) { | 187 | if (DISK_METRICS.contains(cm.metricType())) { |
... | @@ -252,7 +253,7 @@ public class ControlPlaneMonitor implements ControlPlaneMonitorService { | ... | @@ -252,7 +253,7 @@ public class ControlPlaneMonitor implements ControlPlaneMonitorService { |
252 | } | 253 | } |
253 | 254 | ||
254 | private MetricsDatabase genMDbBuilder(String metricName, | 255 | private MetricsDatabase genMDbBuilder(String metricName, |
255 | - ImmutableSet<ControlMetricType> metricTypes) { | 256 | + Set<ControlMetricType> metricTypes) { |
256 | MetricsDatabase.Builder builder = new DefaultMetricsDatabase.Builder(); | 257 | MetricsDatabase.Builder builder = new DefaultMetricsDatabase.Builder(); |
257 | builder.withMetricName(metricName); | 258 | builder.withMetricName(metricName); |
258 | metricTypes.forEach(type -> builder.addMetricType(type.toString())); | 259 | metricTypes.forEach(type -> builder.addMetricType(type.toString())); | ... | ... |
... | @@ -31,6 +31,13 @@ public class DefaultControlLoad implements ControlLoad { | ... | @@ -31,6 +31,13 @@ public class DefaultControlLoad implements ControlLoad { |
31 | private final MetricsDatabase mdb; | 31 | private final MetricsDatabase mdb; |
32 | private final ControlMetricType type; | 32 | private final ControlMetricType type; |
33 | 33 | ||
34 | + /** | ||
35 | + * Constructs a control load using the given metrics database and | ||
36 | + * control metric type. | ||
37 | + * | ||
38 | + * @param mdb metrics database | ||
39 | + * @param type control metric type | ||
40 | + */ | ||
34 | public DefaultControlLoad(MetricsDatabase mdb, ControlMetricType type) { | 41 | public DefaultControlLoad(MetricsDatabase mdb, ControlMetricType type) { |
35 | this.mdb = mdb; | 42 | this.mdb = mdb; |
36 | this.type = type; | 43 | this.type = type; | ... | ... |
... | @@ -53,6 +53,13 @@ public final class DefaultMetricsDatabase implements MetricsDatabase { | ... | @@ -53,6 +53,13 @@ public final class DefaultMetricsDatabase implements MetricsDatabase { |
53 | private static final String INSUFFICIENT_DURATION = "Given duration less than one minute."; | 53 | private static final String INSUFFICIENT_DURATION = "Given duration less than one minute."; |
54 | private static final String EXCEEDED_DURATION = "Given duration exceeds a day time."; | 54 | private static final String EXCEEDED_DURATION = "Given duration exceeds a day time."; |
55 | 55 | ||
56 | + /** | ||
57 | + * Constructs a metrics database using the given metric name and | ||
58 | + * round robin database. | ||
59 | + * | ||
60 | + * @param metricName metric name | ||
61 | + * @param rrdDb round robin database | ||
62 | + */ | ||
56 | private DefaultMetricsDatabase(String metricName, RrdDb rrdDb) { | 63 | private DefaultMetricsDatabase(String metricName, RrdDb rrdDb) { |
57 | this.metricName = metricName; | 64 | this.metricName = metricName; |
58 | this.rrdDb = rrdDb; | 65 | this.rrdDb = rrdDb; | ... | ... |
... | @@ -43,13 +43,13 @@ public class MetricsAggregator { | ... | @@ -43,13 +43,13 @@ public class MetricsAggregator { |
43 | private static final String COUNT_NAME = "count"; | 43 | private static final String COUNT_NAME = "count"; |
44 | 44 | ||
45 | /** | 45 | /** |
46 | - * Constructs a new MetricsAggregator for aggregating a metric. | 46 | + * Constructs a new metrics aggregator for aggregating a metric. |
47 | * Instantiates the metrics service | 47 | * Instantiates the metrics service |
48 | * Initializes all the general metrics for that object | 48 | * Initializes all the general metrics for that object |
49 | * | 49 | * |
50 | - * @param metricsService MetricsService reference | 50 | + * @param metricsService metric service reference |
51 | - * @param type Control metric type | 51 | + * @param type control metric type |
52 | - * @param deviceId DeviceId | 52 | + * @param deviceId device identification |
53 | */ | 53 | */ |
54 | MetricsAggregator(MetricsService metricsService, ControlMetricType type, | 54 | MetricsAggregator(MetricsService metricsService, ControlMetricType type, |
55 | Optional<DeviceId> deviceId) { | 55 | Optional<DeviceId> deviceId) { |
... | @@ -57,12 +57,12 @@ public class MetricsAggregator { | ... | @@ -57,12 +57,12 @@ public class MetricsAggregator { |
57 | } | 57 | } |
58 | 58 | ||
59 | /** | 59 | /** |
60 | - * Constructs a new MetricAggregator for aggregating a metric. | 60 | + * Constructs a new metrics aggregator for aggregating a metric. |
61 | * Instantiates the metrics service | 61 | * Instantiates the metrics service |
62 | * Initializes all the general metrics for that object | 62 | * Initializes all the general metrics for that object |
63 | * | 63 | * |
64 | - * @param metricsService MetricsService reference | 64 | + * @param metricsService metric service reference |
65 | - * @param type Control metric type | 65 | + * @param type control metric type |
66 | * @param resourceName resource name (e.g., ethernet interface name) | 66 | * @param resourceName resource name (e.g., ethernet interface name) |
67 | */ | 67 | */ |
68 | MetricsAggregator(MetricsService metricsService, ControlMetricType type, | 68 | MetricsAggregator(MetricsService metricsService, ControlMetricType type, |
... | @@ -72,12 +72,12 @@ public class MetricsAggregator { | ... | @@ -72,12 +72,12 @@ public class MetricsAggregator { |
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
75 | - * Constructs a new MetricAggregator for aggregating a metric. | 75 | + * Constructs a new metrics aggregator for aggregating a metric. |
76 | * Instantiates the metrics service | 76 | * Instantiates the metrics service |
77 | * Initializes all the general metrics for that object | 77 | * Initializes all the general metrics for that object |
78 | * | 78 | * |
79 | - * @param metricsService MetricsService reference | 79 | + * @param metricsService metrics service reference |
80 | - * @param type Control metric type | 80 | + * @param type control metric type |
81 | */ | 81 | */ |
82 | MetricsAggregator(MetricsService metricsService, ControlMetricType type) { | 82 | MetricsAggregator(MetricsService metricsService, ControlMetricType type) { |
83 | init(metricsService, type, Optional.ofNullable(null), null); | 83 | init(metricsService, type, Optional.ofNullable(null), null); |
... | @@ -86,9 +86,9 @@ public class MetricsAggregator { | ... | @@ -86,9 +86,9 @@ public class MetricsAggregator { |
86 | /** | 86 | /** |
87 | * Base method of the constructor of this class. | 87 | * Base method of the constructor of this class. |
88 | * | 88 | * |
89 | - * @param metricsService MetricsService reference | 89 | + * @param metricsService metrics service reference |
90 | - * @param type Control metric type | 90 | + * @param type control metric type |
91 | - * @param deviceId DeviceId | 91 | + * @param deviceId device identification |
92 | * @param resourceName resource name | 92 | * @param resourceName resource name |
93 | */ | 93 | */ |
94 | private void init(MetricsService metricsService, ControlMetricType type, | 94 | private void init(MetricsService metricsService, ControlMetricType type, |
... | @@ -116,14 +116,19 @@ public class MetricsAggregator { | ... | @@ -116,14 +116,19 @@ public class MetricsAggregator { |
116 | this.countMeter = metricsService.createMeter(metricsComponent, metricsFeature, COUNT_NAME); | 116 | this.countMeter = metricsService.createMeter(metricsComponent, metricsFeature, COUNT_NAME); |
117 | } | 117 | } |
118 | 118 | ||
119 | + /** | ||
120 | + * Returns control metrics type. | ||
121 | + * | ||
122 | + * @return control metrics type | ||
123 | + */ | ||
119 | public ControlMetricType getMetricsType() { | 124 | public ControlMetricType getMetricsType() { |
120 | return metricsType; | 125 | return metricsType; |
121 | } | 126 | } |
122 | 127 | ||
123 | /** | 128 | /** |
124 | - * Increments the meter rate by {@code n}, and the meter counter by 1. | 129 | + * Increments the meter rate by n, and the meter counter by 1. |
125 | * | 130 | * |
126 | - * @param n Increment the meter rate by {@code n}. | 131 | + * @param n increment rate. |
127 | */ | 132 | */ |
128 | public void increment(long n) { | 133 | public void increment(long n) { |
129 | rateMeter.mark(n); | 134 | rateMeter.mark(n); |
... | @@ -131,7 +136,7 @@ public class MetricsAggregator { | ... | @@ -131,7 +136,7 @@ public class MetricsAggregator { |
131 | } | 136 | } |
132 | 137 | ||
133 | /** | 138 | /** |
134 | - * Obtains the average load value. | 139 | + * Returns the average load value. |
135 | * | 140 | * |
136 | * @return load value | 141 | * @return load value |
137 | */ | 142 | */ |
... | @@ -140,7 +145,7 @@ public class MetricsAggregator { | ... | @@ -140,7 +145,7 @@ public class MetricsAggregator { |
140 | } | 145 | } |
141 | 146 | ||
142 | /** | 147 | /** |
143 | - * Obtains the average meter rate within recent 1 minute. | 148 | + * Returns the average meter rate within recent 1 minute. |
144 | * | 149 | * |
145 | * @return rate value | 150 | * @return rate value |
146 | */ | 151 | */ |
... | @@ -149,7 +154,7 @@ public class MetricsAggregator { | ... | @@ -149,7 +154,7 @@ public class MetricsAggregator { |
149 | } | 154 | } |
150 | 155 | ||
151 | /** | 156 | /** |
152 | - * Obtains the average meter count within recent 1 minute. | 157 | + * Returns the average meter count within recent 1 minute. |
153 | * | 158 | * |
154 | * @return count value | 159 | * @return count value |
155 | */ | 160 | */ | ... | ... |
... | @@ -36,6 +36,7 @@ import java.net.HttpURLConnection; | ... | @@ -36,6 +36,7 @@ import java.net.HttpURLConnection; |
36 | import java.net.ServerSocket; | 36 | import java.net.ServerSocket; |
37 | import java.util.Optional; | 37 | import java.util.Optional; |
38 | 38 | ||
39 | +import static org.easymock.EasyMock.anyInt; | ||
39 | import static org.easymock.EasyMock.anyObject; | 40 | import static org.easymock.EasyMock.anyObject; |
40 | import static org.easymock.EasyMock.anyString; | 41 | import static org.easymock.EasyMock.anyString; |
41 | import static org.easymock.EasyMock.createMock; | 42 | import static org.easymock.EasyMock.createMock; |
... | @@ -68,7 +69,7 @@ public class ControlMetricsCollectorResourceTest extends JerseyTest { | ... | @@ -68,7 +69,7 @@ public class ControlMetricsCollectorResourceTest extends JerseyTest { |
68 | 69 | ||
69 | @Test | 70 | @Test |
70 | public void testCpuMetricsPost() { | 71 | public void testCpuMetricsPost() { |
71 | - mockControlPlaneMonitorService.updateMetric(anyObject(), anyObject(), | 72 | + mockControlPlaneMonitorService.updateMetric(anyObject(), anyInt(), |
72 | (Optional<DeviceId>) anyObject()); | 73 | (Optional<DeviceId>) anyObject()); |
73 | expectLastCall().times(5); | 74 | expectLastCall().times(5); |
74 | replay(mockControlPlaneMonitorService); | 75 | replay(mockControlPlaneMonitorService); |
... | @@ -77,7 +78,7 @@ public class ControlMetricsCollectorResourceTest extends JerseyTest { | ... | @@ -77,7 +78,7 @@ public class ControlMetricsCollectorResourceTest extends JerseyTest { |
77 | 78 | ||
78 | @Test | 79 | @Test |
79 | public void testMemoryMetricsPost() { | 80 | public void testMemoryMetricsPost() { |
80 | - mockControlPlaneMonitorService.updateMetric(anyObject(), anyObject(), | 81 | + mockControlPlaneMonitorService.updateMetric(anyObject(), anyInt(), |
81 | (Optional<DeviceId>) anyObject()); | 82 | (Optional<DeviceId>) anyObject()); |
82 | expectLastCall().times(4); | 83 | expectLastCall().times(4); |
83 | replay(mockControlPlaneMonitorService); | 84 | replay(mockControlPlaneMonitorService); |
... | @@ -86,7 +87,7 @@ public class ControlMetricsCollectorResourceTest extends JerseyTest { | ... | @@ -86,7 +87,7 @@ public class ControlMetricsCollectorResourceTest extends JerseyTest { |
86 | 87 | ||
87 | @Test | 88 | @Test |
88 | public void testDiskMetricsWithNullName() { | 89 | public void testDiskMetricsWithNullName() { |
89 | - mockControlPlaneMonitorService.updateMetric(anyObject(), anyObject(), anyString()); | 90 | + mockControlPlaneMonitorService.updateMetric(anyObject(), anyInt(), anyString()); |
90 | expectLastCall().times(4); | 91 | expectLastCall().times(4); |
91 | replay(mockControlPlaneMonitorService); | 92 | replay(mockControlPlaneMonitorService); |
92 | basePostTest("disk-metrics-post.json", PREFIX + "/disk_metrics"); | 93 | basePostTest("disk-metrics-post.json", PREFIX + "/disk_metrics"); |
... | @@ -94,7 +95,7 @@ public class ControlMetricsCollectorResourceTest extends JerseyTest { | ... | @@ -94,7 +95,7 @@ public class ControlMetricsCollectorResourceTest extends JerseyTest { |
94 | 95 | ||
95 | @Test | 96 | @Test |
96 | public void testNetworkMetricsWithNullName() { | 97 | public void testNetworkMetricsWithNullName() { |
97 | - mockControlPlaneMonitorService.updateMetric(anyObject(), anyObject(), anyString()); | 98 | + mockControlPlaneMonitorService.updateMetric(anyObject(), anyInt(), anyString()); |
98 | expectLastCall().times(8); | 99 | expectLastCall().times(8); |
99 | replay(mockControlPlaneMonitorService); | 100 | replay(mockControlPlaneMonitorService); |
100 | basePostTest("network-metrics-post.json", PREFIX + "/network_metrics"); | 101 | basePostTest("network-metrics-post.json", PREFIX + "/network_metrics"); | ... | ... |
-
Please register or login to post a comment