2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-01 06:45:17 +00:00

ofp-actions: Add support for OpenFlow 1.2 "set-field" action.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com extracted this code from a larger patch by above, so:]
Signed-off-by: Ben Pfaff <blp@nicira.com>
[regarding final version of patch:]
Reviewed-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
Isaku Yamahata
2012-09-24 13:11:11 -07:00
committed by Ben Pfaff
parent 3ddcaf2d7d
commit d55b18c8fa
2 changed files with 66 additions and 2 deletions

View File

@@ -719,8 +719,8 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out)
break;
case OFPUTIL_OFPAT12_SET_FIELD:
/* Not yet implemented. */
break;
return nxm_reg_load_from_openflow12_set_field(
(const struct ofp12_action_set_field *)a, out);
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def"

View File

@@ -517,6 +517,70 @@ OFPT_FLOW_MOD (OF1.2) (xid=0x2): ADD table:255 priority=65535,arp,in_port=1,vlan
])
AT_CLEANUP
AT_SETUP([OFPT_FLOW_MOD - OF1.2 - set-field ip_src])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' ofp-print "\
03 0e 00 58 52 33 45 02 00 00 00 00 00 00 00 00 \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff \
ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
00 01 00 0a 80 00 0a 02 08 00 00 00 00 00 00 00 \
00 04 00 18 00 00 00 00 00 19 00 10 80 00 16 04 \
c0 a8 03 5c 00 00 00 00 \
" 2], [0], [dnl
OFPT_FLOW_MOD (OF1.2) (xid=0x52334502): ADD priority=255,ip actions=set_field:192.168.3.92->ip_src
], [dnl
])
AT_CLEANUP
AT_SETUP([OFPT_FLOW_MOD - OF1.2 - set-field ip_dst])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' ofp-print "\
03 0e 00 58 52 33 45 07 00 00 00 00 00 00 00 00 \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff \
ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
00 01 00 0a 80 00 0a 02 08 00 00 00 00 00 00 00 \
00 04 00 18 00 00 00 00 00 19 00 10 80 00 18 04 \
c0 a8 4a 7a 00 00 00 00 \
" 2], [0], [dnl
OFPT_FLOW_MOD (OF1.2) (xid=0x52334507): ADD priority=255,ip actions=set_field:192.168.74.122->ip_dst
], [dnl
])
AT_CLEANUP
AT_SETUP([OFPT_FLOW reply - OF1.2 - set-field ip_src])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' ofp-print "\
03 13 00 68 52 33 45 04 00 01 00 00 00 00 00 00 \
00 58 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
00 01 00 0a 80 00 0a 02 08 00 00 00 00 00 00 00 \
00 04 00 18 00 00 00 00 00 19 00 10 80 00 16 04 \
c0 a8 03 5c 00 00 00 00 \
" 2], [0], [dnl
OFPST_FLOW reply (OF1.2) (xid=0x52334504):
cookie=0x0, duration=0s, table=0, n_packets=0, n_bytes=0, priority=255,ip actions=set_field:192.168.3.92->ip_src
], [dnl
])
AT_CLEANUP
AT_SETUP([OFPT_FLOW reply - OF1.2 - set-field ip_dst])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' ofp-print "\
03 13 00 68 52 33 45 09 00 01 00 00 00 00 00 00 \
00 58 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
00 01 00 0a 80 00 0a 02 08 00 00 00 00 00 00 00 \
00 04 00 18 00 00 00 00 00 19 00 10 80 00 18 04 \
c0 a8 4a 7a 00 00 00 00 \
" 2], [0], [dnl
OFPST_FLOW reply (OF1.2) (xid=0x52334509):
cookie=0x0, duration=0s, table=0, n_packets=0, n_bytes=0, priority=255,ip actions=set_field:192.168.74.122->ip_dst
], [dnl
])
AT_CLEANUP
AT_SETUP([OFPT_PORT_MOD - OF1.0])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\