From 1a81715275dfd5e22225670462886d5bdde59ad6 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Sun, 29 Oct 2017 11:50:57 -0700 Subject: [PATCH] [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 --- dockers/docker-orchagent/Dockerfile.j2 | 7 +++---- dockers/docker-orchagent/start.sh | 1 + dockers/docker-orchagent/switch.json.j2 | 18 ++++++++++++++++++ dockers/docker-orchagent/swssconfig.sh | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 dockers/docker-orchagent/switch.json.j2 diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index b2d20383e3..9fba8d17b9 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -28,9 +28,8 @@ RUN rm -rf /debs COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"] -COPY ["mirror.json.j2", "/usr/share/sonic/templates/"] -COPY ["ports.json.j2", "/usr/share/sonic/templates/"] -COPY ["msn27xx.32ports.buffers.json.j2", "/usr/share/sonic/templates/"] + +## Copy all Jinja2 template files into the templates folder +COPY ["*.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-orchagent/start.sh b/dockers/docker-orchagent/start.sh index 0931321a94..bad88111c9 100755 --- a/dockers/docker-orchagent/start.sh +++ b/dockers/docker-orchagent/start.sh @@ -2,6 +2,7 @@ mkdir -p /etc/swss/config.d/ +sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/switch.json.j2 > /etc/swss/config.d/switch.json sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/mirror.json.j2 > /etc/swss/config.d/mirror.json sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json diff --git a/dockers/docker-orchagent/switch.json.j2 b/dockers/docker-orchagent/switch.json.j2 new file mode 100644 index 0000000000..7a8c3522ec --- /dev/null +++ b/dockers/docker-orchagent/switch.json.j2 @@ -0,0 +1,18 @@ +{# set default hash seed to 0 #} +{% set hash_seed = 0 %} +{% if DEVICE_METADATA.localhost.type %} +{% if DEVICE_METADATA.localhost.type == "ToRRouter" %} +{% set hash_seed = 10 %} +{% elif DEVICE_METADATA.localhost.type == "LeafRouter" %} +{% set hash_seed = 20 %} +{% endif %} +{% endif %} +[ + { + "SWITCH_TABLE:switch": { + "ecmp_hash_seed": "{{ hash_seed }}", + "lag_hash_seed": "{{ hash_seed }}" + }, + "OP": "SET" + } +] diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index f780ae8afb..c00d203a71 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -39,7 +39,7 @@ fast_reboot HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v "DEVICE_METADATA['localhost']['hwsku']"` -SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json " +SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json ports.json switch.json " if [ "$HWSKU" == "Force10-S6000" ]; then SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json "