ovn-nbctl: Update show format for addresses.
authorRussell Bryant <russell@ovn.org>
Thu, 14 Jan 2016 16:00:52 +0000 (11:00 -0500)
committerRussell Bryant <russell@ovn.org>
Thu, 21 Jan 2016 14:06:47 +0000 (09:06 -0500)
This patch updates the formatting for the Logical_Port addresses column
in the show command output.  Previously, output would look like:

  addresses: 00:00:00:00:00:01 192.168.1.1 00:00:00:00:00:01 192.168.1.2

Now it looks like:

  addresses: ["00:00:00:00:00:01 192.168.1.1", "00:00:00:00:00:01 192.168.1.2"]

The grouping of addresses is important, so it should be reflected in the
output.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
ovn/utilities/ovn-nbctl.c

index 8ac1cd0..8c3b3c8 100644 (file)
@@ -407,11 +407,13 @@ print_lswitch(const struct nbrec_logical_switch *lswitch, struct ds *s)
             ds_put_format(s, "            tag: %"PRIu64"\n", lport->tag[0]);
         }
         if (lport->n_addresses) {
-            ds_put_cstr(s, "            addresses:");
+            ds_put_cstr(s, "            addresses: [");
             for (size_t j = 0; j < lport->n_addresses; j++) {
-                ds_put_format(s, " %s", lport->addresses[j]);
+                ds_put_format(s, "%s\"%s\"",
+                        j == 0 ? "" : ", ",
+                        lport->addresses[j]);
             }
-            ds_put_char(s, '\n');
+            ds_put_cstr(s, "]\n");
         }
     }
 }