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