| tierno | c94c3df | 2018-02-09 15:38:54 +0100 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | |
| tierno | d125caf | 2018-11-22 16:05:54 +0000 | [diff] [blame] | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 12 | # implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| tierno | c94c3df | 2018-02-09 15:38:54 +0100 | [diff] [blame] | 16 | export NBI_URL=https://localhost:9999/osm |
| 17 | USERNAME=admin |
| 18 | PASSWORD=admin |
| 19 | PROJECT=admin |
| 20 | |
| tierno | c94c3df | 2018-02-09 15:38:54 +0100 | [diff] [blame] | 21 | #get token |
| tierno | f27c79b | 2018-03-12 17:08:42 +0100 | [diff] [blame] | 22 | 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] | 23 | |
| tierno | c94c3df | 2018-02-09 15:38:54 +0100 | [diff] [blame] | 24 | echo deleting all |
| 25 | #DELETE ALL |
| 26 | |
| tierno | f27c79b | 2018-03-12 17:08:42 +0100 | [diff] [blame] | 27 | 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] | 28 | do |
| 29 | 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}'` ; |
| 30 | do |
| 31 | 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 |
| 32 | done |
| 33 | done |
| 34 | |
| 35 | # curl --insecure ${NBI_URL}/test/prune |
| 36 | |