OSDN Git Service

Add PT test scripts.
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / PT / E / E-2-IPv6v4.sh
1 #!/bin/bash
2 . ${SET_DEFAULT_CONF}
3 \cp ./materials/E-2-IPv6v4-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
4
5 VS="[::1]"
6
7 #Run http server
8 RealServer1=RealServer1
9 RealServer1_ADDR=127.0.0.1
10 RealServer1_PORT=50001
11 start_lighttpd -s $RealServer1 -a $RealServer1_ADDR -p $RealServer1_PORT -S
12
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=127.0.0.1
21 RealServer2_PORT=50002
22 start_lighttpd -s $RealServer2 -a $RealServer2_ADDR -p $RealServer2_PORT -S
23
24 if [ $? -ne 0 ]
25 then
26         echo "Test failed: start_lighttpd RealServer2"
27         exit 1
28 fi
29
30 # Start l7vsd
31 $L7VSD
32 if [ $? -ne 0 ]
33 then
34         echo "Test failed: $L7VSD"
35         exit 1
36 fi
37 usleep 100000
38
39 # Start l7directord
40 $INIT_L7DIRECTORD start 
41 if [ $? -ne 0 ]
42 then
43         echo "Test failed: $INIT_L7DIRECTORD start"
44         exit 1
45 fi
46 sleep 10
47
48 RET=`$L7VSADM`
49 EXPECT="Layer-7 Virtual Server version 3.0.0
50 Prot LocalAddress:Port ProtoMod Scheduler
51   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
52 TCP localhost:50000 sslid rr
53   -> localhost:50001              Masq    1      0          0         
54   -> localhost:50002              Masq    1      0          0         "
55 if [ "$RET" != "$EXPECT" ]
56 then
57         echo "Test failed: $L7VSADM"
58         exit 1
59 fi
60
61 #Connect
62 RET=`curl -g -k --sslv3 https://$VS:50000/ https://$VS:50000/ https://$VS:50000/`
63 EXPECT=`echo -e "${RealServer1}\n${RealServer1}\n${RealServer1}"`
64
65 if [ "${RET}" != "${EXPECT}" ]
66 then
67         echo "Test failed: curl -g -k --sslv3 https://$VS:50000/  https://$VS:50000/ https://$VS:50000/"
68         exit 1
69 fi
70
71 RET=`$L7VSADM`
72 EXPECT="Layer-7 Virtual Server version 3.0.0
73 Prot LocalAddress:Port ProtoMod Scheduler
74   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
75 TCP localhost:50000 sslid rr
76   -> localhost:50001              Masq    1      0          3         
77   -> localhost:50002              Masq    1      0          0         "
78 if [ "$RET" != "$EXPECT" ]
79 then
80         echo "Test failed: $L7VSADM"
81         exit 1
82 fi
83
84 exit 0
85