sipp-test 1.54 KB
Newer Older
Olav Kvittem's avatar
Olav Kvittem committed
1 2
#!/bin/bash

3 4 5 6
# start a test series of sipp-calls with specs from a config file
# log data about the tests so that files can be combined to edible reports
# by qstream-sipp-check

7 8 9 10 11 12
if test .$1 = .-cf ; then
  source $2
  shift;shift
else
  source /etc/sipshaman/sipshaman.cf
fi
Olav Kvittem's avatar
Olav Kvittem committed
13

Olav Kvittem's avatar
Olav Kvittem committed
14 15
hdir=`date +$DATA/%Y/%m/%d/%H`
mkdir -p $hdir
16
cd $hdir  || exit -1   # better not to do anything
Olav Kvittem's avatar
Olav Kvittem committed
17 18 19 20 21

port=$SIP_PORT   # sip service port start
mport=$MEDIA_PORT # rtp service port start
export IFS=";"

22
addr=`/sbin/ifconfig eth0| perl -ne 'print $1 if /inet addr:(\d+\.\d+\.\d+\.\d+)/'`
Olav Kvittem's avatar
Olav Kvittem committed
23

24 25 26 27 28 29 30 31 32 33
while read server service outproxy function machine calls; do
    if test -z "$server"; then
	continue
    fi
    if test -z "$outproxy"; then
	outproxy="outgoing-proxy-missing"	
    fi
    if test -z "$calls" ; then
	calls=1
    fi
Olav Kvittem's avatar
Olav Kvittem committed
34 35 36

  echo $server | egrep -q '^\s*#'
  if test $? = 1 ; then # no comment
37
      /usr/bin/sipp $server -s $service -i $addr -sf $CONF/$CLIENT_SCENARIO -p $port -mp $mport -m $calls -rp 200000 -l 1 -trace_stat  -fd 99999 -trace_logs -trace_msg -trace_err -bg -nofork -rsa $outproxy 2>> sipp.err >> sipp.log &
Olav Kvittem's avatar
Olav Kvittem committed
38 39
      pid=$!
      adr=$service@$server
40 41
      server_ip=`echo $server| sed -e 's/:.*//'`
#      echo server_ip $server_ip
42 43
      echo `date "+%F %T"` $pid $port $mport $service@$server   $function $machine `ping -c 10 -i 0.5 -q $server_ip | awk -F / '/^rtt /{print $5}'`>> task.log
#      time=$y-$m-$d-$h
44
#      perl -e "dbmopen(%tests, 'sip-test.dbm',0622); \$tests\{$time,$pid\}=$adr;dbmclose(%tests)"
Olav Kvittem's avatar
Olav Kvittem committed
45 46 47

      port=$(($port+2))
      mport=$(($mport+4))
48
      sleep 3
Olav Kvittem's avatar
Olav Kvittem committed
49 50 51
  fi
done

52 53