From 3e461c2c0e5b807fe234b4723969014baf2ce0b8 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 24 Dec 2015 15:29:26 -0800 Subject: [PATCH 1/1] ofp-print: Improve formatting of queue stat requests and port_mods. 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 Acked-by: Jarno Rajahalme --- 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 5525aee4e..af56e9bf3 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -934,7 +934,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)); @@ -1714,7 +1714,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 ed9ffdb15..6fae7f0ca 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 787def1c4..eceff58f4 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.20.1