Add support for the Huawei e620 umts card
[planetlab-umts-tools.git] / backend / umts_backend
1 #!/bin/bash
2
3 # Vsys backend
4
5
6 sliver=$1
7
8 . /usr/lib/umts_functions
9
10
11 PATH=/bin:/usr/bin:/sbin:/usr/sbin 
12
13 if [[ $sliver == "" ]]; then
14         echo "I need the first argument (the sliver name)";
15         exit 1
16 fi
17
18 read line
19
20 command=`echo ${line%% *}`
21 rest=`echo ${line#* }`
22
23 case "$command" in
24     start)
25         logger "Starting the umts connection for $sliver"
26         start_umts $sliver;
27         
28         if [[ $? != 0 ]] ; then
29                 echo "Failed"
30         fi
31     ;;
32
33     stop)
34         logger "Stopping umts connection for $sliver"
35         stop_umts $sliver;
36
37         if [[ $? != 0 ]] ; then
38                 echo "Failed"
39         fi
40
41     ;;
42
43     add)
44         logger "Request to add a destination by $sliver for the umts connection";       
45         
46         if ! valid_dotted_quad "$rest"; then
47                 echo "Failed"
48         else
49                 add_destination "$rest" $sliver;
50                 if [[ $? == 0 ]] ; then
51                         echo "OK"
52                 else
53                         echo "Failed"
54                 fi
55         fi
56
57         ;;      
58
59     del)
60         logger "Request to del a destination by $sliver for the umts connection";
61         
62         if ! valid_dotted_quad "$rest"; then
63                 echo "Failed"
64         else
65                 del_destination "$rest" $sliver;
66                 if [[ $? == 0 ]] ; then
67                         echo "OK"
68                 else
69                         echo "Failed"
70                 fi
71         fi
72         ;;
73  
74     status)
75         if  status_umts; then
76                 echo "Connected"
77         else 
78                 echo "Disconnected"
79         fi
80         ;;
81
82     *)
83         echo "Wrong command"
84     ;;
85
86 esac
87
88
89 #sleep 1
90 echo "EOF"
91
92
93 exit 0
94