secchan: Display mgmt and datapath id in status messages
authorJustin Pettit <jpettit@nicira.com>
Tue, 7 Jul 2009 16:34:37 +0000 (09:34 -0700)
committerJustin Pettit <jpettit@nicira.com>
Tue, 7 Jul 2009 16:34:37 +0000 (09:34 -0700)
Since it's not always easy to determine the management id, this adds the
ability to see it (and the datapath id) with the "ovs-ofctl status"
command.

Feature #1533

secchan/ofproto.c
secchan/ofproto.h
secchan/status.c

index aa9e44a..e6c3841 100644 (file)
@@ -635,6 +635,12 @@ ofproto_get_datapath_id(const struct ofproto *ofproto)
     return ofproto->datapath_id;
 }
 
+uint64_t
+ofproto_get_mgmt_id(const struct ofproto *ofproto)
+{
+    return ofproto->mgmt_id;
+}
+
 int
 ofproto_get_probe_interval(const struct ofproto *ofproto)
 {
index 44fc023..f4c1b40 100644 (file)
@@ -72,6 +72,7 @@ int ofproto_set_remote_execution(struct ofproto *, const char *command_acl,
 
 /* Configuration querying. */
 uint64_t ofproto_get_datapath_id(const struct ofproto *);
+uint64_t ofproto_get_mgmt_id(const struct ofproto *);
 int ofproto_get_probe_interval(const struct ofproto *);
 int ofproto_get_max_backoff(const struct ofproto *);
 bool ofproto_get_in_band(const struct ofproto *);
index c7598f3..8bbfd18 100644 (file)
@@ -19,6 +19,7 @@
 #include <arpa/inet.h>
 #include <assert.h>
 #include <errno.h>
+#include <inttypes.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include "dynamic-string.h"
@@ -118,10 +119,21 @@ static void
 config_status_cb(struct status_reply *sr, void *ofproto_)
 {
     const struct ofproto *ofproto = ofproto_;
+    uint64_t datapath_id, mgmt_id;
     struct svec listeners;
     int probe_interval, max_backoff;
     size_t i;
 
+    datapath_id = ofproto_get_datapath_id(ofproto);
+    if (datapath_id) {
+        status_reply_put(sr, "datapath-id=%"PRIx64, datapath_id);
+    }
+
+    mgmt_id = ofproto_get_mgmt_id(ofproto);
+    if (mgmt_id) {
+        status_reply_put(sr, "mgmt-id=%"PRIx64, mgmt_id);
+    }
+
     svec_init(&listeners);
     ofproto_get_listeners(ofproto, &listeners);
     for (i = 0; i < listeners.n; i++) {