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