blob: 0e48e9d969a8c4f9e72faf6e0733cdaf07667d3f [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 Pedrol7e0b2dd2020-03-10 11:46:39 +0100343 locales
Pau Espin Pedrol0baa5c72020-05-05 19:08:13 +0200344----
345
346If one plans to use the 2G ESME (_esme.py_), following extra dependencies shall
347be installed:
348----
349apt-get install python3-setuptools python3-pip
350pip3 install "git+https://github.com/podshumok/python-smpplib.git@master#egg=smpplib"
351----
352
353If one plans to use the 2G OsmoHLR (_hlr_osmo.py_), following extra dependencies shall
354be installed:
355----
356apt-get install sqlite3
357----
358
359If one plans to use SISPM power supply hardware (_powersupply_sispm.py_),
360following extra dependencies shall be installed:
361----
362apt-get install python3-setuptools python3-pip
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100363pip3 install \
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100364 pyusb \
365 pysispm
366----
367
Pau Espin Pedrol0baa5c72020-05-05 19:08:13 +0200368If one plans to use software-based RF emulation on Amarisoft ENB implemented
369through its CTRL interface (_rfemu_amarisoftctrl.py_), following extra
370dependencies shall be installed:
371----
372apt-get install python3-websocket
373----
374
375If one plans to use srsLTE UE metrics subsystems (_ms_srs.py_), following extra
376dependencies shall be installed:
377----
378apt-get install python3-numpy
379----
380
381If one plans to use ofono modems (_ms_ofono.py_), following extra dependencies
382shall be installed:
383----
384apt-get install \
385 dbus \
386 python3 \
387 ofono \
388 python3-pip \
389 udhcpc
390pip3 install \
391 pydbus
392----
393
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100394IMPORTANT: ofono may need to be installed from source to contain the most
395recent fixes needed to operate your modems. This depends on the modem hardware
396used and the tests run. Please see <<hardware_modems>>.
397
Pau Espin Pedrol0baa5c72020-05-05 19:08:13 +0200398Finally, these programs are usually required by osmo-gsm-tester on the Slave Unit to run and manage processes:
399
400----
401apt-get install \
402 tcpdump \
403 patchelf \
404 sudo \
405 libcap2-bin \
406 iperf3
407----
408
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200409==== User Permissions
410
411On the main unit, create a group for all users that should be allowed to use
412the osmo-gsm-tester, and add users (here 'jenkins') to this group.
413
414----
415groupadd osmo-gsm-tester
416gpasswd -a jenkins osmo-gsm-tester
417----
418
419NOTE: you may also need to add users to the 'usrp' group, see
420<<user_config_uhd>>.
421
422A user added to a group needs to re-login for the group permissions to take
423effect.
424
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200425===== Paths
426
427Assuming that you are using the example config, prepare a system wide state
428location in '/var/tmp':
429
430----
431mkdir -p /var/tmp/osmo-gsm-tester/state
432chown -R :osmo-gsm-tester /var/tmp/osmo-gsm-tester
433chmod -R g+rwxs /var/tmp/osmo-gsm-tester
434setfacl -d -m group:osmo-gsm-tester:rwx /var/tmp/osmo-gsm-tester/state
435----
436
437IMPORTANT: the state directory needs to be shared between all users potentially
438running the osmo-gsm-tester to resolve resource allocations. Above 'setfacl'
439command sets the access control to keep all created files group writable.
440
441With the jenkins build as described here, the trials will live in the build
442slave's workspace. Other modes of operation (a daemon scheduling concurrent
443runs, *TODO*) may use a system wide directory to manage trials to run:
444
445----
446mkdir -p /var/tmp/osmo-gsm-tester/trials
447chown -R :osmo-gsm-tester /var/tmp/osmo-gsm-tester
448chmod -R g+rwxs /var/tmp/osmo-gsm-tester
449----
450
451===== Allow DBus Access to ofono
452
453Put a DBus configuration file in place that allows the 'osmo-gsm-tester' group
454to access the org.ofono DBus path:
455
456----
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100457# cat > /etc/dbus-1/system.d/osmo-gsm-tester.conf <<END
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200458<!-- Additional rules for the osmo-gsm-tester to access org.ofono from user
459 land -->
460
461<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
462 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
463<busconfig>
464
465 <policy group="osmo-gsm-tester">
466 <allow send_destination="org.ofono"/>
467 </policy>
468
469</busconfig>
470END
471----
472
473(No restart of dbus nor ofono necessary.)
474
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100475[[install_slave_unit]]
476=== Slave Unit(s)
477
478The slave units are the hosts used by {app-name} to run proceses on. It may be
479the <<install_main_unit,Main Unit>> itself and processes will be run locally, or
480it may be a remote host were processes are run usually through SSH.
481
482This guide assumes slaves unit(s) use same configuration as the Main Unit, that
483is, it runs under 'jenkins' user which is a member of the 'osmo-gsm-tester' user
484group. In order to do so, follow the instruction under the
485<<install_main_unit,Main Unit>> section above. Keep in mind the 'jenkins' user
486on the Main Unit will need to be able to log in through SSH as the slave unit
487'jenkins' user to run the processes. No direct access from Jenkins Master node
488is required here.
489
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200490[[install_capture_packets]]
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100491==== Capture Packets
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200492
493In order to allow collecting pcap traces of the network communication for later
494reference, allow the osmo-gsm-tester group to capture packets using the 'tcpdump'
495program:
496
497----
498chgrp osmo-gsm-tester /usr/sbin/tcpdump
499chmod 750 /usr/sbin/tcpdump
500setcap cap_net_raw,cap_net_admin=eip /usr/sbin/tcpdump
501----
502
503Put 'tcpdump' in the '$PATH' -- assuming that 'tcpdump' is available for root:
504
505----
506ln -s `which tcpdump` /usr/local/bin/tcpdump
507----
508
509TIP: Why a symlink in '/usr/local/bin'? On Debian, 'tcpdump' lives in
510'/usr/sbin', which is not part of the '$PATH' for non-root users. To avoid
511hardcoding non-portable paths in the osmo-gsm-tester source, 'tcpdump' must be
512available in the '$PATH'. There are various trivial ways to modify '$PATH' for
513login shells, but the jenkins build slave typically runs in a *non-login*
514shell; modifying non-login shell enviroments is not trivially possible without
515also interfering with files installed from debian packages. Probably the
516easiest way to allow all users and all shells to find the 'tcpdump' binary is
517to actually place a symbolic link in a directory that is already part of the
518non-login shell's '$PATH'. Above example places such in '/usr/local/bin'.
519
520Verify that a non-login shell can find 'tcpdump':
521
522----
523su jenkins -c 'which tcpdump'
524# should print: "/usr/local/bin/tcpdump"
525----
526
527WARNING: When logged in via SSH on your main unit, running 'tcpdump' to capture
528packets may result in a feedback loop: SSH activity to send tcpdump's output to
529your terminal is in turn is picked up in the tcpdump trace, and so forth. When
530testing 'tcpdump' access, make sure to have proper filter expressions in place.
531
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100532==== Allow Core Files
Pau Espin Pedrol018e1042017-08-28 11:58:25 +0200533
534In case a binary run for the test crashes, a core file of the crash should be
535written. This requires a limit rule. Create a file with the required rule:
536
537----
538sudo -s
539echo "@osmo-gsm-tester - core unlimited" > /etc/security/limits.d/osmo-gsm-tester_allow-core.conf
540----
541
542Re-login the user to make these changes take effect.
543
544Set the *kernel.core_pattern* sysctl to *core* (usually the default). For each
545binary run by osmo-gsm-tester, a core file will then appear in the same dir that
546contains stdout and stderr for that process (because this dir is set as CWD).
547
548----
549sysctl -w kernel.core_pattern=core
550----
551
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100552TIP: Files required to be installed under '/etc/security/limits.d/' can be found
553under 'osmo-gsm-tester.git/utils/limits.d/', so one can simply cp them from
554there.
555
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100556==== Allow Realtime Priority
Pau Espin Pedrol018e1042017-08-28 11:58:25 +0200557
558Certain binaries should be run with real-time priority, like 'osmo-bts-trx'.
559Add this permission on the main unit:
560
561----
562sudo -s
563echo "@osmo-gsm-tester - rtprio 99" > /etc/security/limits.d/osmo-gsm-tester_allow-rtprio.conf
564----
565
566Re-login the user to make these changes take effect.
567
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100568TIP: Files required to be installed under '/etc/security/limits.d/' can be found
569under 'osmo-gsm-tester.git/utils/limits.d/', so one can simply cp them from
570there.
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200571
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100572===== Allow capabilities: 'CAP_NET_RAW', 'CAP_NET_ADMIN', 'CAP_SYS_ADMIN'
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100573
574Certain binaries require 'CAP_NET_RAW' to be set, like 'osmo-bts-octphy' as it
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100575uses a 'AF_PACKET' socket. Similarly, others (like osmo-ggsn) require
576'CAP_NET_ADMIN' to be able to create tun devices, and so on.
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100577
578To be able to set the following capability without being root, osmo-gsm-tester
579uses sudo to gain permissions to set the capability.
580
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100581This is the script that osmo-gsm-tester expects on the host running the process:
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100582
583----
584echo /usr/local/bin/osmo-gsm-tester_setcap_net_raw.sh <<EOF
585#!/bin/bash
586/sbin/setcap cap_net_raw+ep $1
587EOF
588chmod +x /usr/local/bin/osmo-gsm-tester_setcap_net_raw.sh
589----
590
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100591Now, again on the same host, we need to provide sudo access to this script for
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100592osmo-gsm-tester:
593
594----
595echo "%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
596chmod 0440 /etc/sudoers.d/osmo-gsm-tester_setcap_net_raw
597----
598
599The script file name 'osmo-gsm-tester_setcap_net_raw.sh' is important, as
600osmo-gsm-tester expects to find a script with this name in '$PATH' at run time.
601
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100602TIP: Files required to be installed under '/etc/sudoers.d/' can be found
603under 'osmo-gsm-tester.git/utils/sudoers.d/', so one can simply cp them from
604there.
605
606TIP: Files required to be installed under '/usr/local/bin/' can be found
607under 'osmo-gsm-tester.git/utils/bin/', so one can simply cp them from
608there.
609
610[[user_config_uhd]]
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100611==== UHD
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100612
613Grant permission to use the UHD driver to run USRP devices for osmo-bts-trx, by
614adding the jenkins user to the 'usrp' group:
615
616----
617gpasswd -a jenkins usrp
618----
619
620To run osmo-bts-trx with a USRP attached, you may need to install a UHD driver.
621Please refer to http://osmocom.org/projects/osmotrx/wiki/OsmoTRX#UHD for
622details; the following is an example for the B200 family USRP devices:
623
624----
625apt-get install libuhd-dev uhd-host
626/usr/lib/uhd/utils/uhd_images_downloader.py
627----
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100628
Neels Hofmeyr74689532017-09-05 19:43:02 +0200629==== Log Rotation
630
631To avoid clogging up /var/log, it makes sense to choose a sane maximum log size:
632
633----
634echo maxsize 10M > /etc/logrotate.d/maxsize
635----
636
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200637==== Install Scripts
638
639IMPORTANT: When using the jenkins build slave as configured above, *there is no
640need to install the osmo-gsm-tester sources on the main unit*. The jenkins job
641will do so implicitly by checking out the latest osmo-gsm-tester sources in the
642workspace for every run. If you're using only the jenkins build slave, you may
643skip this section.
644
645If you prefer to use a fixed installation of the osmo-gsm-tester sources
646instead of the jenkins workspace, you can:
647
648. From the run job configured above, remove the line that says
649+
650----
651PATH="$PWD/osmo-gsm-tester/src:$PATH" \
652----
653+
654so that this uses a system wide installation instead.
655
656. Install the sources e.g. in '/usr/local/src' as indicated below.
657
658On the main unit, to install the latest in '/usr/local/src':
659
660----
661apt-get install git
662mkdir -p /usr/local/src
663cd /usr/local/src
664git clone git://git.osmocom.org/osmo-gsm-tester
665----
666
667To allow all users to run 'osmo-gsm-tester.py', from login as well as non-login
668shells, the easiest solution is to place a symlink in '/usr/local/bin':
669
670----
671ln -s /usr/local/src/osmo-gsm-tester/src/osmo-gsm-tester.py /usr/local/bin/
672----
673
674(See also the tip in <<install_capture_packets>> for a more detailed
675explanation.)
676
677The example configuration provided in the source is suitable for running as-is,
678*if* your hardware setup matches (you could technically use that directly by a
679symlink e.g. from '/usr/local/etc/osmo-gsm-tester' to the 'example' dir). If in
680doubt, rather copy the example, point 'paths.conf' at the 'suites' dir, and
681adjust your own configuration as needed. For example:
682
683----
684cd /etc
685cp -R /usr/local/src/osmo-gsm-tester/example osmo-gsm-tester
Pau Espin Pedrol69488f62020-04-07 16:40:41 +0200686sed -i 's#\./suites#/usr/local/src/osmo-gsm-tester/suites#' osmo-gsm-tester/paths.conf
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200687----
688
689NOTE: The configuration will be looked up in various places, see
Pau Espin Pedrolffa325e2020-06-10 17:49:55 +0200690<<config_main>>.