X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Ftests%2Fclear-all.sh;h=dc9dca7335824b9ba1a44162f88d814978e9802c;hp=5a9a9c69b45a09a3721446b318bd392f9ec0fe77;hb=70434c15924602743b05f4fcb745fabc94445c59;hpb=cd54a4add397e6f0921a77e97444d32c7a748975 diff --git a/osm_nbi/tests/clear-all.sh b/osm_nbi/tests/clear-all.sh index 5a9a9c6..dc9dca7 100755 --- a/osm_nbi/tests/clear-all.sh +++ b/osm_nbi/tests/clear-all.sh @@ -1,4 +1,18 @@ #! /bin/bash + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # author: Alfonso Tierno # Script that uses the test NBI URL to clean database. See usage @@ -10,6 +24,7 @@ function usage(){ echo -e " OPTIONS" echo -e " -h --help: show this help" echo -e " -f --force: Do not ask for confirmation" + echo -e " --completely: It cleans also user admin. NBI will need to be restarted to init database" echo -e " --clean-RO: clean RO content. RO client (openmano) must be installed and configured" echo -e " --clean-VCA: clean VCA content. juju must be installed and configured" echo -e " ENV variable 'OSMNBI_URL' is used for the URL of the NBI server. If missing, it uses" \ @@ -38,6 +53,7 @@ do shift ( [ "$option" == -h ] || [ "$option" == --help ] ) && usage && exit ( [ "$option" == -f ] || [ "$option" == --force ] ) && OSMNBI_CLEAN_FORCE=yes && continue + [ "$option" == --completely ] && OSMNBI_COMPLETELY=yes && continue [ "$option" == --clean-RO ] && OSMNBI_CLEAN_RO=yes && continue [ "$option" == --clean-VCA ] && OSMNBI_CLEAN_VCA=yes && continue echo "Unknown option '$option'. Type $0 --help" 2>&1 && exit 1 @@ -64,13 +80,18 @@ then done fi -for item in vim_accounts vims sdns nsrs vnfrs nslcmops nsds vnfds projects +for item in vim_accounts sdns nsrs vnfrs nslcmops nsds vnfds projects pdus nsts nsis nsilcmops # vims do curl --insecure ${OSMNBI_URL}/test/db-clear/${item} echo " ${item}" done -# delete all users except admin -curl --insecure ${OSMNBI_URL}/test/db-clear/users?username.ne=admin +if [ -n "$OSMNBI_COMPLETELY" ] ; then + curl --insecure ${OSMNBI_URL}/test/db-clear/users && echo " ${item}" + curl --insecure ${OSMNBI_URL}/test/db-clear/version && echo " ${item}" +else + # delete all users except admin + curl --insecure ${OSMNBI_URL}/test/db-clear/users?username.ne=admin +fi if [ -n "$OSMNBI_CLEAN_RO" ] then