Signed-off-by: Simon Horman <ho...@verge.net.au> --- v2 * Use OFPRAW_OFPST14_FLOW_MONITOR_REPLY rather than OFPRAW_NXST_FLOW_MONITOR_REPLY as a key to differentiate NX and OF messages. This is consistent with the approach taken for Flow Monitor Requests and allows the code to be used for EXT-186 flow monitor replies without further modification. --- lib/ofp-print.c | 26 +++++++++++++++++++++----- tests/ofp-print.at | 27 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/lib/ofp-print.c b/lib/ofp-print.c index 3d3fa0b..15f1fbd 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -2277,12 +2277,14 @@ ofp_print_flow_monitor_request(struct ds *string, const struct ofp_header *oh) } static void -ofp_print_nxst_flow_monitor_reply(struct ds *string, - const struct ofp_header *oh) +ofp_print_flow_monitor_reply(struct ds *string, const struct ofp_header *oh) { uint64_t ofpacts_stub[1024 / 8]; struct ofpbuf ofpacts; struct ofpbuf b; + enum ofpraw raw; + + ofpraw_decode(&raw, oh); ofpbuf_use_const(&b, oh, ntohs(oh->length)); ofpbuf_use_stub(&ofpacts, ofpacts_stub, sizeof ofpacts_stub); @@ -2304,12 +2306,21 @@ ofp_print_nxst_flow_monitor_reply(struct ds *string, ds_put_cstr(string, "\n event="); switch (update.event) { + case OFPFME14_INITIAL: + ds_put_cstr(string, "INITIAL"); + break; + case OFPFME14_ADDED: ds_put_cstr(string, "ADDED"); break; case OFPFME14_REMOVED: - ds_put_format(string, "DELETED reason=%s", + if (raw == OFPRAW_OFPST14_FLOW_MONITOR_REPLY) { + ds_put_cstr(string, "REMOVED"); + } else { + ds_put_cstr(string, "DELETED"); + } + ds_put_format(string, " reason=%s", ofp_flow_removed_reason_to_string(update.reason, reasonbuf, sizeof reasonbuf)); @@ -2323,9 +2334,14 @@ ofp_print_nxst_flow_monitor_reply(struct ds *string, ds_put_format(string, "ABBREV xid=0x%"PRIx32, ntohl(update.xid)); continue; - case OFPFME14_INITIAL: case OFPFME14_PAUSED: + ds_put_cstr(string, "PAUSED"); + continue; + case OFPFME14_RESUMED: + ds_put_cstr(string, "RESUMED"); + continue; + default: OVS_NOT_REACHED(); } @@ -3087,7 +3103,7 @@ ofp_to_string__(const struct ofp_header *oh, enum ofpraw raw, break; case OFPTYPE_FLOW_MONITOR_STATS_REPLY: - ofp_print_nxst_flow_monitor_reply(string, msg); + ofp_print_flow_monitor_reply(string, msg); break; case OFPTYPE_BUNDLE_CONTROL: diff --git a/tests/ofp-print.at b/tests/ofp-print.at index 15efd73..a9bd822 100644 --- a/tests/ofp-print.at +++ b/tests/ofp-print.at @@ -1987,6 +1987,33 @@ OFPST_FLOW_MONITOR request (OF1.4) (xid=0x2): ]) AT_CLEANUP +AT_SETUP([OFPST_FLOW_MONITOR reply - OF1.4]) +AT_KEYWORDS([ofp-print OFPT_STATS_REPLY]) +AT_CHECK([ovs-ofctl ofp-print "\ +05 13 00 b8 00 00 00 02 00 10 00 00 00 00 00 00 \ +00 08 00 04 00 00 00 01 \ +00 30 00 01 01 00 00 05 00 10 00 00 00 00 00 00 \ +12 34 56 78 9a bc de f0 00 01 00 0a 80 00 0c 02 \ +10 09 00 00 00 00 00 00 00 01 00 08 01 00 00 00 \ +00 30 00 02 01 04 00 05 00 10 00 00 00 00 00 00 \ +12 34 56 78 9a bc de f0 00 01 00 0a 80 00 0c 02 \ +10 09 00 00 00 00 00 00 00 01 00 08 01 00 00 00 \ +00 30 00 03 01 00 00 05 00 10 00 00 00 00 00 00 \ +12 34 56 78 9a bc de f0 00 01 00 0a 80 00 0c 02 \ +10 09 00 00 00 00 00 00 00 01 00 08 01 00 00 00 \ +00 08 00 05 00 00 00 00 \ +00 08 00 06 00 00 00 00 \ +"], [0], [dnl +OFPST_FLOW_MONITOR reply (OF1.4) (xid=0x2): + event=ABBREV xid=0x1 + event=ADDED table=1 idle_timeout=5 hard_timeout=16 cookie=0x123456789abcdef0 dl_vlan=9 actions=goto_table:1 + event=REMOVED reason=meter_delete table=1 idle_timeout=5 hard_timeout=16 cookie=0x123456789abcdef0 dl_vlan=9 actions=goto_table:1 + event=MODIFIED table=1 idle_timeout=5 hard_timeout=16 cookie=0x123456789abcdef0 dl_vlan=9 actions=goto_table:1 + event=PAUSED + event=RESUMED +]) +AT_CLEANUP + AT_SETUP([OFPST_PORT_DESC reply - OF1.4]) AT_KEYWORDS([ofp-print OFPT_STATS_REPLY]) AT_CHECK([ovs-ofctl ofp-print "\ -- 2.0.0.rc2 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev