Skip to content

Commit

Permalink
generate otn linecards configuration at boot time and set bgp service…
Browse files Browse the repository at this point in the history
… as global service on otn platform
  • Loading branch information
sonic-otn committed Jan 11, 2024
1 parent 0ce1a5f commit f9c078f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
4 changes: 4 additions & 0 deletions files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@
"{{feature}}": {
"state": "{{state}}",
"delayed" : {{delayed | lower()}},
{%- if feature in ["bgp"] and sonic_asic_platform.startswith('ot-') %}
"has_global_scope": true,
{%- else %}
"has_global_scope": {% if feature + '.service' in installer_services.split(' ') %}true{% else %}false{% endif %},
{%- endif %}
{%- if feature in ["lldp"] %}
{%- if sonic_asic_platform.startswith('ot-') %}
"has_per_asic_scope": "False",
Expand Down
37 changes: 34 additions & 3 deletions files/image_config/config-setup/config-setup
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,37 @@ do_config_initialization()
sonic-db-cli CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
}

# Create OTN device SONiC configuration for first time bootup, it will generate global configration from init_cfg,
# and empty configruations for other asic namespaces
do_otn_config_initialization()
{
echo "init otn configuration"
need_reload_config=false

cfg_file_json_list=''
for cfg_file in $(get_config_db_file_list); do
cfg_file_json=${CONFIG_DB_PATH}${cfg_file}
if [ ! -e $cfg_file_json ]; then
need_reload_config=true

if [ ${cfg_file_json} = ${CONFIG_DB_JSON} ]; then
generate_config factory ${CONFIG_DB_JSON}
else
# For otn device, usr can plugin any linecard, system will generate linecard configuration
# when user start to provisioning a linecard. Generate an empty configuration file by default.
echo "{}" > ${cfg_file_json}
fi
fi
cfg_file_json_list+=','$cfg_file_json
done

if [ x"$need_reload_config" == x"true" ]; then
config reload -y -n $(cfg_file_json_list)
fi

sonic-db-cli CONFIG_DB SET "CONFIG_DB_INITIALIZED" "1"
}

# Restore config-setup post migration hooks from a backup copy
copy_post_migration_hooks()
{
Expand Down Expand Up @@ -431,10 +462,10 @@ boot_config()
if [[ ($NUM_ASIC -gt 1) ]]; then
# For otn platform, do config initialization here
if [[ $PALTFROM_ASIC = ot-* ]]; then
echo "init otn configuration"
else
return 0
do_otn_config_initialization
fi

return 0
fi

if [ -e /tmp/pending_config_initialization ] || [ -e ${CONFIG_SETUP_INITIALIZATION_FLAG} ]; then
Expand Down

0 comments on commit f9c078f

Please sign in to comment.