aboutsummaryrefslogtreecommitdiffstats
path: root/suites/ussd/assert_extension.py
blob: 77e54236c9ba7f76446f8d93756054f89cd2c6e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
from osmo_gsm_tester.testenv import *

USSD_COMMAND_GET_EXTENSION = '*#100#'

nitb = suite.nitb()
bts = suite.bts()
ms = suite.modem()

print('start nitb and bts...')
nitb.bts_add(bts)
nitb.start()
bts.start()

nitb.subscriber_add(ms)

ms.connect(nitb.mcc_mnc())
ms.log_info()

print('waiting for modems to attach...')
wait(ms.is_connected, nitb.mcc_mnc())
wait(nitb.subscriber_attached, ms)

# ofono (qmi) currently changes state to 'registered' jut after sending
# 'Location Update Request', but before receiving 'Location Updating Accept'.
# Which means we can reach lines below and send USSD code while still not being
# attached, which will then fail. See OsmoGsmTester #2239 for more detailed
# information.
# Until we find an ofono fix or a better way to workaround this, let's just
# sleep for a while in order to receive the 'Location Updating Accept' message
# before attemting to send the USSD.
sleep(10)

print('Sending ussd code %s' % USSD_COMMAND_GET_EXTENSION)
response = ms.ussd_send(USSD_COMMAND_GET_EXTENSION)
assert ' ' + ms.msisdn + '\r' in response