You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**The following command shows switch hash global configuration:**
119
121
```bash
120
122
root@sonic:/home/admin# show switch-hash global
121
-
ECMP HASH LAG HASH
122
-
----------------- -----------------
123
-
DST_MAC DST_MAC
124
-
SRC_MAC SRC_MAC
125
-
ETHERTYPE ETHERTYPE
126
-
IP_PROTOCOL IP_PROTOCOL
127
-
DST_IP DST_IP
128
-
SRC_IP SRC_IP
129
-
L4_DST_PORT L4_DST_PORT
130
-
L4_SRC_PORT L4_SRC_PORT
131
-
INNER_DST_MAC INNER_DST_MAC
132
-
INNER_SRC_MAC INNER_SRC_MAC
133
-
INNER_ETHERTYPE INNER_ETHERTYPE
134
-
INNER_IP_PROTOCOL INNER_IP_PROTOCOL
135
-
INNER_DST_IP INNER_DST_IP
136
-
INNER_SRC_IP INNER_SRC_IP
137
-
INNER_L4_DST_PORT INNER_L4_DST_PORT
138
-
INNER_L4_SRC_PORT INNER_L4_SRC_PORT
123
+
+--------+-------------------------------------+
124
+
| Hash | Configuration |
125
+
+========+=====================================+
126
+
| ECMP | +--------------+-------------+ |
127
+
||| Hash Field | Algorithm ||
128
+
|||--------------+-------------||
129
+
||| IP_PROTOCOL | CRC_CCITT ||
130
+
|| +--------------+-------------+ |
131
+
+--------+-------------------------------------+
132
+
| LAG | +-------------------+-------------+ |
133
+
||| Hash Field | Algorithm ||
134
+
|||-------------------+-------------||
135
+
||| INNER_IP_PROTOCOL | CRC ||
136
+
|| +-------------------+-------------+ |
137
+
+--------+-------------------------------------+
139
138
```
140
139
141
140
**The following command shows switch hash capabilities:**
142
141
```bash
143
142
root@sonic:/home/admin# show switch-hash capabilities
144
-
ECMP HASH LAG HASH
145
-
----------------- -----------------
146
-
IN_PORT IN_PORT
147
-
DST_MAC DST_MAC
148
-
SRC_MAC SRC_MAC
149
-
ETHERTYPE ETHERTYPE
150
-
VLAN_ID VLAN_ID
151
-
IP_PROTOCOL IP_PROTOCOL
152
-
DST_IP DST_IP
153
-
SRC_IP SRC_IP
154
-
L4_DST_PORT L4_DST_PORT
155
-
L4_SRC_PORT L4_SRC_PORT
156
-
INNER_DST_MAC INNER_DST_MAC
157
-
INNER_SRC_MAC INNER_SRC_MAC
158
-
INNER_ETHERTYPE INNER_ETHERTYPE
159
-
INNER_IP_PROTOCOL INNER_IP_PROTOCOL
160
-
INNER_DST_IP INNER_DST_IP
161
-
INNER_SRC_IP INNER_SRC_IP
162
-
INNER_L4_DST_PORT INNER_L4_DST_PORT
163
-
INNER_L4_SRC_PORT INNER_L4_SRC_PORT
143
+
+--------+-------------------------------------+
144
+
| Hash | Capabilities |
145
+
+========+=====================================+
146
+
| ECMP | +-------------------+-------------+ |
147
+
||| Hash Field | Algorithm ||
148
+
|||-------------------+-------------||
149
+
||| SRC_IP | CRC ||
150
+
||| DST_IP | XOR ||
151
+
||| INNER_SRC_IP | RANDOM ||
152
+
||| INNER_DST_IP | CRC_CCITT ||
153
+
||| VLAN_ID |||
154
+
||| IP_PROTOCOL |||
155
+
||| ETHERTYPE |||
156
+
||| L4_SRC_PORT |||
157
+
||| L4_DST_PORT |||
158
+
||| SRC_MAC |||
159
+
||| DST_MAC |||
160
+
||| IN_PORT |||
161
+
||| INNER_IP_PROTOCOL |||
162
+
||| INNER_ETHERTYPE |||
163
+
||| INNER_L4_SRC_PORT |||
164
+
||| INNER_L4_DST_PORT |||
165
+
||| INNER_SRC_MAC |||
166
+
||| INNER_DST_MAC |||
167
+
|| +-------------------+-------------+ |
168
+
+--------+-------------------------------------+
169
+
| LAG | +-------------------+-------------+ |
170
+
||| Hash Field | Algorithm ||
171
+
|||-------------------+-------------||
172
+
||| SRC_IP | CRC ||
173
+
||| DST_IP | XOR ||
174
+
||| INNER_SRC_IP | RANDOM ||
175
+
||| INNER_DST_IP | CRC_CCITT ||
176
+
||| VLAN_ID |||
177
+
||| IP_PROTOCOL |||
178
+
||| ETHERTYPE |||
179
+
||| L4_SRC_PORT |||
180
+
||| L4_DST_PORT |||
181
+
||| SRC_MAC |||
182
+
||| DST_MAC |||
183
+
||| IN_PORT |||
184
+
||| INNER_IP_PROTOCOL |||
185
+
||| INNER_ETHERTYPE |||
186
+
||| INNER_L4_SRC_PORT |||
187
+
||| INNER_L4_DST_PORT |||
188
+
||| INNER_SRC_MAC |||
189
+
||| INNER_DST_MAC |||
190
+
|| +-------------------+-------------+ |
191
+
+--------+-------------------------------------+
164
192
```
165
193
166
194
### 3.3 DUT related configuration in config_db
167
195
168
196
```
169
-
{
170
197
"SWITCH_HASH": {
171
198
"GLOBAL": {
172
199
"ecmp_hash": [
173
-
"DST_MAC",
174
-
"SRC_MAC",
175
-
"ETHERTYPE",
176
-
"IP_PROTOCOL",
177
-
"DST_IP",
178
-
"SRC_IP",
179
-
"L4_DST_PORT",
180
-
"L4_SRC_PORT",
181
-
"INNER_DST_MAC",
182
-
"INNER_SRC_MAC",
183
-
"INNER_ETHERTYPE",
184
-
"INNER_IP_PROTOCOL",
185
-
"INNER_DST_IP",
186
-
"INNER_SRC_IP",
187
-
"INNER_L4_DST_PORT",
188
-
"INNER_L4_SRC_PORT"
200
+
"IP_PROTOCOL"
189
201
],
202
+
"ecmp_hash_algorithm": "CRC_CCITT",
190
203
"lag_hash": [
191
-
"DST_MAC",
192
-
"SRC_MAC",
193
-
"ETHERTYPE",
194
-
"IP_PROTOCOL",
195
-
"DST_IP",
196
-
"SRC_IP",
197
-
"L4_DST_PORT",
198
-
"L4_SRC_PORT",
199
-
"INNER_DST_MAC",
200
-
"INNER_SRC_MAC",
201
-
"INNER_ETHERTYPE",
202
-
"INNER_IP_PROTOCOL",
203
-
"INNER_DST_IP",
204
-
"INNER_SRC_IP",
205
-
"INNER_L4_DST_PORT",
206
-
"INNER_L4_SRC_PORT"
207
-
]
204
+
"INNER_IP_PROTOCOL"
205
+
],
206
+
"lag_hash_algorithm": "CRC"
208
207
}
209
208
}
210
-
}
211
209
```
212
210
### 3.4 Supported topology
213
211
The test should support t0 and t1 topologies.
@@ -225,14 +223,17 @@ The test should support t0 and t1 topologies.
225
223
| 7 | test_lag_member_remove_add| Verify the lag hash functionality after a lag member is removed and added back to a portchannel|
226
224
| 8 | test_reboot | Verify there is no hash configuration inconsistence before and after reload/reboot|
227
225
| 9 | test_backend_error_messages | Verify there are backend errors in syslog when the hash config is removed or updated with invalid values via redis cli|
226
+
| 10 | test_algorithm_config | Verify algorithm show and configuration via cli|
228
227
229
228
### Notes:
230
-
1. The tested hash field in each test case is randomly selected from a pre-defined field list per asic type. Currently these fields are tested as default: 'IN_PORT', 'SRC_MAC', 'DST_MAC', 'ETHERTYPE', 'VLAN_ID', 'IP_PROTOCOL', 'SRC_IP', 'DST_IP', 'L4_SRC_PORT', 'L4_DST_PORT', 'INNER_SRC_IP', 'INNER_DST_IP'.
231
-
2. DST_MAC, ETHERTYPE, VLAN_ID fields are only tested in lag hash test cases, because L2 traffic is needed to test these fields, and there is no ecmp hash when the traffic is fowarded in L2.
232
-
3. IPv4 and IPv6 are covered in the test, but the versions(including the inner version when testing the inner fields) are randomly selected in the test cases.
233
-
4. For the inner fields, three types of encapsulations are covered: IPinIP, VxLAN and NVGRE. For the VxLAN packet, the default port 4789 and a custom port 13330 are covered in the test.
234
-
5. For the reboot test, reboot type is randomly selected from config reload, cold, warm and fast reboot.
235
-
6. The random selections of hash fields, ip versions, encapsulation types and reboot types can be controlled by pytest options. The user is able to set each of the option as 'random', 'all', or a specific value.
229
+
1. The tested hash field in each test case is randomly selected from a pre-defined field list per asic type. Currently these fields are tested as default: 'IN_PORT', 'SRC_MAC', 'DST_MAC', 'ETHERTYPE', 'VLAN_ID', 'IP_PROTOCOL', 'SRC_IP', 'DST_IP', 'L4_SRC_PORT', 'L4_DST_PORT', 'INNER_SRC_IP', 'INNER_DST_IP'; In the test enhancement, there are 6 fields added: 'INNER_L4_SRC_PORT', 'INNER_L4_DST_PORT', 'INNER_IP_PROTOCOL', 'INNER_ETHERTYPE', 'INNER_SRC_MAC', 'INNER_DST_MAC', those fields would be updated into all the necessary test cases.
230
+
2. The tested algorithm in each test case is randomly selected from 'CRC' and 'CRC_CCITT' for Mellanox switches, otherwise randomly selected from all the supported algorithms. For the other algorithms that Mellanox switches not fully supported, there would be cli test to cover them.
231
+
3. All the test cases should be integrated to dualtor setup.
232
+
4. DST_MAC, ETHERTYPE, VLAN_ID fields are only tested in lag hash test cases, because L2 traffic is needed to test these fields, and there is no ecmp hash when the traffic is fowarded in L2.
233
+
5. IPv4 and IPv6 are covered in the test, but the versions(including the inner version when testing the inner fields) are randomly selected in the test cases.
234
+
6. For the inner fields, three types of encapsulations are covered: IPinIP, VxLAN and NVGRE. For the VxLAN packet, the default port 4789 and a custom port 13330 are covered in the test.
235
+
7. For the reboot test, reboot type is randomly selected from config reload, cold, warm and fast reboot.
236
+
8. The random selections of algorithms, hash fields, ip versions, encapsulation types and reboot types can be controlled by pytest options. The user is able to set each of the option as 'random', 'all', or a specific value. Furthermore, for algorithms and hash fields option, the user is able to set a list of values separated by comma, such as CRC,CRC_CCITT.
236
237
237
238
### Test cases #1 - test_hash_capability
238
239
1. Get the supported hash fields via cli "show switch-hash capabilities"
@@ -241,33 +242,35 @@ The test should support t0 and t1 topologies.
241
242
### Test cases #2 - test_ecmp_hash
242
243
1. The test is using the default links and routes in a t0/t1 testbed.
243
244
2. Randomly select a hash field and configure it to the ecmp hash list via cli "config switch-hash global ecmp-hash".
244
-
3. Configure the lag hash list to exclude the selected field to verify the lag hash configuration does not affect the hash result.
245
-
4. Send traffic with changing values of the field under test from a downlink ptf port to uplink destination via multiple nexthops.
246
-
5. Check the traffic is balanced over the nexthops.
247
-
6. If the uplinks are portchannels with multiple members, check the traffic is not balanced over the members.
245
+
3. Randomly select an algorithm and configure it to the ecmp hash list via cli "config switch-hash global ecmp-hash-algorithm".
246
+
4. Configure the lag hash list to exclude the selected field to verify the lag hash configuration does not affect the hash result.
247
+
5. Send traffic with changing values of the field under test from a downlink ptf port to uplink destination via multiple nexthops.
248
+
6. Check the traffic is balanced over the nexthops.
249
+
7. If the uplinks are portchannels with multiple members, check the traffic is not balanced over the members.
248
250
249
251
### Test cases #3 - test_lag_hash
250
252
1. The test is using the default links and routes in a t0/t1 testbed, and only runs on setups which have multi-member portchannel uplinks.
251
253
2. Randomly select a hash field and configure it to the lag hash list via cli "config switch-hash global lag-hash".
252
-
3. Configure the ecmp hash list to exclude the selected field to verify the ecmp hash configuration does not affect the hash result.
253
-
4. If the hash field is DST_MAC, ETHERTYPE or VLAN_ID, take the steps 5-7, otherwise skip them.
254
-
5. Choose one downlink interface and one uplink interface, remove all ip/ipv6 addresses on them.
255
-
6. Remove the downlink interface from the existing vlan if it is t0 topology.
256
-
7. For the DST_MAC, ETHERTYPE fields, add the chosen interfaces to a same vlan; For VLAN_ID field, add the interfaces to multiple vlans.
257
-
8. Send traffic with changing values of the field under test from a downlink ptf port to uplink destination via the portchannels.
258
-
9. Check the traffic is forwarded through only one portchannel and is balanced over the members.
254
+
3. Randomly select an algorithm and configure it to the lag hash list via cli "config switch-hash global lag-hash-algorithm".
255
+
4. Configure the ecmp hash list to exclude the selected field to verify the ecmp hash configuration does not affect the hash result.
256
+
5. If the hash field is DST_MAC, ETHERTYPE or VLAN_ID, take the steps 5-7, otherwise skip them.
257
+
6. Choose one downlink interface and one uplink interface, remove all ip/ipv6 addresses on them.
258
+
7. Remove the downlink interface from the existing vlan if it is t0 topology.
259
+
8. For the DST_MAC, ETHERTYPE fields, add the chosen interfaces to a same vlan; For VLAN_ID field, add the interfaces to multiple vlans.
260
+
9. Send traffic with changing values of the field under test from a downlink ptf port to uplink destination via the portchannels.
261
+
10. Check the traffic is forwarded through only one portchannel and is balanced over the members.
259
262
260
263
### Test cases #4 - test_ecmp_and_lag_hash
261
264
1. The test is using the default links and routes in a t0/t1 testbed.
262
265
2. Configure all the supported hash fields for the ecmp and lag hash.
263
-
3. Randomly select one hash field to test.
266
+
3. Randomly select one hash field and algorithm to test.
264
267
4. Send traffic with changing values of the field under test from a downlink ptf port to uplink destination.
265
268
5. Check the traffc is balanced over all the uplink physical ports.
266
269
267
270
### Test cases #5 - test_nexthop_flap
268
271
1. The test is using the default links and routes in a t0/t1 testbed.
269
272
2. Configure all the supported hash fields for the ecmp and lag hash.
270
-
3. Randomly select one hash field to test.
273
+
3. Randomly select one hash field and algorithm to test.
271
274
4. Send traffic with changing values of the field under test from a downlink ptf port to uplink destination.
272
275
5. Check the traffic is balanced over all the uplink ports.
273
276
6. Randomly shutdown 1 nexthop interface.
@@ -280,7 +283,7 @@ The test should support t0 and t1 topologies.
280
283
### Test cases #6 - test_lag_member_flap
281
284
1. The test is using the default links and routes in a t0/t1 testbed, and only runs on setups which have multi-member portchannel uplinks.
282
285
2. Configure all the supported hash fields for the ecmp and lag hash.
283
-
3. Randomly select one hash field to test.
286
+
3. Randomly select one hash field and algorithm to test.
284
287
4. If the hash field is DST_MAC, ETHERTYPE or VLAN_ID, take the steps 5-7, otherwise skip them.
285
288
5. Choose one downlink interface and one uplink interface, remove all ip/ipv6 addresses on them.
286
289
6. Remove the downlink interface from the existing vlan if it is t0 topology.
@@ -297,7 +300,7 @@ The test should support t0 and t1 topologies.
297
300
### Test cases #7 - test_lag_member_remove_add
298
301
1. The test is using the default links and routes in a t0/t1 testbed, and only runs on setups which have multi-member portchannel uplinks.
299
302
2. Configure all the supported hash fields for the ecmp and lag hash.
300
-
3. Randomly select one hash field to test.
303
+
3. Randomly select one hash field and algorithm to test.
301
304
4. If the hash field is DST_MAC, ETHERTYPE or VLAN_ID, take the steps 5-7, otherwise skip them.
302
305
5. Choose one downlink interface and one uplink interface, remove all ip/ipv6 addresses on them.
303
306
6. Remove the downlink interface from the existing vlan if it is t0 topology.
@@ -312,7 +315,7 @@ The test should support t0 and t1 topologies.
312
315
### Test cases #8 - test_reboot
313
316
1. The test is using the default links and routes in a t0/t1 testbed.
314
317
2. Configure all the supported hash fields for the ecmp and lag hash.
315
-
3. Randomly select one hash field to test.
318
+
3. Randomly select one hash field and algorithm to test.
316
319
4. Randomly select a reboot type from reload or fast/warm/cold reboot, if reload or cold reboot, save the configuration before the reload/reboot.
317
320
5. Send traffic with changing values of the field under test from a downlink ptf port to uplink destination.
318
321
6. Check the traffic is balanced over all the uplink ports.
@@ -325,13 +328,27 @@ The test should support t0 and t1 topologies.
325
328
1. Config ecmp and lag hash via cli.
326
329
2. Remove the ecmp hash key via redis cli.
327
330
3. Check there is a warning printed in the syslog.
328
-
4. Remove the lag hash key via redis cli.
331
+
4. Remove the ecmp hash algorithm via redis cli.
329
332
5. Check there is a warning printed in the syslog.
330
-
6. Re-config the ecmp and lag hash via cli.
331
-
7. Update the ecmp hash fields with an invalid value via redis cli.
332
-
8. Check there is a warning printed in the syslog.
333
-
9. Update the lag hash fields with an invalid value via redis cli.
334
-
10. Check there is a warning printed in the syslog.
335
-
11. Re-config the ecmp and lag hash via cli.
336
-
12. Remove the generic hash key via redis cli.
337
-
13. Check there is a warning printed in the syslog.
333
+
6. Remove the lag hash key via redis cli.
334
+
7. Check there is a warning printed in the syslog.
335
+
8. Remove the lag hash algorithm via redis cli.
336
+
9. Check there is a warning printed in the syslog.
337
+
10. Re-config the ecmp and lag hash via cli.
338
+
11. Update the ecmp hash fields with an invalid value via redis cli.
339
+
12. Check there is a warning printed in the syslog.
340
+
13. Update the ecmp hash algorithm with an invalid value via redis cli.
341
+
14. Check there is a warning printed in the syslog.
342
+
15. Update the lag hash fields with an invalid value via redis cli.
343
+
16. Check there is a warning printed in the syslog.
344
+
17. Update the lag hash algorithm with an invalid value via redis cli.
345
+
18. Check there is a warning printed in the syslog.
346
+
19. Re-config the ecmp and lag hash via cli.
347
+
20. Remove the generic hash key via redis cli.
348
+
21. Check there is a warning printed in the syslog.
349
+
350
+
### Test cases #10 - test_algorithm_config
351
+
1. Config ecmp and lag hash via cli.
352
+
2. Config ecmp and lag hash algorithm via cli.
353
+
3. Check configuration correct via show hash capabilities cli
0 commit comments