Add minimal USSD support to test extension number
Change-Id: Ib19331f9c6476ac01bf729790dfd63c56de86a89
diff --git a/example/default-suites.conf b/example/default-suites.conf
index 3fd1322..5cf19ef 100644
--- a/example/default-suites.conf
+++ b/example/default-suites.conf
@@ -1,12 +1,18 @@
- sms:sysmo
- aoip_sms:sysmo
+- ussd:sysmo
+- aoip_ussd:sysmo
- voice:sysmo
- sms:trx-b200
- aoip_sms:trx-b200
+- ussd:trx-b200
+- aoip_ussd:trx-b200
- voice:trx-b200
- sms:trx-sysmocell5000
- aoip_sms:trx-sysmocell5000
- voice:trx-sysmocell5000
+- ussd:trx-sysmocell5000
+- aoip_ussd:trx-sysmocell5000
- smpp
- aoip_smpp
- aoip_encryption
diff --git a/example/resources.conf b/example/resources.conf
index 70c1c35..bdf2347 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -60,7 +60,7 @@
ki: '80A37E6FDEA931EAC92FFA5F671EFEAD'
auth_algo: 'xor'
ciphers: [a5_0, a5_1]
- features: ['sms', 'voice']
+ features: ['sms', 'voice', 'ussd']
- label: sierra_2
path: '/sierra_2'
@@ -68,7 +68,7 @@
ki: '00969E283349D354A8239E877F2E0866'
auth_algo: 'xor'
ciphers: [a5_0, a5_1]
- features: ['sms', 'voice']
+ features: ['sms', 'voice', 'ussd']
- label: gobi_0
path: '/gobi_0'
@@ -76,7 +76,7 @@
ki: 'BB70807226393CDBAC8DD3439FF54252'
auth_algo: 'xor'
ciphers: [a5_0, a5_1]
- features: ['sms']
+ features: ['sms', 'ussd']
- label: gobi_3
path: '/gobi_3'
diff --git a/src/osmo_gsm_tester/ofono_client.py b/src/osmo_gsm_tester/ofono_client.py
index 66c0a79..e8f57cc 100644
--- a/src/osmo_gsm_tester/ofono_client.py
+++ b/src/osmo_gsm_tester/ofono_client.py
@@ -39,6 +39,7 @@
I_SMS = 'org.ofono.MessageManager'
I_CALLMGR = 'org.ofono.VoiceCallManager'
I_CALL = 'org.ofono.VoiceCall'
+I_SS = 'org.ofono.SupplementaryServices'
# See https://github.com/intgr/ofono/blob/master/doc/network-api.txt#L78
NETREG_ST_REGISTERED = 'registered'
@@ -645,4 +646,9 @@
def log_info(self, *args, **kwargs):
self.log(self.info(*args, **kwargs))
+ def ussd_send(self, command):
+ ss = self.dbus.interface(I_SS)
+ service_type, response = ss.Initiate(command)
+ return response
+
# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/suites/aoip_ussd/assert_extension.py b/suites/aoip_ussd/assert_extension.py
new file mode 100755
index 0000000..da5dad3
--- /dev/null
+++ b/suites/aoip_ussd/assert_extension.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+from osmo_gsm_tester.test import *
+
+USSD_COMMAND_GET_EXTENSION = '*#100#'
+
+hlr = suite.hlr()
+bts = suite.bts()
+mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr())
+msc = suite.msc(hlr, mgcpgw)
+bsc = suite.bsc(msc)
+stp = suite.stp()
+ms = suite.modem()
+
+hlr.start()
+stp.start()
+msc.start()
+mgcpgw.start()
+
+bsc.bts_add(bts)
+bsc.start()
+
+bts.start()
+
+hlr.subscriber_add(ms)
+
+ms.connect(msc.mcc_mnc())
+
+ms.log_info()
+
+print('waiting for modems to attach...')
+wait(ms.is_connected, msc.mcc_mnc())
+wait(msc.subscriber_attached, ms)
+
+print('Sending ussd code %s' % USSD_COMMAND_GET_EXTENSION)
+response = ms.ussd_send(USSD_COMMAND_GET_EXTENSION)
+assert ' ' + ms.msisdn + '\r' in response
diff --git a/suites/aoip_ussd/suite.conf b/suites/aoip_ussd/suite.conf
new file mode 100644
index 0000000..1da0cc5
--- /dev/null
+++ b/suites/aoip_ussd/suite.conf
@@ -0,0 +1,9 @@
+resources:
+ ip_address:
+ - times: 5 # msc, bsc, hlr, stp, mgw
+ bts:
+ - times: 1
+ modem:
+ - times: 1
+ features:
+ - ussd
diff --git a/suites/ussd/assert_extension.py b/suites/ussd/assert_extension.py
new file mode 100755
index 0000000..4e2e0e1
--- /dev/null
+++ b/suites/ussd/assert_extension.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+from osmo_gsm_tester.test 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)
+
+print('Sending ussd code %s' % USSD_COMMAND_GET_EXTENSION)
+response = ms.ussd_send(USSD_COMMAND_GET_EXTENSION)
+assert ' ' + ms.msisdn + '\r' in response
diff --git a/suites/ussd/suite.conf b/suites/ussd/suite.conf
new file mode 100644
index 0000000..232a5d8
--- /dev/null
+++ b/suites/ussd/suite.conf
@@ -0,0 +1,12 @@
+resources:
+ ip_address:
+ - times: 1
+ bts:
+ - times: 1
+ modem:
+ - times: 1
+ features:
+ - ussd
+
+defaults:
+ timeout: 60s