Upgrading SDNC with export/import of data



High level steps



  1. run daexim to export mdsal

  2. run sqldump to export mariadb data (just in case)

  3. copy the files to backup directory

  4. helm delete/undelply --purge of sdnc

  5. cleanup k8 pvc, pv, secrets (modify cleanup.sh to not remove mariadb database

  6. DON'T remove dockerdata-nfs data

  7. helm deploy dev-sdnc .... for normal upgrade

  8. copy daexim json file to dockerdata-nfs/dev-sdnc/sdnc/mdsal0 if you mistakenly removed the dockerdata-nfs

  9. run daexim import of mdsal

  10. if mariadb was cleaned run mysqldump to import the databsase backup







Export Script (exportMdsal.sh)

Replace ODL_IP with your k8 host IP of sdnc-0 or set  ODL_IP in your environment

#! /bin/bash


ODL_USER=${ODL_USER:-admin}
ODL_PWD=${ODL_PWD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
ODL_IP=${ODL_IP:-10.12.5.100}

curl -s -S -k -v -X POST -u ${ODL_USER}:${ODL_PWD} -H 'Content-Type: application/json' -d '{ "input": { "data-export-import:run-at": 10, "data-export-import:local-node-only": false } }' https://${ODL_IP}:30267/restconf/operations/data-export-import:schedule-export | python -mjson.tool



Import Script (importMdsal.sh)

Replace ODL_IP with your k8 host IP of sdnc-0 or set  ODL_IP in your environment

Make sure the backup json files are in /dockerdata-nfs/dev-sdnc/sdnc/mdsal0



root@release-nfs:~/sdnc# ls -l /dockerdata-nfs/dev-sdnc/sdnc/mdsal0
total 388
drwxr-xr-x 2 systemd-network systemd-journal 4096 Oct 7 05:30 boot
-rw-r--r-- 1 systemd-network systemd-journal 240673 Oct 10 15:25 odl_backup_config.json
-rw-r--r-- 1 systemd-network systemd-journal 5649 Oct 10 15:25 odl_backup_models.json
-rw-r--r-- 1 systemd-network systemd-journal 141530 Oct 10 15:25 odl_backup_operational.json





#! /bin/bash

ODL_USER=${ODL_USER:-admin}
ODL_PWD=${ODL_PWD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
ODL_IP=${ODL_IP:-10.12.5.100}

curl -s -S -k -v -X POST -u ${ODL_USER}:${ODL_PWD} -H 'Content-Type: application/json' -d '{ "input" : { "check-models" : true, "clear-stores" : "all" } }' https://${ODL_IP}:30267/restconf/operations/data-export-import:immediate-import



If you get an error on netconf clustering not found make sure that the clustering:true setting is the same in both the export and the import ODL.

Mariadb Export/Dump

Log into the mariadb container via kubectl exec -it ...

mysqldump -u sdnctl -p sdnctl > sdnctl.dump

[kubectl cp sdnctl.dump out of the container]

Mariadb Import

Copy the dump into the mariadb container

Log into the mariadb container via kubectl exec -it

mysql -u sdnctl -p sdnctl < sdnctl.dump