summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-02-22 16:24:19 -0800
committerBen Pfaff <blp@nicira.com>2011-02-23 09:42:32 -0800
commit770f1f66bb9dc4e784e6c2c5351089c62b9a5919 (patch)
tree1644362c7317b82d350508e88bf9f21cd9ad91f7 /tests
parentc4894ed48f0c727a87fc64629623bd62aef1e95b (diff)
downloadopenvswitch-770f1f66bb9dc4e784e6c2c5351089c62b9a5919.tar.gz
multipath: Validate multipath actions more thoroughly in multipath_parse().
The stricter validation requires updates to the calls to test-multipath to supply a valid n_links value. test-multipath doesn't actually use that value (it runs over different values in an internal "for" loop), so this doesn't change any behavior. Also adds a test to exercise each possible multipath_parse() error message. Reported-by: Reid Price <reid@nicira.com> Bug #4462.
Diffstat (limited to 'tests')
-rw-r--r--tests/multipath.at45
1 files changed, 41 insertions, 4 deletions
diff --git a/tests/multipath.at b/tests/multipath.at
index a5a1a7be9..6eafa9a3f 100644
--- a/tests/multipath.at
+++ b/tests/multipath.at
@@ -8,7 +8,7 @@ AT_BANNER([multipath link selection])
# if the test does fail.
AT_SETUP([modulo_n multipath link selection])
-AT_CHECK([[test-multipath 'eth_src,50,modulo_n,0,0,NXM_NX_REG0[]']],
+AT_CHECK([[test-multipath 'eth_src,50,modulo_n,1,0,NXM_NX_REG0[]']],
[0], [ignore])
# 1 -> 2: disruption=0.50 (perfect=0.50); stddev/expected=0.0000
# 2 -> 3: disruption=0.66 (perfect=0.33); stddev/expected=0.0023
@@ -76,7 +76,7 @@ AT_CHECK([[test-multipath 'eth_src,50,modulo_n,0,0,NXM_NX_REG0[]']],
AT_CLEANUP
AT_SETUP([hash_threshold multipath link selection])
-AT_CHECK([[test-multipath 'eth_src,50,hash_threshold,0,0,NXM_NX_REG0[]']],
+AT_CHECK([[test-multipath 'eth_src,50,hash_threshold,1,0,NXM_NX_REG0[]']],
[0], [ignore])
# 1 -> 2: disruption=0.50 (perfect=0.50); stddev/expected=0.0000
# 2 -> 3: disruption=0.50 (perfect=0.33); stddev/expected=0.0056
@@ -144,7 +144,7 @@ AT_CHECK([[test-multipath 'eth_src,50,hash_threshold,0,0,NXM_NX_REG0[]']],
AT_CLEANUP
AT_SETUP([hrw multipath link selection])
-AT_CHECK([[test-multipath 'eth_src,50,hrw,0,0,NXM_NX_REG0[]']],
+AT_CHECK([[test-multipath 'eth_src,50,hrw,1,0,NXM_NX_REG0[]']],
[0], [ignore])
# 1 -> 2: disruption=0.50 (perfect=0.50); stddev/expected=0.0000
# 2 -> 3: disruption=0.33 (perfect=0.33); stddev/expected=0.0033
@@ -212,7 +212,7 @@ AT_CHECK([[test-multipath 'eth_src,50,hrw,0,0,NXM_NX_REG0[]']],
AT_CLEANUP
AT_SETUP([iter_hash multipath link selection])
-AT_CHECK([[test-multipath 'eth_src,50,iter_hash,0,0,NXM_NX_REG0[]']],
+AT_CHECK([[test-multipath 'eth_src,50,iter_hash,1,0,NXM_NX_REG0[]']],
[0], [ignore])
# 1 -> 2: disruption=0.50 (perfect=0.50); stddev/expected=0.0000
# 2 -> 3: disruption=0.42 (perfect=0.33); stddev/expected=0.0034
@@ -278,3 +278,40 @@ AT_CHECK([[test-multipath 'eth_src,50,iter_hash,0,0,NXM_NX_REG0[]']],
#62 -> 63: disruption=0.02 (perfect=0.02); stddev/expected=0.0292
#63 -> 64: disruption=0.02 (perfect=0.02); stddev/expected=0.0307
AT_CLEANUP
+
+AT_SETUP([multipath action missing argument])
+AT_CHECK([ovs-ofctl parse-flow actions=multipath], [1], [],
+ [ovs-ofctl: : not enough arguments to multipath action
+])
+AT_CLEANUP
+
+AT_SETUP([multipath action bad fields])
+AT_CHECK([ovs-ofctl parse-flow 'actions=multipath(xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]])'], [1], [],
+ [ovs-ofctl: xyzzy,50,modulo_n,1,0,NXM_NX_REG0[[]]: unknown fields `xyzzy'
+])
+AT_CLEANUP
+
+AT_SETUP([multipath action bad algorithm])
+AT_CHECK([ovs-ofctl parse-flow 'actions=multipath(eth_src,50,fubar,1,0,NXM_NX_REG0[[]])'], [1], [],
+ [ovs-ofctl: eth_src,50,fubar,1,0,NXM_NX_REG0[[]]: unknown algorithm `fubar'
+])
+AT_CLEANUP
+
+AT_SETUP([multipath action bad n_links])
+AT_CHECK([ovs-ofctl parse-flow 'actions=multipath(eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]])'], [1], [],
+ [ovs-ofctl: eth_src,50,modulo_n,0,0,NXM_NX_REG0[[]]: n_links 0 is not in valid range 1 to 65536
+])
+AT_CLEANUP
+
+AT_SETUP([multipath action bad destination])
+AT_CHECK([ovs-ofctl parse-flow 'actions=multipath(eth_src,50,modulo_n,1,0,NXM_OF_VLAN_TCI[[]])'], [1], [],
+ [ovs-ofctl: eth_src,50,modulo_n,1,0,NXM_OF_VLAN_TCI[[]]: destination field must be register
+])
+AT_CLEANUP
+
+AT_SETUP([multipath action destination too narrow])
+AT_CHECK([ovs-ofctl parse-flow 'actions=multipath(eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]])'], [1], [],
+ [ovs-ofctl: eth_src,50,modulo_n,1024,0,NXM_NX_REG0[[0..7]]: 8-bit destination field has 256 possible values, less than specified n_links 1024
+])
+AT_CLEANUP
+