MT#5789 foreign domain support

- bin/config_debug.pl: we need to deactivate dns_cache on lb
- bin/scenario.pl: generates scenario hosts file + adds info on scenario.csv
- bin/check.sh: uses the info from scenario.csv and hosts files
mr3.3.1
Victor Seva 12 years ago
parent 236f7de1dc
commit cfb23bb974

@ -132,6 +132,12 @@ function delete_voip
echo "$(date) - Deleting rewrite rules"
${BIN_DIR}/create_rewrite_rules.pl -d ${SCEN_CHECK_DIR}/rewrite.yml
fi
if [ -f ${SCEN_CHECK_DIR}/hosts ]; then
echo "$(date) - Deleting foreign domains"
sed -e "s:$(cat ${SCEN_CHECK_DIR}/hosts)::" -i /etc/hosts
rm ${SCEN_CHECK_DIR}/hosts
fi
}
function delete_locations
@ -204,6 +210,7 @@ function get_ip
error_helper "cannot find $1 ip on ${SCEN_CHECK_DIR}/scenario.csv" 10
fi
peer_host=$(grep "$1" ${SCEN_CHECK_DIR}/scenario.csv|cut -d\; -f4| tr -d '\n')
foreign_dom=$(grep "$1" ${SCEN_CHECK_DIR}/scenario.csv|cut -d\; -f5| tr -d '\n')
}
#$1 is filename
@ -229,6 +236,7 @@ function copy_logs
# $1 sipp xml scenario file
function run_sipp
{
local PORT_OLD
check_port 50603
local PORT=$port
check_port 6003 3
@ -273,6 +281,12 @@ function run_sipp
error_helper "$(date) - error updating peer info" 15
fi
fi
if [ "${foreign_dom}" != "" ]; then
echo "$(date) - foreign domain detected... using 5060 port"
PORT_OLD=${PORT}
PORT="5060"
fi
echo "$(date) - Running ${base} $ip:${PORT}-${MPORT}"
if [ -f ${SCEN_CHECK_DIR}/${base}_reg.xml ]; then
echo "$(date) - Register ${base} $ip:${PORT}-${MPORT}"
@ -280,12 +294,15 @@ function run_sipp
fi
${BIN_DIR}/sipp.sh -T $transport -i $ip -p ${PORT} -m ${MPORT} -r ${SCEN_CHECK_DIR}/${base}.xml &
responder_pid="${responder_pid} ${base}:$!"
check_port ${PORT}
PORT=$port
if [ "${foreign_dom}" == "" ]; then
check_port ${PORT}
PORT=$port
fi
check_port ${MPORT} 3
MPORT=$port
done
status=0
# let's fire sipp scenarios
for send in $(find ${SCEN_CHECK_DIR} -type f -name 'sipp_scenario[0-9][0-9].xml'| sort); do
@ -417,6 +434,12 @@ if [ -z $SKIP_RUNSIPP ]; then
if [[ $? -ne 0 ]]; then
error_helper "Error creating csv files" 4
fi
if [ -f ${SCEN_CHECK_DIR}/hosts ]; then
echo "$(date) - Setting foreign domains"
cat ${SCEN_CHECK_DIR}/hosts >> /etc/hosts
fi
echo "$(date) - Running sipp scenarios"
run_sipp
echo "$(date) - Done sipp"

@ -69,6 +69,7 @@ $domain = 'spce.test' unless defined($domain);
if (lc($action) eq "off")
{
$yaml->[0]->{kamailio}{lb}{debug} = 'no';
$yaml->[0]->{kamailio}{lb}{use_dns_cache} = 'on';
$yaml->[0]->{kamailio}{proxy}{debug} = 'no';
$yaml->[0]->{kamailio}{proxy}{presence}{enable} = 'no';
$yaml->[0]->{sems}{debug} = 'no';
@ -94,6 +95,7 @@ if (lc($action) eq "off")
else
{
$yaml->[0]->{kamailio}{lb}{debug} = 'yes';
$yaml->[0]->{kamailio}{lb}{use_dns_cache} = 'off';
$yaml->[0]->{kamailio}{proxy}{debug} = 'yes';
$yaml->[0]->{kamailio}{proxy}{presence}{enable} = 'yes';
$yaml->[0]->{sems}{debug} = 'yes';

@ -126,7 +126,12 @@ sub generate
$csv->{scenario}->print($io_scenario, $csv_data);
foreach (@{$_->{responders}})
{
get_subs_info($data->{subscribers}, $_) unless defined($_->{peer_host});
# by default foreign is no
$_->{foreign} = "no" unless defined($_->{foreign});
if(!defined($_->{peer_host}) and $_->{foreign} ne "yes")
{
get_subs_info($data->{subscribers}, $_);
}
$_->{password} = "" unless defined($_->{password});
# by default responder is active
$_->{active} = "yes" unless defined($_->{active});
@ -137,12 +142,16 @@ sub generate
$auth = "[authentication username=$_->{username} password=$_->{password}]";
$csv_data = [$_->{username}, $_->{number}, $auth, $_->{domain}];
$csv->{callee}->print($io_callee, $csv_data);
$csv_data = ["sipp_scenario_responder".sprintf("%02i", $res_id).".xml", $_->{proto}, $_->{ip}, $_->{peer_host}];
$csv_data = ["sipp_scenario_responder".sprintf("%02i", $res_id).".xml", $_->{proto}, $_->{ip}, $_->{peer_host}, $_->{foreign}];
$csv->{scenario}->print($io_scenario, $csv_data);
if($_->{register} eq "yes" && $_->{active} eq "yes")
{
generate_reg($res_id)
}
if($_->{foreign} eq "yes")
{
generate_foreign_dom($_->{domain}, $_->{ip});
}
$res_id++;
}
$id++;
@ -186,5 +195,14 @@ sub generate_presence
}
}
sub generate_foreign_dom
{
my ($domain, $ip) = @_;
my $file = "$base_check_dir/hosts";
my $fn = IO::File->new($file, "w") or die("can't create $file");
print {$fn} "$ip $domain\n";
undef $fn;
}
generate($cf);
generate_presence($cf);

Loading…
Cancel
Save