diff options
author | YAMAMOTO Takashi <yamamoto@valinux.co.jp> | 2015-05-15 11:03:40 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-05-19 15:39:28 +0900 |
commit | dfcb5cd920d2aee45eae763c17fa8e207c70d740 (patch) | |
tree | 751e1ff1b3f22d360c0f9dc7437c766065a10fd7 | |
parent | af5d973c2e1e2d92b8debe5bad571d4074cd5100 (diff) |
packet_generator2: learn action
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/tests/packet_data_generator2/gen.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ryu/tests/packet_data_generator2/gen.c b/ryu/tests/packet_data_generator2/gen.c index 05371bf7..5319501d 100644 --- a/ryu/tests/packet_data_generator2/gen.c +++ b/ryu/tests/packet_data_generator2/gen.c @@ -16,12 +16,14 @@ * limitations under the License. */ +#include <lib/learn.h> #include <lib/ofpbuf.h> #include <lib/ofp-actions.h> #include <lib/ofp-msgs.h> #include <lib/ofp-util.h> #include <lib/packets.h> +#include <assert.h> #include <err.h> #include <stdio.h> @@ -108,6 +110,22 @@ flow_mod(enum ofputil_protocol proto) struct ofpbuf acts; struct ofpact_ipv4 *a_set_field; struct ofpact_goto_table *a_goto; + char *error; + + /* + * Taken from neutron OVS-agent, + * modified for OF>=1.3. (NXM -> OXM) + * NOTE(yamamoto): This needs to be writable. learn_parse() modifies it. + */ + char learn_args[] = + "table=99," + "priority=1," + "hard_timeout=300," + "OXM_OF_VLAN_VID[0..11]," + "OXM_OF_ETH_DST[]=OXM_OF_ETH_SRC[]," + "load:0->OXM_OF_VLAN_VID[]," + "load:OXM_OF_TUNNEL_ID[]->OXM_OF_TUNNEL_ID[]," + "output:OXM_OF_IN_PORT[]"; memset(&fm, 0, sizeof(fm)); fm.command = OFPFC_ADD; @@ -122,6 +140,8 @@ flow_mod(enum ofputil_protocol proto) ofpact_put_STRIP_VLAN(&acts); a_set_field = ofpact_put_SET_IPV4_DST(&acts); a_set_field->ipv4 = inet_addr("192.168.2.9"); + error = learn_parse(learn_args, &acts); + assert(error == NULL); a_goto = ofpact_put_GOTO_TABLE(&acts); a_goto->table_id = 100; |