blob: ed3829607c532857a4e80d57b888cd693616eea5 [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
312 on the system (see <<config_paths>>).
313*** 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 Pedrol7e0b2dd2020-03-10 11:46:39 +0100327==== Install osmo-gsm-tester
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
334On a Debian/Ubuntu based system, these commands install the packages needed to
335run the osmo-gsm-tester.py code, i.e. install these on your main unit:
336
337----
338apt-get install \
339 dbus \
340 tcpdump \
341 sqlite3 \
342 python3 \
343 python3-setuptools \
344 python3-yaml \
345 python3-mako \
346 python3-gi \
347 python3-numpy \
348 python3-wheel \
349 ofono \
350 patchelf \
351 sudo \
352 libcap2-bin \
353 python3-pip \
354 udhcpc \
355 iperf3 \
356 locales
357pip3 install \
358 "git+https://github.com/podshumok/python-smpplib.git@master#egg=smpplib" \
359 pydbus \
360 pyusb \
361 pysispm
362----
363
364IMPORTANT: ofono may need to be installed from source to contain the most
365recent fixes needed to operate your modems. This depends on the modem hardware
366used and the tests run. Please see <<hardware_modems>>.
367
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200368==== User Permissions
369
370On the main unit, create a group for all users that should be allowed to use
371the osmo-gsm-tester, and add users (here 'jenkins') to this group.
372
373----
374groupadd osmo-gsm-tester
375gpasswd -a jenkins osmo-gsm-tester
376----
377
378NOTE: you may also need to add users to the 'usrp' group, see
379<<user_config_uhd>>.
380
381A user added to a group needs to re-login for the group permissions to take
382effect.
383
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200384===== Paths
385
386Assuming that you are using the example config, prepare a system wide state
387location in '/var/tmp':
388
389----
390mkdir -p /var/tmp/osmo-gsm-tester/state
391chown -R :osmo-gsm-tester /var/tmp/osmo-gsm-tester
392chmod -R g+rwxs /var/tmp/osmo-gsm-tester
393setfacl -d -m group:osmo-gsm-tester:rwx /var/tmp/osmo-gsm-tester/state
394----
395
396IMPORTANT: the state directory needs to be shared between all users potentially
397running the osmo-gsm-tester to resolve resource allocations. Above 'setfacl'
398command sets the access control to keep all created files group writable.
399
400With the jenkins build as described here, the trials will live in the build
401slave's workspace. Other modes of operation (a daemon scheduling concurrent
402runs, *TODO*) may use a system wide directory to manage trials to run:
403
404----
405mkdir -p /var/tmp/osmo-gsm-tester/trials
406chown -R :osmo-gsm-tester /var/tmp/osmo-gsm-tester
407chmod -R g+rwxs /var/tmp/osmo-gsm-tester
408----
409
410===== Allow DBus Access to ofono
411
412Put a DBus configuration file in place that allows the 'osmo-gsm-tester' group
413to access the org.ofono DBus path:
414
415----
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100416# cat > /etc/dbus-1/system.d/osmo-gsm-tester.conf <<END
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200417<!-- Additional rules for the osmo-gsm-tester to access org.ofono from user
418 land -->
419
420<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
421 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
422<busconfig>
423
424 <policy group="osmo-gsm-tester">
425 <allow send_destination="org.ofono"/>
426 </policy>
427
428</busconfig>
429END
430----
431
432(No restart of dbus nor ofono necessary.)
433
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100434[[install_slave_unit]]
435=== Slave Unit(s)
436
437The slave units are the hosts used by {app-name} to run proceses on. It may be
438the <<install_main_unit,Main Unit>> itself and processes will be run locally, or
439it may be a remote host were processes are run usually through SSH.
440
441This guide assumes slaves unit(s) use same configuration as the Main Unit, that
442is, it runs under 'jenkins' user which is a member of the 'osmo-gsm-tester' user
443group. In order to do so, follow the instruction under the
444<<install_main_unit,Main Unit>> section above. Keep in mind the 'jenkins' user
445on the Main Unit will need to be able to log in through SSH as the slave unit
446'jenkins' user to run the processes. No direct access from Jenkins Master node
447is required here.
448
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200449[[install_capture_packets]]
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100450==== Capture Packets
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200451
452In order to allow collecting pcap traces of the network communication for later
453reference, allow the osmo-gsm-tester group to capture packets using the 'tcpdump'
454program:
455
456----
457chgrp osmo-gsm-tester /usr/sbin/tcpdump
458chmod 750 /usr/sbin/tcpdump
459setcap cap_net_raw,cap_net_admin=eip /usr/sbin/tcpdump
460----
461
462Put 'tcpdump' in the '$PATH' -- assuming that 'tcpdump' is available for root:
463
464----
465ln -s `which tcpdump` /usr/local/bin/tcpdump
466----
467
468TIP: Why a symlink in '/usr/local/bin'? On Debian, 'tcpdump' lives in
469'/usr/sbin', which is not part of the '$PATH' for non-root users. To avoid
470hardcoding non-portable paths in the osmo-gsm-tester source, 'tcpdump' must be
471available in the '$PATH'. There are various trivial ways to modify '$PATH' for
472login shells, but the jenkins build slave typically runs in a *non-login*
473shell; modifying non-login shell enviroments is not trivially possible without
474also interfering with files installed from debian packages. Probably the
475easiest way to allow all users and all shells to find the 'tcpdump' binary is
476to actually place a symbolic link in a directory that is already part of the
477non-login shell's '$PATH'. Above example places such in '/usr/local/bin'.
478
479Verify that a non-login shell can find 'tcpdump':
480
481----
482su jenkins -c 'which tcpdump'
483# should print: "/usr/local/bin/tcpdump"
484----
485
486WARNING: When logged in via SSH on your main unit, running 'tcpdump' to capture
487packets may result in a feedback loop: SSH activity to send tcpdump's output to
488your terminal is in turn is picked up in the tcpdump trace, and so forth. When
489testing 'tcpdump' access, make sure to have proper filter expressions in place.
490
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100491==== Allow Core Files
Pau Espin Pedrol018e1042017-08-28 11:58:25 +0200492
493In case a binary run for the test crashes, a core file of the crash should be
494written. This requires a limit rule. Create a file with the required rule:
495
496----
497sudo -s
498echo "@osmo-gsm-tester - core unlimited" > /etc/security/limits.d/osmo-gsm-tester_allow-core.conf
499----
500
501Re-login the user to make these changes take effect.
502
503Set the *kernel.core_pattern* sysctl to *core* (usually the default). For each
504binary run by osmo-gsm-tester, a core file will then appear in the same dir that
505contains stdout and stderr for that process (because this dir is set as CWD).
506
507----
508sysctl -w kernel.core_pattern=core
509----
510
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100511TIP: Files required to be installed under '/etc/security/limits.d/' can be found
512under 'osmo-gsm-tester.git/utils/limits.d/', so one can simply cp them from
513there.
514
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100515==== Allow Realtime Priority
Pau Espin Pedrol018e1042017-08-28 11:58:25 +0200516
517Certain binaries should be run with real-time priority, like 'osmo-bts-trx'.
518Add this permission on the main unit:
519
520----
521sudo -s
522echo "@osmo-gsm-tester - rtprio 99" > /etc/security/limits.d/osmo-gsm-tester_allow-rtprio.conf
523----
524
525Re-login the user to make these changes take effect.
526
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100527TIP: Files required to be installed under '/etc/security/limits.d/' can be found
528under 'osmo-gsm-tester.git/utils/limits.d/', so one can simply cp them from
529there.
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200530
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100531===== Allow capabilities: 'CAP_NET_RAW', 'CAP_NET_ADMIN', 'CAP_SYS_ADMIN'
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100532
533Certain binaries require 'CAP_NET_RAW' to be set, like 'osmo-bts-octphy' as it
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100534uses a 'AF_PACKET' socket. Similarly, others (like osmo-ggsn) require
535'CAP_NET_ADMIN' to be able to create tun devices, and so on.
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100536
537To be able to set the following capability without being root, osmo-gsm-tester
538uses sudo to gain permissions to set the capability.
539
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100540This is the script that osmo-gsm-tester expects on the host running the process:
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100541
542----
543echo /usr/local/bin/osmo-gsm-tester_setcap_net_raw.sh <<EOF
544#!/bin/bash
545/sbin/setcap cap_net_raw+ep $1
546EOF
547chmod +x /usr/local/bin/osmo-gsm-tester_setcap_net_raw.sh
548----
549
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100550Now, again on the same host, we need to provide sudo access to this script for
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100551osmo-gsm-tester:
552
553----
554echo "%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
555chmod 0440 /etc/sudoers.d/osmo-gsm-tester_setcap_net_raw
556----
557
558The script file name 'osmo-gsm-tester_setcap_net_raw.sh' is important, as
559osmo-gsm-tester expects to find a script with this name in '$PATH' at run time.
560
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100561TIP: Files required to be installed under '/etc/sudoers.d/' can be found
562under 'osmo-gsm-tester.git/utils/sudoers.d/', so one can simply cp them from
563there.
564
565TIP: Files required to be installed under '/usr/local/bin/' can be found
566under 'osmo-gsm-tester.git/utils/bin/', so one can simply cp them from
567there.
568
569[[user_config_uhd]]
Pau Espin Pedrol71a54fb2020-03-14 19:20:03 +0100570==== UHD
Pau Espin Pedrol7e0b2dd2020-03-10 11:46:39 +0100571
572Grant permission to use the UHD driver to run USRP devices for osmo-bts-trx, by
573adding the jenkins user to the 'usrp' group:
574
575----
576gpasswd -a jenkins usrp
577----
578
579To run osmo-bts-trx with a USRP attached, you may need to install a UHD driver.
580Please refer to http://osmocom.org/projects/osmotrx/wiki/OsmoTRX#UHD for
581details; the following is an example for the B200 family USRP devices:
582
583----
584apt-get install libuhd-dev uhd-host
585/usr/lib/uhd/utils/uhd_images_downloader.py
586----
Pau Espin Pedrol8ad5e6a2017-11-02 16:08:05 +0100587
Neels Hofmeyr74689532017-09-05 19:43:02 +0200588==== Log Rotation
589
590To avoid clogging up /var/log, it makes sense to choose a sane maximum log size:
591
592----
593echo maxsize 10M > /etc/logrotate.d/maxsize
594----
595
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200596==== Install Scripts
597
598IMPORTANT: When using the jenkins build slave as configured above, *there is no
599need to install the osmo-gsm-tester sources on the main unit*. The jenkins job
600will do so implicitly by checking out the latest osmo-gsm-tester sources in the
601workspace for every run. If you're using only the jenkins build slave, you may
602skip this section.
603
604If you prefer to use a fixed installation of the osmo-gsm-tester sources
605instead of the jenkins workspace, you can:
606
607. From the run job configured above, remove the line that says
608+
609----
610PATH="$PWD/osmo-gsm-tester/src:$PATH" \
611----
612+
613so that this uses a system wide installation instead.
614
615. Install the sources e.g. in '/usr/local/src' as indicated below.
616
617On the main unit, to install the latest in '/usr/local/src':
618
619----
620apt-get install git
621mkdir -p /usr/local/src
622cd /usr/local/src
623git clone git://git.osmocom.org/osmo-gsm-tester
624----
625
626To allow all users to run 'osmo-gsm-tester.py', from login as well as non-login
627shells, the easiest solution is to place a symlink in '/usr/local/bin':
628
629----
630ln -s /usr/local/src/osmo-gsm-tester/src/osmo-gsm-tester.py /usr/local/bin/
631----
632
633(See also the tip in <<install_capture_packets>> for a more detailed
634explanation.)
635
636The example configuration provided in the source is suitable for running as-is,
637*if* your hardware setup matches (you could technically use that directly by a
638symlink e.g. from '/usr/local/etc/osmo-gsm-tester' to the 'example' dir). If in
639doubt, rather copy the example, point 'paths.conf' at the 'suites' dir, and
640adjust your own configuration as needed. For example:
641
642----
643cd /etc
644cp -R /usr/local/src/osmo-gsm-tester/example osmo-gsm-tester
Pau Espin Pedrol69488f62020-04-07 16:40:41 +0200645sed -i 's#\./suites#/usr/local/src/osmo-gsm-tester/suites#' osmo-gsm-tester/paths.conf
Neels Hofmeyrb52df172017-05-14 20:09:35 +0200646----
647
648NOTE: The configuration will be looked up in various places, see
649<<config_paths>>.