Pau Espin Pedrol | 2d16f6f | 2017-05-30 15:33:57 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | # This test checks following use-cases while in 'closed' policy: |
| 4 | # * SMPP interface of SMSC accepts SMPP clients (ESMEs) with password previously |
| 5 | # defined in its configuration file. |
| 6 | # * SMPP interface of SMSC rejects ESMEs with known system id but wrong password. |
| 7 | # * SMPP interface of SMSC rejects ESEMs with unknown system id |
| 8 | |
Pau Espin Pedrol | dfe38ad | 2017-11-09 13:57:39 +0100 | [diff] [blame] | 9 | from osmo_gsm_tester.testenv import * |
Pau Espin Pedrol | 2d16f6f | 2017-05-30 15:33:57 +0200 | [diff] [blame] | 10 | |
| 11 | SMPP_ESME_RINVPASWD = 0x0000000E |
| 12 | SMPP_ESME_RINVSYSID = 0x0000000F |
| 13 | |
| 14 | nitb = suite.nitb() |
| 15 | smsc = nitb.smsc |
| 16 | esme = suite.esme() |
| 17 | esme_no_pwd = suite.esme() |
| 18 | esme_no_pwd.set_password('') |
| 19 | |
| 20 | smsc.set_smsc_policy(smsc.SMSC_POLICY_CLOSED) |
| 21 | smsc.esme_add(esme) |
| 22 | smsc.esme_add(esme_no_pwd) |
| 23 | |
| 24 | nitb.start() |
| 25 | |
| 26 | log('Test with correct credentials (no password)') |
| 27 | esme_no_pwd.connect() |
| 28 | esme_no_pwd.disconnect() |
| 29 | |
| 30 | log('Test with correct credentials (no password, non empty)') |
| 31 | esme_no_pwd.set_password('foobar') |
| 32 | esme_no_pwd.connect() |
| 33 | esme_no_pwd.disconnect() |
| 34 | |
| 35 | log('Test with correct credentials') |
| 36 | esme.connect() |
| 37 | esme.disconnect() |
| 38 | |
| 39 | log('Test with bad password, checking for failure') |
| 40 | correct_password = esme.password |
| 41 | new_password = 'barfoo' if correct_password == 'foobar' else 'foobar' |
| 42 | esme.set_password(new_password) |
| 43 | esme.run_method_expect_failure(SMPP_ESME_RINVPASWD, esme.connect) |
| 44 | esme.set_password(correct_password) |
| 45 | |
| 46 | log('Test with bad system_id, checking for failure') |
| 47 | correct_system_id = esme.system_id |
| 48 | new_system_id = 'barfoo' if correct_system_id == 'foobar' else 'foobar' |
| 49 | esme.set_system_id(new_system_id) |
| 50 | esme.run_method_expect_failure(SMPP_ESME_RINVSYSID, esme.connect) |
| 51 | esme.set_system_id(correct_system_id) |