tests: Add bundle action test with buffer realloc.
[cascardo/ovs.git] / tests / bundle.at
1 AT_BANNER([bundle link selection])
2
3 # The test-bundle program prints a lot of output on stdout, but each of the
4 # tests below ignores it because it will vary a bit depending on endianness and
5 # floating point precision.  test-bundle will output an error message on
6 # stderr and return with exit code 1 if anything really goes wrong.  In each
7 # case, we list the (approximate) expected output in a comment to aid debugging
8 # if the test does fail.
9
10 AT_SETUP([hrw bundle link selection])
11 AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:1,2,3,4,5']],
12   [0], [ignore])
13 # 100000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
14 # 110000: disruption=0.50 (perfect=0.50) 0.50 0.50 0.00 0.00 0.00 0.00
15 # 010000: disruption=0.50 (perfect=0.50) 0.00 1.00 0.00 0.00 0.00 0.00
16 # 011000: disruption=0.50 (perfect=0.50) 0.00 0.50 0.50 0.00 0.00 0.00
17 # 111000: disruption=0.33 (perfect=0.33) 0.33 0.33 0.34 0.00 0.00 0.00
18 # 101000: disruption=0.33 (perfect=0.33) 0.50 0.00 0.50 0.00 0.00 0.00
19 # 001000: disruption=0.50 (perfect=0.50) 0.00 0.00 1.00 0.00 0.00 0.00
20 # 001100: disruption=0.50 (perfect=0.50) 0.00 0.00 0.50 0.50 0.00 0.00
21 # 101100: disruption=0.33 (perfect=0.33) 0.33 0.00 0.34 0.33 0.00 0.00
22 # 111100: disruption=0.25 (perfect=0.25) 0.25 0.25 0.25 0.25 0.00 0.00
23 # 011100: disruption=0.25 (perfect=0.25) 0.00 0.33 0.33 0.33 0.00 0.00
24 # 010100: disruption=0.33 (perfect=0.33) 0.00 0.50 0.00 0.50 0.00 0.00
25 # 110100: disruption=0.33 (perfect=0.33) 0.33 0.33 0.00 0.34 0.00 0.00
26 # 100100: disruption=0.33 (perfect=0.33) 0.50 0.00 0.00 0.50 0.00 0.00
27 # 000100: disruption=0.50 (perfect=0.50) 0.00 0.00 0.00 1.00 0.00 0.00
28 # 000110: disruption=0.50 (perfect=0.50) 0.00 0.00 0.00 0.50 0.50 0.00
29 # 100110: disruption=0.33 (perfect=0.33) 0.33 0.00 0.00 0.33 0.33 0.00
30 # 110110: disruption=0.25 (perfect=0.25) 0.25 0.25 0.00 0.25 0.25 0.00
31 # 010110: disruption=0.25 (perfect=0.25) 0.00 0.34 0.00 0.33 0.33 0.00
32 # 011110: disruption=0.25 (perfect=0.25) 0.00 0.25 0.25 0.25 0.25 0.00
33 # 111110: disruption=0.20 (perfect=0.20) 0.20 0.20 0.20 0.20 0.20 0.00
34 # 101110: disruption=0.20 (perfect=0.20) 0.25 0.00 0.25 0.25 0.25 0.00
35 # 001110: disruption=0.25 (perfect=0.25) 0.00 0.00 0.34 0.33 0.33 0.00
36 # 001010: disruption=0.33 (perfect=0.33) 0.00 0.00 0.50 0.00 0.50 0.00
37 # 101010: disruption=0.33 (perfect=0.33) 0.33 0.00 0.34 0.00 0.33 0.00
38 # 111010: disruption=0.25 (perfect=0.25) 0.25 0.25 0.25 0.00 0.25 0.00
39 # 011010: disruption=0.25 (perfect=0.25) 0.00 0.33 0.34 0.00 0.33 0.00
40 # 010010: disruption=0.34 (perfect=0.33) 0.00 0.50 0.00 0.00 0.50 0.00
41 # 110010: disruption=0.33 (perfect=0.33) 0.33 0.33 0.00 0.00 0.33 0.00
42 # 100010: disruption=0.33 (perfect=0.33) 0.50 0.00 0.00 0.00 0.50 0.00
43 # 000010: disruption=0.50 (perfect=0.50) 0.00 0.00 0.00 0.00 1.00 0.00
44 # 000011: disruption=0.50 (perfect=0.50) 0.00 0.00 0.00 0.00 0.50 0.50
45 # 100011: disruption=0.33 (perfect=0.33) 0.33 0.00 0.00 0.00 0.33 0.33
46 # 110011: disruption=0.25 (perfect=0.25) 0.25 0.25 0.00 0.00 0.25 0.25
47 # 010011: disruption=0.25 (perfect=0.25) 0.00 0.33 0.00 0.00 0.33 0.33
48 # 011011: disruption=0.25 (perfect=0.25) 0.00 0.25 0.25 0.00 0.25 0.25
49 # 111011: disruption=0.20 (perfect=0.20) 0.20 0.20 0.20 0.00 0.20 0.20
50 # 101011: disruption=0.20 (perfect=0.20) 0.25 0.00 0.25 0.00 0.25 0.25
51 # 001011: disruption=0.25 (perfect=0.25) 0.00 0.00 0.34 0.00 0.33 0.33
52 # 001111: disruption=0.25 (perfect=0.25) 0.00 0.00 0.25 0.25 0.25 0.25
53 # 101111: disruption=0.20 (perfect=0.20) 0.20 0.00 0.20 0.20 0.20 0.20
54 # 111111: disruption=0.17 (perfect=0.17) 0.17 0.17 0.17 0.17 0.17 0.17
55 # 011111: disruption=0.17 (perfect=0.17) 0.00 0.20 0.20 0.20 0.20 0.20
56 # 010111: disruption=0.20 (perfect=0.20) 0.00 0.25 0.00 0.25 0.25 0.25
57 # 110111: disruption=0.20 (perfect=0.20) 0.20 0.20 0.00 0.20 0.20 0.20
58 # 100111: disruption=0.20 (perfect=0.20) 0.25 0.00 0.00 0.25 0.25 0.25
59 # 000111: disruption=0.25 (perfect=0.25) 0.00 0.00 0.00 0.33 0.33 0.33
60 # 000101: disruption=0.33 (perfect=0.33) 0.00 0.00 0.00 0.50 0.00 0.50
61 # 100101: disruption=0.33 (perfect=0.33) 0.33 0.00 0.00 0.33 0.00 0.33
62 # 110101: disruption=0.25 (perfect=0.25) 0.25 0.25 0.00 0.25 0.00 0.25
63 # 010101: disruption=0.25 (perfect=0.25) 0.00 0.33 0.00 0.33 0.00 0.33
64 # 011101: disruption=0.25 (perfect=0.25) 0.00 0.25 0.25 0.25 0.00 0.25
65 # 111101: disruption=0.20 (perfect=0.20) 0.20 0.20 0.20 0.20 0.00 0.20
66 # 101101: disruption=0.20 (perfect=0.20) 0.25 0.00 0.25 0.25 0.00 0.25
67 # 001101: disruption=0.25 (perfect=0.25) 0.00 0.00 0.33 0.33 0.00 0.33
68 # 001001: disruption=0.33 (perfect=0.33) 0.00 0.00 0.50 0.00 0.00 0.50
69 # 101001: disruption=0.33 (perfect=0.33) 0.33 0.00 0.33 0.00 0.00 0.33
70 # 111001: disruption=0.25 (perfect=0.25) 0.25 0.25 0.25 0.00 0.00 0.25
71 # 011001: disruption=0.25 (perfect=0.25) 0.00 0.33 0.34 0.00 0.00 0.33
72 # 010001: disruption=0.34 (perfect=0.33) 0.00 0.50 0.00 0.00 0.00 0.50
73 # 110001: disruption=0.33 (perfect=0.33) 0.33 0.33 0.00 0.00 0.00 0.34
74 # 100001: disruption=0.33 (perfect=0.33) 0.50 0.00 0.00 0.00 0.00 0.50
75 # 000001: disruption=0.50 (perfect=0.50) 0.00 0.00 0.00 0.00 0.00 1.00
76 # 000000: disruption=1.00 (perfect=1.00) 0.00 0.00 0.00 0.00 0.00 0.00
77 # 100000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
78 AT_CLEANUP
79
80 AT_SETUP([active_backup bundle link selection])
81 AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,active_backup,ofport,NXM_NX_REG0[],slaves:1,2,3,4,5,6']],
82   [0],
83 [100000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
84 110000: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
85 010000: disruption=1.00 (perfect=1.00) 0.00 1.00 0.00 0.00 0.00 0.00
86 011000: disruption=0.00 (perfect=0.00) 0.00 1.00 0.00 0.00 0.00 0.00
87 111000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
88 101000: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
89 001000: disruption=1.00 (perfect=1.00) 0.00 0.00 1.00 0.00 0.00 0.00
90 001100: disruption=0.00 (perfect=0.00) 0.00 0.00 1.00 0.00 0.00 0.00
91 101100: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
92 111100: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
93 011100: disruption=1.00 (perfect=1.00) 0.00 1.00 0.00 0.00 0.00 0.00
94 010100: disruption=0.00 (perfect=0.00) 0.00 1.00 0.00 0.00 0.00 0.00
95 110100: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
96 100100: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
97 000100: disruption=1.00 (perfect=1.00) 0.00 0.00 0.00 1.00 0.00 0.00
98 000110: disruption=0.00 (perfect=0.00) 0.00 0.00 0.00 1.00 0.00 0.00
99 100110: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
100 110110: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
101 010110: disruption=1.00 (perfect=1.00) 0.00 1.00 0.00 0.00 0.00 0.00
102 011110: disruption=0.00 (perfect=0.00) 0.00 1.00 0.00 0.00 0.00 0.00
103 111110: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
104 101110: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
105 001110: disruption=1.00 (perfect=1.00) 0.00 0.00 1.00 0.00 0.00 0.00
106 001010: disruption=0.00 (perfect=0.00) 0.00 0.00 1.00 0.00 0.00 0.00
107 101010: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
108 111010: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
109 011010: disruption=1.00 (perfect=1.00) 0.00 1.00 0.00 0.00 0.00 0.00
110 010010: disruption=0.00 (perfect=0.00) 0.00 1.00 0.00 0.00 0.00 0.00
111 110010: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
112 100010: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
113 000010: disruption=1.00 (perfect=1.00) 0.00 0.00 0.00 0.00 1.00 0.00
114 000011: disruption=0.00 (perfect=0.00) 0.00 0.00 0.00 0.00 1.00 0.00
115 100011: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
116 110011: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
117 010011: disruption=1.00 (perfect=1.00) 0.00 1.00 0.00 0.00 0.00 0.00
118 011011: disruption=0.00 (perfect=0.00) 0.00 1.00 0.00 0.00 0.00 0.00
119 111011: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
120 101011: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
121 001011: disruption=1.00 (perfect=1.00) 0.00 0.00 1.00 0.00 0.00 0.00
122 001111: disruption=0.00 (perfect=0.00) 0.00 0.00 1.00 0.00 0.00 0.00
123 101111: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
124 111111: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
125 011111: disruption=1.00 (perfect=1.00) 0.00 1.00 0.00 0.00 0.00 0.00
126 010111: disruption=0.00 (perfect=0.00) 0.00 1.00 0.00 0.00 0.00 0.00
127 110111: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
128 100111: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
129 000111: disruption=1.00 (perfect=1.00) 0.00 0.00 0.00 1.00 0.00 0.00
130 000101: disruption=0.00 (perfect=0.00) 0.00 0.00 0.00 1.00 0.00 0.00
131 100101: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
132 110101: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
133 010101: disruption=1.00 (perfect=1.00) 0.00 1.00 0.00 0.00 0.00 0.00
134 011101: disruption=0.00 (perfect=0.00) 0.00 1.00 0.00 0.00 0.00 0.00
135 111101: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
136 101101: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
137 001101: disruption=1.00 (perfect=1.00) 0.00 0.00 1.00 0.00 0.00 0.00
138 001001: disruption=0.00 (perfect=0.00) 0.00 0.00 1.00 0.00 0.00 0.00
139 101001: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
140 111001: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
141 011001: disruption=1.00 (perfect=1.00) 0.00 1.00 0.00 0.00 0.00 0.00
142 010001: disruption=0.00 (perfect=0.00) 0.00 1.00 0.00 0.00 0.00 0.00
143 110001: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
144 100001: disruption=0.00 (perfect=0.00) 1.00 0.00 0.00 0.00 0.00 0.00
145 000001: disruption=1.00 (perfect=1.00) 0.00 0.00 0.00 0.00 0.00 1.00
146 000000: disruption=1.00 (perfect=1.00) 0.00 0.00 0.00 0.00 0.00 0.00
147 100000: disruption=1.00 (perfect=1.00) 1.00 0.00 0.00 0.00 0.00 0.00
148 ])
149 AT_CLEANUP
150
151 AT_SETUP([hrw bundle single link selection])
152 AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:1']],
153   [0], [ignore])
154 # 1: disruption=1.00 (perfect=1.00) 1.00
155 # 0: disruption=1.00 (perfect=1.00) 0.00
156 # 1: disruption=1.00 (perfect=1.00) 1.00
157 AT_CLEANUP
158
159 AT_SETUP([hrw bundle no link selection])
160 AT_CHECK([[ovstest test-bundle 'symmetric_l4,60,hrw,ofport,NXM_NX_REG0[],slaves:']],
161   [0], [ignore])
162 AT_CLEANUP
163 #: disruption=0.00 (perfect=0.00)
164 #: disruption=0.00 (perfect=0.00)
165
166 AT_SETUP([bundle action missing argument])
167 AT_CHECK([ovs-ofctl parse-flow actions=bundle], [1], [],
168   [ovs-ofctl: : not enough arguments to bundle action
169 ])
170 AT_CLEANUP
171
172 AT_SETUP([bundle action bad fields])
173 AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(xyzzy,60,hrw,ofport,slaves:1,2))'], [1], [],
174   [ovs-ofctl: xyzzy,60,hrw,ofport,slaves:1,2: unknown fields `xyzzy'
175 ])
176 AT_CLEANUP
177
178 AT_SETUP([bundle action bad algorithm])
179 AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(symmetric_l4,60,fubar,ofport,slaves:1,2))'], [1], [],
180   [ovs-ofctl: symmetric_l4,60,fubar,ofport,slaves:1,2: unknown algorithm `fubar'
181 ])
182 AT_CLEANUP
183
184 AT_SETUP([bundle action bad slave type])
185 AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(symmetric_l4,60,hrw,robot,slaves:1,2))'], [1], [],
186   [ovs-ofctl: symmetric_l4,60,hrw,robot,slaves:1,2: unknown slave_type `robot'
187 ])
188 AT_CLEANUP
189
190 AT_SETUP([bundle action bad slave delimiter])
191 AT_CHECK([ovs-ofctl parse-flow 'actions=bundle(symmetric_l4,60,hrw,ofport,robot:1,2))'], [1], [],
192   [ovs-ofctl: symmetric_l4,60,hrw,ofport,robot:1,2: missing slave delimiter, expected `slaves' got `robot'
193 ])
194 AT_CLEANUP
195
196 AT_SETUP([bundle action with many ports])
197 OVS_VSWITCHD_START
198 AT_CHECK([ovs-ofctl add-flow br0 'actions=set_field:0x1->metadata,set_field:0x2->metadata,set_field:0x3->metadata,set_field:0x4->metadata,bundle(symmetric_l4,0,hrw,ofport,slaves:[[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]])'])
199 OVS_VSWITCHD_STOP
200 AT_CLEANUP