Pau Espin Pedrol | 03983aa | 2017-06-12 15:31:27 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Pau Espin Pedrol | dfe38ad | 2017-11-09 13:57:39 +0100 | [diff] [blame] | 2 | from osmo_gsm_tester.testenv import * |
Pau Espin Pedrol | 03983aa | 2017-06-12 15:31:27 +0200 | [diff] [blame] | 3 | |
| 4 | USSD_COMMAND_GET_EXTENSION = '*#100#' |
| 5 | |
| 6 | hlr = suite.hlr() |
| 7 | bts = suite.bts() |
Pau Espin Pedrol | 86ea02f | 2018-02-26 12:14:46 +0100 | [diff] [blame] | 8 | mgw_msc = suite.mgw() |
Pau Espin Pedrol | 386b78d | 2017-11-09 13:02:09 +0100 | [diff] [blame] | 9 | mgw_bsc = suite.mgw() |
Pau Espin Pedrol | 03983aa | 2017-06-12 15:31:27 +0200 | [diff] [blame] | 10 | stp = suite.stp() |
Pau Espin Pedrol | 86ea02f | 2018-02-26 12:14:46 +0100 | [diff] [blame] | 11 | msc = suite.msc(hlr, mgw_msc, stp) |
Pau Espin Pedrol | 1e1d381 | 2017-11-16 18:06:37 +0100 | [diff] [blame] | 12 | bsc = suite.bsc(msc, mgw_bsc, stp) |
Pau Espin Pedrol | 03983aa | 2017-06-12 15:31:27 +0200 | [diff] [blame] | 13 | ms = suite.modem() |
| 14 | |
| 15 | hlr.start() |
| 16 | stp.start() |
| 17 | msc.start() |
Pau Espin Pedrol | 86ea02f | 2018-02-26 12:14:46 +0100 | [diff] [blame] | 18 | mgw_msc.start() |
Pau Espin Pedrol | 386b78d | 2017-11-09 13:02:09 +0100 | [diff] [blame] | 19 | mgw_bsc.start() |
Pau Espin Pedrol | 03983aa | 2017-06-12 15:31:27 +0200 | [diff] [blame] | 20 | |
| 21 | bsc.bts_add(bts) |
| 22 | bsc.start() |
| 23 | |
| 24 | bts.start() |
Pau Espin Pedrol | 1e19151 | 2017-12-11 15:12:55 +0100 | [diff] [blame] | 25 | wait(bsc.bts_is_connected, bts) |
Pau Espin Pedrol | 03983aa | 2017-06-12 15:31:27 +0200 | [diff] [blame] | 26 | |
| 27 | hlr.subscriber_add(ms) |
| 28 | |
| 29 | ms.connect(msc.mcc_mnc()) |
| 30 | |
| 31 | ms.log_info() |
| 32 | |
| 33 | print('waiting for modems to attach...') |
| 34 | wait(ms.is_connected, msc.mcc_mnc()) |
| 35 | wait(msc.subscriber_attached, ms) |
| 36 | |
Pau Espin Pedrol | 2d9c14a | 2017-08-02 13:08:35 +0200 | [diff] [blame] | 37 | # ofono (qmi) currently changes state to 'registered' jut after sending |
| 38 | # 'Location Update Request', but before receiving 'Location Updating Accept'. |
| 39 | # Which means we can reach lines below and send USSD code while still not being |
| 40 | # attached, which will then fail. See OsmoGsmTester #2239 for more detailed |
| 41 | # information. |
| 42 | # Until we find an ofono fix or a better way to workaround this, let's just |
| 43 | # sleep for a while in order to receive the 'Location Updating Accept' message |
| 44 | # before attemting to send the USSD. |
| 45 | sleep(10) |
| 46 | |
Pau Espin Pedrol | 03983aa | 2017-06-12 15:31:27 +0200 | [diff] [blame] | 47 | print('Sending ussd code %s' % USSD_COMMAND_GET_EXTENSION) |
| 48 | response = ms.ussd_send(USSD_COMMAND_GET_EXTENSION) |
Pau Espin Pedrol | 635f4c8 | 2018-08-13 10:33:01 +0200 | [diff] [blame^] | 49 | log('got ussd response: %r' % repr(response)) |
| 50 | assert response.endswith(' ' + ms.msisdn) |