OSDN Git Service

Add PT test scripts.
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / PT / C / C-8-IPv4v4.sh
1 #!/bin/bash
2 . ${SET_DEFAULT_CONF}
3 \cp ./materials/C-8-IPv4v4-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
4
5 VS="127.0.0.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 # 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 sleep 30
55 RET=`$L7VSADM`
56 EXPECT="Layer-7 Virtual Server version 3.0.0
57 Prot LocalAddress:Port ProtoMod Scheduler
58   -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
59 TCP localhost:50000 sessionless rr
60   -> localhost:50001              Masq    1      0          0         
61   -> localhost:50002              Masq    1      0          0         "
62 if [ "$RET" != "$EXPECT" ]
63 then
64         echo "Test failed: $L7VSADM"
65         exit 1
66 fi
67
68 exit 0
69