move set domain of scenarios/calle[r|e].csv files from sipp.sh to config_debug.pl script.

Do it just ones!
vseva/3.0
Victor Seva 12 years ago
parent d7a103d959
commit b5b0d3b3f7

@ -109,8 +109,8 @@ function run_sipp
for res in $(find ${SCEN_CHECK_DIR} -type f -name 'sipp_scenario_responder[0-9][0-9].xml'| sort); do
base=$(basename $res .xml)
echo "$(date) - Running ${base} ${PORT}-${MPORT}"
${BIN_DIR}/sipp.sh -d ${DOMAIN} -p ${PORT} -r ${SCEN_CHECK_DIR}/${base}_reg.xml
${BIN_DIR}/sipp.sh -d ${DOMAIN} -p ${PORT} -m ${MPORT} -r ${SCEN_CHECK_DIR}/${base}.xml &
${BIN_DIR}/sipp.sh -p ${PORT} -r ${SCEN_CHECK_DIR}/${base}_reg.xml
${BIN_DIR}/sipp.sh -p ${PORT} -m ${MPORT} -r ${SCEN_CHECK_DIR}/${base}.xml &
responder_pid="${responder_pid} ${base}:$!:${PORT}:${MPORT}"
let PORT=${PORT}+1
let MPORT=${MPORT}+3
@ -120,7 +120,7 @@ function run_sipp
for send in $(find ${SCEN_CHECK_DIR} -type f -name 'sipp_scenario[0-9][0-9].xml'| sort); do
base=$(basename $send .xml)
echo "$(date) - Running ${base} 50602-7002"
${BIN_DIR}/sipp.sh -d ${DOMAIN} -p 50602 -m 7002 $send
${BIN_DIR}/sipp.sh -p 50602 -m 7002 $send
if [[ $? -ne 0 ]]; then
status=1
fi
@ -142,7 +142,7 @@ function run_sipp
kill -9 ${pid}
fi
fi
${BIN_DIR}/sipp.sh -d ${DOMAIN} -p ${PORT} -r ${SCEN_CHECK_DIR}/${base}_unreg.xml
${BIN_DIR}/sipp.sh -p ${PORT} -r ${SCEN_CHECK_DIR}/${base}_unreg.xml
done
# wait a moment. We want all the info

@ -1,4 +1,5 @@
#!/usr/bin/perl
use File::Spec;
use Tie::File;
use strict;
use warnings;
@ -32,9 +33,19 @@ if($profile ne "CE" && $profile ne "PRO")
die("Uknown PROFILE:$profile\n".usage());
}
my $base_dir;
my $yaml = YAML::Tiny->new;
my $file = "/etc/ngcp-config/config.yml";
my @array;
my $path;
if (exists $ENV{'BASE_DIR'})
{
$base_dir = $ENV{'BASE_DIR'};
}
else
{
$base_dir = '/usr/local/src/kamailio-config-tests';
}
$yaml = YAML::Tiny->read($file) or die "File $file could not be read";
@ -55,7 +66,16 @@ if (lc($action) eq "off")
s/\Q$domain\E//;
}
untie @array;
for my $i ('caller.csv', 'callee.csv')
{
$path = File::Spec->catfile( $base_dir, 'scenarios', $i);
tie @array, 'Tie::File', $path or die ("Can set test domain on $path");
for (@array)
{
s/\Q$domain\E/DOMAIN/;
}
untie @array;
}
}
else
{
@ -69,6 +89,16 @@ else
s/127.0.0.1 localhost/127.0.0.1 localhost $domain/;
}
untie @array;
for my $i ('caller.csv', 'callee.csv')
{
$path = File::Spec->catfile( $base_dir, 'scenarios', $i);
tie @array, 'Tie::File', $path or die ("Can set test domain on $path");
for (@array)
{
s/DOMAIN/$domain/;
}
untie @array;
}
}
open(my $fh, '>', "$file") or die "Could not open $file for writing";
print $fh $yaml->write_string() or die "Could not write YAML to $file";

@ -1,27 +1,9 @@
#!/bin/bash
function set_domain
{
if [[ $1 -eq 1 ]]; then
p="s/DOMAIN/${DOMAIN}/"
else
p="s/${DOMAIN}/DOMAIN/"
fi
for i in e r; do
if [ -f "${BASE_DIR}/../calle$i.csv" ]; then
sed -e "$p" -i ${BASE_DIR}/../calle$i.csv
else
echo "No ${BASE_DIR}/../calle$i.csv file found"
exit 1
fi
done
}
function usage
{
echo "Usage: sipp.sh [-d domain] [-p PORT] [-m MPORT] [-t TIMEOUT] [-r] scenario.xml"
echo "Usage: sipp.sh [-p PORT] [-m MPORT] [-t TIMEOUT] [-r] scenario.xml"
echo "Options:"
echo -e "\t-d: DOMAIN. default: spce.test"
echo -e "\t-p: sip port. default 50602/50603(responder)"
echo -e "\t-m: media port"
echo -e "\t-t: timeout. default 10/25(responder)"
@ -29,14 +11,13 @@ function usage
echo -e "\t sipp_scenario.xml file"
}
while getopts 'hrp:m:t:d:' opt; do
while getopts 'hrp:m:t:' opt; do
case $opt in
h) usage; exit 0;;
r) RESP=1;;
p) PORT=$OPTARG;;
m) MPORT=$OPTARG;;
t) TIMEOUT=$OPTARG;;
d) DOMAIN=$OPTARG;;
esac
done
shift $(($OPTIND - 1))
@ -53,9 +34,7 @@ if [ ! -f $1 ]; then
fi
BASE_DIR="$(dirname $1)"
IP="127.0.0.1"
DOMAIN=${DOMAIN:-"spce.test"}
MAX="5000"
set_domain 1
if [ -z ${RESP} ]; then
if [ ! -z ${MPORT} ]; then
@ -79,6 +58,5 @@ else
status=$?
fi
set_domain 0
exit $status
#EOF

Loading…
Cancel
Save