[PATCH] osmo-gsm-tester[master]: bts_*: Add incrementing bvci and rac values

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Dec 5 12:10:27 UTC 2017


Hello Neels Hofmeyr, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/5068

to look at the new patch set (#4).

bts_*: Add incrementing bvci and rac values

Change-Id: Ie65d7d33322c775a1040b5c81f367d882a7c2c5b
---
M selftest/template_test.ok
M selftest/template_test.py
M src/osmo_gsm_tester/bts_octphy.py
M src/osmo_gsm_tester/bts_osmotrx.py
M src/osmo_gsm_tester/bts_sysmo.py
M src/osmo_gsm_tester/resource.py
M src/osmo_gsm_tester/schema.py
M src/osmo_gsm_tester/suite.py
M src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
M src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl
10 files changed, 78 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/68/5068/4

diff --git a/selftest/template_test.ok b/selftest/template_test.ok
index ed96be7..c5471d0 100644
--- a/selftest/template_test.ok
+++ b/selftest/template_test.ok
@@ -51,9 +51,9 @@
   ip.access unit_id val_bts.unit_id_bts0 0
   oml ip.access stream_id val_bts.stream_id_bts0 line 0
   gprs mode gprs
-  gprs routing area 0
+  gprs routing area val_bts.routing_area_code_bts0
   gprs network-control-order nc1
-  gprs cell bvci 1800
+  gprs cell bvci val_bts.bvci_bts0
   gprs cell timer blocking-timer 3
   gprs cell timer blocking-retries 3
   gprs cell timer unblocking-retries 3
@@ -65,7 +65,7 @@
   gprs cell timer resume-retries 3
   gprs cell timer capability-update-timer 10
   gprs cell timer capability-update-retries 3
-  gprs nsei 1800
+  gprs nsei val_bts.bvci_bts0
   gprs ns timer tns-block 3
   gprs ns timer tns-block-retries 3
   gprs ns timer tns-reset 3
@@ -122,9 +122,9 @@
   ip.access unit_id val_bts.unit_id_bts1 0
   oml ip.access stream_id val_bts.stream_id_bts1 line 0
   gprs mode gprs
-  gprs routing area 0
+  gprs routing area val_bts.routing_area_code_bts1
   gprs network-control-order nc1
-  gprs cell bvci 1800
+  gprs cell bvci val_bts.bvci_bts1
   gprs cell timer blocking-timer 3
   gprs cell timer blocking-retries 3
   gprs cell timer unblocking-retries 3
@@ -136,7 +136,7 @@
   gprs cell timer resume-retries 3
   gprs cell timer capability-update-timer 10
   gprs cell timer capability-update-retries 3
-  gprs nsei 1800
+  gprs nsei val_bts.bvci_bts1
   gprs ns timer tns-block 3
   gprs ns timer tns-block-retries 3
   gprs ns timer tns-reset 3
diff --git a/selftest/template_test.py b/selftest/template_test.py
index 314dd8d..f4f1bd5 100755
--- a/selftest/template_test.py
+++ b/selftest/template_test.py
@@ -22,7 +22,9 @@
     'osmobsc_bts_type': 'val_type',
     'band': 'val_band',
     'location_area_code': 'val_bts.location_area_code',
+    'routing_area_code': 'val_bts.routing_area_code',
     'cell_identity': 'val_bts.cell_identity',
+    'bvci': 'val_bts.bvci',
     'base_station_id_code': 'val_bts.base_station_id_code',
     'ipa_unit_id': 'val_bts.unit_id',
     'stream_id': 'val_bts.stream_id',
diff --git a/src/osmo_gsm_tester/bts_octphy.py b/src/osmo_gsm_tester/bts_octphy.py
index 90eeb40..1953e85 100644
--- a/src/osmo_gsm_tester/bts_octphy.py
+++ b/src/osmo_gsm_tester/bts_octphy.py
@@ -32,7 +32,9 @@
     pcu_sk_tmp_dir = None
     values = None
     lac = None
+    rac = None
     cellid = None
+    bvci = None
     proc_bts = None
     _pcu = None
 
@@ -169,8 +171,12 @@
         config.overlay(values, config.get_defaults('osmo_bts_octphy'))
         if self.lac is not None:
             config.overlay(values, { 'location_area_code': self.lac })
+        if self.rac is not None:
+            config.overlay(values, { 'routing_area_code': self.rac })
         if self.cellid is not None:
             config.overlay(values, { 'cell_identity': self.cellid })
+        if self.bvci is not None:
+            config.overlay(values, { 'bvci': self.bvci })
         config.overlay(values, self.conf)
 
         sgsn_conf = {} if self.sgsn is None else self.sgsn.conf_for_client()
@@ -193,7 +199,13 @@
     def set_lac(self, lac):
         self.lac = lac
 
+    def set_rac(self, rac):
+        self.rac = rac
+
     def set_cellid(self, cellid):
         self.cellid = cellid
 
+    def set_bvci(self, bvci):
+        self.bvci = bvci
+
 # vim: expandtab tabstop=4 shiftwidth=4
diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py
index 6d4f634..9b1f077 100644
--- a/src/osmo_gsm_tester/bts_osmotrx.py
+++ b/src/osmo_gsm_tester/bts_osmotrx.py
@@ -32,7 +32,9 @@
     trx = None
     pcu_sk_tmp_dir = None
     lac = None
+    rac = None
     cellid = None
+    bvci = None
     proc_bts = None
     _pcu = None
 
@@ -147,8 +149,12 @@
         config.overlay(values, config.get_defaults('osmo_bts_trx'))
         if self.lac is not None:
             config.overlay(values, { 'location_area_code': self.lac })
+        if self.rac is not None:
+            config.overlay(values, { 'routing_area_code': self.rac })
         if self.cellid is not None:
             config.overlay(values, { 'cell_identity': self.cellid })
+        if self.bvci is not None:
+            config.overlay(values, { 'bvci': self.bvci })
         config.overlay(values, self.conf)
 
         sgsn_conf = {} if self.sgsn is None else self.sgsn.conf_for_client()
@@ -171,9 +177,15 @@
     def set_lac(self, lac):
         self.lac = lac
 
+    def set_rac(self, rac):
+        self.rac = rac
+
     def set_cellid(self, cellid):
         self.cellid = cellid
 
+    def set_bvci(self, bvci):
+        self.bvci = bvci
+
 class OsmoTrx(log.Origin):
     suite_run = None
     run_dir = None
diff --git a/src/osmo_gsm_tester/bts_sysmo.py b/src/osmo_gsm_tester/bts_sysmo.py
index 812a247..1d2dbf6 100644
--- a/src/osmo_gsm_tester/bts_sysmo.py
+++ b/src/osmo_gsm_tester/bts_sysmo.py
@@ -31,7 +31,9 @@
     remote_env = None
     remote_dir = None
     lac = None
+    rac = None
     cellid = None
+    bvci = None
     proc_bts = None
     _pcu = None
 
@@ -166,8 +168,12 @@
         config.overlay(values, config.get_defaults('osmo_bts_sysmo'))
         if self.lac is not None:
             config.overlay(values, { 'location_area_code': self.lac })
+        if self.rac is not None:
+            config.overlay(values, { 'routing_area_code': self.rac })
         if self.cellid is not None:
             config.overlay(values, { 'cell_identity': self.cellid })
+        if self.bvci is not None:
+            config.overlay(values, { 'bvci': self.bvci })
         config.overlay(values, self.conf)
 
         sgsn_conf = {} if self.sgsn is None else self.sgsn.conf_for_client()
@@ -190,7 +196,13 @@
     def set_lac(self, lac):
         self.lac = lac
 
+    def set_rac(self, rac):
+        self.rac = rac
+
     def set_cellid(self, cellid):
         self.cellid = cellid
 
+    def set_bvci(self, bvci):
+        self.bvci = bvci
+
 # vim: expandtab tabstop=4 shiftwidth=4
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index 604a9e9..4acf0f6 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -215,9 +215,16 @@
         # LAC=0 has special meaning (MS detached), avoid it
         return self.next_persistent_value('lac', '1', schema.uint16, lambda x: str(((int(x)+1) % pow(2,16)) or 1), origin)
 
+    def next_rac(self, origin):
+        return self.next_persistent_value('rac', '1', schema.uint8, lambda x: str((int(x)+1) % pow(2,8) or 1), origin)
+
     def next_cellid(self, origin):
         return self.next_persistent_value('cellid', '1', schema.uint16, lambda x: str((int(x)+1) % pow(2,16)), origin)
 
+    def next_bvci(self, origin):
+        # BVCI=0 and =1 are reserved, avoid them.
+        return self.next_persistent_value('bvci', '2', schema.uint16, lambda x: str(int(x)+1) if int(x) < pow(2,16) - 1 else '2', origin)
+
 class NoResourceExn(log.Error):
     pass
 
diff --git a/src/osmo_gsm_tester/schema.py b/src/osmo_gsm_tester/schema.py
index a78bc63..f92d1db 100644
--- a/src/osmo_gsm_tester/schema.py
+++ b/src/osmo_gsm_tester/schema.py
@@ -71,6 +71,13 @@
     if n < 0:
         raise ValueError('Positive value expected instead of %d' % n)
 
+def uint8(val):
+    n = int(val)
+    if n < 0:
+        raise ValueError('Positive value expected instead of %d' % n)
+    if n > 255: # 2^8 - 1
+        raise ValueError('Value %d too big, max value is 255' % n)
+
 def uint16(val):
     n = int(val)
     if n < 0:
diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py
index 0d5f97a..e7c68b7 100644
--- a/src/osmo_gsm_tester/suite.py
+++ b/src/osmo_gsm_tester/suite.py
@@ -268,7 +268,9 @@
     def bts(self, specifics=None):
         bts = bts_obj(self, self.reserved_resources.get(resource.R_BTS, specifics=specifics))
         bts.set_lac(self.lac())
+        bts.set_rac(self.rac())
         bts.set_cellid(self.cellid())
+        bts.set_bvci(self.bvci())
         self.register_for_cleanup(bts)
         return bts
 
@@ -300,11 +302,21 @@
         self.log('using LAC', lac)
         return lac
 
+    def rac(self):
+        rac = self.resources_pool.next_rac(self)
+        self.log('using RAC', rac)
+        return rac
+
     def cellid(self):
         cellid = self.resources_pool.next_cellid(self)
         self.log('using CellId', cellid)
         return cellid
 
+    def bvci(self):
+        bvci = self.resources_pool.next_bvci(self)
+        self.log('using BVCI', bvci)
+        return bvci
+
     def poll(self):
         if self._processes:
             for process in self._processes:
diff --git a/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
index 2466f9f..95db16d 100644
--- a/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
@@ -61,9 +61,9 @@
   oml ip.access stream_id ${bts.stream_id} line 0
 % if bts.get('sgsn', False):
   gprs mode gprs
-  gprs routing area 0
+  gprs routing area ${bts.routing_area_code}
   gprs network-control-order nc1
-  gprs cell bvci 1800
+  gprs cell bvci ${bts.bvci}
   gprs cell timer blocking-timer 3
   gprs cell timer blocking-retries 3
   gprs cell timer unblocking-retries 3
@@ -75,7 +75,7 @@
   gprs cell timer resume-retries 3
   gprs cell timer capability-update-timer 10
   gprs cell timer capability-update-retries 3
-  gprs nsei 1800
+  gprs nsei ${bts.bvci}
   gprs ns timer tns-block 3
   gprs ns timer tns-block-retries 3
   gprs ns timer tns-reset 3
@@ -83,7 +83,7 @@
   gprs ns timer tns-test 30
   gprs ns timer tns-alive 3
   gprs ns timer tns-alive-retries 10
-  gprs nsvc 0 nsvci 1800
+  gprs nsvc 0 nsvci ${bts.bvci}
   gprs nsvc 0 local udp port 23020
   gprs nsvc 0 remote udp port 23000
   gprs nsvc 0 remote ip ${bts.sgsn.ip_address.addr}
diff --git a/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl
index 419d185..acedd0c 100644
--- a/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl
@@ -51,9 +51,9 @@
   oml ip.access stream_id ${bts.stream_id} line 0
 % if bts.get('sgsn', False):
   gprs mode gprs
-  gprs routing area 0
+  gprs routing area ${bts.routing_area_code}
   gprs network-control-order nc1
-  gprs cell bvci 1800
+  gprs cell bvci ${bts.bvci}
   gprs cell timer blocking-timer 3
   gprs cell timer blocking-retries 3
   gprs cell timer unblocking-retries 3
@@ -65,7 +65,7 @@
   gprs cell timer resume-retries 3
   gprs cell timer capability-update-timer 10
   gprs cell timer capability-update-retries 3
-  gprs nsei 1800
+  gprs nsei ${bts.bvci}
   gprs ns timer tns-block 3
   gprs ns timer tns-block-retries 3
   gprs ns timer tns-reset 3
@@ -73,7 +73,7 @@
   gprs ns timer tns-test 30
   gprs ns timer tns-alive 3
   gprs ns timer tns-alive-retries 10
-  gprs nsvc 0 nsvci 1800
+  gprs nsvc 0 nsvci ${bts.bvci}
   gprs nsvc 0 local udp port 23020
   gprs nsvc 0 remote udp port 23000
   gprs nsvc 0 remote ip ${bts.sgsn.ip_address.addr}

-- 
To view, visit https://gerrit.osmocom.org/5068
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie65d7d33322c775a1040b5c81f367d882a7c2c5b
Gerrit-PatchSet: 4
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list