From afb153f175d15e0ded8ea688cf78f51eeb31138a Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 7 Apr 2015 15:44:37 +0900 Subject: [PATCH] packet_data_generator2: Add flow_mod Signed-off-by: YAMAMOTO Takashi Signed-off-by: FUJITA Tomonori --- ryu/tests/packet_data_generator2/gen.c | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ryu/tests/packet_data_generator2/gen.c b/ryu/tests/packet_data_generator2/gen.c index 449f23a7..e41aba00 100644 --- a/ryu/tests/packet_data_generator2/gen.c +++ b/ryu/tests/packet_data_generator2/gen.c @@ -77,6 +77,35 @@ packet_in(enum ofputil_protocol proto) return ofputil_encode_packet_in(&pin, proto, NXPIF_OPENFLOW10); } +struct ofpbuf * +flow_mod(enum ofputil_protocol proto) +{ + struct ofputil_flow_mod fm; + struct ofpbuf acts; + struct ofpact_ipv4 *a_set_field; + struct ofpact_goto_table *a_goto; + + memset(&fm, 0, sizeof(fm)); + fm.command = OFPFC_ADD; + fm.table_id = 2; + fm.new_cookie = htonll(0x123456789abcdef0); + fm.cookie_mask = OVS_BE64_MAX; + fm.importance = 0x9878; + + fill_match(&fm.match); + + ofpbuf_init(&acts, 64); + ofpact_put_STRIP_VLAN(&acts); + a_set_field = ofpact_put_SET_IPV4_DST(&acts); + a_set_field->ipv4 = inet_addr("192.168.2.9"); + a_goto = ofpact_put_GOTO_TABLE(&acts); + a_goto->table_id = 100; + + fm.ofpacts = acts.data; + fm.ofpacts_len = acts.size; + return ofputil_encode_flow_mod(&fm, proto); +} + struct ofpbuf * bundle_ctrl(enum ofputil_protocol proto) { @@ -116,6 +145,7 @@ struct message { const struct message messages[] = { M(packet_in), + M(flow_mod), M(bundle_ctrl), };