path: root/src/osmo_gsm_tester/esme.py
AgeCommit message (Collapse)AuthorFilesLines
2017-08-18esme: Remove temporary workaround for non-implemented deliver_smPau Espin Pedrol1-3/+1
Openbsc has SMS Delivery Reports since recently, which means we are now receiving deliver_sm messages and this workaround introduced in commit db0d8ab4fcfac67e76729241d92ca128d4526240 is not required anymore. Closes OS-#2353. Change-Id: Iecf3983bfc24fec8023ba5d589c2d7620ec5d921
2017-08-17esme: user_message_referece values should be smaller than 256Pau Espin Pedrol1-1/+1
SMPP specs say message reference is 16 bits field. However, message reference field in GSM03.40 spec is only 8 bits. Change-Id: I52968a10089d14e0e3b0f9be678c261e3f92939c
2017-08-17esme: smpp pdu field is a string and needs conversionPau Espin Pedrol1-2/+3
I take the chance to also swap the two log parameters, because they are included into a dictionary and shown in swapped order in the log anyway, which distracts me every time I look at the values. Change-Id: I6e6ec5b9980958de82ade40e4cd898dc6f1b889f
2017-08-10esme: Add cleanup function to avoid cascade failure of testsPau Espin Pedrol1-0/+3
In commit 6100b629e55ed4aa319f46ad797741131b9da8e7 I assumed esme already had a cleanup function, which doesn't seem to be the case. This means if a test calls esme.connect() and fails afterwards without calling esme.disconnect(), the connection will be kept but as the test will finish and the NITB is closed, then the connection will be kept forever in an erroneous state. With the cleanup function we ensure we will close the connection after the test. Change-Id: Ia3a23bb8bbccfe7ac5c544521b5566164609f0a5
2017-07-31esme: Log connection parameters of the SMSCPau Espin Pedrol1-1/+1
Change-Id: Ie4d3019503a68b02ace849defe618bdc74eacbd9
2017-07-20esme: Fix race condition waiting for message responsePau Espin Pedrol1-1/+2
Sometimes in test esme_ms_sms_transaction.py we get the following error: esme_ms_sms_transaction.py:54: ERR: ValueError: list.remove(x): x not in list This appears due to a race condition because sms_send is used several times, which means we don't wait or sync until we receive the response before calling sms_send_wait_resp. That means when we wait for response of message with seqnum X, we may receive response from message seqnum X-1 which was initiated by sms_send and thus was not stored in the self.pdus_pending array. As it's not there, trying to remove it triggers an exception. Change-Id: Idf49f40eb46be1448b328a5c338ddbc4547148ff
2017-07-20Improve SMPP supported features and test coveragePau Espin Pedrol1-7/+50
esme: Add several bits to handle logic required by tests: - Allow specifying the mode used to send an sms - Add a parameter to ask to receive a Delivery receipt for that message - Add sms_send_wait_resp API, which waits until the response message for a given smpp message is received when sending an sms. - Add receipt_was_received API, which together with message_received_handler maintains state of the delivery receipts we asked for and were still not received. However, the check needs to be disabled for now because OsmoNITB doens't seem to be sending stuff properly, see OsmoNITB #2353. - On message_received_handler, also print alert_notification messages, to show that there's actually a bug in OsmoNITB, see #2352. Move old esme_ms_sms to esme_ms_sms_transaction, and explicitly state that we are using that mode. On the same test, we can now enable the part which asserts that sending an SMS to an msisdn with unknown destination triggers an error. The issue was mainly that the error had to come from the SMSC server response, not from the sent message, so we have to wait for the response to have the failure triggered. Finally, add esme_ms_sms_storeforward, which tests features for sms sent using that mode, and uses the APIs described above. Change-Id: Ia2c0c325fee14143deca8310312fc530cd9ce92e
2017-06-18Add support for SMPP testingPau Espin Pedrol1-0/+138
As defined in [1], the different related actors are implemented in this commit: ESME and SMSC. SMSC: In Osmocom, the SMSC is currently implemented inside the NITB or the MSC. A new Smsc abstract class is created to shared code between the NITB and the MSC, and also makes it easier for later when the SMSC is splitted. ESMEs can be dynamically added to its configuration in a similar way to how the BTSs are added. ESME: A new class Esme is created which can be used by tests to control an ESME to interact with the SMSC. The ESME functionalities are implemented using python-smpplib. Required version of this library is at least 43cc6f819ec76b2c0a9d36d1d439308634716227, which contains support for python 3 and some required features to poll the socket. This commit already contains a few tests which checks different features and tests the API. Extending tested features or scenarios can be later done quite easily. The tests are not enabled by default right now, because there are several of them in a suite and the ip_address resources are not freed after every tests which ends up in the suite failing due to missing reserved resources. All the tests run alone work though. When the issue is fixed they can then be added to the default list of tests to be run. [1] http://opensmpp.org/specs/SMPP_v3_4_Issue1_2.pdf Change-Id: I14ca3cb009d6d646a449ca99b0200da12085c0da