Skip to content

Commit

Permalink
ofp-print: Avoid trailing white space in OpenFlow dumps.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Russell Bryant <[email protected]>
  • Loading branch information
blp committed Oct 7, 2017
1 parent 327a39b commit f92ef1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions lib/ofp-print.c
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
16 changes: 8 additions & 8 deletions tests/ofp-print.at
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit f92ef1a

Please sign in to comment.