echo -e " --screen forces to run openmano (and openvim) service in a screen"
echo -e " --insert-bashrc insert the created tenant,datacenter variables at"
echo -e " ~/.bashrc to be available by openmano CLI"
+ echo -e " --install-openvim install openvim in test mode"
echo -e " --init-openvim if openvim runs locally, an init is called to clean openvim"
echo -e " database and add fake hosts"
}
#process options
-source ${DIRscript}/get-options.sh "force:f help:h insert-bashrc init-openvim screen" $* || $_exit 1
+source ${DIRscript}/get-options.sh "force:f help:h insert-bashrc init-openvim install-openvim screen" $* || $_exit 1
#help
[ -n "$option_help" ] && usage && $_exit 0
for argument in $params
do
- if [[ $argument == reset ]] || [[ $argument == create ]] || [[ $argument == delete ]]
+ if [[ $argument == reset ]] || [[ $argument == create ]] || [[ $argument == delete ]] || [[ -z "$argument" ]]
then
action_list="$action_list $argument"
continue
#by default action should be reset and create
[[ -z $action_list ]] && action_list="reset create delete"
+
+if [[ -n "$option_install_openvim" ]]
+then
+ pushd ${DIRmano}/..
+ echo "installing openvim at $PWD/openvim ... "
+ wget -O install-openvim.sh "https://osm.etsi.org/gitweb/?p=osm/openvim.git;a=blob_plain;f=scripts/install-openvim.sh"
+ chmod +x install-openvim.sh
+ sudo ./install-openvim.sh --no-install-packages --force --quiet --develop
+ alias initopenvim="${PWD}/openvim/scripts/initopenvim.sh"
+ alias openvim="${PWD}/openvim/scripts/openvim"
+ option_init_openvim="-"
+ popd
+fi
[[ -z "$option_init_openvim" ]] || initopenvim${force_param}${insert_bashrc_param}${screen_vim_param} || echo "WARNING openvim cannot be initialized. The rest of test can fail!"
#check openvim client variables are set
[[ -z $OPENVIM_HOST ]] && OPENVIM_HOST=localhost
[[ -z $OPENVIM_PORT ]] && OPENVIM_PORT=9080
URL_ADMIN_PARAM=""
- [[ -n $OPENVIM_ADMIN_PORT ]] && URL_ADMIN_PARAM="--url_admin=http://${OPENVIM_HOST}:${OPENVIM_ADMIN_PORT}/openvim"
- result=`${DIRmano}/openmano datacenter-create TEST-dc "http://${OPENVIM_HOST}:${OPENVIM_PORT}/openvim" --type=openvim $URL_ADMIN_PARAM`
+ [[ -n $OPENVIM_ADMIN_PORT ]] && URL_ADMIN_PARAM=" --url_admin=http://${OPENVIM_HOST}:${OPENVIM_ADMIN_PORT}/openvim"
+ result=`${DIRmano}/openmano datacenter-create TEST-dc "http://${OPENVIM_HOST}:${OPENVIM_PORT}/openvim" --type=openvim${URL_ADMIN_PARAM} --config="{test: no use just for test}"`
datacenter=`echo $result |gawk '{print $1}'`
#check a valid uuid is obtained
! is_valid_uuid $datacenter && echo "FAIL" && echo " $result" && $_exit 1
[[ -n "$option_insert_bashrc" ]] && echo -e "\nexport OPENMANO_DATACENTER=$datacenter" >> ~/.bashrc
printf "%-50s" "Attaching openmano tenant to the datacenter:"
- result=`${DIRmano}/openmano datacenter-attach TEST-dc`
+ result=`${DIRmano}/openmano datacenter-attach TEST-dc --config="{test: no use just for test}"`
[[ $? != 0 ]] && echo "FAIL" && echo " $result" && $_exit 1
echo OK