blob: c94c596bc06f799fa2c2cbe5b39c2c674a0a1265 [file] [log] [blame]
Pau Espin Pedrol06376b72020-05-05 18:39:44 +02001== Installation
Neels Hofmeyrb52df172017-05-14 20:09:35 +02002
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +01003=== Trial Builder
Neels Hofmeyrb52df172017-05-14 20:09:35 +02004
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +01005The Trial Builder is the jenkins build slave (host) building all sysroot binary
6packages used later by {app-name} to run the tests. It's purpose is to build the
7sysroots and provide them to {app-anme}, for instance, as jenkins job artifacts
8which the {app-name} runner job can fetch.
Neels Hofmeyrb52df172017-05-14 20:09:35 +02009
10[[jenkins_deps]]
Pau Espin Pedrolf5c83da2017-11-02 15:48:10 +010011==== Osmocom Build Dependencies
Neels Hofmeyrb52df172017-05-14 20:09:35 +020012
13Each of the jenkins builds requires individual dependencies. This is generally
14the same as for building the software outside of osmo-gsm-tester and will not
15be detailed here. For the Osmocom projects, refer to
16http://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_Source . Be
17aware of specific requirements for BTS hardware: for example, the
18osmo-bts-sysmo build needs the sysmoBTS SDK installed on the build slave, which
19should match the installed sysmoBTS firmware.
20
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +010021==== Add Build Jobs
22
23There are various jenkins-build-* scripts in osmo-gsm-tester/contrib/, which
24can be called as jenkins build jobs to build and bundle binaries as artifacts,
25to be run on the osmo-gsm-tester main unit and/or BTS hardware.
26
27Be aware of the dependencies, as hinted at in <<jenkins_deps>>.
28
29While the various binaries could technically be built on the osmo-gsm-tester
30main unit, it is recommended to use a separate build slave, to take load off
31of the main unit.
32
33Please note nowadays we set up all the osmocom jenkins jobs (including
34{app-name} ones) using 'jenkins-job-builder'. You can find all the
35configuration's in Osmocom's 'osmo-ci.git' files 'jobs/osmo-gsm-tester-*.yml.
36Explanation below on how to set up jobs manually is left as a reference for
37other projects.
38
39On your jenkins master, set up build jobs to call these scripts -- typically
40one build job per script. Look in contrib/ and create one build job for each of
41the BTS types you would like to test, as well as one for the 'build-osmo-nitb'.
42
43These are generic steps to configure a jenkins build
44job for each of these build scripts, by example of the
45jenkins-build-osmo-nitb.sh script; all that differs to the other scripts is the
46"osmo-nitb" part:
47
48* 'Project name': "osmo-gsm-tester_build-osmo-nitb" +
49 (Replace 'osmo-nitb' according to which build script this is for)
50* 'Discard old builds' +
51 Configure this to taste, for example:
52** 'Max # of build to keep': "20"
53* 'Restrict where this project can be run': Choose a build slave label that
54 matches the main unit's architecture and distribution, typically a Debian
55 system, e.g.: "linux_amd64_debian8"
56* 'Source Code Management':
57** 'Git'
58*** 'Repository URL': "git://git.osmocom.org/osmo-gsm-tester"
59*** 'Branch Specifier': "*/master"
60*** 'Additional Behaviors'
61**** 'Check out to a sub-directory': "osmo-gsm-tester"
62* 'Build Triggers' +
63 The decision on when to build is complex. Here are some examples:
64** Once per day: +
65 'Build periodically': "H H * * *"
66** For the Osmocom project, the purpose is to verify our software changes.
67 Hence we would like to test every time our code has changed:
68*** We could add various git repositories to watch, and enable 'Poll SCM'.
69*** On jenkins.osmocom.org, we have various jobs that build the master branches
70 of their respective git repositories when a new change was merged. Here, we
71 can thus trigger e.g. an osmo-nitb build for osmo-gsm-tester everytime the
72 master build has run: +
73 'Build after other projects are built': "OpenBSC"
74*** Note that most of the Osmocom projects also need to be re-tested when their
75 dependencies like libosmo* have changed. Triggering on all those changes
76 typically causes more jenkins runs than necessary: for example, it rebuilds
77 once per each dependency that has rebuilt due to one libosmocore change.
78 There is so far no trivial way known to avoid this. It is indeed safest to
79 rebuild more often.
80* 'Build'
81** 'Execute Shell'
82+
83----
84#!/bin/sh
85set -e -x
86./osmo-gsm-tester/contrib/jenkins-build-osmo-nitb.sh
87----
88+
89(Replace 'osmo-nitb' according to which build script this is for)
90
91* 'Post-build Actions'
92** 'Archive the artifacts': "*.tgz, *.md5" +
93 (This step is important to be able to use the built binaries in the run job
94 below.)
95
96
97TIP: When you've created one build job, it is convenient to create further
98build jobs by copying the first one and, e.g., simply replacing all "osmo-nitb"
99with "osmo-bts-trx".
100
101[[install_main_unit]]
102=== Main Unit
103
104The main unit is a general purpose computer that orchestrates the tests. It
105runs the core network components, controls the modems and so on. This can be
106anything from a dedicated production rack unit to your laptop at home.
107
108This manual will assume that tests are run from a jenkins build slave, by a user
109named 'jenkins' that belongs to group 'osmo-gsm-tester'. The user configuration
110for manual test runs and/or a different user name is identical, simply replace
111the user name or group.
112
113Please, note installation steps and dependencies needed will depend on lots of
114factors, like your distribution, your specific setup, which hardware you plan to
115support, etc.
116
117This section aims at being one place to document the rationale behind certain
118configurations being done in one way or another. For an up to date step by step
119detailed way to install and maintain the Osmocom {app-name} setup, one will want
120to look at the <<ansible,ansible scripts section>>.
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200121
Pau Espin Pedrolf5c83da2017-11-02 15:48:10 +0100122[[configure_jenkins_slave]]
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100123==== Create 'jenkins' User
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200124
125On the main unit, create a jenkins user:
126
127----
128useradd -m jenkins
129----
130
Neels Hofmeyr3f596ed2017-07-14 00:04:40 +0200131==== Install Java on Main Unit
132
133To be able to launch the Jenkins build slave, a Java RE must be available on
134the main unit. For example:
135
136----
137apt-get install default-jdk
138----
139
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200140==== Allow SSH Access from Jenkins Master
141
142Create an SSH keypair to be used for login on the osmo-gsm-tester. This may be
143entered on the jenkins web UI; alternatively, use the jenkins server's shell:
144
145Login on the main jenkins server shell and create an SSH keypair, for example:
146
147----
148# su jenkins
Neels Hofmeyr3f596ed2017-07-14 00:04:40 +0200149$ mkdir -p /usr/local/jenkins/keys
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200150$ ssh-keygen
151Generating public/private rsa key pair.
152Enter file in which to save the key (/home/jenkins/.ssh/id_rsa): /usr/local/jenkins/keys/osmo-gsm-tester-rnd
153Enter passphrase (empty for no passphrase): <enter a passphrase>
154Enter same passphrase again: <enter a passphrase>
155Your identification has been saved in /usr/local/jenkins/keys/osmo-gsm-tester-rnd
156Your public key has been saved in /usr/local/jenkins/keys/osmo-gsm-tester-rnd.pub.
157The key fingerprint is:
158...
159----
160
161Copy the public key to the main unit, e.g. copy-paste:
162
163----
164cat /usr/local/jenkins/keys/osmo-gsm-tester-rnd.pub
165# copy this public key
166----
167
168On the main unit:
169
170----
171mkdir ~jenkins/.ssh
172cat > ~jenkins/.ssh/authorized_keys
173# paste above public key and hit Ctrl-D
174chown -R jenkins: ~jenkins/.ssh
175----
176
177Make sure that the user running the jenkins master accepts the main unit's host
178identification. There must be an actual RSA host key available in the
179known_hosts file for the jenkins master to be able to log in. Simply calling
180ssh and accepting the host key as usual is not enough. Jenkins may continue to
181say "Host key verification failed".
182
183To place an RSA host key in the jenkins' known_hosts file, you may do:
184
185On the Jenkins master:
186
187----
188main_unit_ip=10.9.8.7
189ssh-keyscan -H $main_unit_ip >> ~jenkins/.ssh/known_hosts
190chown jenkins: ~jenkins/.ssh/known_hosts
191----
192
193Verify that the jenkins user on the Jenkins master has SSH access to the main
194unit:
195
196----
197su jenkins
198main_unit_ip=10.9.8.7
Neels Hofmeyr3f596ed2017-07-14 00:04:40 +0200199ssh -i /usr/local/jenkins/keys/osmo-gsm-tester-rnd jenkins@$main_unit_ip
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200200exit
201----
202
Pau Espin Pedrolf5c83da2017-11-02 15:48:10 +0100203[[install_add_jenkins_slave]]
204==== Add Jenkins Slave
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200205
206In the jenkins web UI, add a new build slave for the osmo-gsm-tester:
207
208* 'Manage Jenkins'
209** 'Manage Nodes'
210*** 'New Node'
211**** Enter a node name, e.g. "osmo-gsm-tester-1" +
212 (the "-1" is just some identification in case you'd like to add another
213 setup later).
214**** 'Permanent Agent'
215
216Configure the node as:
217
218* '# of executors': 1
219* 'Remote root directory': "/home/jenkins"
220* 'Labels': "osmo-gsm-tester" +
221 (This is a general label common to all osmo-gsm-tester build slaves you may set up in the future.)
222* 'Usage': 'Only build jobs with label expressions matching this node'
223* 'Launch method': 'Launch slave agents via SSH'
224** 'Host': your main unit's IP address
225** 'Credentials': choose 'Add' / 'Jenkins'
226*** 'Domain': 'Global credentials (unrestricted)'
227*** 'Kind': 'SSH Username with private key'
228*** 'Scope': 'Global'
229*** 'Username': "jenkins" +
230 (as created on the main unit above)
231*** 'Private Key': 'From a file on Jenkins master'
232**** 'File': "/usr/local/jenkins/keys/osmo-gsm-tester-rnd"
233*** 'Passphrase': enter same passphrase as above
234*** 'ID': "osmo-gsm-tester-1"
235*** 'Name': "jenkins for SSH to osmo-gsm-tester-1"
236
237The build slave should be able to start now.
238
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200239==== Add Run Job
240
Pau Espin Pedrolf5c83da2017-11-02 15:48:10 +0100241This is the jenkins job that runs the tests on the GSM hardware:
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200242
Pau Espin Pedrolf5c83da2017-11-02 15:48:10 +0100243* It sources the artifacts from jenkins' build jobs.
244* It runs on the osmo-gsm-tester main unit.
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200245
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100246Sample script to run {app-name} as a jenkins job can be found in
247'osmo-gsm-tester.git' file 'contrib/jenkins-run.sh'.
248
249Please note nowadays we set up all the osmocom jenkins jobs (including
250{app-name} ones) using 'jenkins-job-builder'. You can find all the
251configuration's in Osmocom's 'osmo-ci.git' files 'jobs/osmo-gsm-tester-*.yml.
252Explanation below on how to set up jobs manually is left as a reference for
253other projects.
254
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200255Here is the configuration for the run job:
256
257* 'Project name': "osmo-gsm-tester_run"
258* 'Discard old builds' +
259 Configure this to taste, for example:
260** 'Max # of build to keep': "20"
261* 'Restrict where this project can be run': "osmo-gsm-tester" +
Pau Espin Pedrolf5c83da2017-11-02 15:48:10 +0100262 (to match the 'Label' configured in <<install_add_jenkins_slave>>).
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200263* 'Source Code Management':
264** 'Git'
265*** 'Repository URL': "git://git.osmocom.org/osmo-gsm-tester"
266*** 'Branch Specifier': "*/master"
267*** 'Additional Behaviors'
268**** 'Check out to a sub-directory': "osmo-gsm-tester"
269**** 'Clean before checkout'
270* 'Build Triggers' +
271 The decision on when to build is complex. For this run job, it is suggested
272 to rebuild:
273** after each of above build jobs that produced new artifacts: +
274 'Build after other projects are built': "osmo-gsm-tester_build-osmo-nitb,
275 osmo-gsm-tester_build-osmo-bts-sysmo, osmo-gsm-tester_build-osmo-bts-trx" +
276 (Add each build job name you configured above)
277** as well as once per day: +
278 'Build periodically': "H H * * *"
279** and, in addition, whenever the osmo-gsm-tester scripts have been modified: +
280 'Poll SCM': "H/5 * * * *" +
281 (i.e. look every five minutes whether the upstream git has changed)
282* 'Build'
283** Copy artifacts from each build job you have set up:
284*** 'Copy artifacts from another project'
285**** 'Project name': "osmo-gsm-tester_build-osmo-nitb"
286**** 'Which build': 'Latest successful build'
287**** enable 'Stable build only'
288**** 'Artifacts to copy': "*.tgz, *.md5"
289*** Add a separate similar 'Copy artifacts...' section for each build job you
290 have set up.
291** 'Execute Shell'
292+
293----
294#!/bin/sh
295set -e -x
296
297# debug: provoke a failure
298#export OSMO_GSM_TESTER_OPTS="-s debug -t fail"
299
300PATH="$PWD/osmo-gsm-tester/src:$PATH" \
301 ./osmo-gsm-tester/contrib/jenkins-run.sh
302----
303+
304Details:
305
306*** The 'jenkins-run.sh' script assumes to find the 'osmo-gsm-tester.py' in the
307 '$PATH'. To use the most recent osmo-gsm-tester code here, we direct
308 '$PATH' to the actual workspace checkout. This could also run from a sytem
309 wide install, in which case you could omit the explicit PATH to
310 "$PWD/osmo-gsm-tester/src".
311*** This assumes that there are configuration files for osmo-gsm-tester placed
Pau Espin Pedrolffa325e2020-06-10 17:49:55 +0200312 on the system (see <<config_main>>).
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200313*** If you'd like to check the behavior of test failures, you can uncomment the
314 line below "# debug" to produce a build failure on every run. Note that
315 this test typically produces a quite empty run result, since it launches no
316 NITB nor BTS.
317* 'Post-build Actions'
318** 'Archive the artifacts'
Neels Hofmeyr8d8a1362017-06-18 02:31:38 +0200319*** 'Files to archive': "*-run.tgz, *-bin.tgz" +
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200320 This stores the complete test report with config files, logs, stdout/stderr
Neels Hofmeyr8d8a1362017-06-18 02:31:38 +0200321 output, pcaps as well as the binaries used for the test run in artifacts.
322 This allows analysis of older builds, instead of only the most recent build
323 (which cleans up the jenkins workspace every time). The 'trial-N-run.tgz'
324 and 'trial-N-bin.tgz' archives are produced by the 'jenkins-run.sh' script,
325 both for successful and failing runs.
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200326
Pau Espin Pedrol0baa5c72020-05-05 19:08:13 +0200327==== Install osmo-gsm-tester dependencies
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200328
Pau Espin Pedrolf5c83da2017-11-02 15:48:10 +0100329This assumes you have already created the jenkins user (see <<configure_jenkins_slave>>).
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200330
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100331Dependencies needed will depend on lots of factors, like your distribution, your
332specific setup, which hardware you plan to support, etc.
333
Pau Espin Pedrol0baa5c72020-05-05 19:08:13 +0200334On a Debian/Ubuntu based system, these commands install the mandatory packages
335needed to run the osmo-gsm-tester.py code, i.e. install these on your main unit:
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100336
337----
338apt-get install \
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100339 python3 \
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100340 python3-yaml \
341 python3-mako \
342 python3-gi \
Pau Espin Pedrol600c7992020-11-09 21:17:51 +0100343 python3-watchdog \
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100344 locales
Pau Espin Pedrol0baa5c72020-05-05 19:08:13 +0200345----
346
347If one plans to use the 2G ESME (_esme.py_), following extra dependencies shall
348be installed:
349----
350apt-get install python3-setuptools python3-pip
351pip3 install "git+https://github.com/podshumok/python-smpplib.git@master#egg=smpplib"
352----
353
354If one plans to use the 2G OsmoHLR (_hlr_osmo.py_), following extra dependencies shall
355be installed:
356----
357apt-get install sqlite3
358----
359
360If one plans to use SISPM power supply hardware (_powersupply_sispm.py_),
361following extra dependencies shall be installed:
362----
363apt-get install python3-setuptools python3-pip
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100364pip3 install \
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100365 pyusb \
366 pysispm
367----
368
Pau Espin Pedrol0baa5c72020-05-05 19:08:13 +0200369If one plans to use software-based RF emulation on Amarisoft ENB implemented
370through its CTRL interface (_rfemu_amarisoftctrl.py_), following extra
371dependencies shall be installed:
372----
373apt-get install python3-websocket
374----
375
376If one plans to use srsLTE UE metrics subsystems (_ms_srs.py_), following extra
377dependencies shall be installed:
378----
379apt-get install python3-numpy
380----
381
382If one plans to use ofono modems (_ms_ofono.py_), following extra dependencies
383shall be installed:
384----
385apt-get install \
386 dbus \
387 python3 \
388 ofono \
389 python3-pip \
390 udhcpc
391pip3 install \
392 pydbus
393----
394
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100395IMPORTANT: ofono may need to be installed from source to contain the most
396recent fixes needed to operate your modems. This depends on the modem hardware
397used and the tests run. Please see <<hardware_modems>>.
398
Pau Espin Pedrol0baa5c72020-05-05 19:08:13 +0200399Finally, these programs are usually required by osmo-gsm-tester on the Slave Unit to run and manage processes:
400
401----
402apt-get install \
403 tcpdump \
404 patchelf \
405 sudo \
406 libcap2-bin \
407 iperf3
408----
409
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200410==== User Permissions
411
412On the main unit, create a group for all users that should be allowed to use
413the osmo-gsm-tester, and add users (here 'jenkins') to this group.
414
415----
416groupadd osmo-gsm-tester
417gpasswd -a jenkins osmo-gsm-tester
418----
419
420NOTE: you may also need to add users to the 'usrp' group, see
421<<user_config_uhd>>.
422
423A user added to a group needs to re-login for the group permissions to take
424effect.
425
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200426===== Paths
427
428Assuming that you are using the example config, prepare a system wide state
429location in '/var/tmp':
430
431----
432mkdir -p /var/tmp/osmo-gsm-tester/state
433chown -R :osmo-gsm-tester /var/tmp/osmo-gsm-tester
434chmod -R g+rwxs /var/tmp/osmo-gsm-tester
435setfacl -d -m group:osmo-gsm-tester:rwx /var/tmp/osmo-gsm-tester/state
436----
437
438IMPORTANT: the state directory needs to be shared between all users potentially
439running the osmo-gsm-tester to resolve resource allocations. Above 'setfacl'
440command sets the access control to keep all created files group writable.
441
442With the jenkins build as described here, the trials will live in the build
443slave's workspace. Other modes of operation (a daemon scheduling concurrent
444runs, *TODO*) may use a system wide directory to manage trials to run:
445
446----
447mkdir -p /var/tmp/osmo-gsm-tester/trials
448chown -R :osmo-gsm-tester /var/tmp/osmo-gsm-tester
449chmod -R g+rwxs /var/tmp/osmo-gsm-tester
450----
451
452===== Allow DBus Access to ofono
453
454Put a DBus configuration file in place that allows the 'osmo-gsm-tester' group
455to access the org.ofono DBus path:
456
457----
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100458# cat > /etc/dbus-1/system.d/osmo-gsm-tester.conf <<END
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200459<!-- Additional rules for the osmo-gsm-tester to access org.ofono from user
460 land -->
461
462<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
463 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
464<busconfig>
465
466 <policy group="osmo-gsm-tester">
467 <allow send_destination="org.ofono"/>
468 </policy>
469
470</busconfig>
471END
472----
473
474(No restart of dbus nor ofono necessary.)
475
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100476[[install_slave_unit]]
477=== Slave Unit(s)
478
479The slave units are the hosts used by {app-name} to run proceses on. It may be
480the <<install_main_unit,Main Unit>> itself and processes will be run locally, or
481it may be a remote host were processes are run usually through SSH.
482
483This guide assumes slaves unit(s) use same configuration as the Main Unit, that
484is, it runs under 'jenkins' user which is a member of the 'osmo-gsm-tester' user
485group. In order to do so, follow the instruction under the
486<<install_main_unit,Main Unit>> section above. Keep in mind the 'jenkins' user
487on the Main Unit will need to be able to log in through SSH as the slave unit
488'jenkins' user to run the processes. No direct access from Jenkins Master node
489is required here.
490
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200491[[install_capture_packets]]
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100492==== Capture Packets
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200493
494In order to allow collecting pcap traces of the network communication for later
495reference, allow the osmo-gsm-tester group to capture packets using the 'tcpdump'
496program:
497
498----
499chgrp osmo-gsm-tester /usr/sbin/tcpdump
500chmod 750 /usr/sbin/tcpdump
501setcap cap_net_raw,cap_net_admin=eip /usr/sbin/tcpdump
502----
503
504Put 'tcpdump' in the '$PATH' -- assuming that 'tcpdump' is available for root:
505
506----
507ln -s `which tcpdump` /usr/local/bin/tcpdump
508----
509
510TIP: Why a symlink in '/usr/local/bin'? On Debian, 'tcpdump' lives in
511'/usr/sbin', which is not part of the '$PATH' for non-root users. To avoid
512hardcoding non-portable paths in the osmo-gsm-tester source, 'tcpdump' must be
513available in the '$PATH'. There are various trivial ways to modify '$PATH' for
514login shells, but the jenkins build slave typically runs in a *non-login*
515shell; modifying non-login shell enviroments is not trivially possible without
516also interfering with files installed from debian packages. Probably the
517easiest way to allow all users and all shells to find the 'tcpdump' binary is
518to actually place a symbolic link in a directory that is already part of the
519non-login shell's '$PATH'. Above example places such in '/usr/local/bin'.
520
521Verify that a non-login shell can find 'tcpdump':
522
523----
524su jenkins -c 'which tcpdump'
525# should print: "/usr/local/bin/tcpdump"
526----
527
528WARNING: When logged in via SSH on your main unit, running 'tcpdump' to capture
529packets may result in a feedback loop: SSH activity to send tcpdump's output to
530your terminal is in turn is picked up in the tcpdump trace, and so forth. When
531testing 'tcpdump' access, make sure to have proper filter expressions in place.
532
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100533==== Allow Core Files
Pau Espin Pedrol018e1042017-08-28 11:58:25 +0200534
535In case a binary run for the test crashes, a core file of the crash should be
536written. This requires a limit rule. Create a file with the required rule:
537
538----
539sudo -s
540echo "@osmo-gsm-tester - core unlimited" > /etc/security/limits.d/osmo-gsm-tester_allow-core.conf
541----
542
543Re-login the user to make these changes take effect.
544
545Set the *kernel.core_pattern* sysctl to *core* (usually the default). For each
546binary run by osmo-gsm-tester, a core file will then appear in the same dir that
547contains stdout and stderr for that process (because this dir is set as CWD).
548
549----
550sysctl -w kernel.core_pattern=core
551----
552
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100553TIP: Files required to be installed under '/etc/security/limits.d/' can be found
554under 'osmo-gsm-tester.git/utils/limits.d/', so one can simply cp them from
555there.
556
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100557==== Allow Realtime Priority
Pau Espin Pedrol018e1042017-08-28 11:58:25 +0200558
559Certain binaries should be run with real-time priority, like 'osmo-bts-trx'.
560Add this permission on the main unit:
561
562----
563sudo -s
564echo "@osmo-gsm-tester - rtprio 99" > /etc/security/limits.d/osmo-gsm-tester_allow-rtprio.conf
565----
566
567Re-login the user to make these changes take effect.
568
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100569TIP: Files required to be installed under '/etc/security/limits.d/' can be found
570under 'osmo-gsm-tester.git/utils/limits.d/', so one can simply cp them from
571there.
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200572
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100573===== Allow capabilities: 'CAP_NET_RAW', 'CAP_NET_ADMIN', 'CAP_SYS_ADMIN'
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100574
575Certain binaries require 'CAP_NET_RAW' to be set, like 'osmo-bts-octphy' as it
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100576uses a 'AF_PACKET' socket. Similarly, others (like osmo-ggsn) require
577'CAP_NET_ADMIN' to be able to create tun devices, and so on.
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100578
579To be able to set the following capability without being root, osmo-gsm-tester
580uses sudo to gain permissions to set the capability.
581
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100582This is the script that osmo-gsm-tester expects on the host running the process:
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100583
584----
585echo /usr/local/bin/osmo-gsm-tester_setcap_net_raw.sh <<EOF
586#!/bin/bash
587/sbin/setcap cap_net_raw+ep $1
588EOF
589chmod +x /usr/local/bin/osmo-gsm-tester_setcap_net_raw.sh
590----
591
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100592Now, again on the same host, we need to provide sudo access to this script for
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100593osmo-gsm-tester:
594
595----
596echo "%osmo-gsm-tester ALL=(root) NOPASSWD: /usr/local/bin/osmo-gsm-tester_setcap_net_raw.sh" > /etc/sudoers.d/osmo-gsm-tester_setcap_net_raw
597chmod 0440 /etc/sudoers.d/osmo-gsm-tester_setcap_net_raw
598----
599
600The script file name 'osmo-gsm-tester_setcap_net_raw.sh' is important, as
601osmo-gsm-tester expects to find a script with this name in '$PATH' at run time.
602
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100603TIP: Files required to be installed under '/etc/sudoers.d/' can be found
604under 'osmo-gsm-tester.git/utils/sudoers.d/', so one can simply cp them from
605there.
606
607TIP: Files required to be installed under '/usr/local/bin/' can be found
608under 'osmo-gsm-tester.git/utils/bin/', so one can simply cp them from
609there.
610
611[[user_config_uhd]]
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100612==== UHD
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100613
614Grant permission to use the UHD driver to run USRP devices for osmo-bts-trx, by
615adding the jenkins user to the 'usrp' group:
616
617----
618gpasswd -a jenkins usrp
619----
620
621To run osmo-bts-trx with a USRP attached, you may need to install a UHD driver.
622Please refer to http://osmocom.org/projects/osmotrx/wiki/OsmoTRX#UHD for
623details; the following is an example for the B200 family USRP devices:
624
625----
626apt-get install libuhd-dev uhd-host
627/usr/lib/uhd/utils/uhd_images_downloader.py
628----
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100629
Neels Hofmeyr74689532017-09-05 19:43:02 +0200630==== Log Rotation
631
632To avoid clogging up /var/log, it makes sense to choose a sane maximum log size:
633
634----
635echo maxsize 10M > /etc/logrotate.d/maxsize
636----
637
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200638==== Install Scripts
639
640IMPORTANT: When using the jenkins build slave as configured above, *there is no
641need to install the osmo-gsm-tester sources on the main unit*. The jenkins job
642will do so implicitly by checking out the latest osmo-gsm-tester sources in the
643workspace for every run. If you're using only the jenkins build slave, you may
644skip this section.
645
646If you prefer to use a fixed installation of the osmo-gsm-tester sources
647instead of the jenkins workspace, you can:
648
649. From the run job configured above, remove the line that says
650+
651----
652PATH="$PWD/osmo-gsm-tester/src:$PATH" \
653----
654+
655so that this uses a system wide installation instead.
656
657. Install the sources e.g. in '/usr/local/src' as indicated below.
658
659On the main unit, to install the latest in '/usr/local/src':
660
661----
662apt-get install git
663mkdir -p /usr/local/src
664cd /usr/local/src
665git clone git://git.osmocom.org/osmo-gsm-tester
666----
667
668To allow all users to run 'osmo-gsm-tester.py', from login as well as non-login
669shells, the easiest solution is to place a symlink in '/usr/local/bin':
670
671----
672ln -s /usr/local/src/osmo-gsm-tester/src/osmo-gsm-tester.py /usr/local/bin/
673----
674
675(See also the tip in <<install_capture_packets>> for a more detailed
676explanation.)
677
678The example configuration provided in the source is suitable for running as-is,
679*if* your hardware setup matches (you could technically use that directly by a
680symlink e.g. from '/usr/local/etc/osmo-gsm-tester' to the 'example' dir). If in
681doubt, rather copy the example, point 'paths.conf' at the 'suites' dir, and
682adjust your own configuration as needed. For example:
683
684----
685cd /etc
686cp -R /usr/local/src/osmo-gsm-tester/example osmo-gsm-tester
Pau Espin Pedrol69488f62020-04-07 16:40:41 +0200687sed -i 's#\./suites#/usr/local/src/osmo-gsm-tester/suites#' osmo-gsm-tester/paths.conf
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200688----
689
690NOTE: The configuration will be looked up in various places, see
Pau Espin Pedrolffa325e2020-06-10 17:49:55 +0200691<<config_main>>.