EXT-350 Signed-off-by: Simon Horman <simon.hor...@netronome.com> --- lib/ofp-print.c | 39 ++++++++++++++++++++++++++++++++++++--- tests/ofproto.at | 2 +- 2 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/lib/ofp-print.c b/lib/ofp-print.c index d27d8a7..68f5740 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -2104,8 +2104,40 @@ ofp_header_to_string__(const struct ofp_header *oh, enum ofpraw raw, } static void +ofp_print_bucket_id(struct ds *s, uint32_t bucket_id, + enum ofp_version ofp_version) +{ + switch (ofp_version) { + case OFP10_VERSION: + case OFP11_VERSION: + case OFP12_VERSION: + case OFP13_VERSION: + case OFP14_VERSION: + return; + + case OFP15_VERSION: + break; + + default: + OVS_NOT_REACHED(); + } + + ds_put_cstr(s, "bucket_id:"); + + if (bucket_id >= OFPG15_BUCKET_FIRST) { + static const char *id_str[] = { "first", "last", "all" }; + + ds_put_cstr(s, id_str[bucket_id - OFPG15_BUCKET_FIRST]); + } else { + ds_put_format(s, "%"PRIu32, bucket_id); + } + + ds_put_char(s, ','); +} + +static void ofp_print_group(struct ds *s, uint32_t group_id, uint8_t type, - struct list *p_buckets) + struct list *p_buckets, enum ofp_version ofp_version) { static const char *type_str[] = { "all", "select", "indirect", "ff", "unknown" }; @@ -2120,6 +2152,7 @@ ofp_print_group(struct ds *s, uint32_t group_id, uint8_t type, LIST_FOR_EACH (bucket, list_node, p_buckets) { ds_put_cstr(s, ",bucket="); + ofp_print_bucket_id(s, bucket->bucket_id, ofp_version); if (bucket->weight != 1) { ds_put_format(s, "weight:%"PRIu16",", bucket->weight); } @@ -2164,7 +2197,7 @@ ofp_print_group_desc(struct ds *s, const struct ofp_header *oh) ds_put_char(s, '\n'); ds_put_char(s, ' '); - ofp_print_group(s, gd.group_id, gd.type, &gd.buckets); + ofp_print_group(s, gd.group_id, gd.type, &gd.buckets, oh->version); ofputil_bucket_list_destroy(&gd.buckets); } } @@ -2301,7 +2334,7 @@ ofp_print_group_mod(struct ds *s, const struct ofp_header *oh) } ds_put_char(s, ' '); - ofp_print_group(s, gm.group_id, gm.type, &gm.buckets); + ofp_print_group(s, gm.group_id, gm.type, &gm.buckets, oh->version); ofputil_bucket_list_destroy(&gm.buckets); } diff --git a/tests/ofproto.at b/tests/ofproto.at index def0783..d5998a8 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -274,7 +274,7 @@ AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn add-groups br0 groups.txt]) AT_CHECK([ovs-ofctl -F OXM-OpenFlow15 -O OpenFlow15 -vwarn dump-groups br0 1234], [0], [stdout]) AT_CHECK([STRIP_XIDS stdout], [0], [dnl OFPST_GROUP_DESC reply (OF1.5): - group_id=1234,type=all,bucket=actions=output:10 + group_id=1234,type=all,bucket=bucket_id:0,actions=output:10 ]) AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn del-groups br0 group_id=1234]) AT_CHECK([ovs-ofctl -O OpenFlow11 -vwarn dump-groups br0], [0], [stdout]) -- 2.1.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev