OSDN Git Service

trunk整理
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / PT / C / C-2-IPv6v4.sh
1 #!/bin/bash
2 . ${SET_DEFAULT_CONF}
3 \cp ./materials/C-2-IPv6v4-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
4
5 VS="[::1]"
6 RS1="127.0.0.1"
7 RS2="127.0.0.2"
8 #Run http server
9 RealServer1=RealServer1
10 RealServer1_ADDR=$RS1
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=$RS2
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 # Start l7vsd
30 $L7VSD
31 if [ $? -ne 0 ]
32 then
33         echo "Test failed: $L7VSD"
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 5
46
47 RET=`$INIT_L7DIRECTORD status 2>&1 | grep "l7directord for .${L7DIRECTORD_CONF_DIR}/l7directord.cf' is running with pid:"`
48 if [ -z "$RET"  ]
49 then
50         echo "Test failed: $INIT_L7DIRECTORD status "
51         exit 1
52 fi
53
54 RET=`$L7VSADM -l -n`
55 EXPECT="Layer-7 Virtual Server version 3.0.0
56 Prot LocalAddress:Port ProtoMod Scheduler
57   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
58 TCP [::1]:50000 sessionless rr
59   -> 127.0.0.1:50001              Masq    1      0          0         
60   -> 127.0.0.2:50002              Masq    1      0          0         "
61 if [ "$RET" != "$EXPECT" ]
62 then
63         echo "Test failed: $L7VSADM -l -n"
64         exit 1
65 fi
66
67 iptables -A INPUT -s $RS2 -p icmp -j DROP
68 sleep 30
69
70 RET=`$L7VSADM -l -n`
71 EXPECT="Layer-7 Virtual Server version 3.0.0
72 Prot LocalAddress:Port ProtoMod Scheduler
73   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
74 TCP [::1]:50000 sessionless rr
75   -> 127.0.0.1:50001              Masq    1      0          0         
76   -> 127.0.0.2:50002              Masq    0      0          0         "
77 if [ "$RET" != "$EXPECT" ]
78 then
79         echo "Test failed: $L7VSADM -l -n"
80         iptables -F
81         exit 1
82 fi
83
84 iptables -F
85
86 exit 0
87