Skip to content

Commit 5e3b132

Browse files
authored
[hash] update GH frontend with IPV6_FLOW_LABEL for ECMP/LAG switch hash configuration (#3730)
- What I did CLI updated with ability to configure generic hash with IPV6_FLOW_LABEL parameter - How I did it Updated HASH_FIELD_LIST Updated sonic-utilities tests Updated doc file - How to verify it root@sonic:/home/admin# config switch-hash global ecmp-hash IPV6_FLOW_LABEL root@sonic:/home/admin# config switch-hash global lag-hash IPV6_FLOW_LABEL root@sonic:/home/admin# show switch-hash global Signed-off-by: Andriy Yurkiv <[email protected]>
1 parent 706f97e commit 5e3b132

File tree

10 files changed

+42
-19
lines changed

10 files changed

+42
-19
lines changed

doc/Command-Reference.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4724,6 +4724,7 @@ This command displays switch hash global configuration.
47244724
| | | INNER_SRC_IP | | |
47254725
| | | INNER_L4_DST_PORT | | |
47264726
| | | INNER_L4_SRC_PORT | | |
4727+
| | | IPV6_FLOW_LABEL | | |
47274728
| | +-------------------+-------------+ |
47284729
+--------+-------------------------------------+
47294730
| LAG | +-------------------+-------------+ |
@@ -4745,6 +4746,7 @@ This command displays switch hash global configuration.
47454746
| | | INNER_SRC_IP | | |
47464747
| | | INNER_L4_DST_PORT | | |
47474748
| | | INNER_L4_SRC_PORT | | |
4749+
| | | IPV6_FLOW_LABEL | | |
47484750
| | +-------------------+-------------+ |
47494751
+--------+-------------------------------------+
47504752
```
@@ -4788,6 +4790,7 @@ This command displays switch hash capabilities.
47884790
| | | INNER_SRC_IP | | |
47894791
| | | INNER_L4_DST_PORT | | |
47904792
| | | INNER_L4_SRC_PORT | | |
4793+
| | | IPV6_FLOW_LABEL | | |
47914794
| | +-------------------+-------------+ |
47924795
+--------+-------------------------------------+
47934796
| LAG | +-------------------+-------------+ |
@@ -4811,6 +4814,7 @@ This command displays switch hash capabilities.
48114814
| | | INNER_SRC_IP | | |
48124815
| | | INNER_L4_DST_PORT | | |
48134816
| | | INNER_L4_SRC_PORT | | |
4817+
| | | IPV6_FLOW_LABEL | | |
48144818
| | +-------------------+-------------+ |
48154819
+--------+-------------------------------------+
48164820
```
@@ -4850,7 +4854,8 @@ This command is used to manage switch hash global configuration.
48504854
'INNER_DST_IP' \
48514855
'INNER_SRC_IP' \
48524856
'INNER_L4_DST_PORT' \
4853-
'INNER_L4_SRC_PORT'
4857+
'INNER_L4_SRC_PORT' \
4858+
'IPV6_FLOW_LABEL'
48544859
admin@sonic:~$ config switch-hash global lag-hash \
48554860
'DST_MAC' \
48564861
'SRC_MAC' \
@@ -4867,7 +4872,8 @@ This command is used to manage switch hash global configuration.
48674872
'INNER_DST_IP' \
48684873
'INNER_SRC_IP' \
48694874
'INNER_L4_DST_PORT' \
4870-
'INNER_L4_SRC_PORT'
4875+
'INNER_L4_SRC_PORT' \
4876+
'IPV6_FLOW_LABEL'
48714877
```
48724878

48734879
**config switch-hash global ecmp/lag hash algorithm**

tests/hash_input/assert_show_output.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
| | | INNER_SRC_IP | | |
3030
| | | INNER_L4_DST_PORT | | |
3131
| | | INNER_L4_SRC_PORT | | |
32+
| | | IPV6_FLOW_LABEL | | |
3233
| | +-------------------+-------------+ |
3334
+--------+-------------------------------------+
3435
| LAG | +--------------+-------------+ |
@@ -57,7 +58,8 @@
5758
"INNER_DST_IP",
5859
"INNER_SRC_IP",
5960
"INNER_L4_DST_PORT",
60-
"INNER_L4_SRC_PORT"
61+
"INNER_L4_SRC_PORT",
62+
"IPV6_FLOW_LABEL"
6163
],
6264
"algorithm": "CRC"
6365
},
@@ -97,6 +99,7 @@
9799
| | | INNER_SRC_IP | | |
98100
| | | INNER_L4_DST_PORT | | |
99101
| | | INNER_L4_SRC_PORT | | |
102+
| | | IPV6_FLOW_LABEL | | |
100103
| | +-------------------+-------------+ |
101104
+--------+-------------------------------------+
102105
"""
@@ -123,7 +126,8 @@
123126
"INNER_DST_IP",
124127
"INNER_SRC_IP",
125128
"INNER_L4_DST_PORT",
126-
"INNER_L4_SRC_PORT"
129+
"INNER_L4_SRC_PORT",
130+
"IPV6_FLOW_LABEL"
127131
],
128132
"algorithm": "XOR"
129133
}
@@ -153,6 +157,7 @@
153157
| | | INNER_SRC_IP | | |
154158
| | | INNER_L4_DST_PORT | | |
155159
| | | INNER_L4_SRC_PORT | | |
160+
| | | IPV6_FLOW_LABEL | | |
156161
| | +-------------------+-------------+ |
157162
+--------+-------------------------------------+
158163
| LAG | +-------------------+-------------+ |
@@ -174,6 +179,7 @@
174179
| | | INNER_SRC_IP | | |
175180
| | | INNER_L4_DST_PORT | | |
176181
| | | INNER_L4_SRC_PORT | | |
182+
| | | IPV6_FLOW_LABEL | | |
177183
| | +-------------------+-------------+ |
178184
+--------+-------------------------------------+
179185
"""
@@ -196,7 +202,8 @@
196202
"INNER_DST_IP",
197203
"INNER_SRC_IP",
198204
"INNER_L4_DST_PORT",
199-
"INNER_L4_SRC_PORT"
205+
"INNER_L4_SRC_PORT",
206+
"IPV6_FLOW_LABEL"
200207
],
201208
"algorithm": "CRC"
202209
},
@@ -217,7 +224,8 @@
217224
"INNER_DST_IP",
218225
"INNER_SRC_IP",
219226
"INNER_L4_DST_PORT",
220-
"INNER_L4_SRC_PORT"
227+
"INNER_L4_SRC_PORT",
228+
"IPV6_FLOW_LABEL"
221229
],
222230
"algorithm": "XOR"
223231
}
@@ -339,6 +347,7 @@
339347
| | | INNER_SRC_IP | | |
340348
| | | INNER_L4_DST_PORT | | |
341349
| | | INNER_L4_SRC_PORT | | |
350+
| | | IPV6_FLOW_LABEL | | |
342351
| | +-------------------+-------------+ |
343352
+--------+-------------------------------------+
344353
| LAG | +---------------+---------------+ |
@@ -369,7 +378,8 @@
369378
"INNER_DST_IP",
370379
"INNER_SRC_IP",
371380
"INNER_L4_DST_PORT",
372-
"INNER_L4_SRC_PORT"
381+
"INNER_L4_SRC_PORT",
382+
"IPV6_FLOW_LABEL"
373383
],
374384
"algorithm": [
375385
"CRC",
@@ -419,6 +429,7 @@
419429
| | | INNER_SRC_IP | | |
420430
| | | INNER_L4_DST_PORT | | |
421431
| | | INNER_L4_SRC_PORT | | |
432+
| | | IPV6_FLOW_LABEL | | |
422433
| | +-------------------+-------------+ |
423434
+--------+-------------------------------------+
424435
"""
@@ -447,7 +458,8 @@
447458
"INNER_DST_IP",
448459
"INNER_SRC_IP",
449460
"INNER_L4_DST_PORT",
450-
"INNER_L4_SRC_PORT"
461+
"INNER_L4_SRC_PORT",
462+
"IPV6_FLOW_LABEL"
451463
],
452464
"algorithm": [
453465
"CRC",
@@ -487,6 +499,7 @@
487499
| | | INNER_SRC_IP | | |
488500
| | | INNER_L4_DST_PORT | | |
489501
| | | INNER_L4_SRC_PORT | | |
502+
| | | IPV6_FLOW_LABEL | | |
490503
| | +-------------------+-------------+ |
491504
+--------+-------------------------------------+
492505
| LAG | +-------------------+-------------+ |
@@ -510,6 +523,7 @@
510523
| | | INNER_SRC_IP | | |
511524
| | | INNER_L4_DST_PORT | | |
512525
| | | INNER_L4_SRC_PORT | | |
526+
| | | IPV6_FLOW_LABEL | | |
513527
| | +-------------------+-------------+ |
514528
+--------+-------------------------------------+
515529
"""
@@ -534,7 +548,8 @@
534548
"INNER_DST_IP",
535549
"INNER_SRC_IP",
536550
"INNER_L4_DST_PORT",
537-
"INNER_L4_SRC_PORT"
551+
"INNER_L4_SRC_PORT",
552+
"IPV6_FLOW_LABEL"
538553
],
539554
"algorithm": [
540555
"CRC",
@@ -565,7 +580,8 @@
565580
"INNER_DST_IP",
566581
"INNER_SRC_IP",
567582
"INNER_L4_DST_PORT",
568-
"INNER_L4_SRC_PORT"
583+
"INNER_L4_SRC_PORT",
584+
"IPV6_FLOW_LABEL"
569585
],
570586
"algorithm": [
571587
"CRC",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"SWITCH_HASH|GLOBAL": {
3-
"ecmp_hash@": "DST_MAC,SRC_MAC,ETHERTYPE,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT",
3+
"ecmp_hash@": "DST_MAC,SRC_MAC,ETHERTYPE,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT,IPV6_FLOW_LABEL",
44
"ecmp_hash_algorithm": "CRC"
55
}
66
}

tests/hash_input/mock_config/ecmp_and_lag.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"SWITCH_HASH|GLOBAL": {
3-
"ecmp_hash@": "DST_MAC,SRC_MAC,ETHERTYPE,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT",
4-
"lag_hash@": "DST_MAC,SRC_MAC,ETHERTYPE,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT",
3+
"ecmp_hash@": "DST_MAC,SRC_MAC,ETHERTYPE,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT,IPV6_FLOW_LABEL",
4+
"lag_hash@": "DST_MAC,SRC_MAC,ETHERTYPE,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT,IPV6_FLOW_LABEL",
55
"ecmp_hash_algorithm": "CRC",
66
"lag_hash_algorithm": "XOR"
77
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"SWITCH_HASH|GLOBAL": {
3-
"lag_hash@": "DST_MAC,SRC_MAC,ETHERTYPE,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT",
3+
"lag_hash@": "DST_MAC,SRC_MAC,ETHERTYPE,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT,IPV6_FLOW_LABEL",
44
"lag_hash_algorithm": "XOR"
55
}
66
}

tests/hash_input/mock_state/ecmp.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"LAG_HASH_CAPABLE": "false",
55
"ECMP_HASH_ALGORITHM_CAPABLE": "true",
66
"LAG_HASH_ALGORITHM_CAPABLE": "false",
7-
"HASH|NATIVE_HASH_FIELD_LIST": "IN_PORT,DST_MAC,SRC_MAC,ETHERTYPE,VLAN_ID,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT",
7+
"HASH|NATIVE_HASH_FIELD_LIST": "IN_PORT,DST_MAC,SRC_MAC,ETHERTYPE,VLAN_ID,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT,IPV6_FLOW_LABEL",
88
"ECMP_HASH_ALGORITHM": "CRC,XOR,RANDOM,CRC_32LO,CRC_32HI,CRC_CCITT,CRC_XOR",
99
"LAG_HASH_ALGORITHM": "CRC,XOR,RANDOM,CRC_32LO,CRC_32HI,CRC_CCITT,CRC_XOR"
1010
}

tests/hash_input/mock_state/ecmp_and_lag.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"LAG_HASH_CAPABLE": "true",
55
"ECMP_HASH_ALGORITHM_CAPABLE": "true",
66
"LAG_HASH_ALGORITHM_CAPABLE": "true",
7-
"HASH|NATIVE_HASH_FIELD_LIST": "IN_PORT,DST_MAC,SRC_MAC,ETHERTYPE,VLAN_ID,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT",
7+
"HASH|NATIVE_HASH_FIELD_LIST": "IN_PORT,DST_MAC,SRC_MAC,ETHERTYPE,VLAN_ID,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT,IPV6_FLOW_LABEL",
88
"ECMP_HASH_ALGORITHM": "CRC,XOR,RANDOM,CRC_32LO,CRC_32HI,CRC_CCITT,CRC_XOR",
99
"LAG_HASH_ALGORITHM": "CRC,XOR,RANDOM,CRC_32LO,CRC_32HI,CRC_CCITT,CRC_XOR"
1010
}

tests/hash_input/mock_state/empty.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"LAG_HASH_CAPABLE": "false",
55
"ECMP_HASH_ALGORITHM_CAPABLE": "false",
66
"LAG_HASH_ALGORITHM_CAPABLE": "false",
7-
"HASH|NATIVE_HASH_FIELD_LIST": "IN_PORT,DST_MAC,SRC_MAC,ETHERTYPE,VLAN_ID,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT",
7+
"HASH|NATIVE_HASH_FIELD_LIST": "IN_PORT,DST_MAC,SRC_MAC,ETHERTYPE,VLAN_ID,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT,IPV6_FLOW_LABEL",
88
"ECMP_HASH_ALGORITHM": "CRC,XOR,RANDOM,CRC_32LO,CRC_32HI,CRC_CCITT,CRC_XOR",
99
"LAG_HASH_ALGORITHM": "CRC,XOR,RANDOM,CRC_32LO,CRC_32HI,CRC_CCITT,CRC_XOR"
1010
}

tests/hash_input/mock_state/lag.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"LAG_HASH_CAPABLE": "true",
55
"ECMP_HASH_ALGORITHM_CAPABLE": "false",
66
"LAG_HASH_ALGORITHM_CAPABLE": "true",
7-
"HASH|NATIVE_HASH_FIELD_LIST": "IN_PORT,DST_MAC,SRC_MAC,ETHERTYPE,VLAN_ID,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT",
7+
"HASH|NATIVE_HASH_FIELD_LIST": "IN_PORT,DST_MAC,SRC_MAC,ETHERTYPE,VLAN_ID,IP_PROTOCOL,DST_IP,SRC_IP,L4_DST_PORT,L4_SRC_PORT,INNER_DST_MAC,INNER_SRC_MAC,INNER_ETHERTYPE,INNER_IP_PROTOCOL,INNER_DST_IP,INNER_SRC_IP,INNER_L4_DST_PORT,INNER_L4_SRC_PORT,IPV6_FLOW_LABEL",
88
"ECMP_HASH_ALGORITHM": "CRC,XOR,RANDOM,CRC_32LO,CRC_32HI,CRC_CCITT,CRC_XOR",
99
"LAG_HASH_ALGORITHM": "CRC,XOR,RANDOM,CRC_32LO,CRC_32HI,CRC_CCITT,CRC_XOR"
1010
}

utilities_common/switch_hash.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"INNER_DST_IP",
3939
"INNER_SRC_IP",
4040
"INNER_L4_DST_PORT",
41-
"INNER_L4_SRC_PORT"
41+
"INNER_L4_SRC_PORT",
42+
"IPV6_FLOW_LABEL"
4243
]
4344

4445
HASH_ALGORITHM = [

0 commit comments

Comments
 (0)