blob: 5e934db61343e153752e06292279d6a19cd529f5 [file] [log] [blame]
Pau Espin Pedrol03983aa2017-06-12 15:31:27 +02001#!/usr/bin/env python3
2from osmo_gsm_tester.test import *
3
4USSD_COMMAND_GET_EXTENSION = '*#100#'
5
6hlr = suite.hlr()
7bts = suite.bts()
8mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr())
9msc = suite.msc(hlr, mgcpgw)
10bsc = suite.bsc(msc)
11stp = suite.stp()
12ms = suite.modem()
13
14hlr.start()
15stp.start()
16msc.start()
17mgcpgw.start()
18
19bsc.bts_add(bts)
20bsc.start()
21
22bts.start()
23
24hlr.subscriber_add(ms)
25
26ms.connect(msc.mcc_mnc())
27
28ms.log_info()
29
30print('waiting for modems to attach...')
31wait(ms.is_connected, msc.mcc_mnc())
32wait(msc.subscriber_attached, ms)
33
Pau Espin Pedrol2d9c14a2017-08-02 13:08:35 +020034# ofono (qmi) currently changes state to 'registered' jut after sending
35# 'Location Update Request', but before receiving 'Location Updating Accept'.
36# Which means we can reach lines below and send USSD code while still not being
37# attached, which will then fail. See OsmoGsmTester #2239 for more detailed
38# information.
39# Until we find an ofono fix or a better way to workaround this, let's just
40# sleep for a while in order to receive the 'Location Updating Accept' message
41# before attemting to send the USSD.
42sleep(10)
43
Pau Espin Pedrol03983aa2017-06-12 15:31:27 +020044print('Sending ussd code %s' % USSD_COMMAND_GET_EXTENSION)
45response = ms.ussd_send(USSD_COMMAND_GET_EXTENSION)
46assert ' ' + ms.msisdn + '\r' in response