From 04d6ec70c877f03e3c592c77fb3e53db950118f8 Mon Sep 17 00:00:00 2001 From: Marco Capetta Date: Fri, 20 Mar 2020 16:11:46 +0100 Subject: [PATCH] TT#76664 Check if there are still rtp ports open after tests execution The command rtpengine-ctl -ip "${rtpengine_ctl_ip}" list interfaces is used to check the number of rtp ports still open on the system Change-Id: Id0e48aaf1f354cecf153db8102a5b5635e073287 --- bin/config_debug.pl | 3 ++- run_tests.sh | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/bin/config_debug.pl b/bin/config_debug.pl index 9e8f5e6b..47d71b02 100755 --- a/bin/config_debug.pl +++ b/bin/config_debug.pl @@ -117,7 +117,8 @@ else $yaml->{sems}{debug} = 'yes'; $yaml->{witnessd}{gather}{sip_responsiveness} = 'no'; $yaml->{security}->{ngcp_panel}->{scripts}->{restapi}->{sslverify} = 'no'; - $yaml->{mediator}{interval} = '1'; + $yaml->{mediator}{interval} = '1'; # Necessary to speedup the creation of the CDRs + $yaml->{rtpproxy}{delete_delay} = '5'; # Necessary to speedup the deletetion of the used ports in rtpengine $net_yaml = LoadFile($file_net_yaml); $net_yaml->{hosts_common}->{etc_hosts_global_extra_entries} //= (); diff --git a/run_tests.sh b/run_tests.sh index bf41a4fa..6c09e790 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -381,8 +381,26 @@ for t in ${SCENARIOS}; do fi done -# Hack to allow tcpdump to capture all the packages and kamailio to write all the json files -sleep 5 +# Hack to allow: +# - tcpdump to capture all the packages +# - kamailio to write all the json files +# - rtpengine to close rtp ports +sleep 6 + +# Check if there are still some rtp port open after tests execution +rtpengine_ctl_ip=$(grep 'listen-cli' /etc/rtpengine/rtpengine.conf |awk '{print $3}') +rtp_ports=$(rtpengine-ctl -ip "${rtpengine_ctl_ip}" list interfaces |grep "Ports used" | awk '{print $3}') +if [ -n "${rtp_ports}" ]; then + while read -r i; do + if [ "${i}" -gt 0 ]; then + echo "$(date) - =================================================================================" + echo "$(date) - There are still some rtp ports open, please check the following output" + rtpengine-ctl -ip "${rtpengine_ctl_ip}" list interfaces + echo "$(date) - =================================================================================" + error_flag=1 + fi + done <<< "${rtp_ports}" +fi if "${CAPTURE}" ; then stop_capture