Change in osmo-gsm-tester[master]: bsc: add active lchan matching via vty

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

neels gerrit-no-reply at lists.osmocom.org
Thu Dec 10 23:42:04 UTC 2020


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

Change subject: bsc: add active lchan matching via vty
......................................................................

bsc: add active lchan matching via vty

Will be used in upcoming handover_2G test suite in
I0b2671304165a1aaae2b386af46fbd8b098e3bd8, which needs to verify that a
handover actually ended up on the expected lchan.

Change-Id: I03df8f3ae2ee47930eee311c7ce104c36dbb3154
---
M src/osmo_gsm_tester/obj/bsc_osmo.py
1 file changed, 49 insertions(+), 0 deletions(-)

Approvals:
  pespin: Looks good to me, approved



diff --git a/src/osmo_gsm_tester/obj/bsc_osmo.py b/src/osmo_gsm_tester/obj/bsc_osmo.py
index bd8649b..158bf93 100644
--- a/src/osmo_gsm_tester/obj/bsc_osmo.py
+++ b/src/osmo_gsm_tester/obj/bsc_osmo.py
@@ -192,4 +192,53 @@
         self.bsc = bsc
         super().__init__(self.bsc.addr(), port)
 
+    def get_active_lchans(self):
+        lchan_summary = self.cmd('show lchan summary')
+
+        re_lchan_summary = re.compile('BTS ([0-9]+), TRX ([0-9]+), Timeslot ([0-9]+) *([^,]*), Lchan ([0-9]+),.* State ([A-Za-z_]+).*')
+        active_lchans = set()
+        for line in lchan_summary:
+            m = re_lchan_summary.match(line)
+            if m:
+                bts, trx, ts, lchan_type, subslot, state = m.groups()
+                active_lchans.add('%s-%s-%s-%s %s %s' % (bts, trx, ts, subslot, lchan_type, state))
+        if not active_lchans:
+            self.dbg('No active lchans')
+        else:
+            self.dbg('Active lchans:\n|', '\n| '.join(active_lchans), '\n');
+        return active_lchans
+
+    def active_lchans_match(self, expected=[], not_expected=[]):
+        active_lchans = self.get_active_lchans()
+        matches = []
+        mismatches = []
+
+        for expected_lchan in expected:
+            found = False
+            for active_lchan in active_lchans:
+                if active_lchan.startswith(expected_lchan):
+                    found = True
+                    break
+            if found:
+                matches.append(expected_lchan)
+            else:
+                mismatches.append('missing: ' + expected_lchan)
+
+        for not_expected_lchan in not_expected:
+            found = False
+            for active_lchan in active_lchans:
+                if active_lchan.startswith(not_expected_lchan):
+                    found = True
+                    break
+            if not found:
+                matches.append('not: ' + not_expected_lchan)
+            else:
+                mismatches.append('unexpected: ' + not_expected_lchan)
+
+        if matches:
+            self.log('Found matching lchan activity (%d of %d requirements):' % (len(matches), len(expected) + len(not_expected)), matches)
+        if mismatches:
+            self.err('Found unexpected lchan activity (%d of %d requirements):' % (len(mismatches), len(expected) + len(not_expected)), mismatches)
+        return not mismatches
+
 # vim: expandtab tabstop=4 shiftwidth=4

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/21506
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: I03df8f3ae2ee47930eee311c7ce104c36dbb3154
Gerrit-Change-Number: 21506
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
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/20201210/18025cf0/attachment.htm>


More information about the gerrit-log mailing list