[ovs-dev] [PATCH 2/9] ofp-print: Improve formatting of queue stat requests and port_mods.

Ben Pfaff blp at ovn.org
Tue Dec 29 21:09:30 UTC 2015


Without this, OFPST_QUEUE requests are formatted as:
    OFPST_QUEUE request:port=LOCAL queue=5
With this commit, OFPST_QUEUE requests are formatted as:
    OFPST_QUEUE request: port=LOCAL queue=5
which looks better.

Similarly for OFPT_PORT_MOD.

Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 lib/ofp-print.c    |  4 ++--
 tests/ofp-print.at | 20 ++++++++++----------
 tests/ofproto.at   | 12 ++++++------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 930b01a..778323f 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -920,7 +920,7 @@ ofp_print_port_mod(struct ds *string, const struct ofp_header *oh)
         return;
     }
 
-    ds_put_cstr(string, "port: ");
+    ds_put_cstr(string, " port: ");
     ofputil_format_port(pm.port_no, string);
     ds_put_format(string, ": addr:"ETH_ADDR_FMT"\n",
                   ETH_ADDR_ARGS(pm.hw_addr));
@@ -1700,7 +1700,7 @@ ofp_print_ofpst_queue_request(struct ds *string, const struct ofp_header *oh)
         return;
     }
 
-    ds_put_cstr(string, "port=");
+    ds_put_cstr(string, " port=");
     ofputil_format_port(oqsr.port_no, string);
 
     ds_put_cstr(string, " queue=");
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index ed9ffdb..6fae7f0 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -1037,7 +1037,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 01 0f 00 20 00 00 00 03 00 03 50 54 00 00 00 01 \
 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 \
 " 3], [0], [dnl
-OFPT_PORT_MOD (xid=0x3):port: 3: addr:50:54:00:00:00:01
+OFPT_PORT_MOD (xid=0x3): port: 3: addr:50:54:00:00:00:01
      config: PORT_DOWN
      mask:   PORT_DOWN
      advertise: UNCHANGED
@@ -1051,7 +1051,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 50 54 00 00 00 01 00 00 00 00 00 01 00 00 00 01 \
 00 00 00 00 00 00 00 00 \
 " 3], [0], [dnl
-OFPT_PORT_MOD (OF1.1) (xid=0x3):port: 3: addr:50:54:00:00:00:01
+OFPT_PORT_MOD (OF1.1) (xid=0x3): port: 3: addr:50:54:00:00:00:01
      config: PORT_DOWN
      mask:   PORT_DOWN
      advertise: UNCHANGED
@@ -1065,7 +1065,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 50 54 00 00 00 01 00 00 00 00 00 01 00 00 00 01 \
 00 00 00 00 00 00 00 00 \
 " 3], [0], [dnl
-OFPT_PORT_MOD (OF1.2) (xid=0x3):port: 3: addr:50:54:00:00:00:01
+OFPT_PORT_MOD (OF1.2) (xid=0x3): port: 3: addr:50:54:00:00:00:01
      config: PORT_DOWN
      mask:   PORT_DOWN
      advertise: UNCHANGED
@@ -1079,7 +1079,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 50 54 00 00 00 01 00 00 00 00 00 01 00 00 00 01 \
 00 00 00 00 00 00 00 00 \
 " 3], [0], [dnl
-OFPT_PORT_MOD (OF1.3) (xid=0x3):port: 3: addr:50:54:00:00:00:01
+OFPT_PORT_MOD (OF1.3) (xid=0x3): port: 3: addr:50:54:00:00:00:01
      config: PORT_DOWN
      mask:   PORT_DOWN
      advertise: UNCHANGED
@@ -1093,7 +1093,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 50 54 00 00 00 01 00 00 00 00 00 01 00 00 00 01 \
 00 00 00 08 00 00 00 01
 " 3], [0], [dnl
-OFPT_PORT_MOD (OF1.4) (xid=0x3):port: 3: addr:50:54:00:00:00:01
+OFPT_PORT_MOD (OF1.4) (xid=0x3): port: 3: addr:50:54:00:00:00:01
      config: PORT_DOWN
      mask:   PORT_DOWN
      advertise: 10MB-HD
@@ -1755,7 +1755,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 01 10 00 14 00 00 00 01 00 05 00 00 ff fc 00 00 \
 ff ff ff ff \
 "], [0], [dnl
-OFPST_QUEUE request (xid=0x1):port=ANY queue=ALL
+OFPST_QUEUE request (xid=0x1): port=ANY queue=ALL
 ])
 AT_CLEANUP
 
@@ -1765,7 +1765,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 02 12 00 18 00 00 00 02 00 05 00 00 00 00 00 00 \
 ff ff ff ff ff ff ff ff \
 "], [0], [dnl
-OFPST_QUEUE request (OF1.1) (xid=0x2):port=ANY queue=ALL
+OFPST_QUEUE request (OF1.1) (xid=0x2): port=ANY queue=ALL
 ])
 AT_CLEANUP
 
@@ -1775,7 +1775,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 03 12 00 18 00 00 00 02 00 05 00 00 00 00 00 00 \
 ff ff ff ff ff ff ff ff \
 "], [0], [dnl
-OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=ALL
+OFPST_QUEUE request (OF1.2) (xid=0x2): port=ANY queue=ALL
 ])
 AT_CLEANUP
 
@@ -1785,7 +1785,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 04 12 00 18 00 00 00 02 00 05 00 00 00 00 00 00 \
 ff ff ff ff ff ff ff ff \
 "], [0], [dnl
-OFPST_QUEUE request (OF1.3) (xid=0x2):port=ANY queue=ALL
+OFPST_QUEUE request (OF1.3) (xid=0x2): port=ANY queue=ALL
 ])
 AT_CLEANUP
 
@@ -3383,7 +3383,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 "], [0], [dnl
 OFPT_BUNDLE_ADD_MESSAGE (OF1.4) (xid=0x3):
  bundle_id=0x1 flags=atomic
-OFPT_PORT_MOD (OF1.4) (xid=0x3):port: 3: addr:50:54:00:00:00:01
+OFPT_PORT_MOD (OF1.4) (xid=0x3): port: 3: addr:50:54:00:00:00:01
      config: PORT_DOWN
      mask:   PORT_DOWN
      advertise: 10MB-HD
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 52e1ab4..7ab8254 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -188,11 +188,11 @@ OFPST_QUEUE reply: 0 queues
 ])
 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 ANY 5], [0],
   [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_QUEUE
-OFPST_QUEUE request (xid=0x2):port=ANY queue=5
+OFPST_QUEUE request (xid=0x2): port=ANY queue=5
 ])
 AT_CHECK([ovs-ofctl -vwarn queue-stats br0 10], [0],
   [OFPT_ERROR (xid=0x2): OFPQOFC_BAD_PORT
-OFPST_QUEUE request (xid=0x2):port=10 queue=ALL
+OFPST_QUEUE request (xid=0x2): port=10 queue=ALL
 ])
 OVS_VSWITCHD_STOP
 AT_CLEANUP
@@ -205,11 +205,11 @@ OFPST_QUEUE reply (OF1.2): 0 queues
 ])
 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 ALL 5], [0],
   [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_QUEUE
-OFPST_QUEUE request (OF1.2) (xid=0x2):port=ANY queue=5
+OFPST_QUEUE request (OF1.2) (xid=0x2): port=ANY queue=5
 ])
 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn queue-stats br0 10], [0],
   [OFPT_ERROR (OF1.2) (xid=0x2): OFPQOFC_BAD_PORT
-OFPST_QUEUE request (OF1.2) (xid=0x2):port=10 queue=ALL
+OFPST_QUEUE request (OF1.2) (xid=0x2): port=10 queue=ALL
 ])
 OVS_VSWITCHD_STOP
 AT_CLEANUP
@@ -222,11 +222,11 @@ OFPST_QUEUE reply (OF1.4): 0 queues
 ])
 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 ALL 5], [0],
   [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_QUEUE
-OFPST_QUEUE request (OF1.4) (xid=0x2):port=ANY queue=5
+OFPST_QUEUE request (OF1.4) (xid=0x2): port=ANY queue=5
 ])
 AT_CHECK([ovs-ofctl -O OpenFlow14 -vwarn queue-stats br0 10], [0],
   [OFPT_ERROR (OF1.4) (xid=0x2): OFPQOFC_BAD_PORT
-OFPST_QUEUE request (OF1.4) (xid=0x2):port=10 queue=ALL
+OFPST_QUEUE request (OF1.4) (xid=0x2): port=10 queue=ALL
 ])
 OVS_VSWITCHD_STOP
 AT_CLEANUP
-- 
2.1.3




More information about the dev mailing list