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