ofp-print: Print OFPUTIL_NXT_ROLE_REQUEST and OFPUTIL_NXT_ROLE_REPLY.
authorBen Pfaff <blp@nicira.com>
Tue, 7 Dec 2010 22:36:18 +0000 (14:36 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 9 Dec 2010 18:27:08 +0000 (10:27 -0800)
lib/ofp-print.c

index 4f634bdf29f8edc16fdea8491ead924323972c0e..2a6528afd0348bb95365555abfdec6de836ec9c5 100644 (file)
@@ -1462,6 +1462,24 @@ ofp_print_nxt_tun_id_from_cookie(struct ds *string,
     ds_put_format(string, " set=%"PRIu8, ntic->set);
 }
 
+static void
+ofp_print_nxt_role_message(struct ds *string,
+                           const struct nx_role_request *nrr)
+{
+    unsigned int role = ntohl(nrr->role);
+
+    ds_put_cstr(string, " role=");
+    if (role == NX_ROLE_OTHER) {
+        ds_put_cstr(string, "other");
+    } else if (role == NX_ROLE_MASTER) {
+        ds_put_cstr(string, "master");
+    } else if (role == NX_ROLE_SLAVE) {
+        ds_put_cstr(string, "slave");
+    } else {
+        ds_put_format(string, "%u", role);
+    }
+}
+
 static void
 ofp_print_nxt_set_flow_format(struct ds *string,
                               const struct nxt_set_flow_format *nsff)
@@ -1621,7 +1639,7 @@ ofp_to_string__(const struct ofp_header *oh,
 
     case OFPUTIL_NXT_ROLE_REQUEST:
     case OFPUTIL_NXT_ROLE_REPLY:
-        /* XXX */
+        ofp_print_nxt_role_message(string, msg);
         break;
 
     case OFPUTIL_NXT_SET_FLOW_FORMAT: