ofp-print: Make flow statistics and actions slightly easier to read.
authorBen Pfaff <blp@nicira.com>
Tue, 10 Mar 2009 22:15:06 +0000 (15:15 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 10 Mar 2009 22:15:06 +0000 (15:15 -0700)
lib/ofp-print.c

index 00d95260ef9b397729c41bf445b2e73715baa27a..1883049d5998571f0e6e56f9623097290c5b89e6 100644 (file)
@@ -417,6 +417,9 @@ ofp_print_actions(struct ds *string, const struct ofp_action_header *action,
     int len = 0;
 
     ds_put_cstr(string, "actions=");
+    if (!actions_len) {
+        ds_put_cstr(string, "drop");
+    }
     while (actions_len > 0) {
         if (len) {
             ds_put_cstr(string, ",");
@@ -989,10 +992,14 @@ ofp_flow_stats_reply(struct ds *string, const void *body_, size_t len,
         ds_put_format(string, "n_packets=%"PRIu64", ",
                     ntohll(fs->packet_count));
         ds_put_format(string, "n_bytes=%"PRIu64", ", ntohll(fs->byte_count));
-        ds_put_format(string, "idle_timeout=%"PRIu16",",
-                      ntohs(fs->idle_timeout));
-        ds_put_format(string, "hard_timeout=%"PRIu16",",
-                      ntohs(fs->hard_timeout));
+        if (fs->idle_timeout != htons(OFP_FLOW_PERMANENT)) {
+            ds_put_format(string, "idle_timeout=%"PRIu16",",
+                          ntohs(fs->idle_timeout));
+        }
+        if (fs->hard_timeout != htons(OFP_FLOW_PERMANENT)) {
+            ds_put_format(string, "hard_timeout=%"PRIu16",",
+                          ntohs(fs->hard_timeout));
+        }
         ofp_print_match(string, &fs->match, verbosity);
         ofp_print_actions(string, fs->actions, length - sizeof *fs);
         ds_put_char(string, '\n');