[PATCH] osmo-gsm-tester[master]: WIP: Introduce ip.access nanobts support

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
Fri Mar 9 17:30:59 UTC 2018


Hello Jenkins Builder,

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

    https://gerrit.osmocom.org/7168

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

WIP: Introduce ip.access nanobts support

Change-Id: Ibaea025b3a503dfe897d36701234445de6d49f82
---
M example/resources.conf
A example/scenarios/nanobts.conf
A src/osmo_gsm_tester/bts_nanobts.py
M src/osmo_gsm_tester/resource.py
4 files changed, 129 insertions(+), 1 deletion(-)


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

diff --git a/example/resources.conf b/example/resources.conf
index fb2ac9f..500eb71 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -44,6 +44,16 @@
   - hw_addr: 00:0c:90:2e:80:1e
     net_device: enp2s0
 
+- label: NanoBTS
+  type: nanobts
+  ipa_unit_id: 9
+  addr: 10.42.42.53
+  band: GSM-1800
+  power_supply:
+    type: 'sispm'
+    device: '01:01:55:2e:b6'
+    port: '1'
+
 arfcn:
   - arfcn: 512
     band: GSM-1800
diff --git a/example/scenarios/nanobts.conf b/example/scenarios/nanobts.conf
new file mode 100644
index 0000000..7322288
--- /dev/null
+++ b/example/scenarios/nanobts.conf
@@ -0,0 +1,3 @@
+resources:
+  bts:
+  - type: nanobts
diff --git a/src/osmo_gsm_tester/bts_nanobts.py b/src/osmo_gsm_tester/bts_nanobts.py
new file mode 100644
index 0000000..f45dea9
--- /dev/null
+++ b/src/osmo_gsm_tester/bts_nanobts.py
@@ -0,0 +1,111 @@
+# osmo_gsm_tester: specifics for running an ip.access nanoBTS
+#
+# Copyright (C) 2018 by sysmocom - s.f.m.c. GmbH
+#
+# Author: Pau Espin Pedrol <pespin at sysmocom.de>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import pprint
+import tempfile
+from abc import ABCMeta, abstractmethod
+from . import log, config, util, template, process, event_loop, bts, pcu
+from . import powersupply
+
+class NanoBts(bts.Bts):
+
+    pwsup = None
+    pcu = None
+##############
+# PROTECTED
+##############
+    def __init__(self, suite_run, conf):
+        super().__init__(suite_run, conf, 'nanobts')
+
+    def configure(self):
+        if self.bsc is None:
+            raise RuntimeError('BTS needs to be added to a BSC or NITB before it can be configured')
+
+        pwsup_opt = self.conf.get('power_supply', {})
+        if not pwsup_opt:
+            raise log.Error('No power_supply attribute provided in conf!')
+        pwsup_type = pwsup_opt.get('type')
+        if not pwsup_type:
+            raise log.Error('No type attribute provided in power_supply conf!')
+
+        self.pwsup = powersupply.get_instance_by_type(pwsup_type, pwsup_opt)
+
+########################
+# PUBLIC - INTERNAL API
+########################
+
+    def conf_for_bsc(self):
+        values = config.get_defaults('bsc_bts')
+        config.overlay(values, config.get_defaults('nanobts'))
+        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()
+        config.overlay(values, sgsn_conf)
+
+        config.overlay(values, { 'osmobsc_bts_type': 'nanobts' })
+
+        self.dbg(conf=values)
+        return values
+
+
+    def cleanup(self):
+        if self.pwsup:
+            self.dbg('Powering off NanoBTS')
+            self.pwsup.power_set(False)
+
+###################
+# PUBLIC (test API included)
+###################
+
+    def start(self):
+        self.run_dir = util.Dir(self.suite_run.get_test_run_dir().new_dir(self.name()))
+        self.configure()
+
+        self.pwsup.power_cycle(1.0)
+
+        self.log('Starting to connect to', self.bsc)
+
+        #According to roh, it can be configured to use a static IP in a permanent way:
+        # 1- use abisip-find to find the default address
+        # 2- use ./ipaccess-config --ip-address IP/MASK
+        # 3- use ./ipaccess-config  --ip-gateway IP to set the IP of the main unit
+        # 4- use ./ipaccess-config --restart to restart and apply the changes
+
+        #Start must do the following:
+        # 1- use abisip-find to find the default address
+        # 2- use ./ipaccess-config --unit-id UNIT_ID
+        # 3- use ./ipaccess-config --oml-ip --restart to set the IP of the BSC and apply+restart.
+        # According to roh, using the 3 of them together was not reliable to work properly.
+
+    def ready_for_pcu(self):
+        return True
+
+    def pcu(self):
+        if not self.pcu:
+            self.pcu = pcu.PcuDummy(self.ssuite_run, self, self.conf)
+        return self.pcu
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index 4acf0f6..689f976 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -29,7 +29,7 @@
 from . import schema
 from . import modem
 from . import osmo_nitb
-from . import bts_sysmo, bts_osmotrx, bts_octphy
+from . import bts_sysmo, bts_osmotrx, bts_octphy, bts_nanobts
 
 from .util import is_dict, is_list
 
@@ -56,6 +56,9 @@
         'bts[].trx_remote_ip': schema.IPV4,
         'bts[].launch_trx': schema.BOOL_STR,
         'bts[].direct_pcu': schema.BOOL_STR,
+        'bts[].power_supply.type': schema.STR,
+        'bts[].power_supply.device': schema.STR,
+        'bts[].power_supply.port': schema.STR,
         'bts[].ciphers[]': schema.CIPHER,
         'bts[].trx_list[].hw_addr': schema.HWADDR,
         'bts[].trx_list[].net_device': schema.STR,
@@ -84,6 +87,7 @@
         'osmo-bts-sysmo': bts_sysmo.SysmoBts,
         'osmo-bts-trx': bts_osmotrx.OsmoBtsTrx,
         'osmo-bts-octphy': bts_octphy.OsmoBtsOctphy,
+        'nanobts': bts_nanobts.NanoBts,
     }
 
 def register_bts_type(name, clazz):

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

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



More information about the gerrit-log mailing list