[Blackbird] ONOS-1317 - JSON outpout for 'intents -p' command
Change-Id: I7722709347a5b24e83de57de8bb6124d06a58a21
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java
index ae6f189..89877dd 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java
@@ -76,12 +76,16 @@
}
return;
} else if (pending) {
- service.getPending().forEach(intent ->
- print("id=%s, key=%s, type=%s, appId=%s",
- intent.id(), intent.key(),
- intent.getClass().getSimpleName(),
- intent.appId().name())
- );
+ if (outputJson()) {
+ print("%s", json(service, service.getPending()));
+ } else {
+ service.getPending().forEach(intent ->
+ print("id=%s, key=%s, type=%s, appId=%s",
+ intent.id(), intent.key(),
+ intent.getClass().getSimpleName(),
+ intent.appId().name())
+ );
+ }
return;
}