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 3 23:56:19 UTC 2020


neels has uploaded this change for review. ( 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(-)



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

diff --git a/src/osmo_gsm_tester/obj/bsc_osmo.py b/src/osmo_gsm_tester/obj/bsc_osmo.py
index 24e639e..636514e 100644
--- a/src/osmo_gsm_tester/obj/bsc_osmo.py
+++ b/src/osmo_gsm_tester/obj/bsc_osmo.py
@@ -20,6 +20,7 @@
 import os
 import re
 import pprint
+import re
 
 from ..core import log, util, config, template, process
 from ..core import schema
@@ -153,6 +154,54 @@
     def vty(self):
         return OsmoBscVty(self)
 
+    def get_active_lchans(self):
+        lchan_summary = self.vty().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
 
 class OsmoBscCtrl(log.Origin):
     PORT = 4249

-- 
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: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201203/125ee217/attachment.htm>


More information about the gerrit-log mailing list