Change in osmo-gsm-tester[master]: ms_srs: refactor UE state getter functions

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/.

srs_andre gerrit-no-reply at lists.osmocom.org
Wed May 27 16:53:18 UTC 2020


srs_andre has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18535 )


Change subject: ms_srs: refactor UE state getter functions
......................................................................

ms_srs: refactor UE state getter functions

rename UE helper functions to query RRC connected/idle state
and adapt tests accordingly

also add helper to retrieve assinged IP address

Change-Id: I6cd057e34b4df6a1a73695355dd6406d7e039546
---
M src/osmo_gsm_tester/obj/ms_srs.py
M sysmocom/suites/4g/handover.py
M sysmocom/suites/4g/iperf3_dl.py
M sysmocom/suites/4g/iperf3_ul.py
M sysmocom/suites/4g/ping.py
5 files changed, 23 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/35/18535/1

diff --git a/src/osmo_gsm_tester/obj/ms_srs.py b/src/osmo_gsm_tester/obj/ms_srs.py
index 409021e..af26011 100644
--- a/src/osmo_gsm_tester/obj/ms_srs.py
+++ b/src/osmo_gsm_tester/obj/ms_srs.py
@@ -306,11 +306,27 @@
             self.rem_host.recreate_remote_dir(self.remote_run_dir)
             self.rem_host.scp('scp-cfg-to-remote', self.config_file, self.remote_config_file)
 
-    def is_connected(self, mcc_mnc=None):
+    def is_rrc_connected(self):
+        ''' Check whether UE is RRC connected using console message '''
+        pos_connected = (self.process.get_stdout() or '').rfind('RRC Connected')
+        pos_released = (self.process.get_stdout() or '').rfind('RRC IDLE')
+        # return true if RRC
+        return pos_connected > pos_released
+
+    def is_rrc_idle(self):
+        return not self.is_rrc_connected()
+
+    def is_emm_registered(self):
         return 'Network attach successful.' in (self.process.get_stdout() or '')
 
-    def is_attached(self):
-        return self.is_connected()
+    def get_ipv4_addr(self):
+        ''' Return last assigned IP address '''
+        import re
+        stdout_lines = (self.process.get_stdout() or '').splitlines()
+        for line in reversed(stdout_lines):
+            if line.find('Network attach successful. IP: ') != -1:
+                ipv4_addr = re.findall( r'[0-9]+(?:\.[0-9]+){3}', line)
+                return ipv4_addr[0]
 
     def running(self):
         return not self.process.terminated()
diff --git a/sysmocom/suites/4g/handover.py b/sysmocom/suites/4g/handover.py
index b0837d8..6bb6456 100755
--- a/sysmocom/suites/4g/handover.py
+++ b/sysmocom/suites/4g/handover.py
@@ -46,7 +46,7 @@
 proc = iperf3cli.prepare_test_proc(iperf3cli.DIR_UL, ue.netns(), duration + 30)
 
 print('waiting for UE to attach...')
-wait(ue.is_connected, None)
+wait(ue.is_rrc_connected)
 print('UE is attached')
 
 rfemu_cell1 = enb.get_rfemu(0)
diff --git a/sysmocom/suites/4g/iperf3_dl.py b/sysmocom/suites/4g/iperf3_dl.py
index d90c80b..055ce97 100755
--- a/sysmocom/suites/4g/iperf3_dl.py
+++ b/sysmocom/suites/4g/iperf3_dl.py
@@ -26,7 +26,7 @@
 proc = iperf3cli.prepare_test_proc(iperf3cli.DIR_DL, ue.netns(), bitrate=max_rate)
 
 print('waiting for UE to attach...')
-wait(ue.is_connected, None)
+wait(ue.is_rrc_connected)
 print('UE is attached')
 
 print("Running iperf3 client to %s through %s" % (str(iperf3cli), ue.netns()))
diff --git a/sysmocom/suites/4g/iperf3_ul.py b/sysmocom/suites/4g/iperf3_ul.py
index 453cdfa..6e24070 100755
--- a/sysmocom/suites/4g/iperf3_ul.py
+++ b/sysmocom/suites/4g/iperf3_ul.py
@@ -26,7 +26,7 @@
 proc = iperf3cli.prepare_test_proc(iperf3cli.DIR_UL, ue.netns(), bitrate=max_rate)
 
 print('waiting for UE to attach...')
-wait(ue.is_connected, None)
+wait(ue.is_rrc_connected)
 print('UE is attached')
 
 print("Running iperf3 client to %s through %s" % (str(iperf3cli), ue.netns()))
diff --git a/sysmocom/suites/4g/ping.py b/sysmocom/suites/4g/ping.py
index c81a35d..0fb2edb 100755
--- a/sysmocom/suites/4g/ping.py
+++ b/sysmocom/suites/4g/ping.py
@@ -16,7 +16,7 @@
 
 ue.connect(enb)
 print('waiting for UE to attach...')
-wait(ue.is_connected, None)
+wait(ue.is_rrc_connected)
 print('UE is attached')
 
 proc = ue.run_netns_wait('ping', ('ping', '-c', '10', epc.tun_addr()))

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18535
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: I6cd057e34b4df6a1a73695355dd6406d7e039546
Gerrit-Change-Number: 18535
Gerrit-PatchSet: 1
Gerrit-Owner: srs_andre <andre at softwareradiosystems.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200527/6d4f4cc2/attachment.htm>


More information about the gerrit-log mailing list