| tierno | c94c3df | 2018-02-09 15:38:54 +0100 | [diff] [blame] | 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 |
| tierno | f27c79b | 2018-03-12 17:08:42 +0100 | [diff] [blame] | 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 |
| tierno | c94c3df | 2018-02-09 15:38:54 +0100 | [diff] [blame] | 12 | |
| 13 | |
| 14 | echo deleting all |
| 15 | #DELETE ALL |
| 16 | |
| tierno | f27c79b | 2018-03-12 17:08:42 +0100 | [diff] [blame] | 17 | for url_item in nslcm/v1/ns_instances nsd/v1/ns_descriptors_content vnfpkgm/v1/vnf_packages_content |
| tierno | c94c3df | 2018-02-09 15:38:54 +0100 | [diff] [blame] | 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 | |