X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=umts_backend;fp=umts_backend;h=8d1dae1e35f698d5525d9ef955ae2b8cd117b0d5;hb=29a8ad81f201bb3c538057dd174c31c9ae551e78;hp=0000000000000000000000000000000000000000;hpb=46cf404603955fa122ad50cfe9a72b82491f9b4d;p=planetlab-umts-tools.git diff --git a/umts_backend b/umts_backend new file mode 100755 index 0000000..8d1dae1 --- /dev/null +++ b/umts_backend @@ -0,0 +1,105 @@ +#!/bin/bash + +# Vsys backend + + +sliver=$1 + +. /usr/lib/umts_functions + + +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +if [[ $sliver == "" ]]; then + echo "I need the first argument (the sliver name)"; + exit 1 +fi + +read line + +command=`echo ${line%% *}` +rest=`echo ${line#* }` + +case "$command" in + #init) + #logger "Initialitation of the UMTS inteface requested by $sliver" + #init_umts $sliver; + # + #if [[ $? != 0 ]] ; then + # echo "Failed" + #fi + #;; + + start) + logger "Starting the umts connection for $sliver" + start_umts $sliver; + + if [[ $? != 0 ]] ; then + echo "Failed" + fi + ;; + + stop) + logger "Stopping umts connection for $sliver" + stop_umts $sliver; + + if [[ $? != 0 ]] ; then + echo "Failed" + fi + + ;; + + add) + logger "Request to add a destination by $sliver for the UMTS connection"; + + if ! valid_dotted_quad "$rest"; then + echo "Failed" + else + add_destination "$rest" $sliver; + if [[ $? != 0 ]] ; then + echo "OK" + else + echo "Failed" + fi + fi + + ;; + + del) + logger "Request to del a destination by $sliver for the UMTS connection"; + + if ! valid_dotted_quad "$rest"; then + echo "Failed" + else + del_destination "$rest" $sliver; + if [[ $? == 0 ]] ; then + echo "OK" + else + echo "Failed" + fi + fi + ;; + + status) + if status_umts $sliver; then + if check_who_locked $sliver; then + echo "Connected" + fi + else + echo "Disconnected" + fi + ;; + + *) + echo "Wrong command" + ;; + +esac + + +#sleep 1 +echo "EOF" + + +exit 0 +