summaryrefslogtreecommitdiffstats
path: root/ms/gra/gra-docker/src/main/scripts
diff options
context:
space:
mode:
authorTimoney, Dan (dt5972) <dt5972@att.com>2021-10-29 14:47:40 -0400
committerDan Timoney <dtimoney@att.com>2021-11-01 10:17:41 -0400
commit5b935a9086ec1080f896b9a71c52283122aa0163 (patch)
treef28aee1327e5b6c8ad423dec5950d46f66ac201b /ms/gra/gra-docker/src/main/scripts
parent53b2788231f5ab3aeda4f09e1445a02c3a3b6be9 (diff)
Sync local changes to support GRA microservice
Sync changes made downstream to support GRA microservice Change-Id: If3bf5d879f7d61ab91209c63b0344d78128246a8 Issue-ID: CCSDK-3504 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'ms/gra/gra-docker/src/main/scripts')
-rw-r--r--ms/gra/gra-docker/src/main/scripts/chmodScripts.sh3
-rwxr-xr-xms/gra/gra-docker/src/main/scripts/compareContrail.sh55
-rwxr-xr-xms/gra/gra-docker/src/main/scripts/comparePortmirror.sh55
-rwxr-xr-xms/gra/gra-docker/src/main/scripts/comparePreload.sh55
-rwxr-xr-xms/gra/gra-docker/src/main/scripts/compareSvc.sh55
-rw-r--r--ms/gra/gra-docker/src/main/scripts/exportGraDaexim.sh40
-rw-r--r--ms/gra/gra-docker/src/main/scripts/graToMdsal.sh104
-rwxr-xr-xms/gra/gra-docker/src/main/scripts/importGraDaexim.sh207
8 files changed, 574 insertions, 0 deletions
diff --git a/ms/gra/gra-docker/src/main/scripts/chmodScripts.sh b/ms/gra/gra-docker/src/main/scripts/chmodScripts.sh
new file mode 100644
index 0000000..50d959f
--- /dev/null
+++ b/ms/gra/gra-docker/src/main/scripts/chmodScripts.sh
@@ -0,0 +1,3 @@
+#/bin/bash
+echo $(pwd)
+chmod 755 target/docker-stage/opt/sdnc/gra/bin/startGra.sh
diff --git a/ms/gra/gra-docker/src/main/scripts/compareContrail.sh b/ms/gra/gra-docker/src/main/scripts/compareContrail.sh
new file mode 100755
index 0000000..5c613e7
--- /dev/null
+++ b/ms/gra/gra-docker/src/main/scripts/compareContrail.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+if [ $# -eq 2 ]
+then
+ verbose=false
+ file1=$1
+ file2=$2
+elif [ $# -eq 3 -a $1 = "-v" ]
+then
+ verbose=true
+ file1=$2
+ file2=$3
+else
+ echo "Usage: $0 [-v] file1 file2"
+ exit 1
+fi
+
+tmppfx=contrail$$
+
+formattedfile1=/tmp/$tmppfx-formatted1
+formattedfile2=/tmp/$tmppfx-formatted2
+idlist1=/tmp/$tmppfx-contrail-ids-1
+idlist2=/tmp/$tmppfx-contrail-ids-2
+
+
+echo "Comparing $file1 to $file2 ...."
+
+cat $file1 | python3 -mjson.tool > $formattedfile1
+cat $file2 | python3 -mjson.tool > $formattedfile2
+
+cat $formattedfile1 | grep '"allotted-resource-id":' | cut -d: -f2 | sed -e "s/,$//" -e 's/\"//g' -e '/^[[:space:]]*$/d' | sort -u > $idlist1
+cat $formattedfile2 | grep '"allotted-resource-id":' | cut -d: -f2 | sed -e "s/,$//" -e 's/\"//g' -e '/^[[:space:]]*$/d' | sort -u > $idlist2
+
+echo
+echo "Diff of allotted resource ids:"
+echo "------------------------------"
+diff $idlist1 $idlist2
+
+if [ "$verbose" = "true" ]
+then
+ echo
+ echo "Full diff:"
+ echo "----------"
+ diff $formattedfile1 $formattedfile2
+fi
+
+echo
+echo "Allotted resource counts:"
+echo "-------------------------"
+echo " $file1 : $(cat $idlist1 | wc -l)"
+echo " $file2 : $(cat $idlist2 | wc -l)"
+
+
+
+
diff --git a/ms/gra/gra-docker/src/main/scripts/comparePortmirror.sh b/ms/gra/gra-docker/src/main/scripts/comparePortmirror.sh
new file mode 100755
index 0000000..5a39660
--- /dev/null
+++ b/ms/gra/gra-docker/src/main/scripts/comparePortmirror.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+if [ $# -eq 2 ]
+then
+ verbose=false
+ file1=$1
+ file2=$2
+elif [ $# -eq 3 -a $1 = "-v" ]
+then
+ verbose=true
+ file1=$2
+ file2=$3
+else
+ echo "Usage: $0 [-v] file1 file2"
+ exit 1
+fi
+
+tmppfx=portmirror$$
+
+formattedfile1=/tmp/$tmppfx-formatted1
+formattedfile2=/tmp/$tmppfx-formatted2
+idlist1=/tmp/$tmppfx-configuration-ids-1
+idlist2=/tmp/$tmppfx-configuration-ids-2
+
+
+echo "Comparing $file1 to $file2 ...."
+
+cat $file1 | python3 -mjson.tool > $formattedfile1
+cat $file2 | python3 -mjson.tool > $formattedfile2
+
+cat $formattedfile1 | grep '"configuration-id":' | cut -d: -f2 | sed -e "s/,$//" -e 's/\"//g' -e '/^[[:space:]]*$/d' | sort -u > $idlist1
+cat $formattedfile2 | grep '"configuration-id":' | cut -d: -f2 | sed -e "s/,$//" -e 's/\"//g' -e '/^[[:space:]]*$/d' | sort -u > $idlist2
+
+echo
+echo "Diff of configuration ids:"
+echo "--------------------------"
+diff $idlist1 $idlist2
+
+if [ "$verbose" = "true" ]
+then
+ echo
+ echo "Full diff:"
+ echo "----------"
+ diff $formattedfile1 $formattedfile2
+fi
+
+echo
+echo "Configuration counts:"
+echo "---------------------"
+echo " $file1 : $(cat $idlist1 | wc -l)"
+echo " $file2 : $(cat $idlist2 | wc -l)"
+
+
+
+
diff --git a/ms/gra/gra-docker/src/main/scripts/comparePreload.sh b/ms/gra/gra-docker/src/main/scripts/comparePreload.sh
new file mode 100755
index 0000000..4e8ab79
--- /dev/null
+++ b/ms/gra/gra-docker/src/main/scripts/comparePreload.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+if [ $# -eq 2 ]
+then
+ verbose=false
+ file1=$1
+ file2=$2
+elif [ $# -eq 3 -a $1 = "-v" ]
+then
+ verbose=true
+ file1=$2
+ file2=$3
+else
+ echo "Usage: $0 [-v] file1 file2"
+ exit 1
+fi
+
+tmppfx=preload$$
+
+formattedfile1=/tmp/$tmppfx-formatted1
+formattedfile2=/tmp/$tmppfx-formatted2
+idlist1=/tmp/$tmppfx-preload-ids-1
+idlist2=/tmp/$tmppfx-preload-ids-2
+
+
+echo "Comparing $file1 to $file2 ...."
+
+cat $file1 | python3 -mjson.tool > $formattedfile1
+cat $file2 | python3 -mjson.tool > $formattedfile2
+
+cat $formattedfile1 | grep '"preload-id":' | cut -d: -f2 | sed -e "s/,$//" -e 's/\"//g' -e '/^[[:space:]]*$/d' | sort -u > $idlist1
+cat $formattedfile2 | grep '"preload-id":' | cut -d: -f2 | sed -e "s/,$//" -e 's/\"//g' -e '/^[[:space:]]*$/d' | sort -u > $idlist2
+
+echo
+echo "Diff of preload ids:"
+echo "--------------------"
+diff $idlist1 $idlist2
+
+if [ "$verbose" = "true" ]
+then
+ echo
+ echo "Full diff:"
+ echo "----------"
+ diff $formattedfile1 $formattedfile2
+fi
+
+echo
+echo "Preload id counts:"
+echo "------------------"
+echo " $file1 : $(cat $idlist1 | wc -l)"
+echo " $file2 : $(cat $idlist2 | wc -l)"
+
+
+
+
diff --git a/ms/gra/gra-docker/src/main/scripts/compareSvc.sh b/ms/gra/gra-docker/src/main/scripts/compareSvc.sh
new file mode 100755
index 0000000..0c977b5
--- /dev/null
+++ b/ms/gra/gra-docker/src/main/scripts/compareSvc.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+if [ $# -eq 2 ]
+then
+ verbose=false
+ file1=$1
+ file2=$2
+elif [ $# -eq 3 -a $1 = "-v" ]
+then
+ verbose=true
+ file1=$2
+ file2=$3
+else
+ echo "Usage: $0 [-v] file1 file2"
+ exit 1
+fi
+
+tmppfx=svc$$
+
+formattedfile1=/tmp/$tmppfx-formatted1
+formattedfile2=/tmp/$tmppfx-formatted2
+svcinstancelist1=/tmp/$tmppfx-svc-instance-ids-1
+svcinstancelist2=/tmp/$tmppfx-svc-instance-ids-2
+
+
+echo "Comparing $file1 to $file2 ...."
+
+cat $file1 | python3 -mjson.tool > $formattedfile1
+cat $file2 | python3 -mjson.tool > $formattedfile2
+
+cat $formattedfile1 | grep '"service-instance-id":' | cut -d: -f2 | sed -e "s/,$//" -e 's/\"//g' -e '/^[[:space:]]*$/d' | sort -u > $svcinstancelist1
+cat $formattedfile2 | grep '"service-instance-id":' | cut -d: -f2 | sed -e "s/,$//" -e 's/\"//g' -e '/^[[:space:]]*$/d' | sort -u > $svcinstancelist2
+
+echo
+echo "Diff of service instance ids:"
+echo "-----------------------------"
+diff $svcinstancelist1 $svcinstancelist2
+
+if [ "$verbose" = "true" ]
+then
+ echo
+ echo "Full diff:"
+ echo "----------"
+ diff $formattedfile1 $formattedfile2
+fi
+
+echo
+echo "Service instance counts:"
+echo "------------------------"
+echo " $file1 : $(cat $svcinstancelist1 | wc -l)"
+echo " $file2 : $(cat $svcinstancelist2 | wc -l)"
+
+
+
+
diff --git a/ms/gra/gra-docker/src/main/scripts/exportGraDaexim.sh b/ms/gra/gra-docker/src/main/scripts/exportGraDaexim.sh
new file mode 100644
index 0000000..08da8b0
--- /dev/null
+++ b/ms/gra/gra-docker/src/main/scripts/exportGraDaexim.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+ODL_USER=${ODL_USER:-m27434@dev.sdncp.att.com}
+ODL_PASSWORD=${AAF_MECHID_CRED:-admin}
+ODL_URI=${ODL_URI:-https://localhost:8443}
+
+export TMPDIR=/tmp/daexim-$$
+
+if [ $# -ne 1 ]
+then
+ echo "Usage: $0 filename"
+ exit 1
+fi
+
+
+set -e
+
+mkdir $TMPDIR
+
+if [[ $1 == /* ]]
+then
+ tarfile=$1
+else
+ tarfile=$TMPDIR/$1
+fi
+
+echo "Exporting services ..."
+curl -k -u${ODL_USER}:${ODL_PASSWORD} ${ODL_URI}/restconf/config/GENERIC-RESOURCE-API:services/ > ${TMPDIR}/services_config.json
+echo "Exporting contrail data ..."
+curl -k -u${ODL_USER}:${ODL_PASSWORD} ${ODL_URI}/restconf/config/GENERIC-RESOURCE-API:contrail-route-allotted-resources/ > ${TMPDIR}/contrail_config.json
+echo "Exporting port mirror data ..."
+curl -k -u${ODL_USER}:${ODL_PASSWORD} ${ODL_URI}/restconf/config/GENERIC-RESOURCE-API:port-mirror-configurations/ > ${TMPDIR}/portmirror_config.json
+echo "Exporting preload data ..."
+curl -k -u${ODL_USER}:${ODL_PASSWORD} ${ODL_URI}/restconf/config/GENERIC-RESOURCE-API:preload-information/ > ${TMPDIR}/preload_config.json
+
+cd $TMPDIR
+tar czf $tarfile ./*.json
+
+echo Exported data is in $tarfile
+
diff --git a/ms/gra/gra-docker/src/main/scripts/graToMdsal.sh b/ms/gra/gra-docker/src/main/scripts/graToMdsal.sh
new file mode 100644
index 0000000..9fb62f8
--- /dev/null
+++ b/ms/gra/gra-docker/src/main/scripts/graToMdsal.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+# Copies data from NFT Azure GRA node and stores in MDSAL in NFT EOM
+
+TMPNAME=gra-mdsal-$$
+
+if [ $# -eq 2 ]
+then
+ fetchFile=false
+ NFT_AZURE_EXPORT_FILE=$1
+ NFT_EOM_URL=$2
+elif [ $# -eq 3 ]
+then
+ fetchFile=true
+ NFT_AZURE_EXPORT_FILE=$TMPNAME.tar.gz
+ NFT_AZURE_NAMESPACE=$1
+ NFT_AZURE_GRA_POD=$2
+ NFT_EOM_URL=$3
+else
+ echo "Usage: $0 {export-file-name | nft-namespace gra-pod-name} eom-url"
+ exit 1
+fi
+
+
+# Credentials configuration
+NFT_AZURE_USER=${NFT_AZURE_USER:-m27434@dev.sdncp.att.com}
+NFT_AZURE_PASSWORD=${NFT_AZURE_PASSWORD:-sdncp20190501}
+NFT_EOM_USER=${NFT_EOM_USER:-admin}
+NFT_EOM_PASSWORD=${NFT_EOM_PASSWORD:-admin}
+
+set -e
+
+TMPNAME=gra-mdsal-$$
+mkdir /tmp/$TMPNAME
+
+if [ "$fetchFile" = "true" ]
+then
+ # Export data on Azure
+ kubectl -n $NFT_AZURE_NAMESPACE exec -ti $NFT_AZURE_GRA_POD -c gra -- env ODL_USER=$NFT_AZURE_USER AAF_MECHID_CRED=$NFT_AZURE_PASSWORD /opt/sdnc/gra/bin/exportGraDaexim.sh /tmp/$NFT_AZURE_EXPORT_FILE
+
+
+ # Put exported data to NFT EOM
+ kubectl -n $NFT_AZURE_NAMESPACE cp $NFT_AZURE_GRA_POD:/tmp/$NFT_AZURE_EXPORT_FILE /tmp/$TMPNAME/$NFT_AZURE_EXPORT_FILE
+else
+ cp $NFT_AZURE_EXPORT_FILE /tmp/$TMPNAME
+fi
+
+cd /tmp/$TMPNAME
+tar xzf $NFT_AZURE_EXPORT_FILE
+
+# Massage files and create daexim input
+echo "{" > lsc_backup_config_$TMPNAME.json
+addComma=false
+if [ -f services_config.json ]
+then
+ echo "Converting service data ..."
+ cat services_config.json | python3 -mjson.tool | sed -e "s/services/GENERIC-RESOURCE-API:services/" -e "/\"gateway-address\": \"\"/d" > services_config_upd.json
+ cat services_config_upd.json | sed -e "1s/{//" -e "$ s/}//" >> lsc_backup_config_$TMPNAME.json
+ addComma=true
+fi
+
+if [ -f contrail_config.json ]
+then
+ if [ "$addComma" = "true" ]
+ then
+ echo "," >> lsc_backup_config_$TMPNAME.json
+ fi
+ cat contrail_config.json | sed -e "s/{//" -e "s/contrail-route-allotted-resources/GENERIC-RESOURCE-API:contrail-route-allotted-resources/" -e "s/}$//" >> lsc_backup_config_$TMPNAME.json
+ addComma=true
+fi
+
+if [ -f portmirror_config.json ]
+then
+ if [ "$addComma" = "true" ]
+ then
+ echo "," >> lsc_backup_config_$TMPNAME.json
+ fi
+ cat portmirror_config.json | sed -e "s/{//" -e "s/port-mirror-configurations/GENERIC-RESOURCE-API:port-mirror-configurations/" -e "s/}$//" >> lsc_backup_config_$TMPNAME.json
+ addComma=true
+fi
+
+echo "}" >> lsc_backup_config_$TMPNAME.json
+
+echo "Exported data files are in /tmp/$TMPNAME"
+
+if [ -f services_config_upd.json ]
+then
+ echo "Importing service data ..."
+ curl -k -v -u${NFT_EOM_USER}:${NFT_EOM_PASSWORD} -H "Content-Type: application/json" -X PUT -d@services_config_upd.json ${NFT_EOM_URL}/restconf/config/GENERIC-RESOURCE-API:services/
+fi
+
+if [ -f contrail_config.json ]
+then
+ echo "Importing contrail data ..."
+ curl -k -v -u${NFT_EOM_USER}:${NFT_EOM_PASSWORD} -H "Content-Type: application/json" -X PUT -d@contrail_config.json ${NFT_EOM_URL}/restconf/config/GENERIC-RESOURCE-API:contrail-route-allotted-resources/
+fi
+
+if [ -f portmirror_config.json ]
+then
+ echo "Importing port mirror data ..."
+ curl -k -v -u${NFT_EOM_USER}:${NFT_EOM_PASSWORD} -H "Content-Type: application/json" -X PUT -d@portmirror_config.json ${NFT_EOM_URL}/restconf/config/GENERIC-RESOURCE-API:port-mirror-configurations/
+fi
+
+
diff --git a/ms/gra/gra-docker/src/main/scripts/importGraDaexim.sh b/ms/gra/gra-docker/src/main/scripts/importGraDaexim.sh
new file mode 100755
index 0000000..2c90421
--- /dev/null
+++ b/ms/gra/gra-docker/src/main/scripts/importGraDaexim.sh
@@ -0,0 +1,207 @@
+#!/bin/bash
+
+export CHUNK_SIZE=${CHUNK_SIZE:-75}
+set -e
+CURLFLAGS="--silent --show-error"
+if [ $# -eq 3 ]
+then
+ if [ "$1" != "-v" ]
+ then
+ echo "Usage: $0 [-v] filename controller-url"
+ exit 1
+ fi
+ CURLFLAGS="-v"
+ filename=$2
+ url=$3
+elif [ $# -eq 2 ]
+then
+ filename=$1
+ url=$2
+else
+ echo "Usage: $0 [-v] filename controller-url"
+ exit 1
+fi
+
+ODL_USER=${ODL_USER:-admin}
+ODL_PASSWORD=${ODL_PASSWORD:-admin}
+
+
+export TMPDIR=/tmp/daexim-$$
+# Unzip file
+if [[ "$filename" == *.zip ]]
+then
+ unzip -qd $TMPDIR $filename
+ DAEXIM_CONFIG=$(find $TMPDIR -name *config.json)
+elif [[ "$filename" == *config.json ]]
+then
+ mkdir $TMPDIR
+ DAEXIM_CONFIG=$filename
+else
+ echo "$filename is not a recognized format"
+ exit 1
+fi
+
+
+
+cat ${DAEXIM_CONFIG} | python3 -c '
+import sys,json,os
+
+data = json.load(sys.stdin)
+
+chunk_size = int(os.environ["CHUNK_SIZE"])
+if chunk_size == "":
+ chunk_size = 75
+
+if "GENERIC-RESOURCE-API:services" in data:
+ chunk = 0
+ lineno = chunk_size
+ f = None
+ for service in data["GENERIC-RESOURCE-API:services"]["service"]:
+ if lineno >= chunk_size:
+ chunk = chunk+1
+ lineno = 1
+ if f != None:
+ print ("]}}", file=f)
+ f.flush()
+ f.close()
+ outfile = os.environ["TMPDIR"] + "/config_gra_services_"+str(chunk).zfill(3)+".json"
+ f = open(outfile, "w")
+ print("{\"services\":", file=f, end="")
+ print("{\"service\":[", file=f, end="")
+ json.dump(service, f)
+ else:
+ lineno = lineno+1
+ print(",",file=f, end="")
+ json.dump(service, f)
+ if f != None:
+ print("]}}", file=f)
+ f.flush()
+ f.close()
+ print("Split "+str(len(data["GENERIC-RESOURCE-API:services"]["service"]))+ " services into "+str(chunk)+" chunks")
+
+if "GENERIC-RESOURCE-API:contrail-route-allotted-resources" in data:
+ chunk = 0
+ lineno = chunk_size
+ f = None
+ for contrail_route in data["GENERIC-RESOURCE-API:contrail-route-allotted-resources"]["contrail-route-allotted-resource"]:
+ if lineno >= chunk_size:
+ chunk = chunk+1
+ lineno = 1
+ if f != None:
+ print ("]}}", file=f)
+ f.flush()
+ f.close()
+ outfile = os.environ["TMPDIR"] + "/config_gra_contrail_"+str(chunk).zfill(3)+".json"
+ f = open(outfile, "w")
+ print("{\"contrail-route-allotted-resources\":", file=f, end="")
+ print("{\"contrail-route-allotted-resource\":[", file=f, end="")
+ json.dump(contrail_route, f)
+ else:
+ lineno = lineno+1
+ print(",",file=f, end="")
+ json.dump(contrail_route, f)
+ if f != None:
+ print("]}}", file=f)
+ f.flush()
+ f.close()
+ print("Split "+ str(len(data["GENERIC-RESOURCE-API:contrail-route-allotted-resources"]["contrail-route-allotted-resource"]))+ " contrail-route-allotted-services into "+str(chunk)+" chunks")
+
+if "GENERIC-RESOURCE-API:port-mirror-configurations" in data:
+ chunk = 0
+ lineno = chunk_size
+ f = None
+ for port_mirror in data["GENERIC-RESOURCE-API:port-mirror-configurations"]["port-mirror-configuration"]:
+ if lineno >= chunk_size:
+ chunk = chunk+1
+ lineno = 1
+ if f != None:
+ print ("]}}", file=f)
+ f.flush()
+ f.close()
+ outfile = os.environ["TMPDIR"] + "/config_gra_port_mirror_"+str(chunk).zfill(3)+".json"
+ f = open(outfile, "w")
+ print("{\"port-mirror-configurations\":", file=f, end="")
+ print("{\"port-mirror-configuration\":[", file=f, end="")
+ json.dump(port_mirror, f)
+ else:
+ lineno = lineno+1
+ print(",",file=f, end="")
+ json.dump(port_mirror, f)
+ if f != None:
+ print("]}}", file=f)
+ f.flush()
+ f.close()
+ print("Split "+str(len(data["GENERIC-RESOURCE-API:port-mirror-configurations"]["port-mirror-configuration"]))+" port-mirror-configuration into "+str(chunk)+" chunks")
+
+if "GENERIC-RESOURCE-API:preload-information" in data:
+ chunk = 0
+ lineno = chunk_size
+ f = None
+ for preload in data["GENERIC-RESOURCE-API:preload-information"]["preload-list"]:
+ if lineno >= chunk_size:
+ chunk = chunk+1
+ lineno = 0
+ if f != None:
+ print ("]}}", file=f)
+ f.flush()
+ f.close()
+ outfile = os.environ["TMPDIR"] + "/config_gra_preloads_"+str(chunk).zfill(3)+".json"
+ f = open(outfile, "w")
+ print("{\"preload-information\":", file=f, end="")
+ print("{\"preload-list\":[", file=f, end="")
+ json.dump(preload, f)
+ else:
+ lineno = lineno+1
+ print(",",file=f, end="")
+ json.dump(preload, f)
+ if f != None:
+ print("]}}", file=f)
+ f.flush()
+ f.close()
+ print ("Split "+str(len(data["GENERIC-RESOURCE-API:preload-information"]["preload-list"]))+" preloads into "+str(chunk)+" chunks")'
+
+first=true
+
+if [ $(ls -1 $TMPDIR/config_gra_services_*.json 2>/dev/null | wc -l) -gt 0 ]
+then
+ echo "Transferring services data ..."
+ for file in $(ls $TMPDIR/config_gra_services_*.json)
+ do
+ echo "Transferring file $file ..."
+ curl ${CURLFLAGS} --fail -k -u${ODL_USER}:${ODL_PASSWORD} -H "Content-Type: application/json" -X PUT -d@$file ${url}/restconf/config/GENERIC-RESOURCE-API:services/
+ done
+fi
+
+if [ $(ls -1 $TMPDIR/config_gra_contrail_*.json 2>/dev/null | wc -l) -gt 0 ]
+then
+ echo "Transferring contrail data ..."
+ for file in $(ls $TMPDIR/config_gra_contrail_*.json)
+ do
+ echo "Transferring file $file ..."
+ curl ${CURLFLAGS} --fail -k -u${ODL_USER}:${ODL_PASSWORD} -H "Content-Type: application/json" -X PUT -d@$file ${url}/restconf/config/GENERIC-RESOURCE-API:contrail-route-allotted-resources/
+ done
+fi
+
+if [ $(ls -1 $TMPDIR/config_gra_port_mirror_*.json 2>/dev/null | wc -l) -gt 0 ]
+then
+ echo "Transferring port mirror data ..."
+ for file in $(ls $TMPDIR/config_gra_port_mirror_*.json)
+ do
+ echo "Transferring file $file ..."
+ curl ${CURLFLAGS} --fail -k -u${ODL_USER}:${ODL_PASSWORD} -H "Content-Type: application/json" -X PUT -d@$file ${url}/restconf/config/GENERIC-RESOURCE-API:port-mirror-configurations/
+ done
+fi
+
+if [ $(ls -1 $TMPDIR/config_gra_preloads_*.json 2>/dev/null | wc -l) -gt 0 ]
+then
+ echo "Transferring preload data ..."
+ first=true
+ for file in $(ls $TMPDIR/config_gra_preloads_*.json)
+ do
+ echo "Transferring file $file ..."
+ curl ${CURLFLAGS} --fail -k -u${ODL_USER}:${ODL_PASSWORD} -H "Content-Type: application/json" -X PUT -d@$file ${url}/restconf/config/GENERIC-RESOURCE-API:preload-information/
+ done
+fi
+
+rm -rf $TMPDIR
+echo "Done!" \ No newline at end of file