summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-07-13 16:50:33 -0700
committerBen Pfaff <blp@ovn.org>2016-07-14 09:15:29 -0700
commit4b684612d9009c20ace820d48ba772fa00975d87 (patch)
treec84d72ace28075a1fe08cabb7024721ed4f92601 /tests
parent0f2aaee939fb9d10c6d985687edb20c8847f9143 (diff)
downloadopenvswitch-4b684612d9009c20ace820d48ba772fa00975d87.tar.gz
ofp-actions: Translate mod_nw_ecn action to OF1.1 properly.
Also, translate OF1.2+ "set_field" on OXM_OF_IP_ECN properly to OF1.1 "mod_nw_ecn". Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ofp-actions.at40
-rw-r--r--tests/ovs-ofctl.at4
2 files changed, 42 insertions, 2 deletions
diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at
index a3b4ccf87..b17789354 100644
--- a/tests/ofp-actions.at
+++ b/tests/ofp-actions.at
@@ -329,6 +329,9 @@ AT_DATA([test-data], [dnl
# actions=mod_nw_tos:48
0007 0008 30 000000
+# actions=mod_nw_ecn:2
+0008 0008 02 000000
+
# actions=mod_tp_src:80
0009 0008 0050 0000
@@ -768,3 +771,40 @@ OFPST_FLOW reply (OF1.3):
])
OVS_VSWITCHD_STOP
AT_CLEANUP
+
+AT_SETUP([mod_nw_ecn action translation])
+AT_KEYWORDS([ofp-actions])
+OVS_VSWITCHD_START
+
+dnl OpenFlow 1.1, but no other version, has a "mod_nw_ecn" action.
+dnl Check that we translate it properly for OF1.0 and OF1.2.
+dnl (OF1.3+ should be the same as OF1.2.)
+AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'ip,actions=mod_nw_ecn:2'])
+AT_CHECK([ovs-ofctl -O OpenFlow10 dump-flows br0 | ofctl_strip], [0], [dnl
+NXST_FLOW reply:
+ ip actions=load:0x2->NXM_NX_IP_ECN[[]]
+])
+AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
+OFPST_FLOW reply (OF1.1):
+ ip actions=mod_nw_ecn:2
+])
+AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
+OFPST_FLOW reply (OF1.2):
+ ip actions=set_field:2->nw_ecn
+])
+
+dnl Check that OF1.2+ set_field to set ECN is translated into the OF1.1
+dnl mod_nw_ecn action.
+dnl
+dnl We don't do anything equivalent for OF1.0 reg_load because we prefer
+dnl that anything that comes in as reg_load gets translated back to reg_load
+dnl on output. Perhaps this is somewhat inconsistent but it's what OVS
+dnl has done for multiple versions.
+AT_CHECK([ovs-ofctl del-flows br0])
+AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip,actions=set_field:2->ip_ecn'])
+AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
+OFPST_FLOW reply (OF1.1):
+ ip actions=mod_nw_ecn:2
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index e3d3e7a58..23effd6c2 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -184,7 +184,7 @@ tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
-ip,actions=set_field:10.4.3.77->ip_src
+ip,actions=set_field:10.4.3.77->ip_src,mod_nw_ecn:2
sctp actions=drop
sctp actions=drop
in_port=0 actions=resubmit:0
@@ -215,7 +215,7 @@ OFPT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:
OFPT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
OFPT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
OFPT_FLOW_MOD: ADD actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
-OFPT_FLOW_MOD: ADD ip actions=mod_nw_src:10.4.3.77
+OFPT_FLOW_MOD: ADD ip actions=mod_nw_src:10.4.3.77,load:0x2->NXM_NX_IP_ECN[]
OFPT_FLOW_MOD: ADD sctp actions=drop
OFPT_FLOW_MOD: ADD sctp actions=drop
OFPT_FLOW_MOD: ADD in_port=0 actions=resubmit:0