[ovs-dev] [appctl 3/7] lacp: Add "lacp/list" command to ovs-appctl.

Justin Pettit jpettit at nicira.com
Thu Sep 29 22:34:39 UTC 2011


---
 NEWS                       |    1 +
 lib/lacp.c                 |   18 ++++++++++++++++++
 vswitchd/ovs-vswitchd.8.in |    2 ++
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index 99380cf..f23e7c7 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Post-v1.2.0
     - ovs-appctl:
       - New "version" command to determine version of running daemon
       - New "cfm/list" command to print interfaces configured with CFM
+      - New "lacp/list" command to print ports configured with LACP
     - ovs-vswitchd:
       - The software switch now supports 255 OpenFlow tables, instead
         of just one.  By default, only table 0 is consulted, but the
diff --git a/lib/lacp.c b/lib/lacp.c
index a565419..fba9c16 100644
--- a/lib/lacp.c
+++ b/lib/lacp.c
@@ -135,6 +135,8 @@ static bool slave_may_tx(const struct slave *);
 static struct slave *slave_lookup(const struct lacp *, const void *slave);
 static bool info_tx_equal(struct lacp_info *, struct lacp_info *);
 
+static void lacp_unixctl_list(struct unixctl_conn *, const char *args,
+                              void *aux);
 static void lacp_unixctl_show(struct unixctl_conn *, const char *args,
                               void *aux);
 
@@ -187,6 +189,7 @@ parse_lacp_packet(const struct ofpbuf *b)
 void
 lacp_init(void)
 {
+    unixctl_command_register("lacp/list", "port", lacp_unixctl_list, NULL);
     unixctl_command_register("lacp/show", "port", lacp_unixctl_show, NULL);
 }
 
@@ -706,6 +709,20 @@ info_tx_equal(struct lacp_info *a, struct lacp_info *b)
         && eth_addr_equals(a->sys_id, b->sys_id);
 }
 
+static void
+lacp_unixctl_list(struct unixctl_conn *conn,
+                  const char *args OVS_UNUSED, void *aux OVS_UNUSED)
+{
+    struct ds ds = DS_EMPTY_INITIALIZER;
+    struct lacp *lacp;
+
+    LIST_FOR_EACH (lacp, node, &all_lacps) {
+        ds_put_format(&ds, "%s\n", lacp->name);
+    }
+    unixctl_command_reply(conn, 200, ds_cstr(&ds));
+    ds_destroy(&ds);
+}
+
 static struct lacp *
 lacp_find(const char *name)
 {
@@ -862,3 +879,4 @@ lacp_unixctl_show(struct unixctl_conn *conn,
     unixctl_command_reply(conn, 200, ds_cstr(&ds));
     ds_destroy(&ds);
 }
+
diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
index 829c115..446812e 100644
--- a/vswitchd/ovs-vswitchd.8.in
+++ b/vswitchd/ovs-vswitchd.8.in
@@ -183,6 +183,8 @@ status of \fIslave\fR changes.
 Returns the hash value which would be used for \fImac\fR with \fIvlan\fR
 and \fIbasis\fR if specified.
 .
+.IP "\fBlacp/list\fR"
+Lists ports configured with LACP.
 .IP "\fBlacp/show\fR \fIport\fR"
 Lists all of the LACP related information about the given \fIport\fR:
 active or passive, aggregation key, system id, and system priority.  Also
-- 
1.7.1




More information about the dev mailing list