Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sonic-cfggen] Loading the configuration from init_cfg.json and then from config_db.json #4148

Merged
merged 4 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function postStartAction()
else
# If there is a config db dump file, load it
if [ -r /etc/sonic/config_db.json ]; then
sonic-cfggen -j /etc/sonic/config_db.json --write-to-db
sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --write-to-db
jleveque marked this conversation as resolved.
Show resolved Hide resolved
fi

if [[ "$BOOT_TYPE" == "fast" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion files/image_config/config-setup/config-setup
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ reload_minigraph()
echo "{}" > /etc/sonic/init_cfg.json
fi
sonic-db-cli CONFIG_DB FLUSHDB
sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --write-to-db
sonic-cfggen -H -j /etc/sonic/init_cfg.json -m --write-to-db
jleveque marked this conversation as resolved.
Show resolved Hide resolved
sonic-db-cli CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
if [ -f /etc/sonic/acl.json ]; then
acl-loader update full /etc/sonic/acl.json
Expand Down
2 changes: 1 addition & 1 deletion files/image_config/updategraph/updategraph
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ reload_minigraph()
echo "{}" > /etc/sonic/init_cfg.json
fi
sonic-db-cli CONFIG_DB FLUSHDB
sonic-cfggen -H -m -j /etc/sonic/init_cfg.json --write-to-db
sonic-cfggen -H -j /etc/sonic/init_cfg.json -m --write-to-db
sonic-db-cli CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
if [ -f /etc/sonic/acl.json ]; then
acl-loader update full /etc/sonic/acl.json
Expand Down
2 changes: 1 addition & 1 deletion files/scripts/configdb-load.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ done

# If there is a config db dump file, load it
if [ -r /etc/sonic/config_db.json ]; then
sonic-cfggen -j /etc/sonic/config_db.json --write-to-db
sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --write-to-db
jleveque marked this conversation as resolved.
Show resolved Hide resolved
fi

sonic-db-cli CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
2 changes: 1 addition & 1 deletion platform/p4/docker-sonic-p4/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json

if [ -f /etc/sonic/config_db.json ]; then
sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --print-data > /tmp/config_db.json
sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --print-data > /tmp/config_db.json
mv /tmp/config_db.json /etc/sonic/config_db.json
else
sonic-cfggen -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json
Expand Down
2 changes: 1 addition & 1 deletion platform/vs/docker-sonic-vs/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' --print-data > /etc/sonic/init_cfg.json

if [ -f /etc/sonic/config_db.json ]; then
sonic-cfggen -j /etc/sonic/config_db.json -j /etc/sonic/init_cfg.json --print-data > /tmp/config_db.json
sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --print-data > /tmp/config_db.json
mv /tmp/config_db.json /etc/sonic/config_db.json
else
# generate and merge buffers configuration into config file
Expand Down