commit | d1e42f4dd8b249414c3c7c2af624148c72c3ffa7 | [log] [tgz] |
---|---|---|
author | Yuta HIGUCHI <y-higuchi@ak.jp.nec.com> | Tue Jan 24 20:04:10 2017 -0800 |
committer | Andrea Campanella <andrea@onlab.us> | Wed Jan 25 17:10:52 2017 +0000 |
tree | 66e3f0aed86ea87ee9699a04b40e06cb356c8cea | |
parent | b0720e7dd3d2d9a34b59f1f0b7b3a5027621c9f9 [diff] |
Sort alarm count by severity Change-Id: Ic805fa7ecd055ca431b2abde5715b3fe6865acff
diff --git a/apps/faultmanagement/fmcli/src/main/java/org/onosproject/faultmanagement/alarms/cli/GetAllAlarmsCounts.java b/apps/faultmanagement/fmcli/src/main/java/org/onosproject/faultmanagement/alarms/cli/GetAllAlarmsCounts.java index a5413dc..9b95d70 100644 --- a/apps/faultmanagement/fmcli/src/main/java/org/onosproject/faultmanagement/alarms/cli/GetAllAlarmsCounts.java +++ b/apps/faultmanagement/fmcli/src/main/java/org/onosproject/faultmanagement/alarms/cli/GetAllAlarmsCounts.java
@@ -15,6 +15,8 @@ */ package org.onosproject.faultmanagement.alarms.cli; +import static java.util.Comparator.comparingInt; + import org.apache.karaf.shell.commands.Argument; import org.apache.karaf.shell.commands.Command; import org.apache.karaf.shell.commands.Option; @@ -66,9 +68,10 @@ } void printCounts(Map<Alarm.SeverityLevel, Long> alarmCounts) { - alarmCounts.entrySet().forEach((countEntry) -> { + alarmCounts.entrySet().stream() + .sorted(comparingInt(e -> e.getKey().ordinal())) + .forEach((countEntry) -> { print(String.format("%s, %d", countEntry.getKey(), countEntry.getValue())); - }); } }