commit | 58ea8f24d4074f5d210ff80cf32fbf89efeaccfe | [log] [tgz] |
---|---|---|
author | Jonathan Hart <jono@onlab.us> | Mon May 08 15:09:31 2017 -0700 |
committer | Yuta HIGUCHI <y-higuchi@onlab.us> | Tue May 09 20:56:33 2017 +0000 |
tree | 80a51532f625039aea9d51bf1ff99b8f434ab8c5 | |
parent | c7a60ce6b4d13923e7e0f6f7fb4896b78e9e32f3 [diff] |
Sort routes for a prefix by next hop address. This prevents the CLI output being ordered differently for different invocations. Change-Id: I182b3c79c466b4e30f0b951666f59db9fdf89aee
diff --git a/cli/src/main/java/org/onosproject/cli/net/RoutesListCommand.java b/cli/src/main/java/org/onosproject/cli/net/RoutesListCommand.java index 31b7555..b24ee5d 100644 --- a/cli/src/main/java/org/onosproject/cli/net/RoutesListCommand.java +++ b/cli/src/main/java/org/onosproject/cli/net/RoutesListCommand.java
@@ -81,7 +81,8 @@ } private void print(String format, RouteInfo routeInfo) { - routeInfo.allRoutes() + routeInfo.allRoutes().stream() + .sorted(Comparator.comparing(r -> r.nextHop())) .forEach(r -> print(format, isBestRoute(routeInfo.bestRoute(), r) ? ">" : "", r.prefix(), r.nextHop(), r.route().source())); }