OSDN Git Service

Bug fix. (Line 162: /usr/sbin/l7vsd -b => /usr/sbin/l7vsd)
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / virtualservice / virtualservice-46.sh
1 #!/bin/bash
2
3 . ${SET_DEFAULT_CONF}
4
5 #Run http server
6 SorryServer1=SorryServer1
7 SorryServer1_ADDR=127.0.0.1
8 SorryServer1_PORT=50001
9 start_lighttpd -s $SorryServer1 -a $SorryServer1_ADDR -p $SorryServer1_PORT
10 if [ $? -ne 0 ]
11 then
12         echo "Test failed: start_lighttpd SorryServer1"
13         exit 1
14 fi
15
16 RealServer1=RealServer1
17 RealServer1_ADDR=127.0.0.1
18 RealServer1_PORT=50002
19 start_lighttpd -s $RealServer1 -a $RealServer1_ADDR -p $RealServer1_PORT
20 if [ $? -ne 0 ]
21 then
22         echo "Test failed: start_lighttpd RealServer1"
23         exit 1
24 fi
25
26 #Add Service
27 $L7VSD
28 if [ $? -ne 0 ]
29 then
30         echo "Test failed: $L7VSD"
31         exit 1
32 fi
33 usleep 100000
34
35 $L7VSADM -A -t 127.0.0.1:40001 -m ip -b ${SorryServer1_ADDR}:${SorryServer1_PORT} -f 0
36 if [ $? -ne 0 ]
37 then
38         echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip -b ${SorryServer1_ADDR}:${SorryServer1_PORT} -f 0"
39         exit 1
40 fi
41
42 $L7VSADM -a -t 127.0.0.1:40001 -m ip -r ${RealServer1_ADDR}:${RealServer1_PORT}
43 if [ $? -ne 0 ]
44 then
45         echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r ${RealServer1_ADDR}:${RealServer1_PORT}"
46         exit 1
47 fi
48
49 $L7VSADM -E -t 127.0.0.1:40001 -m ip -b ${SorryServer1_ADDR}:${SorryServer1_PORT} -f 1
50 if [ $? -ne 0 ]
51 then
52         echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip -b ${SorryServer1_ADDR}:${SorryServer1_PORT} -f 1"
53         exit 0
54 fi
55
56 #Connect
57 RET=`$WGET -t 1 -qO- http://127.0.0.1:40001/`
58 if [ "${RET}" != "${SorryServer1}" ]
59 then
60         echo "Test failed: $WGET -t 1 -qO- http://127.0.0.1:40001/"
61         exit 1
62 fi
63
64 stop_lighttpd $RealServer1
65 stop_lighttpd $SorryServer1
66
67 exit 0
68