Skip to content

Commit 1a81715

Browse files
author
Shuotian Cheng
authored
[swss]: Add switch.json.j2 to set the hash seed according to the switch type (#1089)
Set the ECMP/LAG hash seed to 10 when the switch is a ToR, 20 when the switch is a Leaf, 0 otherwise. Signed-off-by: Shu0T1an ChenG <[email protected]>
1 parent 2ba2818 commit 1a81715

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

dockers/docker-orchagent/Dockerfile.j2

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ RUN rm -rf /debs
2828

2929
COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"]
3030
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
31-
COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"]
32-
COPY ["mirror.json.j2", "/usr/share/sonic/templates/"]
33-
COPY ["ports.json.j2", "/usr/share/sonic/templates/"]
34-
COPY ["msn27xx.32ports.buffers.json.j2", "/usr/share/sonic/templates/"]
31+
32+
## Copy all Jinja2 template files into the templates folder
33+
COPY ["*.j2", "/usr/share/sonic/templates/"]
3534

3635
ENTRYPOINT ["/usr/bin/supervisord"]

dockers/docker-orchagent/start.sh

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
mkdir -p /etc/swss/config.d/
44

5+
sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/switch.json.j2 > /etc/swss/config.d/switch.json
56
sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json
67
sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json
78
sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{# set default hash seed to 0 #}
2+
{% set hash_seed = 0 %}
3+
{% if DEVICE_METADATA.localhost.type %}
4+
{% if DEVICE_METADATA.localhost.type == "ToRRouter" %}
5+
{% set hash_seed = 10 %}
6+
{% elif DEVICE_METADATA.localhost.type == "LeafRouter" %}
7+
{% set hash_seed = 20 %}
8+
{% endif %}
9+
{% endif %}
10+
[
11+
{
12+
"SWITCH_TABLE:switch": {
13+
"ecmp_hash_seed": "{{ hash_seed }}",
14+
"lag_hash_seed": "{{ hash_seed }}"
15+
},
16+
"OP": "SET"
17+
}
18+
]

dockers/docker-orchagent/swssconfig.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fast_reboot
3939

4040
HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v "DEVICE_METADATA['localhost']['hwsku']"`
4141

42-
SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json "
42+
SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json switch.json "
4343

4444
if [ "$HWSKU" == "Force10-S6000" ]; then
4545
SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json "

0 commit comments

Comments
 (0)