Added CLI support for showing key/value annotations for devices, ports, links & hosts.
diff --git a/cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java b/cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
index f2c280e..3be8e5c 100644
--- a/cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
+++ b/cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
@@ -43,7 +43,7 @@
description = "Lists all ports or all ports of a device")
public class DevicePortsListCommand extends DevicesListCommand {
- private static final String FMT = " port=%s, state=%s";
+ private static final String FMT = " port=%s, state=%s%s";
@Option(name = "-e", aliases = "--enabled", description = "Show only enabled ports",
required = false, multiValued = false)
@@ -112,7 +112,8 @@
if (isIncluded(port)) {
ports.add(mapper.createObjectNode()
.put("port", port.number().toString())
- .put("isEnabled", port.isEnabled()));
+ .put("isEnabled", port.isEnabled())
+ .set("annotations", annotations(mapper, port.annotations())));
}
}
return result.put("device", device.id().toString()).set("ports", ports);
@@ -131,7 +132,8 @@
Collections.sort(ports, Comparators.PORT_COMPARATOR);
for (Port port : ports) {
if (isIncluded(port)) {
- print(FMT, port.number(), port.isEnabled() ? "enabled" : "disabled");
+ print(FMT, port.number(), port.isEnabled() ? "enabled" : "disabled",
+ annotations(port.annotations()));
}
}
}