summaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester/bts_sysmo.py
AgeCommit message (Collapse)AuthorFilesLines
2018-10-02osmotrx: Make sure remote process stops after ssh session is closedPau Espin Pedrol1-0/+6
First of all, it was found that vty allocation must be forced (-t -t) during ssh session creation to make sure SIGHUP is forwarded when session is closed. Second, since osmo-trx ignores SIGHUP (osmo_init_ignore_signals()), we must add a wrapper script which converts received SIGHUP into a SIGINT to stop osmo-trx. Change-Id: Ic334a54b1a1827d74fe0b453ac32bb77b8616147
2018-10-02Make code copying inst through ssh genericPau Espin Pedrol1-37/+8
It can later on be used by other classes that need to run binaries in inst remotely. Change-Id: I838b999528695207e1147cfe76e6f7aaf3b1dd53
2018-08-13Cleanup of class scoped variablesPau Espin Pedrol1-4/+4
After bug described in OS#3456 and fixed in last commit, let's categorize and place variables in its correct plac to avoid similar issus. We leave under the class keyword (class scoped variables) the attributes which are to be used as static class attributes. All other ones are initialized during __init__(). This way w avoid scenarios in which while using an object from an instance attribute we end up reading a class scoped variable which is shared among all instances. Change-Id: I5ad4cac34a9f49eaf42966c01c9c5a4d3f3e9dc8
2018-05-25Add option to expect bts/pcu failures and respawn its processesPau Espin Pedrol1-4/+4
Some tests may want to reproduce some scenarios in which it is expected that a BTS process is stopped, for instance if the BSC link is dropped. Provide a keepalive parameter to start() for bts and pcu objects to inform suite that failures are expected and that it should keep them alive in case that ocurrs by respawning the BTS process. Change-Id: Ia2a7539f9fad457125ac9b60a52a52999e885ba8
2018-05-07bts: Pass defaults config name at construct timePau Espin Pedrol1-2/+2
It will be needed later at construction time when resolving the num of trx. Change-Id: I2c6a46ead14010f714897ea178917327215823e7
2018-05-07bts: Refactor conf_for_bsc_osmoPau Espin Pedrol1-15/+1
Move duplicated code into a method in the superclass. Change-Id: Ie27932f94142f667c3fb8c054b77e04afa0d5cbb
2017-12-14cosmetic: bts_sysmo: Sort members according to scopePau Espin Pedrol1-46/+55
Change-Id: Ifc19b34660cc8d20b8db2dcf245eeb2173cd7a6a
2017-12-14Create bts abstract classes to avoid code duplication and ease developmentPau Espin Pedrol1-52/+5
A lot of code can be shared by all osmocom related BTS we currently use (sysmo, octphy, trx). This commits moves all this easily shareable code to an abstract class OsmoBts which all (osmocom) BTS use. Some bits of code do not apply for osmo-bts-sysmo but it's still shared by BTS running in the main unit (octphy, trx), for instance the pcu socket handling. Those are put together in OsmoBtsMainUnit. This way we have: log.Origin<-OsmoBts<-OsmoBtsMainUnit<-OsmoBtsOctphy log.Origin<-OsmoBts<-OsmoBtsMainUnit<-OsmoBtsTrx log.Origin<-OsmoBts<-OsmoBtsSysmo Also take the chance to categorize the different APIs in the new abstract class based on their use and scope. Some code changes while moving which were required: - A new protected abstract API "create_pcu", which returns an object of "pcu" interface. Subclasses implement this API returning either a PcySysmo or a PcuOsmo object. This is needed to abstract the pcu() getter into the base class. - For BTS running in the main unit, pcu_sk_tmp_dir object is allocated when first used (API pcu_socket_path()) instead of doing it in the constructor. This is moved into OsmoBtsMainUnit Change-Id: I86db35a7f2497d37360b2c56affa8bf6bf704ee2
2017-12-05bts_*: Add incrementing bvci and rac valuesPau Espin Pedrol1-0/+12
Change-Id: Ie65d7d33322c775a1040b5c81f367d882a7c2c5b
2017-12-05OsmoPcuSysmo: Integrate with Sysmobts and OsmoSgsnPau Espin Pedrol1-7/+31
Change-Id: I01485c5d74e5fe62d0ffea9eb1fad29041426eef
2017-12-05bts_*: Add ready_for_pcu APIPau Espin Pedrol1-5/+12
This is required to start osmo-pcu after osmo-bts is already setup and activated. Otherwise osmo-pcu ends after connecting to socket with: "pcu_l1_if.cpp:416 BTS not available" Change-Id: I7209589f60bda63094336e417638906be5e273c4
2017-11-08Use unique incrementing value for BTS CellIdPau Espin Pedrol1-0/+6
Change-Id: If4559b945a3e71f3a36fd7ac760cb094278f6b39
2017-11-08Use unique incrementing value for BTS LACPau Espin Pedrol1-0/+6
Change-Id: I9f864bac05e39ec2fc305f774194799c3d8fe1b0
2017-09-12Use tmpdir to create bts pcu-socketPau Espin Pedrol1-1/+7
In commit 329b6f4 pcu-socket path was moved to run inside the test run dir to avoid issues between different tests creating a socket in the same place. However, it seems unix sockets paths are limited to 108 bytes (with Null char included). In some cases, the run dir for a test can be quite long, as it contains suite name, test name, etc. and the path can be longer that the limit defined above. In order to fix this issue, create a tmp dir using mkdtemp to ensure the path to be used for the pcu-socket doesn't collide between different instances of osmo-bts-trx. Clean up of tmp dir and pcu socket is done inside the cleanup() method called by suite.py. method pcu_socket_path() is added to help with new implementation, and it will be used as well as a public API later soon to be used by OsmoPcu classes. Related: OS#2507 Change-Id: I0c53a0a3ccc5eb2823265fe14c0f7b8f4adb1038
2017-08-09Set osmo-bts pcu-socket config to point to run dirPau Espin Pedrol1-1/+6
Otherwise osmo-bts stores the socket file in /tmp. If an earlier instance doesn't finish cleanly, the file is left there and a new instance will fail to start because it cannot create a new socket file in the same place. Change-Id: I5a1da23c45a4ac496fe765e0d78c52dae3e7808b
2017-06-17Use a subdir of run_dir for each testPau Espin Pedrol1-1/+1
Processes created have the scope of the test, so we should store everything in a per-suite_run/per-test directory, otherwise everything is stored in the same trial run_dir directory and it's really messy. Change-Id: I06be2dd21710e14c1337d13b1fe6c2f68f037957
2017-06-13fix and refactor logging: drop 'with', simplifyNeels Hofmeyr1-42/+42
With the recent fix of the junit report related issues, another issue arose: the 'with log.Origin' was changed to disallow __enter__ing an object twice to fix problems, now still code would fail because it tries to do 'with' on the same object twice. The only reason is to ensure that logging is associated with a given object. Instead of complicating even more, implement differently. Refactor logging to simplify use: drop the 'with Origin' style completely, and instead use the python stack to determine which objects are created by which, and which object to associate a log statement with. The new way: we rely on the convention that each class instance has a local 'self' referencing the object instance. If we need to find an origin as a new object's parent, or to associate a log message with, we traverse each stack frame, fetching the first local 'self' object that is a log.Origin class instance. How to use: Simply call log.log() anywhere, and it finds an Origin object to log for, from the stack. Alternatively call self.log() for any Origin() object to skip the lookup. Create classes as child class of log.Origin and make sure to call super().__init__(category, name). This constructor will magically find a parent Origin on the stack. When an exception happens, we first escalate the exception up through call scopes to where ever it is handled by log.log_exn(). This then finds an Origin object in the traceback's stack frames, no need to nest in 'with' scopes. Hence the 'with log.Origin' now "happens implicitly", we can write pure natural python code, no more hassles with scope ordering. Furthermore, any frame can place additional logging information in a frame by calling log.ctx(). This is automatically inserted in the ancestry associated with a log statement / exception. Change-Id: I5f9b53150f2bb6fa9d63ce27f0806f0ca6a45e90
2017-06-03Re-License under GPLv3-or-later instead of AGPLv3-or-laterHarald Welte1-3/+3
The "Affero" nature makes sense for the Osmocom network components like BSC, SGSN, etc. as they are typically operated to provide a network service. For testing, this doesn't make so much sense as it is difficult to imagine people creating a business out of offering to run test cases on an end-to-end Osmocom GSM network. So let's drop the 'Affero' here. All code is so far developed by sysmocom staff, so as Managing Director of sysmocom I can effect such a license change unilaterally. Change-Id: I8959c2d605854ffdc21cb29c0fe0e715685c4c05
2017-05-29bts: add remote_addr() functionNeels Hofmeyr1-6/+6
To start an MGCPGW, we so far need the BTS address in advance (should get fixed at some point, but so far we do). The sysmoBTS has a fixed IP address configured. The osmo-bts-trx so far always uses 127.0.0.1 (should also be fixed at some point). Both now return this address with the remote_addr() function. This also replaces a SysmoBts.remote_addr member variable (which is not sufficient because it is only populated during configure()). Change-Id: I7af9275914f34808cb60ae16b65ecd3688fd6b5b
2017-05-29rename more items from nitb to bscNeels Hofmeyr1-12/+12
A NITB is a BSC + MSC, and if a BTS talks to a NITB, it talks to the BSC part of the NITB. Hence it makes more sense to name certain things 'bsc' instead of 'nitb', to prepare for a separate BSC process appearing soon. Change-Id: I6a0343b9243b166d4053cc44f523543f1245d772
2017-05-29debug: config logging before templates: use pprint and an all-caps labelNeels Hofmeyr1-1/+3
Change-Id: I0e1c1d3ce8163d5b40c17b7d0fb0847a068ced76
2017-05-15Enable GSMTAP on BTS and record it on the main unit NITBPau Espin Pedrol1-1/+2
Change-Id: I057a83bc20c5e664ac1778812452f189166919ba
2017-05-04fix sysmobts: also use username for dsp firmware reload commandNeels Hofmeyr1-1/+1
2017-05-04Add remote user for RemoteProcressPau Espin Pedrol1-3/+4
Use it to set root user for SysmoBTS, otherwise if osmo-gsm-tester is run by another user it will fail to connect Change-Id: I67d4126fc75cb9c2d249c713cd6f14db1f1e21da
2017-05-04sysmobts: fix: reload firmware before each osmo-bts-sysmo runNeels Hofmeyr1-0/+2
2017-04-13fix octphy, fix conf, improve loggingYour Name1-1/+0
Clearly separate the kinds of BTS hardware the GSM tester knows ('type') from the NITB's bts/type config item ('osmobsc_bts_type' -- not 'osmonitb_...' to stay in tune with future developments: it is the libbsc that needs this). For BTS hardware kinds, use the full name of the binary for osmo driven models: osmo-bts-sysmo, osmo-bts-trx, osmo-bts-octphy. Change-Id: I1aa9b48e74013a93f9db1a34730f17717fb3b36c
2017-04-10logging tweakNeels Hofmeyr1-34/+35
Change-Id: I59d230cdf9f393fa20bd2b8daf0e5549e4d7da4f
2017-04-10trying to get sysmobts to work and various detailsNeels Hofmeyr1-4/+71
I know that these commit messages aren't very good, but the code is not stable yet, so I'm not bothering with details. Change-Id: I2d5e5f4a5407725d71093cbd71ef97b271eb8197
2017-04-08core implementationNeels Hofmeyr1-0/+69
code bomb implementing the bulk of the osmo-gsm-tester Change-Id: I53610becbf643ed51b90cfd9debc6992fe211ec9