ofp-parse: Ignore extra fields produced by dump-flows.
authorBen Pfaff <blp@nicira.com>
Wed, 8 Jun 2011 20:35:00 +0000 (13:35 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 14 Jun 2011 18:21:52 +0000 (11:21 -0700)
It's reasonable to want to dump a flow table with "dump-flows" and then
later use that output as input to other commands that read flows, but until
now that hasn't been directly possible because "dump-flows" adds extra
fields that other commands reject on input.  This changes the flow parser
to just ignore those extra fields.

lib/ofp-parse.c
utilities/ovs-ofctl.8.in

index efcfab07eb9fba32fa1efdc05d890fd641f2aafe..a4679a3ac6d05ac252a61532b526ba67cb0b8575 100644 (file)
@@ -878,6 +878,12 @@ parse_ofp_str(struct flow_mod *fm, struct ofpbuf *actions, char *string)
                     ovs_fatal(0, "only %d registers supported", FLOW_N_REGS);
                 }
                 parse_reg_value(&fm->cr, reg_idx, value);
+            } else if (!strcmp(name, "duration")
+                       || !strcmp(name, "n_packets")
+                       || !strcmp(name, "n_bytes")) {
+                /* Ignore these, so that users can feed the output of
+                 * "ovs-ofctl dump-flows" back into commands that parse
+                 * flows. */
             } else {
                 ovs_fatal(0, "unknown keyword %s", name);
             }
index 4a914ca448695a30c907b017cdbea8d9450a9002..c4fbed90bd212f27fb011e1afb27ba2fb0541dd9 100644 (file)
@@ -548,6 +548,11 @@ Same as \fBdl_type=0x86dd,nw_proto=17\fR.
 Same as \fBdl_type=0x86dd,nw_proto=58\fR.
 .
 .PP
+Finally, field assignments to \fBduration\fR, \fBn_packets\fR, or
+\fBn_bytes\fR are ignored to allow output from the \fBdump\-flows\fR
+command to be used as input for other commands that parse flows.
+.
+.PP
 The \fBadd\-flow\fR and \fBadd\-flows\fR commands require an additional
 field, which must be the final field specified:
 .