OSDN Git Service

trunk整理
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / snmpagent / snmpagent-17.sh
1 #!/bin/bash
2
3 # set config file
4 . ${SET_DEFAULT_CONF}
5
6 #copy config file
7 \cp -f materials/snmpagent-1-19-l7vs.cf ${L7VSD_CONF_DIR}/l7vs.cf
8
9 #Start snmptrapd
10 ${SNMPTRAPD} -c ./materials/snmpagent-1-19-snmptrapd.conf -Lf ${L7VS_LOG_DIR}/snmpagent-1-19-snmptrapd.log
11
12 #Start L7VAD Service
13 $L7VSD
14 if [ $? -ne 0 ]
15 then
16         echo "Test failed: $L7VSD"
17         exit 1
18 fi
19 usleep 100000
20
21 #Set Trap Log Level
22 $L7VSADM -S -t 1 -l warn
23 if [ $? -ne 0 ]
24 then
25         echo "Test failed: $L7VSADM -S -t 1 -l warn"
26         exit 1
27 fi
28
29 #Add virtual Service
30 $L7VSADM -A -t 127.0.0.1:40001 -m sessionless
31 if [ $? -ne 0 ]
32 then
33         echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m sessionless 1"
34         exit 1
35 fi
36 #Add virtual Service Again
37 $L7VSADM -A -t 127.0.0.1:40001 -m sessionless
38
39 usleep 1000000
40
41 #Check Trap Log
42 cat ${L7VS_LOG_DIR}/snmpagent-1-19-snmptrapd.log
43
44 RET=`cat  ${L7VS_LOG_DIR}/snmpagent-1-19-snmptrapd.log | grep -e  "SNMPv2-SMI::enterprises.32132.1.0.3.3 = STRING: \"[0-9]\{4\}/[0-9]\{2\}/[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\},VSD3.*"`
45 if [ -z "${RET}" ]
46 then
47         echo "Test failed: cat ${L7VS_LOG_DIR}/snmpagent-1-19-snmptrapd.log"
48         exit 1
49 fi
50
51 exit 0