[swss] Reduce Calls to SONiC Cfggen (#5177)
Calls to sonic-cfggen is CPU expensive. This PR reduces calls to sonic-cfggen to one call during startup when starting swss service. singed-off-by: Tamer Ahmed <tamer.ahmed@microsoft.com>
This commit is contained in:
parent
a10c5bfd02
commit
89f3206a3f
@ -2,10 +2,16 @@
|
|||||||
|
|
||||||
mkdir -p /etc/swss/config.d/
|
mkdir -p /etc/swss/config.d/
|
||||||
|
|
||||||
sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/switch.json.j2 > /etc/swss/config.d/switch.json
|
CFGGEN_PARAMS=" \
|
||||||
sonic-cfggen -d -t /usr/share/sonic/templates/ipinip.json.j2 > /etc/swss/config.d/ipinip.json
|
-d \
|
||||||
sonic-cfggen -d -t /usr/share/sonic/templates/ports.json.j2 > /etc/swss/config.d/ports.json
|
-y /etc/sonic/constants.yml \
|
||||||
sonic-cfggen -d -t /usr/share/sonic/templates/copp.json.j2 > /etc/swss/config.d/00-copp.config.json
|
-t /usr/share/sonic/templates/switch.json.j2,/etc/swss/config.d/switch.json \
|
||||||
|
-t /usr/share/sonic/templates/ipinip.json.j2,/etc/swss/config.d/ipinip.json \
|
||||||
|
-t /usr/share/sonic/templates/ports.json.j2,/etc/swss/config.d/ports.json \
|
||||||
|
-t /usr/share/sonic/templates/copp.json.j2,/etc/swss/config.d/00-copp.config.json \
|
||||||
|
-t /usr/share/sonic/templates/vlan_vars.j2 \
|
||||||
|
"
|
||||||
|
VLAN=$(sonic-cfggen $CFGGEN_PARAMS)
|
||||||
|
|
||||||
# Executed HWSKU specific initialization tasks.
|
# Executed HWSKU specific initialization tasks.
|
||||||
if [ -x /usr/share/sonic/hwsku/hwsku-init ]; then
|
if [ -x /usr/share/sonic/hwsku/hwsku-init ]; then
|
||||||
@ -13,7 +19,6 @@ if [ -x /usr/share/sonic/hwsku/hwsku-init ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Start arp_update when VLAN exists
|
# Start arp_update when VLAN exists
|
||||||
VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'`
|
|
||||||
if [ "$VLAN" != "" ]; then
|
if [ "$VLAN" != "" ]; then
|
||||||
cp /usr/share/sonic/templates/arp_update.conf /etc/supervisord/conf.d/
|
cp /usr/share/sonic/templates/arp_update.conf /etc/supervisord/conf.d/
|
||||||
fi
|
fi
|
||||||
|
1
dockers/docker-orchagent/vlan_vars.j2
Normal file
1
dockers/docker-orchagent/vlan_vars.j2
Normal file
@ -0,0 +1 @@
|
|||||||
|
{%- if VLAN -%}{{- VLAN.keys() | join(' ') -}}{%- endif -%}
|
Reference in New Issue
Block a user