diff options
Diffstat (limited to 'suites')
-rwxr-xr-x | suites/aoip_smpp/esme_connect_policy_acceptall.py | 37 | ||||
-rwxr-xr-x | suites/aoip_smpp/esme_connect_policy_closed.py | 57 | ||||
-rwxr-xr-x | suites/aoip_smpp/esme_ms_sms.py | 56 | ||||
-rw-r--r-- | suites/aoip_smpp/suite.conf | 10 | ||||
-rwxr-xr-x | suites/smpp/esme_connect_policy_acceptall.py | 32 | ||||
-rwxr-xr-x | suites/smpp/esme_connect_policy_closed.py | 51 | ||||
-rwxr-xr-x | suites/smpp/esme_ms_sms.py | 49 | ||||
-rw-r--r-- | suites/smpp/suite.conf | 10 |
8 files changed, 302 insertions, 0 deletions
diff --git a/suites/aoip_smpp/esme_connect_policy_acceptall.py b/suites/aoip_smpp/esme_connect_policy_acceptall.py new file mode 100755 index 0000000..2a954d5 --- /dev/null +++ b/suites/aoip_smpp/esme_connect_policy_acceptall.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 + +# This test checks following use-cases while in 'accept-all' policy: +# * SMPP interface of SMSC accepts SMPP clients (ESMEs) which do not appear on +# the config file + +from osmo_gsm_tester.test import * + +hlr = suite.hlr() +bts = suite.bts() # bts not started, only needed for mgcpgw +mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr()) +msc = suite.msc(hlr, mgcpgw) +smsc = msc.smsc +esme = suite.esme() + +# Here we deliberately omit calling smsc.esme_add() to avoid having it included +# in the smsc config. +smsc.set_smsc_policy(smsc.SMSC_POLICY_ACCEPT_ALL) +esme.set_smsc(smsc) + +hlr.start() +msc.start() +mgcpgw.start() + +# Due to accept-all policy, connect() should work even if we didn't previously +# configure the esme in the smsc, no matter the system_id / password we use. +log('Test connect with non-empty values in system_id and password') +esme.set_system_id('foo') +esme.set_password('bar') +esme.connect() +esme.disconnect() + +log('Test connect with empty values in system_id and password') +esme.set_system_id('') +esme.set_password('') +esme.connect() +esme.disconnect() diff --git a/suites/aoip_smpp/esme_connect_policy_closed.py b/suites/aoip_smpp/esme_connect_policy_closed.py new file mode 100755 index 0000000..29b25d1 --- /dev/null +++ b/suites/aoip_smpp/esme_connect_policy_closed.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 + +# This test checks following use-cases while in 'closed' policy: +# * SMPP interface of SMSC accepts SMPP clients (ESMEs) with password previously +# defined in its configuration file. +# * SMPP interface of SMSC rejects ESMEs with known system id but wrong password. +# * SMPP interface of SMSC rejects ESEMs with unknown system id + +from osmo_gsm_tester.test import * + +SMPP_ESME_RINVPASWD = 0x0000000E +SMPP_ESME_RINVSYSID = 0x0000000F + +hlr = suite.hlr() +bts = suite.bts() +mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr()) +msc = suite.msc(hlr, mgcpgw) +smsc = msc.smsc + +esme = suite.esme() +esme_no_pwd = suite.esme() +esme_no_pwd.set_password('') + +smsc.set_smsc_policy(smsc.SMSC_POLICY_CLOSED) +smsc.esme_add(esme) +smsc.esme_add(esme_no_pwd) + +hlr.start() +msc.start() +mgcpgw.start() + +log('Test with correct credentials (no password)') +esme_no_pwd.connect() +esme_no_pwd.disconnect() + +log('Test with correct credentials (no password, non empty)') +esme_no_pwd.set_password('foobar') +esme_no_pwd.connect() +esme_no_pwd.disconnect() + +log('Test with correct credentials') +esme.connect() +esme.disconnect() + +log('Test with bad password, checking for failure') +correct_password = esme.password +new_password = 'barfoo' if correct_password == 'foobar' else 'foobar' +esme.set_password(new_password) +esme.run_method_expect_failure(SMPP_ESME_RINVPASWD, esme.connect) +esme.set_password(correct_password) + +log('Test with bad system_id, checking for failure') +correct_system_id = esme.system_id +new_system_id = 'barfoo' if correct_system_id == 'foobar' else 'foobar' +esme.set_system_id(new_system_id) +esme.run_method_expect_failure(SMPP_ESME_RINVSYSID, esme.connect) +esme.set_system_id(correct_system_id) diff --git a/suites/aoip_smpp/esme_ms_sms.py b/suites/aoip_smpp/esme_ms_sms.py new file mode 100755 index 0000000..7f9ef18 --- /dev/null +++ b/suites/aoip_smpp/esme_ms_sms.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 + +# This test checks following use-cases: +# * SMPP interface of SMSC accepts SMPP clients (ESMEs) with password previously +# defined in its configuration file. +# * ESME can send an SMS to an already registered MS when SMSC is in 'forward' mode. + +from osmo_gsm_tester.test import * + +SMPP_ESME_RINVDSTADR = 0x0000000B + +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() +bsc.bts_add(bts) + +ms = suite.modem() +esme = suite.esme() +msc.smsc.esme_add(esme) + +hlr.start() +stp.start() +msc.start() +mgcpgw.start() +bsc.start() +bts.start() + +esme.connect() +hlr.subscriber_add(ms) +ms.connect(msc.mcc_mnc()) + +ms.log_info() +print('waiting for modem to attach...') +wait(ms.is_connected, msc.mcc_mnc()) +wait(msc.subscriber_attached, ms) + +print('sending first sms...') +msg = Sms(esme.msisdn, ms.msisdn, 'smpp send message') +esme.sms_send(msg) +wait(ms.sms_was_received, msg) + +print('sending second sms (unicode chars not in gsm aplhabet)...') +msg = Sms(esme.msisdn, ms.msisdn, 'chars:[кизаçйж]') +esme.sms_send(msg) +wait(ms.sms_was_received, msg) + +# FIXME: This test is not failing with error but succeeds, need to check why: (forward vs store policy?) +# wrong_msisdn = ms.msisdn + esme.msisdn +# print('sending third sms (with wrong msisdn %s)' % wrong_msisdn) +# msg = Sms(esme.msisdn, wrong_msisdn, 'smpp message with wrong dest') +# esme.run_method_expect_failure(SMPP_ESME_RINVDSTADR, esme.sms_send, msg) + +esme.disconnect() diff --git a/suites/aoip_smpp/suite.conf b/suites/aoip_smpp/suite.conf new file mode 100644 index 0000000..46f8d09 --- /dev/null +++ b/suites/aoip_smpp/suite.conf @@ -0,0 +1,10 @@ +resources: + ip_address: + - times: 5 # msc, bsc, hlr, stp, mgw + bts: + - times: 1 + modem: + - times: 1 + +defaults: + timeout: 60s diff --git a/suites/smpp/esme_connect_policy_acceptall.py b/suites/smpp/esme_connect_policy_acceptall.py new file mode 100755 index 0000000..d22703d --- /dev/null +++ b/suites/smpp/esme_connect_policy_acceptall.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +# This test checks following use-cases while in 'accept-all' policy: +# * SMPP interface of SMSC accepts SMPP clients (ESMEs) which do not appear on +# the config file + +from osmo_gsm_tester.test import * + +nitb = suite.nitb() +smsc = nitb.smsc +esme = suite.esme() + +# Here we deliberately omit calling smsc.esme_add() to avoid having it included +# in the smsc config. +smsc.set_smsc_policy(smsc.SMSC_POLICY_ACCEPT_ALL) +esme.set_smsc(smsc) + +nitb.start() + +# Due to accept-all policy, connect() should work even if we didn't previously +# configure the esme in the smsc, no matter the system_id / password we use. +log('Test connect with non-empty values in system_id and password') +esme.set_system_id('foo') +esme.set_password('bar') +esme.connect() +esme.disconnect() + +log('Test connect with empty values in system_id and password') +esme.set_system_id('') +esme.set_password('') +esme.connect() +esme.disconnect() diff --git a/suites/smpp/esme_connect_policy_closed.py b/suites/smpp/esme_connect_policy_closed.py new file mode 100755 index 0000000..7fac276 --- /dev/null +++ b/suites/smpp/esme_connect_policy_closed.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 + +# This test checks following use-cases while in 'closed' policy: +# * SMPP interface of SMSC accepts SMPP clients (ESMEs) with password previously +# defined in its configuration file. +# * SMPP interface of SMSC rejects ESMEs with known system id but wrong password. +# * SMPP interface of SMSC rejects ESEMs with unknown system id + +from osmo_gsm_tester.test import * + +SMPP_ESME_RINVPASWD = 0x0000000E +SMPP_ESME_RINVSYSID = 0x0000000F + +nitb = suite.nitb() +smsc = nitb.smsc +esme = suite.esme() +esme_no_pwd = suite.esme() +esme_no_pwd.set_password('') + +smsc.set_smsc_policy(smsc.SMSC_POLICY_CLOSED) +smsc.esme_add(esme) +smsc.esme_add(esme_no_pwd) + +nitb.start() + +log('Test with correct credentials (no password)') +esme_no_pwd.connect() +esme_no_pwd.disconnect() + +log('Test with correct credentials (no password, non empty)') +esme_no_pwd.set_password('foobar') +esme_no_pwd.connect() +esme_no_pwd.disconnect() + +log('Test with correct credentials') +esme.connect() +esme.disconnect() + +log('Test with bad password, checking for failure') +correct_password = esme.password +new_password = 'barfoo' if correct_password == 'foobar' else 'foobar' +esme.set_password(new_password) +esme.run_method_expect_failure(SMPP_ESME_RINVPASWD, esme.connect) +esme.set_password(correct_password) + +log('Test with bad system_id, checking for failure') +correct_system_id = esme.system_id +new_system_id = 'barfoo' if correct_system_id == 'foobar' else 'foobar' +esme.set_system_id(new_system_id) +esme.run_method_expect_failure(SMPP_ESME_RINVSYSID, esme.connect) +esme.set_system_id(correct_system_id) diff --git a/suites/smpp/esme_ms_sms.py b/suites/smpp/esme_ms_sms.py new file mode 100755 index 0000000..bc9d7d4 --- /dev/null +++ b/suites/smpp/esme_ms_sms.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +# This test checks following use-cases: +# * SMPP interface of SMSC accepts SMPP clients (ESMEs) with password previously +# defined in its configuration file. +# * ESME can send an SMS to an already registered MS when SMSC is in 'forward' mode. + +from osmo_gsm_tester.test import * + +SMPP_ESME_RINVDSTADR = 0x0000000B + +nitb = suite.nitb() +bts = suite.bts() +ms = suite.modem() +esme = suite.esme() + +print('start nitb and bts...') +nitb.bts_add(bts) +nitb.smsc.esme_add(esme) +nitb.start() +bts.start() + +esme.connect() +nitb.subscriber_add(ms) +ms.connect(nitb.mcc_mnc()) + +ms.log_info() +print('waiting for modem to attach...') +wait(ms.is_connected, nitb.mcc_mnc()) +wait(nitb.subscriber_attached, ms) + +print('sending first sms...') +msg = Sms(esme.msisdn, ms.msisdn, 'smpp send message') +esme.sms_send(msg) +wait(ms.sms_was_received, msg) + +print('sending second sms (unicode chars not in gsm aplhabet)...') +msg = Sms(esme.msisdn, ms.msisdn, 'chars:[кизаçйж]') +esme.sms_send(msg) +wait(ms.sms_was_received, msg) + + +# FIXME: This test is not failing with error but succeeds, need to check why: (forward vs store policy?) +# wrong_msisdn = ms.msisdn + esme.msisdn +# print('sending third sms (with wrong msisdn %s)' % wrong_msisdn) +# msg = Sms(esme.msisdn, wrong_msisdn, 'smpp message with wrong dest') +# esme.run_method_expect_failure(SMPP_ESME_RINVDSTADR, esme.sms_send, msg) + +esme.disconnect() diff --git a/suites/smpp/suite.conf b/suites/smpp/suite.conf new file mode 100644 index 0000000..eb59abb --- /dev/null +++ b/suites/smpp/suite.conf @@ -0,0 +1,10 @@ +resources: + ip_address: + - times: 1 + bts: + - times: 1 + modem: + - times: 1 + +defaults: + timeout: 60s |