blob: 643b6070223cf797329bf59b330400d95f50c353 [file] [log] [blame]
tiernoc94c3df2018-02-09 15:38:54 +01001#! /bin/bash
2
tiernod125caf2018-11-22 16:05:54 +00003# 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
tiernoc94c3df2018-02-09 15:38:54 +010016export NBI_URL=https://localhost:9999/osm
17USERNAME=admin
18PASSWORD=admin
19PROJECT=admin
20
tiernoc94c3df2018-02-09 15:38:54 +010021#get token
tiernof27c79b2018-03-12 17:08:42 +010022TOKEN=`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
tiernoc94c3df2018-02-09 15:38:54 +010023
tiernoc94c3df2018-02-09 15:38:54 +010024echo deleting all
25#DELETE ALL
26
tiernof27c79b2018-03-12 17:08:42 +010027for url_item in nslcm/v1/ns_instances nsd/v1/ns_descriptors_content vnfpkgm/v1/vnf_packages_content
tiernoc94c3df2018-02-09 15:38:54 +010028do
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
33done
34
35# curl --insecure ${NBI_URL}/test/prune
36