[ovs-dev] [PATCH ovn 1/2] ovn-nbctl: Add lport-get-up command.

Ben Pfaff blp at nicira.com
Mon Apr 6 21:15:03 UTC 2015


On Mon, Apr 06, 2015 at 11:27:05AM -0400, Russell Bryant wrote:
> Add a command to get the 'up' state of a logical port.
> 
> Signed-off-by: Russell Bryant <rbryant at redhat.com>

Thanks!

For this kind of thing I prefer clear names over Booleans so I folded
in the following change and applied to ovn:

diff --git a/ovn/ovn-nbctl.c b/ovn/ovn-nbctl.c
index f689ec4..3178105 100644
--- a/ovn/ovn-nbctl.c
+++ b/ovn/ovn-nbctl.c
@@ -67,7 +67,7 @@ Logical Port Commands:\n\
                             Set MAC addresses for the logical port. Specify\n\
                             more than one using additional arguments.\n\
   lport-get-macs <lport>    Get a list of MAC addresses on the port.\n\
-  lport-get-up <lport>      Get the 'up' state of the port.\n\
+  lport-get-up <lport>      Get state of the port ('up' or 'down').\n\
 \n\
 Options:\n\
   --db=DATABASE             connect to DATABASE\n\
@@ -422,7 +422,7 @@ do_lport_get_up(struct ovs_cmdl_context *ctx)
         return;
     }
 
-    printf("%s\n", (lport->up && *lport->up) ? "true" : "false");
+    printf("%s\n", (lport->up && *lport->up) ? "up" : "down");
 }
 
 static void



More information about the dev mailing list