Change in osmo-gsm-tester[master]: sysmocom: emergency_preemptive_call.py: Avoid test failure if 2nd cal...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Thu Oct 22 09:14:53 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20825 )

Change subject: sysmocom: emergency_preemptive_call.py: Avoid test failure if 2nd call not fully established
......................................................................

sysmocom: emergency_preemptive_call.py: Avoid test failure if 2nd call not fully established

It may happen that the non-emergency call MT leg is still not properly
released when the emergency call MT leg is to be assigned a TCH, meaning
BSC will fail with an Assignment Failure upon Assignment request from
MSC.
The test sometimes passed and sometimes didn't, due to above mentioned
race condition. Let's relax a bit the test expectancies to have it
always passing, while still verifying preemption happens, and MT phone
is reached.

Related: OS#4549
Change-Id: I3697227cac56a1327f9ea08c5c2f52568e8d2a8a
---
M src/osmo_gsm_tester/obj/ms_ofono.py
M sysmocom/suites/emergency/emergency_preemptive_call.py
2 files changed, 18 insertions(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/src/osmo_gsm_tester/obj/ms_ofono.py b/src/osmo_gsm_tester/obj/ms_ofono.py
index a5ee3ea..c709f31 100644
--- a/src/osmo_gsm_tester/obj/ms_ofono.py
+++ b/src/osmo_gsm_tester/obj/ms_ofono.py
@@ -773,6 +773,15 @@
         MainLoop.wait(lambda: self._find_call_msisdn_state(caller_msisdn, 'incoming') is not None, timeout=timeout)
         return self._find_call_msisdn_state(caller_msisdn, 'incoming')
 
+    def call_wait_dialing(self, caller_msisdn_or_modem, timeout=60):
+        if isinstance(caller_msisdn_or_modem, Modem):
+            caller_msisdn = caller_msisdn_or_modem.msisdn()
+        else:
+            caller_msisdn = str(caller_msisdn_or_modem)
+        self.dbg('Waiting for dialing call from:', caller_msisdn)
+        MainLoop.wait(lambda: self._find_call_msisdn_state(caller_msisdn, 'dialing') is not None, timeout=timeout)
+        return self._find_call_msisdn_state(caller_msisdn, 'dialing')
+
     def call_answer(self, call_id):
         self.dbg('Answer call %s' % call_id)
         assert self.call_state(call_id) == 'incoming'
diff --git a/sysmocom/suites/emergency/emergency_preemptive_call.py b/sysmocom/suites/emergency/emergency_preemptive_call.py
index b4fba4b..7e76a31 100755
--- a/sysmocom/suites/emergency/emergency_preemptive_call.py
+++ b/sysmocom/suites/emergency/emergency_preemptive_call.py
@@ -80,20 +80,16 @@
 assert len(emerg_numbers) > 0
 print('dialing Emergency Number %s' % (emerg_numbers[0]))
 mo_cid_emerg = ms_mo_emerg.call_dial(emerg_numbers[0])
-mt_cid_emerg = ms_mt_emerg.call_wait_incoming(ms_mo_emerg)
+# In here we'd ideally wait for incoming call and accept it, but there may be a
+# race condition in previous MT TCH not being yet released, so BSC will only be
+# able to allocate a SDCCH for not a TCH, and will fail later with Assignment
+# Failure:
+mt_cid_emerg = ms_mt_emerg.call_wait_dialing(ms_mo_emerg)
 print('dial success')
-assert not ms_mo_emerg.call_is_active(mo_cid_emerg) and not ms_mt_emerg.call_is_active(mt_cid_emerg)
-ms_mt_emerg.call_answer(mt_cid_emerg)
-wait(ms_mo_emerg.call_is_active, mo_cid_emerg)
-wait(ms_mt_emerg.call_is_active, mt_cid_emerg)
-print('answer success, call established and ongoing')
-
+assert ms_mo_emerg.call_state(mo_cid_emerg) == 'alerting'
 # Now the emergency call is ongoing, and the previous one should have been gone:
-assert len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0
+wait(lambda: len(ms_mo.call_id_list()) == 0 and len(ms_mt.call_id_list()) == 0)
+print('preemption worked')
 
 sleep(5) # maintain the emergency call active for 5 seconds
-
-assert ms_mo_emerg.call_is_active(mo_cid_emerg) and ms_mt.call_is_active(mt_cid_emerg)
-ms_mt_emerg.call_hangup(mt_cid_emerg)
-wait(lambda: len(ms_mo_emerg.call_id_list()) == 0 and len(ms_mt_emerg.call_id_list()) == 0)
-print('hangup success')
+print('done sleepig, success')

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20825
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I3697227cac56a1327f9ea08c5c2f52568e8d2a8a
Gerrit-Change-Number: 20825
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201022/9add838b/attachment.htm>


More information about the gerrit-log mailing list