OSDN Git Service

trunk整理
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / PT / B / B-34-IPv6v4.sh
1 #!/bin/bash
2 . ${SET_DEFAULT_CONF}
3 \cp -f materials/B-34-IPv6v4-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
4
5 VS="[::1]"
6 RS="127.0.0.1"
7
8 #Run http server
9 RealServer1=RealServer1
10 RealServer1_ADDR=$RS
11 RealServer1_PORT=50001
12 start_lighttpd -s $RealServer1 -a $RealServer1_ADDR -p $RealServer1_PORT
13 if [ $? -ne 0 ]
14 then
15         echo "Test failed: start_lighttpd RealServer1"
16         exit 1
17 fi
18
19 RealServer2=RealServer2
20 RealServer2_ADDR=$RS
21 RealServer2_PORT=50002
22 start_lighttpd -s $RealServer2 -a $RealServer2_ADDR -p $RealServer2_PORT
23 if [ $? -ne 0 ]
24 then
25         echo "Test failed: start_lighttpd RealServer2"
26         exit 1
27 fi
28
29 #Add Service
30 $INIT_L7VSD start
31 if [ $? -ne 0 ]
32 then
33         echo "Test failed: $INIT_L7VSD start"
34         exit 1
35 fi
36 usleep 100000
37
38 # Start l7directord
39 $INIT_L7DIRECTORD start
40 if [ $? -ne 0 ]
41 then
42         echo "Test failed: $INIT_L7DIRECTORD start"
43         exit 1
44 fi
45 sleep 3
46
47 RET=`$L7VSADM`
48 EXPECT="Layer-7 Virtual Server version 3.0.0
49 Prot LocalAddress:Port ProtoMod Scheduler
50   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
51 TCP localhost:50000 sessionless wrr
52   -> localhost:50001              Masq    2      0          0         
53   -> localhost:50002              Masq    1      0          0         "
54 if [ "${RET}" != "${EXPECT}" ]
55 then
56         echo "Test failed: $L7VSADM"
57         exit 1
58 fi
59
60 #Connect
61 for ((i=0;i<128;i++)){
62         RET=`$WGET -t 1 -qO- http://$VS:50000/`
63         if [ $? -ne 0 ]
64         then
65                 echo "Test failed: $WGET -t 1 -qO- http://$VS:50000/"
66                 exit 1
67         fi
68 }
69
70 RET=`$L7VSADM | grep "localhost:50001" | awk '{print $6}'`
71 if [ 86 -ne ${RET} ]
72 then
73         echo "Test failed: $L7VSADM | grep localhost:50001 | awk '{print $6}'"
74         exit 1
75 fi
76
77 RET=`$L7VSADM | grep "localhost:50002" | awk '{print $6}'`
78 if [ 42 -ne ${RET} ]
79 then
80         echo "Test failed: $L7VSADM | grep localhost:50002 | awk '{print $6}'"
81         exit 1
82 fi
83
84 exit 0