[ovs-dev] [PATCH 27/47] ofp-util: Allow decoding of Open Flow 1.2 Flow Statistics Request Messages
Simon Horman
horms at verge.net.au
Wed Aug 1 07:02:10 UTC 2012
Allow decoding of Open Flow 1.1 and 1.2 flow and aggregate flow statistics
request messages.
Signed-off-by: Simon Horman <horms at verge.net.au>
---
v9
* No change
v8
* Manual rebase
* Add ofp-print test
v7
* Omitted
v6
* No change
v5
* Manual rebase
v4
* Use OFPG11_ANY in place of OFPG_ANY.
The value is the same, but it seems to make sense to
use the Open Flow 1.1 constant when working with Open Flow 1.1.
* Do not handle Open Flow 1.1, the parsing is slightly different
and not supplied by this patch.
* Use sizeof(struct ofp11_flow_stats_request) as the minimum size of the
message, previously sizeof(struct ofp10_flow_stats_request) was
incorrectly used.
* Indicate that the message may be larger than the minimum size.
* Handle OFPUTIL_OFPST11_FLOW_REQUEST and OFPUTIL_OFPST11_AGGREGATE_REQUEST in
ofputil_decode_flow_stats_request().
* Add entry for Open Flow 1.2 aggregate request to ofputil_msg_types[]
v3
* Initial post
Fix parsing of FlowMod instructions
Conflicts:
lib/ofp-util.c
Signed-off-by: Simon Horman <horms at verge.net.au>
---
lib/ofp-util.c | 22 ++++++++++++++++++++++
tests/ofp-print.at | 14 +++++++++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index e3d3ca4..c7640d2 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1428,6 +1428,7 @@ ofputil_decode_ofpst_flow_request(struct ofputil_flow_stats_request *fsr,
{
enum ofperr error;
enum ofpraw raw;
+ const struct ofp_header *oh = msg->data;
error = (msg->l2
? ofpraw_decode(&raw, msg->l2)
@@ -1440,6 +1441,26 @@ ofputil_decode_ofpst_flow_request(struct ofputil_flow_stats_request *fsr,
if (!msg->size) {
return EOF;
+ } else if (raw == OFPRAW_OFPST11_FLOW_REQUEST) {
+ const struct ofp11_flow_stats_request *ofsr;
+ enum ofperr error;
+
+ ofsr = ofpbuf_pull(msg, sizeof *ofsr);
+ fsr->table_id = ofsr->table_id;
+ error = ofputil_port_from_ofp11(ofsr->out_port, &fsr->out_port);
+ if (error) {
+ return error;
+ }
+ if (ofsr->out_group != htonl(OFPG11_ANY)) {
+ return OFPERR_NXFMFC_GROUPS_NOT_SUPPORTED;
+ }
+ fsr->cookie = ofsr->cookie;
+ fsr->cookie_mask = ofsr->cookie_mask;
+ error = ofputil_pull_ofp11_match__(msg, 0, &fsr->match, NULL,
+ oh->version);
+ if (error) {
+ return error;
+ }
} else if (raw == OFPRAW_OFPST10_FLOW_REQUEST ||
raw == OFPRAW_OFPST_AGGREGATE_REQUEST) {
const struct ofp10_flow_stats_request *ofsr = msg->data;
@@ -1493,6 +1514,7 @@ ofputil_decode_flow_stats_request(struct ofputil_flow_stats_request *fsr,
raw = ofpraw_pull_assert(&b);
switch ((int) raw) {
case OFPRAW_OFPST10_FLOW_REQUEST:
+ case OFPRAW_OFPST11_FLOW_REQUEST:
return ofputil_decode_ofpst_flow_request(fsr, &b, false);
case OFPRAW_OFPST_AGGREGATE_REQUEST:
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index 827d4f3..910d146 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -634,7 +634,7 @@ DP Description: None
])
AT_CLEANUP
-AT_SETUP([OFPST_FLOW request])
+AT_SETUP([OFPST_FLOW request - OF1.0])
AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST])
AT_CHECK([ovs-ofctl ofp-print "\
01 10 00 38 00 00 00 04 00 01 00 00 00 38 20 ff \
@@ -646,6 +646,18 @@ OFPST_FLOW request (xid=0x4): @&t@
])
AT_CLEANUP
+AT_SETUP([OFPST_FLOW request - OF1.2])
+AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST])
+AT_CHECK([ovs-ofctl ofp-print "\
+03 12 00 38 00 00 00 02 00 01 00 00 00 00 00 00 \
+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@
+])
+AT_CLEANUP
+
AT_SETUP([OFPST_FLOW reply])
AT_KEYWORDS([ofp-print OFPT_STATS_REPLY])
AT_CHECK([ovs-ofctl ofp-print "\
--
1.7.10.2.484.gcd07cc5
More information about the dev
mailing list