mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-09 14:26:10 +02:00
packet_data_generator2: Add flow_mod
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
3e48d82c62
commit
afb153f175
@ -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),
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user