blob: aeda80d1ca974517d1c92c5c5c63a430c776b4ae [file] [log] [blame]
Pau Espin Pedrol24824162018-08-21 15:03:51 +02001#!/usr/bin/env python3
2from osmo_gsm_tester.testenv import *
3
4hlr = suite.hlr()
5bts = suite.bts()
6mgw_msc = suite.mgw()
7mgw_bsc = suite.mgw()
8stp = suite.stp()
9msc = suite.msc(hlr, mgw_msc, stp)
10bsc = suite.bsc(msc, mgw_bsc, stp)
11ms_mo = suite.modem()
12ms_mt = suite.modem()
13
14hlr.start()
15stp.start()
16msc.start()
17mgw_msc.start()
18mgw_bsc.start()
19
20bsc.bts_add(bts)
21bsc.start()
22
23bts.start()
24wait(bsc.bts_is_connected, bts)
25
26hlr.subscriber_add(ms_mo)
27hlr.subscriber_add(ms_mt)
28
29ms_mo.connect(msc.mcc_mnc())
30ms_mt.connect(msc.mcc_mnc())
31
32ms_mo.log_info()
33ms_mt.log_info()
34
35print('waiting for modems to attach...')
36wait(ms_mo.is_connected, msc.mcc_mnc())
37wait(ms_mt.is_connected, msc.mcc_mnc())
38wait(msc.subscriber_attached, ms_mo, ms_mt)
39
40assert len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0
41mo_cid = ms_mo.call_dial(ms_mt)
42mt_cid = ms_mt.call_wait_incoming(ms_mo)
43print('dial success')
44
45assert not ms_mo.call_is_active(mo_cid) and not ms_mt.call_is_active(mt_cid)
46ms_mt.call_answer(mt_cid)
47wait(ms_mo.call_is_active, mo_cid)
48wait(ms_mt.call_is_active, mt_cid)
49print('answer success, call established and ongoing')
50
51sleep(5) # maintain the call active for 5 seconds
52
53assert ms_mo.call_is_active(mo_cid) and ms_mt.call_is_active(mt_cid)
54ms_mt.call_hangup(mt_cid)
55wait(lambda: len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0)
56print('hangup success')