blob: 46c5ec8c8b120c65e51419b4cf5d002daa8b62f7 [file] [log] [blame]
Pau Espin Pedrold71edd12017-10-06 13:53:54 +02001#!/usr/bin/env python3
Pau Espin Pedroldfe38ad2017-11-09 13:57:39 +01002from osmo_gsm_tester.testenv import *
Pau Espin Pedrold71edd12017-10-06 13:53:54 +02003
4hlr = suite.hlr()
5bts = suite.bts()
6mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr())
Pau Espin Pedrol386b78d2017-11-09 13:02:09 +01007mgw_bsc = suite.mgw()
Pau Espin Pedrold71edd12017-10-06 13:53:54 +02008stp = suite.stp()
Pau Espin Pedrol1e1d3812017-11-16 18:06:37 +01009msc = suite.msc(hlr, mgcpgw, stp)
10bsc = suite.bsc(msc, mgw_bsc, stp)
Pau Espin Pedrold71edd12017-10-06 13:53:54 +020011ms_mo = suite.modem()
12ms_mt = suite.modem()
13
14hlr.start()
15stp.start()
16msc.start()
17mgcpgw.start()
Pau Espin Pedrol386b78d2017-11-09 13:02:09 +010018mgw_bsc.start()
Pau Espin Pedrold71edd12017-10-06 13:53:54 +020019
20bsc.bts_add(bts)
21bsc.start()
22
23bts.start()
24
25hlr.subscriber_add(ms_mo)
26hlr.subscriber_add(ms_mt)
27
28ms_mo.connect(msc.mcc_mnc())
29ms_mt.connect(msc.mcc_mnc())
30
31ms_mo.log_info()
32ms_mt.log_info()
33
34print('waiting for modems to attach...')
35wait(ms_mo.is_connected, msc.mcc_mnc())
36wait(ms_mt.is_connected, msc.mcc_mnc())
37wait(msc.subscriber_attached, ms_mo, ms_mt)
38
39assert len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0
40mo_cid = ms_mo.call_dial(ms_mt)
41mt_cid = ms_mt.call_wait_incoming(ms_mo)
42print('dial success')
43
44assert not ms_mo.call_is_active(mo_cid) and not ms_mt.call_is_active(mt_cid)
45ms_mt.call_answer(mt_cid)
46wait(ms_mo.call_is_active, mo_cid)
47wait(ms_mt.call_is_active, mt_cid)
48print('answer success, call established and ongoing')
49
50sleep(5) # maintain the call active for 5 seconds
51
52assert ms_mo.call_is_active(mo_cid) and ms_mt.call_is_active(mt_cid)
53ms_mt.call_hangup(mt_cid)
54wait(lambda: len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0)
55print('hangup success')