X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Ftest%2Fdelete-all.sh;fp=osm_nbi%2Ftest%2Fdelete-all.sh;h=6b0453868541df6dae81b20501fb98151d5a3806;hb=c94c3df90aa64298a7935a80b221f80f3c043260;hp=0000000000000000000000000000000000000000;hpb=22ed16460edb54806e9b957be18cbafb2f63b54d;p=osm%2FNBI.git diff --git a/osm_nbi/test/delete-all.sh b/osm_nbi/test/delete-all.sh new file mode 100755 index 0000000..6b04538 --- /dev/null +++ b/osm_nbi/test/delete-all.sh @@ -0,0 +1,26 @@ +#! /bin/bash + +export NBI_URL=https://localhost:9999/osm +USERNAME=admin +PASSWORD=admin +PROJECT=admin + + + +#get token +TOKEN=`curl --insecure -H "Content-Type: application/yaml" -H "Accept: application/yaml" --data "{username: $USERNAME, password: $PASSWORD, project_id: $PROJECT}" ${NBI_URL}/token/v1 2>/dev/null | awk '($1=="id:"){print $2}' ` ; echo $TOKEN + + +echo deleting all +#DELETE ALL + +for url_item in nslcm/v1/ns_instances nsd/v1/ns_descriptors vnfpkgm/v1/vnf_packages +do + 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}'` ; + do + 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 + done +done + +# curl --insecure ${NBI_URL}/test/prune +