diff --git a/selftest/template_test.ok b/selftest/template_test.ok index bae21d2c..c5471d0a 100644 --- a/selftest/template_test.ok +++ b/selftest/template_test.ok @@ -51,9 +51,9 @@ network 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 @@ network 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 @@ -73,7 +73,7 @@ network 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 val_bts.bvci_bts0 gprs nsvc 0 local udp port 23020 gprs nsvc 0 remote udp port 23000 gprs nsvc 0 remote ip val_bts.sgsn_ip_addr_bts0 @@ -122,9 +122,9 @@ network 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 @@ network 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 @@ -144,7 +144,7 @@ network 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 val_bts.bvci_bts1 gprs nsvc 0 local udp port 23020 gprs nsvc 0 remote udp port 23000 gprs nsvc 0 remote ip val_bts.sgsn_ip_addr_bts1 diff --git a/selftest/template_test.py b/selftest/template_test.py index 314dd8d5..f4f1bd56 100755 --- a/selftest/template_test.py +++ b/selftest/template_test.py @@ -22,7 +22,9 @@ mock_bts = { '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 90eeb400..1953e855 100644 --- a/src/osmo_gsm_tester/bts_octphy.py +++ b/src/osmo_gsm_tester/bts_octphy.py @@ -32,7 +32,9 @@ class OsmoBtsOctphy(log.Origin): pcu_sk_tmp_dir = None values = None lac = None + rac = None cellid = None + bvci = None proc_bts = None _pcu = None @@ -169,8 +171,12 @@ class OsmoBtsOctphy(log.Origin): 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 @@ class OsmoBtsOctphy(log.Origin): 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 6d4f634e..9b1f0773 100644 --- a/src/osmo_gsm_tester/bts_osmotrx.py +++ b/src/osmo_gsm_tester/bts_osmotrx.py @@ -32,7 +32,9 @@ class OsmoBtsTrx(log.Origin): trx = None pcu_sk_tmp_dir = None lac = None + rac = None cellid = None + bvci = None proc_bts = None _pcu = None @@ -147,8 +149,12 @@ class OsmoBtsTrx(log.Origin): 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 @@ class OsmoBtsTrx(log.Origin): 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 812a2474..1d2dbf65 100644 --- a/src/osmo_gsm_tester/bts_sysmo.py +++ b/src/osmo_gsm_tester/bts_sysmo.py @@ -31,7 +31,9 @@ class SysmoBts(log.Origin): remote_env = None remote_dir = None lac = None + rac = None cellid = None + bvci = None proc_bts = None _pcu = None @@ -166,8 +168,12 @@ class SysmoBts(log.Origin): 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 @@ class SysmoBts(log.Origin): 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 604a9e9b..4acf0f6d 100644 --- a/src/osmo_gsm_tester/resource.py +++ b/src/osmo_gsm_tester/resource.py @@ -215,9 +215,16 @@ class ResourcesPool(log.Origin): # 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 a78bc63b..f92d1db4 100644 --- a/src/osmo_gsm_tester/schema.py +++ b/src/osmo_gsm_tester/schema.py @@ -71,6 +71,13 @@ def uint(val): 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 0d5f97ad..e7c68b70 100644 --- a/src/osmo_gsm_tester/suite.py +++ b/src/osmo_gsm_tester/suite.py @@ -268,7 +268,9 @@ class SuiteRun(log.Origin): 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 @@ class SuiteRun(log.Origin): 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 2466f9fd..95db16d7 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 @@ network 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 @@ network 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 @@ network 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 211b4ccc..2c27273d 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 @@ network 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 @@ network 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 @@ network 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}