forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
alb.at
223 lines (177 loc) · 8.13 KB
/
alb.at
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
AT_BANNER([PMD Auto Load Balance])
m4_divert_push([PREPARE_TESTS])
get_log_next_line_num () {
LINENUM=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
}
m4_divert_pop([PREPARE_TESTS])
m4_define([DUMMY_NUMA], [--dummy-numa="0,0"])
dnl CHECK_ALB_PARAM([param], [value], [+line])
dnl
dnl Waits for ALB logs for 'param' in logs and checks if value matches
dnl 'value'. Checking starts from line number 'line' in ovs-vswithd.log.
m4_define([CHECK_ALB_PARAM], [
line_st=$3
if [[ -z "$line_st" ]]
then
line_st="+0"
fi
OVS_WAIT_UNTIL([tail -n $line_st ovs-vswitchd.log | grep "PMD auto load balance $1 set to"])
AT_CHECK([tail -n $line_st ovs-vswitchd.log dnl
| sed -n "s#.*\(PMD auto load balance $1 set to.*\)#\1#p" | tail -1], [0], [dnl
PMD auto load balance $1 set to $2
])
])
AT_SETUP([ALB - default state])
OVS_VSWITCHD_START
OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
OVS_VSWITCHD_STOP
AT_CLEANUP
AT_SETUP([ALB - enable/disable])
OVS_VSWITCHD_START([add-port br0 p0 \
-- set Interface p0 type=dummy-pmd options:n_rxq=3 \
-- set Open_vSwitch . other_config:pmd-cpu-mask=3 \
-- set open_vswitch . other_config:pmd-auto-lb="true"],
[], [], [DUMMY_NUMA])
OVS_WAIT_UNTIL([grep "PMD auto load balance is enabled" ovs-vswitchd.log])
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load balance is disabled"])
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load balance is enabled"])
OVS_VSWITCHD_STOP
AT_CLEANUP
AT_SETUP([ALB - min num PMD/RxQ])
OVS_VSWITCHD_START([add-port br0 p0 \
-- set Interface p0 type=dummy-pmd options:n_rxq=2 \
-- set Open_vSwitch . other_config:pmd-cpu-mask=1 \
-- set open_vswitch . other_config:pmd-auto-lb="true"],
[], [], [DUMMY_NUMA])
OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
# Add more PMD
AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x3])
OVS_WAIT_UNTIL([grep "There are 2 pmd threads on numa node" ovs-vswitchd.log])
# Add one more rxq to have 2 rxq on a PMD
get_log_next_line_num
AT_CHECK([ovs-vsctl set interface p0 options:n_rxq=3])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load balance is enabled"])
# Reduce PMD
get_log_next_line_num
AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x1])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load balance is disabled"])
# Check logs when try to enable but min PMD/RxQ prevents
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load balance is disabled"])
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load balance is disabled"])
OVS_VSWITCHD_STOP
AT_CLEANUP
AT_SETUP([ALB - PMD/RxQ assignment type])
OVS_VSWITCHD_START([add-port br0 p0 \
-- set Interface p0 type=dummy-pmd options:n_rxq=3 \
-- set Open_vSwitch . other_config:pmd-cpu-mask=3 \
-- set open_vswitch . other_config:pmd-auto-lb="true"],
[], [], [DUMMY_NUMA])
OVS_WAIT_UNTIL([grep "PMD auto load balance is enabled" ovs-vswitchd.log])
# Change assignment type
get_log_next_line_num
AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-rxq-assign=roundrobin])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "mode changed to: 'roundrobin'"])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load balance is disabled"])
# Change back assignment type
get_log_next_line_num
AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-rxq-assign=cycles])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "mode changed to: 'cycles'"])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load balance is enabled"])
# Check logs when try to enable but assignment prevents
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="false"])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load balance is disabled"])
get_log_next_line_num
AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-rxq-assign=roundrobin])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "mode changed to: 'roundrobin'"])
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"])
OVS_WAIT_UNTIL([tail -n +$LINENUM ovs-vswitchd.log | grep "PMD auto load balance is disabled"])
OVS_VSWITCHD_STOP
AT_CLEANUP
AT_SETUP([ALB - interval param])
OVS_VSWITCHD_START
OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
# Check default
CHECK_ALB_PARAM([interval], [1 mins], [])
# Set new value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-rebal-interval="10"])
CHECK_ALB_PARAM([interval], [10 mins], [+$LINENUM])
# Set min value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-rebal-interval="1"])
CHECK_ALB_PARAM([interval], [1 mins], [+$LINENUM])
# Set max value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-rebal-interval="20000"])
CHECK_ALB_PARAM([interval], [20000 mins], [+$LINENUM])
# Set below min value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-rebal-interval="0"])
CHECK_ALB_PARAM([interval], [1 mins], [+$LINENUM])
# No check for above max as it is only a documented max value and not a hard limit
OVS_VSWITCHD_STOP
AT_CLEANUP
AT_SETUP([ALB - improvement param])
OVS_VSWITCHD_START
OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
# Check default
CHECK_ALB_PARAM([improvement threshold], [25%], [])
# Set new value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-improvement-threshold=60])
CHECK_ALB_PARAM([improvement threshold], [60%], [+$LINENUM])
# Set min value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-improvement-threshold=0])
CHECK_ALB_PARAM([improvement threshold], [0%], [+$LINENUM])
# Set below min value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-improvement-threshold=-1])
CHECK_ALB_PARAM([improvement threshold], [25%], [+$LINENUM])
# Set max value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-improvement-threshold=100])
CHECK_ALB_PARAM([improvement threshold], [100%], [+$LINENUM])
# Set above max value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-improvement-threshold=101])
CHECK_ALB_PARAM([improvement threshold], [25%], [+$LINENUM])
OVS_VSWITCHD_STOP
AT_CLEANUP
AT_SETUP([ALB - load param])
OVS_VSWITCHD_START
OVS_WAIT_UNTIL([grep "PMD auto load balance is disabled" ovs-vswitchd.log])
# Check default
CHECK_ALB_PARAM([load threshold], [95%], [])
# Set to new value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-load-threshold=70])
CHECK_ALB_PARAM([load threshold], [70%], [+$LINENUM])
# Set to min value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-load-threshold=0])
CHECK_ALB_PARAM([load threshold], [0%], [+$LINENUM])
# Set to below min
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-load-threshold=-1])
CHECK_ALB_PARAM([load threshold], [95%], [+$LINENUM])
# Set to max
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-load-threshold=100])
CHECK_ALB_PARAM([load threshold], [100%], [+$LINENUM])
# Set above max value
get_log_next_line_num
AT_CHECK([ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-load-threshold=101])
CHECK_ALB_PARAM([load threshold], [95%], [+$LINENUM])
OVS_VSWITCHD_STOP
AT_CLEANUP