2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-03 15:55:19 +00:00

ofp-print: Print bucket ids of OpenFlow 1.5 group messages.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <simon.horman@netronome.com>
[blp@nicira.com changed ofp_print_bucket_id()]
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Simon Horman
2014-11-11 12:39:20 +09:00
committed by Ben Pfaff
parent 18ac06d354
commit 1c4c05afa1
2 changed files with 33 additions and 4 deletions

View File

@@ -2109,9 +2109,37 @@ ofp_header_to_string__(const struct ofp_header *oh, enum ofpraw raw,
ofp_print_version(oh, string);
}
static void
ofp_print_bucket_id(struct ds *s, uint32_t bucket_id,
enum ofp_version ofp_version)
{
if (ofp_version < OFP15_VERSION) {
return;
}
ds_put_cstr(s, "bucket_id:");
switch (bucket_id) {
case OFPG15_BUCKET_FIRST:
ds_put_cstr(s, "first");
break;
case OFPG15_BUCKET_LAST:
ds_put_cstr(s, "last");
break;
case OFPG15_BUCKET_ALL:
ds_put_cstr(s, "all");
break;
default:
ds_put_format(s, "%"PRIu32, bucket_id);
break;
}
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" };
@@ -2126,6 +2154,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);
}
@@ -2170,7 +2199,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);
}
}
@@ -2307,7 +2336,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);
}

View File

@@ -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])