[Asterisk-code-review] t38 fast reject: remove dependency on rtpdump (testsuite[16])

Jenkins2 asteriskteam at digium.com
Wed Jul 25 07:10:58 CDT 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/9567 )

Change subject: t38_fast_reject: remove dependency on rtpdump
......................................................................

t38_fast_reject: remove dependency on rtpdump

removed dependency on rtpdump, added executable permissions to
perl script validating response time

Change-Id: Ia73ef502f72bd75522d4b6656f6070807dbef349
---
D tests/fax/pjsip/t38_fast_reject/check_reinvite_rtt.pl
A tests/fax/pjsip/t38_fast_reject/check_reinvite_rtt.py
M tests/fax/pjsip/t38_fast_reject/run-test
M tests/fax/pjsip/t38_fast_reject/test-config.yaml
4 files changed, 26 insertions(+), 66 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/tests/fax/pjsip/t38_fast_reject/check_reinvite_rtt.pl b/tests/fax/pjsip/t38_fast_reject/check_reinvite_rtt.pl
deleted file mode 100644
index 1744aef..0000000
--- a/tests/fax/pjsip/t38_fast_reject/check_reinvite_rtt.pl
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use Text::CSV;
-use Data::Dumper;
-
-my $filename = $ARGV[0];
-open(my $fh, '<:utf8', $filename)
-    or die "Can't open $filename: $!";
-
-my $csv = Text::CSV->new({sep_char => ';'})
-    or die "Text::CSV error: " . Text::CSV->error_diag;
-
-my $header = <$fh>; 
-# define column names    
-$csv->parse($header);
-$csv->column_names([$csv->fields]);
-
-my $ret = 0;
-# parse the rest
-while (my $row = $csv->getline_hr($fh)) {
-    if (!defined  $row->{'ResponseTimereinvite(P)'} ) {
-	    print "column not found! make sure scenario is correct!\n";
-	    $ret = -1;
-	    last;
-    }
- 
-    my $pkey = $row->{'ResponseTimereinvite(P)'};
-    my ($hour, $minute, $second, $msec) = split(/:/, $pkey);
-    $minute += $hour*60;
-    $second += $minute*60;
-    $msec += $second * 1000;
-    
-    if ($msec > 500) {
-	    print "Slow 488 Rejection detected ($msec)!\n";
-	    $ret = -2;
-	    last;
-    }
-}
-
-$csv->eof or $csv->error_diag;
-close $fh;
-
-exit $ret;
diff --git a/tests/fax/pjsip/t38_fast_reject/check_reinvite_rtt.py b/tests/fax/pjsip/t38_fast_reject/check_reinvite_rtt.py
new file mode 100755
index 0000000..c67da51
--- /dev/null
+++ b/tests/fax/pjsip/t38_fast_reject/check_reinvite_rtt.py
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+import csv
+import sys
+import re
+
+regex = re.compile("([0-9]{2}):([0-9]{2}):([0-9]{2}):([0-9]{3})([0-9]{3})?")
+with open(sys.argv[1]) as csvfile:
+    reader = csv.DictReader(csvfile, delimiter=';')
+    for row in reader:
+        if not row.has_key('ResponseTimereinvite(P)'):
+            print "column not found! make sure scenario is correct!\n"
+            exit(-1);
+        parts = regex.match(row['ResponseTimereinvite(P)'])
+        hours = int(parts.group(1))
+        minutes = (hours * 60) + int(parts.group(2))
+        seconds = (minutes * 60) + int(parts.group(3))
+        milliseconds = (seconds * 1000) + int(parts.group(4))
+        if (milliseconds > 500):
+            print "Slow 488 Rejection detected (" + milliseconds + ")!\n";
+            exit(-2)
+
+csvfile.close()
+exit(0)
\ No newline at end of file
diff --git a/tests/fax/pjsip/t38_fast_reject/run-test b/tests/fax/pjsip/t38_fast_reject/run-test
index 9d86e01..7db6898 100755
--- a/tests/fax/pjsip/t38_fast_reject/run-test
+++ b/tests/fax/pjsip/t38_fast_reject/run-test
@@ -49,6 +49,7 @@
         'scenario' : 'A_PARTY.xml',
         '-i' : '127.0.0.1',
         '-p' : '5061',
+        '-m' : '1',
         '-s' : e164,
         '-message_file' : sippA_logfile,
         '-error_file' : sippA_errfile,
@@ -62,33 +63,12 @@
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
     test.reactor_timeout = 100;
 
-    dump_A = WORKING_DIR + "/carrier_rtp.log"
-    dump_B = WORKING_DIR + "/customer_rtp.log"
-    rtpdump_A = subprocess.Popen(["rtpdump", "-t","5", "-F","ascii","-d","101","-o",dump_A, "127.0.0.1/9000"])
-    rtpdump_B = subprocess.Popen(["rtpdump", "-t","5", "-F","ascii","-d","101","-o",dump_B, "127.0.0.1/8000"])
-
-    time.sleep(10) #Wait 10 seconds to ensure that all the sockets are open before running the test	
-
     reactor.run()
 
-    # Kill the RTPDUMP, pass it the signal"
-    rtpdump_A.send_signal(signal.SIGINT)	
-    rtpdump_A.wait()
-    rtpdump_B.send_signal(signal.SIGINT)	
-    rtpdump_B.wait()
-
-    #Verify that audio packets were routed in both directions after G711 fallback
-    if (os.path.getsize(dump_B) == 0):
-    	logger.error("No RTP routed towards customer ...failing the test")
-	return 1
-    if (os.path.getsize(dump_A) == 0):
-    	logger.error("No RTP routed towards carrier ...failing the test")
-	return 1
-
     if not test.passed:
         return 1
 
-    ret_A = subprocess.call([WORKING_DIR + "/check_reinvite_rtt.pl", WORKING_DIR+"/A_PARTY_STAT.log"])
+    ret_A = subprocess.call([WORKING_DIR + "/check_reinvite_rtt.py", WORKING_DIR+"/A_PARTY_STAT.log"])
 
     if (ret_A != 0):
 	    logger.debug("Slow ReInvite Detected!")
diff --git a/tests/fax/pjsip/t38_fast_reject/test-config.yaml b/tests/fax/pjsip/t38_fast_reject/test-config.yaml
index cf74af8..90eddc0 100644
--- a/tests/fax/pjsip/t38_fast_reject/test-config.yaml
+++ b/tests/fax/pjsip/t38_fast_reject/test-config.yaml
@@ -7,7 +7,6 @@
     dependencies:
         - python : 'twisted'
         - python : 'starpy'
-        - app    : 'rtpdump'
 
     tags:
         - PJSIP

-- 
To view, visit https://gerrit.asterisk.org/9567
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia73ef502f72bd75522d4b6656f6070807dbef349
Gerrit-Change-Number: 9567
Gerrit-PatchSet: 1
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180725/09de8bc2/attachment.html>


More information about the asterisk-code-review mailing list