[ovs-dev] [PATCH RFC 05/52] ofp-print: Avoid trailing white space in OpenFlow dumps.

Ben Pfaff blp at ovn.org
Tue Sep 19 22:00:38 UTC 2017


ofp_to_string() sometimes yields a trailing space in its output.  This is
annoying for the test infrastructure, since we have to specially mark the
trailing white space in Autotest with a "@&t@" marker at the end of the
line.  This commit gets rid of the trailing white space and the annoying
"@&t@" markers.

Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 lib/ofp-print.c    |  1 +
 tests/ofp-print.at | 16 ++++++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index f77b31baf0b4..151d618b59e8 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -3791,6 +3791,7 @@ ofp_to_string(const void *oh_, size_t len,
         error = ofpraw_decode(&raw, oh);
         if (!error) {
             ofp_to_string__(oh, port_map, raw, &string, verbosity);
+            ds_chomp(&string, ' ');
             if (verbosity >= 5) {
                 if (ds_last(&string) != '\n') {
                     ds_put_char(&string, '\n');
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index a00e3f3fe74b..50083a34d556 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -1355,7 +1355,7 @@ ff fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
 00 00 00 00 ff 00 ff ff \
 "], [0], [dnl
-OFPST_FLOW request (xid=0x4): @&t@
+OFPST_FLOW request (xid=0x4):
 ])
 AT_CLEANUP
 
@@ -1367,7 +1367,7 @@ ff 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 \
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
 00 01 00 04 00 00 00 00 \
 "], [0], [dnl
-OFPST_FLOW request (OF1.2) (xid=0x2): @&t@
+OFPST_FLOW request (OF1.2) (xid=0x2):
 ])
 AT_CLEANUP
 
@@ -1379,7 +1379,7 @@ ff 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 \
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
 00 01 00 04 00 00 00 00 \
 "], [0], [dnl
-OFPST_FLOW request (OF1.3) (xid=0x2): @&t@
+OFPST_FLOW request (OF1.3) (xid=0x2):
 ])
 AT_CLEANUP
 
@@ -1470,7 +1470,7 @@ ff fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
 00 00 00 00 ff 00 ff ff \
 "], [0], [dnl
-OFPST_AGGREGATE request (xid=0x4): @&t@
+OFPST_AGGREGATE request (xid=0x4):
 ])
 AT_CLEANUP
 
@@ -1482,7 +1482,7 @@ ff 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 \
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
 00 01 00 04 00 00 00 00 \
 "], [0], [dnl
-OFPST_AGGREGATE request (OF1.2) (xid=0x2): @&t@
+OFPST_AGGREGATE request (OF1.2) (xid=0x2):
 ])
 AT_CLEANUP
 
@@ -1494,7 +1494,7 @@ ff 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 \
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
 00 01 00 04 00 00 00 00 \
 "], [0], [dnl
-OFPST_AGGREGATE request (OF1.3) (xid=0x2): @&t@
+OFPST_AGGREGATE request (OF1.3) (xid=0x2):
 ])
 AT_CLEANUP
 
@@ -3256,7 +3256,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 01 10 00 20 00 00 00 04 ff ff 00 00 00 00 23 20 \
 00 00 00 00 00 00 00 00 ff ff 00 00 ff 00 00 00 \
 "], [0], [dnl
-NXST_FLOW request (xid=0x4): @&t@
+NXST_FLOW request (xid=0x4):
 ])
 AT_CLEANUP
 
@@ -3420,7 +3420,7 @@ AT_CHECK([ovs-ofctl ofp-print "\
 01 10 00 20 00 00 00 04 ff ff 00 00 00 00 23 20 \
 00 00 00 01 00 00 00 00 ff ff 00 00 ff 00 00 00 \
 "], [0], [dnl
-NXST_AGGREGATE request (xid=0x4): @&t@
+NXST_AGGREGATE request (xid=0x4):
 ])
 AT_CLEANUP
 
-- 
2.10.2



More information about the dev mailing list