OSDN Git Service

trunk整理
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / PT / C / C-3-IPv6v4.sh
1 #!/bin/bash
2 . ${SET_DEFAULT_CONF}
3 \cp ./materials/C-3-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 RealServer3=RealServer3
30 RealServer3_ADDR=$RS
31 RealServer3_PORT=50003
32 start_lighttpd -s $RealServer3 -a $RealServer3_ADDR -p $RealServer3_PORT 
33 if [ $? -ne 0 ]
34 then
35         echo "Test failed: start_lighttpd RealServer3"
36         exit 1
37 fi
38
39 # Start l7vsd
40 $L7VSD
41 if [ $? -ne 0 ]
42 then
43         echo "Test failed: $L7VSD"
44         exit 1
45 fi
46 usleep 100000
47
48 # Start l7directord
49 $INIT_L7DIRECTORD start 
50 if [ $? -ne 0 ]
51 then
52         echo "Test failed: $INIT_L7DIRECTORD start"
53         exit 1
54 fi
55 sleep 5
56
57 RET=`$INIT_L7DIRECTORD status 2>&1 | grep "l7directord for .${L7DIRECTORD_CONF_DIR}/l7directord.cf' is running with pid:"`
58 if [ -z "$RET"  ]
59 then
60         echo "Test failed: $INIT_L7DIRECTORD status "
61         exit 1
62 fi
63
64 RET=`$L7VSADM`
65 EXPECT="Layer-7 Virtual Server version 3.0.0
66 Prot LocalAddress:Port ProtoMod Scheduler
67   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
68 TCP localhost:50000 sessionless rr
69   -> localhost:50001              Masq    1      0          0         
70   -> localhost:50002              Masq    1      0          0         "
71 if [ "$RET" != "$EXPECT" ]
72 then
73         echo "Test failed: $L7VSADM"
74         exit 1
75 fi
76
77 stop_lighttpd $RealServer1
78 stop_lighttpd $RealServer2
79
80 sleep 30
81
82 RET=`$L7VSADM`
83 EXPECT="Layer-7 Virtual Server version 3.0.0
84 Prot LocalAddress:Port ProtoMod Scheduler
85   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
86 TCP localhost:50000 sessionless rr
87   -> localhost:50003              Masq    1      0          0         "
88 if [ "$RET" != "$EXPECT" ]
89 then
90         echo "Test failed: $L7VSADM"
91         exit 1
92 fi
93
94 #Connect
95 RET=`$WGET -t 1 -qO- http://$VS:50000/`
96 if [ "${RET}" != "${RealServer3}" ]
97 then
98         echo "Test failed: $WGET -t 1 -qO- http://$VS:50000/"
99         exit 1
100 fi
101
102 RET=`$L7VSADM`
103 EXPECT="Layer-7 Virtual Server version 3.0.0
104 Prot LocalAddress:Port ProtoMod Scheduler
105   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
106 TCP localhost:50000 sessionless rr
107   -> localhost:50003              Masq    1      0          1         "
108 if [ "$RET" != "$EXPECT" ]
109 then
110         echo "Test failed: $L7VSADM"
111         exit 1
112 fi
113
114 exit 0
115