On Thu, Aug 09, 2012 at 11:41:01AM -0700, Ben Pfaff wrote: > On Thu, Aug 09, 2012 at 05:49:54PM +0900, Simon Horman wrote: > > Signed-off-by: Simon Horman <[email protected]> > > I decided that it made sense to commit this after the patch to allow > encoding these messages. I support for hard_timeout and an ofp-print > test. Here is what I am going to apply:
Thanks, that looks good to me. Sorry for missing hard_timeout, I'm unsure how that slipped through without even a comment in the code about it. > > --8<--------------------------cut here-------------------------->8-- > > From: Simon Horman <[email protected]> > Date: Thu, 9 Aug 2012 17:49:54 +0900 > Subject: [PATCH] Allow decoding of Open Flow 1.1 & 1.2 Flow Removed Messages > > Signed-off-by: Simon Horman <[email protected]> > [[email protected] added support for hard_timeout, plus a test] > Signed-off-by: Ben Pfaff <[email protected]> > --- > lib/ofp-util.c | 23 ++++++++++++++++++++++- > tests/ofp-print.at | 13 ++++++++++++- > 2 files changed, 34 insertions(+), 2 deletions(-) > > diff --git a/lib/ofp-util.c b/lib/ofp-util.c > index a8030ff..edcc163 100644 > --- a/lib/ofp-util.c > +++ b/lib/ofp-util.c > @@ -1825,7 +1825,28 @@ ofputil_decode_flow_removed(struct > ofputil_flow_removed *fr, > > ofpbuf_use_const(&b, oh, ntohs(oh->length)); > raw = ofpraw_pull_assert(&b); > - if (raw == OFPRAW_OFPT10_FLOW_REMOVED) { > + if (raw == OFPRAW_OFPT11_FLOW_REMOVED) { > + const struct ofp12_flow_removed *ofr; > + enum ofperr error; > + > + ofr = ofpbuf_pull(&b, sizeof *ofr); > + > + error = ofputil_pull_ofp11_match(&b, ntohs(ofr->priority), > + &fr->rule, NULL); > + if (error) { > + return error; > + } > + > + fr->cookie = ofr->cookie; > + fr->reason = ofr->reason; > + /* XXX: ofr->table_id is ignored */ > + fr->duration_sec = ntohl(ofr->duration_sec); > + fr->duration_nsec = ntohl(ofr->duration_nsec); > + fr->idle_timeout = ntohs(ofr->idle_timeout); > + fr->hard_timeout = ntohs(ofr->hard_timeout); > + fr->packet_count = ntohll(ofr->packet_count); > + fr->byte_count = ntohll(ofr->byte_count); > + } else if (raw == OFPRAW_OFPT10_FLOW_REMOVED) { > const struct ofp_flow_removed *ofr; > > ofr = ofpbuf_pull(&b, sizeof *ofr); > diff --git a/tests/ofp-print.at b/tests/ofp-print.at > index 842869c..a0bd643 100644 > --- a/tests/ofp-print.at > +++ b/tests/ofp-print.at > @@ -355,7 +355,7 @@ priority:0,tunnel:0,metadata:0,in_port:0000,tci(0) > mac(00:23:20:83:c1:5f->ff:ff: > ]) > AT_CLEANUP > > -AT_SETUP([OFPT_FLOW_REMOVED]) > +AT_SETUP([OFPT_FLOW_REMOVED - OF1.0]) > AT_KEYWORDS([ofp-print]) > AT_CHECK([ovs-ofctl ofp-print "\ > 01 0b 00 58 00 00 00 00 00 00 00 00 00 03 50 54 \ > @@ -369,6 +369,17 @@ OFPT_FLOW_REMOVED (xid=0x0): > priority=65535,arp,in_port=3,vlan_tci=0x0000,dl_src > ]) > AT_CLEANUP > > +AT_SETUP([OFPT_FLOW_REMOVED - OF1.2]) > +AT_KEYWORDS([ofp-print]) > +AT_CHECK([ovs-ofctl ofp-print "\ > +03 0b 00 40 00 00 00 00 fe dc ba 98 76 54 32 10 \ > +80 00 01 05 00 00 00 01 00 98 96 80 00 3c 00 78 \ > +00 00 00 00 00 12 d6 87 00 00 00 00 6f 68 ba 66 \ > +00 01 00 0a 80 00 0c 02 00 09 00 00 00 00 00 00"], [0], [dnl > +OFPT_FLOW_REMOVED (OF1.2) (xid=0x0): dl_vlan=9 reason=hard > cookie:0xfedcba9876543210 duration1.01s idle60 hard120 pkts1234567 > bytes1869134438 > +]) > +AT_CLEANUP > + > AT_SETUP([OFPT_PORT_STATUS - OF1.0]) > AT_KEYWORDS([ofp-print]) > AT_CHECK([ovs-ofctl ofp-print "\ > -- > 1.7.2.5 > _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
