-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathrun-test
executable file
·79 lines (64 loc) · 2.07 KB
/
run-test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python
import sys
import os
import logging
import signal
import subprocess
sys.path.append("lib/python")
sys.path.append("utils")
from twisted.internet import reactor
from asterisk.sipp import SIPpTest
WORKING_DIR = os.path.abspath(os.path.dirname(__file__))
TEST_DIR = os.path.dirname(os.path.realpath(__file__))
logger = logging.getLogger(__name__)
e164 = "3200000000"
sippA_logfile = WORKING_DIR + "/A_PARTY.log"
sippA_errfile = WORKING_DIR + "/A_PARTY_ERR.log"
sippB_logfile = WORKING_DIR + "/B_PARTY.log"
sippB_errfile = WORKING_DIR + "/B_PARTY_ERR.log"
dump_B = WORKING_DIR + "/codec_B.log"
SIPP_SCENARIOS = [
{
'scenario' : 'uas_asterisk.xml',
'-i' : '127.0.0.1',
'-p' : '5700',
'-min_rtp_port' : '6300',
'-message_file' : sippB_logfile,
'-error_file' : sippB_errfile,
'-trace_msg' : '-trace_err',
},
{
'scenario' : 'uac_asterisk.xml',
'-i' : '127.0.0.1',
'-p' : '5061',
'-s' : e164,
'-d' : '5000',
'-message_file' : sippA_logfile,
'-error_file' : sippA_errfile,
'-trace_msg' : '-trace_err',
}
]
def cleanup():
filelist = [ f for f in os.listdir(WORKING_DIR) if f.endswith(".log") ]
for f in filelist:
os.remove(os.path.join(WORKING_DIR, f))
def main():
test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS,test_config={'memcheck-delay-stop':7})
test.reactor_timeout = 55;
# Run the RTPDUMP tool to capture the logs on B side
rtpdump = subprocess.Popen(["rtpdump", "-t","5", "-F","ascii","-o",dump_B, "127.0.0.1/8000"])
reactor.run()
# Kill the RTPDUMP, pass it the signal"
rtpdump.send_signal(signal.SIGINT)
rtpdump.wait()
ret_B = subprocess.call(["perl","contrib/scripts/verify_codecs.pl",dump_B ,"0"])
if (ret_B != 99):
ret_B = subprocess.call(["perl","contrib/scripts/verify_rtp_len.pl",dump_B ,"172"])
cleanup()
if(ret_B != 99):
return 0
else:
return 1
if __name__ == "__main__":
sys.exit(main())
# vim:sw=4:ts=4:expandtab:textwidth=79