OSDN Git Service

bugfix
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / l7vsadm / l7vsadm-5-3-10.sh
1 #!/bin/bash
2
3 . ${SET_DEFAULT_CONF}
4
5 #Run http server
6 RealServer1=RealServer1
7 RealServer1_ADDR=127.0.0.1
8 RealServer1_PORT=50001
9 start_lighttpd -s $RealServer1 -a $RealServer1_ADDR -p $RealServer1_PORT
10 if [ $? -ne 0 ]
11 then
12         echo "Test failed: start_lighttpd RealServer1"
13         exit 1
14 fi
15
16 #Add Service
17 $L7VSD
18 if [ $? -ne 0 ]
19 then
20         echo "Test failed: $L7VSD"
21         exit 1
22 fi
23 usleep 100000
24
25 $L7VSADM -A -t 127.0.0.1:40001 -m ip
26 if [ $? -ne 0 ]
27 then
28         echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m ip"
29         exit 1
30 fi
31
32 $L7VSADM -a -t 127.0.0.1:40001 -m ip -r ${RealServer1_ADDR}:${RealServer1_PORT} -w 2
33 if [ $? -ne 0 ]
34 then
35         echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m ip -r ${RealServer1_ADDR}:${RealServer1_PORT} -w 2"
36         exit 1
37 fi
38
39 RET=`$L7VSADM -l -n`
40 EXPECT="Layer-7 Virtual Server version 3.0.0-1
41 Prot LocalAddress:Port ProtoMod Scheduler
42   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
43 TCP 127.0.0.1:40001 ip rr
44   -> ${RealServer1_ADDR}:${RealServer1_PORT}              Masq    2      0          0         "
45 if [ "${RET}" != "${EXPECT}" ]
46 then
47         echo "Test failed: $L7VSADM"
48         exit 1
49 fi
50
51
52 RET=`$L7VSADM -e -t 127.0.0.1:40001 -m ip -r ${RealServer1_ADDR}:${RealServer1_PORT} 2>&1 | grep "PARSE ERROR : All option omitted for edit rs command."`
53 EXPECT="PARSE ERROR : All option omitted for edit rs command."
54 if [ "${RET}" != "${EXPECT}" ]
55 then
56         echo "Test failed: $L7VSADM -e -t 127.0.0.1:40001 -m ip -r ${RealServer1_ADDR}:${RealServer1_PORT}"
57         exit 1
58 fi
59
60 RET=`$L7VSADM -l -n`
61 EXPECT="Layer-7 Virtual Server version 3.0.0-1
62 Prot LocalAddress:Port ProtoMod Scheduler
63   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
64 TCP 127.0.0.1:40001 ip rr
65   -> ${RealServer1_ADDR}:${RealServer1_PORT}              Masq    2      0          0         "
66 if [ "${RET}" != "${EXPECT}" ]
67 then
68         echo "Test failed: $L7VSADM"
69         exit 1
70 fi
71
72 exit 0
73