nbi.py: initial commit for NetSlices with definition
[osm/NBI.git] / osm_nbi / tests / delete-all.sh
1 #! /bin/bash
2
3 export NBI_URL=https://localhost:9999/osm
4 USERNAME=admin
5 PASSWORD=admin
6 PROJECT=admin
7
8
9
10 #get token
11 TOKEN=`curl --insecure -H "Content-Type: application/yaml" -H "Accept: application/yaml" --data "{username: $USERNAME, password: $PASSWORD, project_id: $PROJECT}" ${NBI_URL}/admin/v1/tokens 2>/dev/null | awk '($1=="id:"){print $2}' ` ; echo $TOKEN
12
13
14 echo deleting all
15 #DELETE ALL
16
17 for url_item in nslcm/v1/ns_instances nsd/v1/ns_descriptors_content vnfpkgm/v1/vnf_packages_content
18 do
19 for ITEM_ID in `curl --insecure -w "%{http_code}\n" -H "Content-Type: application/yaml" -H "Accept: application/yaml" -H "Authorization: Bearer $TOKEN" ${NBI_URL}/${url_item} 2>/dev/null | awk '($1=="_id:") {print $2}'` ;
20 do
21 curl --insecure -w "%{http_code}\n" -H "Content-Type: application/yaml" -H "Accept: application/yaml" -H "Authorization: Bearer $TOKEN" ${NBI_URL}/${url_item}/$ITEM_ID -X DELETE
22 done
23 done
24
25 # curl --insecure ${NBI_URL}/test/prune
26