packet_data_generator2: Generate OF1.5 GroupMod packets

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Yusuke Iwase 2015-08-03 14:25:42 +09:00 committed by FUJITA Tomonori
parent 64df2437ee
commit fcff174771

View File

@ -17,6 +17,7 @@
*/
#include <lib/learn.h>
#include <lib/list.h>
#include <lib/ofpbuf.h>
#include <lib/ofp-actions.h>
#include <lib/ofp-msgs.h>
@ -207,6 +208,40 @@ flow_mod_conjunction(enum ofputil_protocol proto)
return ofputil_encode_flow_mod(&fm, proto);
}
struct ofpbuf *
group_mod(enum ofputil_protocol proto)
{
struct ofputil_group_mod gm;
struct ofpbuf acts;
struct ofpact_ipv4 *a_set_field;
struct ofpact_goto_table *a_goto;
struct ofputil_bucket bckt;
memset(&gm, 0, sizeof(gm));
gm.command = OFPGC15_INSERT_BUCKET;
gm.type = OFPGT11_SELECT;
gm.group_id = 0xaaaaaaaa;
gm.command_bucket_id = 0xbbbbbbbb;
ofpbuf_init(&acts, 0x18);
ofpact_put_STRIP_VLAN(&acts);
a_set_field = ofpact_put_SET_IPV4_DST(&acts);
a_set_field->ipv4 = inet_addr("192.168.2.9");
bckt.weight = 0xcccc;
bckt.watch_port = 0xdddd;
bckt.watch_group = 0xeeeeeeee;
bckt.bucket_id = 0x12345678;
bckt.ofpacts = acts.data;
bckt.ofpacts_len = acts.size;
list_init(&(gm.buckets));
list_push_back(&(gm.buckets), &(bckt.list_node));
return ofputil_encode_group_mod(
ofputil_protocol_to_ofp_version(proto), &gm);
}
struct ofpbuf *
bundle_ctrl(enum ofputil_protocol proto)
{
@ -271,6 +306,8 @@ const struct message messages[] = {
((const struct protocol_version *[]){&p13, &p15, NULL})),
M(flow_mod_conjunction,
((const struct protocol_version *[]){&p13, &p15, NULL})),
M(group_mod,
((const struct protocol_version *[]){&p15, NULL})),
M(bundle_ctrl,
((const struct protocol_version *[]){&p15, NULL})),
M(bundle_add,