[port_config] Introduce ad-hoc mport_config.json file (#8066)

Signed-off-by: Jing Kan jika@microsoft.com
This commit is contained in:
Blueve 2021-07-15 08:56:35 +08:00 committed by GitHub
parent e439676455
commit 3da6f12b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 2 deletions

View File

@ -117,7 +117,8 @@ clean_flash() {
[ $f != "old_config" ] &&
[ $f != "minigraph.xml" ] &&
[ $f != "snmp.yml" ] &&
[ $f != "acl.json" ]
[ $f != "acl.json" ] &&
[ $f != "port_config.json" ]
then
rm -rf "$target_path/$f"
fi

View File

@ -305,7 +305,7 @@ check_all_config_db_present()
do_config_migration()
{
# Identify list of files to migrate
copy_list="minigraph.xml snmp.yml acl.json frr telemetry"
copy_list="minigraph.xml snmp.yml acl.json port_config.json frr telemetry"
# Migrate all configuration files from old to new
copy_config_files_and_directories $copy_list

View File

@ -120,6 +120,8 @@ migrate_nos_configuration()
MG_FILE=$NOS_DIR/minigraph.xml
ACL_GZFILE=$NOS_DIR/acl.json.gz.base64.txt
ACL_FILE=$NOS_DIR/acl.json
PORT_CONFIG_GZFILE=$NOS_DIR/port_config.json.gz.base64.txt
PORT_CONFIG_FILE=$NOS_DIR/port_config.json
SNMP_FILE=$NOS_DIR/snmp.yml
mkdir -p $NOS_DIR
@ -131,11 +133,13 @@ migrate_nos_configuration()
# decode & unzip minigraph.xml.gz.base64.txt
[ -f $MG_GZFILE ] && /usr/bin/base64 -d $MG_GZFILE | /bin/gunzip > $MG_FILE
[ -f $ACL_GZFILE ] && /usr/bin/base64 -d $ACL_GZFILE | /bin/gunzip > $ACL_FILE
[ -f $PORT_CONFIG_GZFILE ] && /usr/bin/base64 -d $PORT_CONFIG_GZFILE | /bin/gunzip > $PORT_CONFIG_FILE
# Copy relevant files
nos_migration_import $NOS_DIR/mgmt_interface.cfg /host/migration
nos_migration_import $MG_FILE /host/migration
nos_migration_import $ACL_FILE /host/migration
nos_migration_import $PORT_CONFIG_FILE /host/migration
nos_migration_import $SNMP_FILE /host/migration
if [ "$sonic_fast_reboot" == true ]; then
@ -243,12 +247,14 @@ if [ -f $FIRST_BOOT_FILE ]; then
mkdir -p /etc/sonic/old_config
mv /host/minigraph.xml /etc/sonic/old_config/
[ -f /host/acl.json ] && mv /host/acl.json /etc/sonic/old_config/
[ -f /host/port_config.json ] && mv /host/port_config.json /etc/sonic/old_config/
[ -f /host/snmp.yml ] && mv /host/snmp.yml /etc/sonic/old_config/
touch /tmp/pending_config_migration
elif [ -n "$migration" ] && [ -f /host/migration/minigraph.xml ]; then
mkdir -p /etc/sonic/old_config
mv /host/migration/minigraph.xml /etc/sonic/old_config/
[ -f /host/migration/acl.json ] && mv /host/migration/acl.json /etc/sonic/old_config/
[ -f /host/migration/port_config.json ] && mv /host/migration/port_config.json /etc/sonic/old_config/
[ -f /host/migration/snmp.yml ] && mv /host/migration/snmp.yml /etc/sonic/old_config/
touch /tmp/pending_config_migration
[ -f /etc/sonic/updategraph.conf ] && sed -i -e "s/enabled=false/enabled=true/g" /etc/sonic/updategraph.conf

View File

@ -25,6 +25,7 @@ etc/sonic/acl.json
etc/sonic/config_db.json
etc/sonic/minigraph.xml
etc/sonic/old_config/.*
etc/sonic/port_config.json
etc/sonic/snmp.yml
etc/sonic/sonic-environment
etc/sonic/updategraph.conf