Pau Espin Pedrol | dcc67fc | 2018-11-21 13:55:47 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | # Following test verifies CS paging works when MS is GPRS attached. |
| 4 | # See OS#2204 for more information. |
| 5 | |
| 6 | from osmo_gsm_tester.testenv import * |
| 7 | |
| 8 | hlr = suite.hlr() |
| 9 | bts = suite.bts() |
| 10 | pcu = bts.pcu() |
| 11 | mgw_msc = suite.mgw() |
| 12 | mgw_bsc = suite.mgw() |
| 13 | stp = suite.stp() |
| 14 | ggsn = suite.ggsn() |
| 15 | sgsn = suite.sgsn(hlr, ggsn) |
| 16 | msc = suite.msc(hlr, mgw_msc, stp) |
| 17 | bsc = suite.bsc(msc, mgw_bsc, stp) |
| 18 | ms_mo = suite.modem() |
| 19 | ms_mt = suite.modem() |
| 20 | |
| 21 | bsc.bts_add(bts) |
| 22 | sgsn.bts_add(bts) |
| 23 | |
| 24 | print('start network...') |
| 25 | hlr.start() |
| 26 | stp.start() |
| 27 | ggsn.start() |
| 28 | sgsn.start() |
| 29 | msc.start() |
| 30 | mgw_msc.start() |
| 31 | mgw_bsc.start() |
| 32 | bsc.start() |
| 33 | |
| 34 | bts.start() |
| 35 | wait(bsc.bts_is_connected, bts) |
| 36 | print('Waiting for bts to be ready...') |
| 37 | wait(bts.ready_for_pcu) |
| 38 | pcu.start() |
| 39 | |
| 40 | hlr.subscriber_add(ms_mo) |
| 41 | hlr.subscriber_add(ms_mt) |
| 42 | |
| 43 | ms_mo.connect(msc.mcc_mnc()) |
| 44 | ms_mt.connect(msc.mcc_mnc()) |
| 45 | ms_mo.attach() |
| 46 | ms_mt.attach() |
| 47 | |
| 48 | ms_mo.log_info() |
| 49 | ms_mt.log_info() |
| 50 | |
| 51 | print('waiting for modems to attach...') |
| 52 | wait(ms_mo.is_connected, msc.mcc_mnc()) |
| 53 | wait(ms_mt.is_connected, msc.mcc_mnc()) |
| 54 | wait(msc.subscriber_attached, ms_mo, ms_mt) |
| 55 | |
| 56 | print('waiting for modems to attach to data services...') |
| 57 | wait(ms_mo.is_attached) |
| 58 | wait(ms_mt.is_attached) |
| 59 | |
| 60 | # We need to use inet46 since ofono qmi only uses ipv4v6 eua (OS#2713) |
| 61 | ctx_id_v4_mo = ms_mo.activate_context(apn='inet46', protocol=ms_mo.CTX_PROT_IPv4) |
| 62 | ctx_id_v4_mt = ms_mt.activate_context(apn='inet46', protocol=ms_mt.CTX_PROT_IPv4) |
| 63 | |
| 64 | assert len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0 |
| 65 | mo_cid = ms_mo.call_dial(ms_mt) |
| 66 | mt_cid = ms_mt.call_wait_incoming(ms_mo) |
| 67 | print('dial success') |
| 68 | |
| 69 | assert not ms_mo.call_is_active(mo_cid) and not ms_mt.call_is_active(mt_cid) |
| 70 | ms_mt.call_answer(mt_cid) |
| 71 | wait(ms_mo.call_is_active, mo_cid) |
| 72 | wait(ms_mt.call_is_active, mt_cid) |
| 73 | print('answer success, call established and ongoing') |
| 74 | |
| 75 | sleep(5) # maintain the call active for 5 seconds |
| 76 | |
| 77 | assert ms_mo.call_is_active(mo_cid) and ms_mt.call_is_active(mt_cid) |
| 78 | ms_mt.call_hangup(mt_cid) |
| 79 | wait(lambda: len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0) |
| 80 | print('hangup success') |
| 81 | |
| 82 | ms_mo.deactivate_context(ctx_id_v4_mo) |
| 83 | ms_mt.deactivate_context(ctx_id_v4_mt) |