[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 <shuche@microsoft.com>
This commit is contained in:
Shuotian Cheng 2017-10-29 11:50:57 -07:00 committed by GitHub
parent 2ba281829c
commit 1a81715275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 5 deletions

View File

@ -28,9 +28,8 @@ RUN rm -rf /debs
COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] COPY ["arp_update", "start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["ipinip.json.j2", "/usr/share/sonic/templates/"]
COPY ["mirror.json.j2", "/usr/share/sonic/templates/"] ## Copy all Jinja2 template files into the templates folder
COPY ["ports.json.j2", "/usr/share/sonic/templates/"] COPY ["*.j2", "/usr/share/sonic/templates/"]
COPY ["msn27xx.32ports.buffers.json.j2", "/usr/share/sonic/templates/"]
ENTRYPOINT ["/usr/bin/supervisord"] ENTRYPOINT ["/usr/bin/supervisord"]

View File

@ -2,6 +2,7 @@
mkdir -p /etc/swss/config.d/ 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/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/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 sonic-cfggen -m /etc/sonic/minigraph.xml -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json

View File

@ -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"
}
]

View File

@ -39,7 +39,7 @@ fast_reboot
HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -d -v "DEVICE_METADATA['localhost']['hwsku']"` 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 if [ "$HWSKU" == "Force10-S6000" ]; then
SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json "