Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 1 | == Installation on Main Unit |
| 2 | |
| 3 | The main unit is a general purpose computer that orchestrates the tests. It |
| 4 | runs the core network components, controls the modems and so on. This can be |
| 5 | anything from a dedicated production rack unit to your laptop at home. |
| 6 | |
| 7 | This manual will assume that tests are run from a jenkins build slave, by a |
| 8 | user named 'jenkins'. The user configuration for manual test runs and/or a |
| 9 | different user name is identical, simply replace the user name. |
| 10 | |
| 11 | === Dependencies |
| 12 | |
| 13 | On a Debian/Ubuntu based system, these commands install the packages needed to |
| 14 | run the osmo-gsm-tester.py code, i.e. install these on your main unit: |
| 15 | |
| 16 | ---- |
| 17 | apt-get install \ |
| 18 | dbus \ |
| 19 | tcpdump \ |
Neels Hofmeyr | 9711069 | 2017-06-03 15:20:28 +0200 | [diff] [blame] | 20 | sqlite3 \ |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 21 | python3 \ |
| 22 | python3-yaml \ |
| 23 | python3-mako \ |
| 24 | python3-gi \ |
| 25 | ofono \ |
| 26 | python3-pip |
| 27 | pip3 install pydbus |
Pau Espin Pedrol | 8d72cd6 | 2017-06-14 16:02:34 +0200 | [diff] [blame] | 28 | pip3 install git+git://github.com/podshumok/python-smpplib.git |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 29 | ---- |
| 30 | |
| 31 | IMPORTANT: ofono may need to be installed from source to contain the most |
Neels Hofmeyr | 7b8dbd8 | 2017-05-15 15:28:34 +0200 | [diff] [blame] | 32 | recent fixes needed to operate your modems. This depends on the modem hardware |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 33 | used and the tests run. Please see <<hardware_modems>>. |
| 34 | |
| 35 | To run osmo-bts-trx with a USRP attached, you may need to install a UHD driver. |
| 36 | Please refer to http://osmocom.org/projects/osmotrx/wiki/OsmoTRX#UHD for |
| 37 | details; the following is an example for the B200 family USRP devices: |
| 38 | |
| 39 | ---- |
| 40 | apt-get install libuhd-dev uhd-host |
| 41 | /usr/lib/uhd/utils/uhd_images_downloader.py |
| 42 | ---- |
| 43 | |
| 44 | [[jenkins_deps]] |
| 45 | ==== Jenkins Build Dependencies |
| 46 | |
| 47 | Each of the jenkins builds requires individual dependencies. This is generally |
| 48 | the same as for building the software outside of osmo-gsm-tester and will not |
| 49 | be detailed here. For the Osmocom projects, refer to |
| 50 | http://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_Source . Be |
| 51 | aware of specific requirements for BTS hardware: for example, the |
| 52 | osmo-bts-sysmo build needs the sysmoBTS SDK installed on the build slave, which |
| 53 | should match the installed sysmoBTS firmware. |
| 54 | |
| 55 | |
| 56 | [[configure_build_slave]] |
| 57 | === Jenkins Build Slave |
| 58 | |
| 59 | ==== Create 'jenkins' User on Main Unit |
| 60 | |
| 61 | On the main unit, create a jenkins user: |
| 62 | |
| 63 | ---- |
| 64 | useradd -m jenkins |
| 65 | ---- |
| 66 | |
Neels Hofmeyr | 3f596ed | 2017-07-14 00:04:40 +0200 | [diff] [blame] | 67 | ==== Install Java on Main Unit |
| 68 | |
| 69 | To be able to launch the Jenkins build slave, a Java RE must be available on |
| 70 | the main unit. For example: |
| 71 | |
| 72 | ---- |
| 73 | apt-get install default-jdk |
| 74 | ---- |
| 75 | |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 76 | ==== Allow SSH Access from Jenkins Master |
| 77 | |
| 78 | Create an SSH keypair to be used for login on the osmo-gsm-tester. This may be |
| 79 | entered on the jenkins web UI; alternatively, use the jenkins server's shell: |
| 80 | |
| 81 | Login on the main jenkins server shell and create an SSH keypair, for example: |
| 82 | |
| 83 | ---- |
| 84 | # su jenkins |
Neels Hofmeyr | 3f596ed | 2017-07-14 00:04:40 +0200 | [diff] [blame] | 85 | $ mkdir -p /usr/local/jenkins/keys |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 86 | $ ssh-keygen |
| 87 | Generating public/private rsa key pair. |
| 88 | Enter file in which to save the key (/home/jenkins/.ssh/id_rsa): /usr/local/jenkins/keys/osmo-gsm-tester-rnd |
| 89 | Enter passphrase (empty for no passphrase): <enter a passphrase> |
| 90 | Enter same passphrase again: <enter a passphrase> |
| 91 | Your identification has been saved in /usr/local/jenkins/keys/osmo-gsm-tester-rnd |
| 92 | Your public key has been saved in /usr/local/jenkins/keys/osmo-gsm-tester-rnd.pub. |
| 93 | The key fingerprint is: |
| 94 | ... |
| 95 | ---- |
| 96 | |
| 97 | Copy the public key to the main unit, e.g. copy-paste: |
| 98 | |
| 99 | ---- |
| 100 | cat /usr/local/jenkins/keys/osmo-gsm-tester-rnd.pub |
| 101 | # copy this public key |
| 102 | ---- |
| 103 | |
| 104 | On the main unit: |
| 105 | |
| 106 | ---- |
| 107 | mkdir ~jenkins/.ssh |
| 108 | cat > ~jenkins/.ssh/authorized_keys |
| 109 | # paste above public key and hit Ctrl-D |
| 110 | chown -R jenkins: ~jenkins/.ssh |
| 111 | ---- |
| 112 | |
| 113 | Make sure that the user running the jenkins master accepts the main unit's host |
| 114 | identification. There must be an actual RSA host key available in the |
| 115 | known_hosts file for the jenkins master to be able to log in. Simply calling |
| 116 | ssh and accepting the host key as usual is not enough. Jenkins may continue to |
| 117 | say "Host key verification failed". |
| 118 | |
| 119 | To place an RSA host key in the jenkins' known_hosts file, you may do: |
| 120 | |
| 121 | On the Jenkins master: |
| 122 | |
| 123 | ---- |
| 124 | main_unit_ip=10.9.8.7 |
| 125 | ssh-keyscan -H $main_unit_ip >> ~jenkins/.ssh/known_hosts |
| 126 | chown jenkins: ~jenkins/.ssh/known_hosts |
| 127 | ---- |
| 128 | |
| 129 | Verify that the jenkins user on the Jenkins master has SSH access to the main |
| 130 | unit: |
| 131 | |
| 132 | ---- |
| 133 | su jenkins |
| 134 | main_unit_ip=10.9.8.7 |
Neels Hofmeyr | 3f596ed | 2017-07-14 00:04:40 +0200 | [diff] [blame] | 135 | ssh -i /usr/local/jenkins/keys/osmo-gsm-tester-rnd jenkins@$main_unit_ip |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 136 | exit |
| 137 | ---- |
| 138 | |
| 139 | [[install_add_build_slave]] |
| 140 | ==== Add Build Slave |
| 141 | |
| 142 | In the jenkins web UI, add a new build slave for the osmo-gsm-tester: |
| 143 | |
| 144 | * 'Manage Jenkins' |
| 145 | ** 'Manage Nodes' |
| 146 | *** 'New Node' |
| 147 | **** Enter a node name, e.g. "osmo-gsm-tester-1" + |
| 148 | (the "-1" is just some identification in case you'd like to add another |
| 149 | setup later). |
| 150 | **** 'Permanent Agent' |
| 151 | |
| 152 | Configure the node as: |
| 153 | |
| 154 | * '# of executors': 1 |
| 155 | * 'Remote root directory': "/home/jenkins" |
| 156 | * 'Labels': "osmo-gsm-tester" + |
| 157 | (This is a general label common to all osmo-gsm-tester build slaves you may set up in the future.) |
| 158 | * 'Usage': 'Only build jobs with label expressions matching this node' |
| 159 | * 'Launch method': 'Launch slave agents via SSH' |
| 160 | ** 'Host': your main unit's IP address |
| 161 | ** 'Credentials': choose 'Add' / 'Jenkins' |
| 162 | *** 'Domain': 'Global credentials (unrestricted)' |
| 163 | *** 'Kind': 'SSH Username with private key' |
| 164 | *** 'Scope': 'Global' |
| 165 | *** 'Username': "jenkins" + |
| 166 | (as created on the main unit above) |
| 167 | *** 'Private Key': 'From a file on Jenkins master' |
| 168 | **** 'File': "/usr/local/jenkins/keys/osmo-gsm-tester-rnd" |
| 169 | *** 'Passphrase': enter same passphrase as above |
| 170 | *** 'ID': "osmo-gsm-tester-1" |
| 171 | *** 'Name': "jenkins for SSH to osmo-gsm-tester-1" |
| 172 | |
| 173 | The build slave should be able to start now. |
| 174 | |
| 175 | |
| 176 | ==== Add Build Jobs |
| 177 | |
| 178 | There are various jenkins-build-* scripts in osmo-gsm-tester/contrib/, which |
| 179 | can be called as jenkins build jobs to build and bundle binaries as artifacts, |
| 180 | to be run on the osmo-gsm-tester main unit and/or BTS hardware. |
| 181 | |
| 182 | Be aware of the dependencies, as hinted at in <<jenkins_deps>>. |
| 183 | |
| 184 | While the various binaries could technically be built on the osmo-gsm-tester |
| 185 | main unit, it is recommended to use a separate build slave, to take load off |
| 186 | of the main unit. |
| 187 | |
| 188 | On your jenkins master, set up build jobs to call these scripts -- typically |
| 189 | one build job per script. Look in contrib/ and create one build job for each of |
| 190 | the BTS types you would like to test, as well as one for the 'build-osmo-nitb'. |
| 191 | |
| 192 | These are generic steps to configure a jenkins build |
| 193 | job for each of these build scripts, by example of the |
| 194 | jenkins-build-osmo-nitb.sh script; all that differs to the other scripts is the |
| 195 | "osmo-nitb" part: |
| 196 | |
| 197 | * 'Project name': "osmo-gsm-tester_build-osmo-nitb" + |
| 198 | (Replace 'osmo-nitb' according to which build script this is for) |
| 199 | * 'Discard old builds' + |
| 200 | Configure this to taste, for example: |
| 201 | ** 'Max # of build to keep': "20" |
| 202 | * 'Restrict where this project can be run': Choose a build slave label that |
| 203 | matches the main unit's architecture and distribution, typically a Debian |
| 204 | system, e.g.: "linux_amd64_debian8" |
| 205 | * 'Source Code Management': |
| 206 | ** 'Git' |
| 207 | *** 'Repository URL': "git://git.osmocom.org/osmo-gsm-tester" |
| 208 | *** 'Branch Specifier': "*/master" |
| 209 | *** 'Additional Behaviors' |
| 210 | **** 'Check out to a sub-directory': "osmo-gsm-tester" |
| 211 | * 'Build Triggers' + |
| 212 | The decision on when to build is complex. Here are some examples: |
| 213 | ** Once per day: + |
| 214 | 'Build periodically': "H H * * *" |
| 215 | ** For the Osmocom project, the purpose is to verify our software changes. |
| 216 | Hence we would like to test every time our code has changed: |
| 217 | *** We could add various git repositories to watch, and enable 'Poll SCM'. |
| 218 | *** On jenkins.osmocom.org, we have various jobs that build the master branches |
| 219 | of their respective git repositories when a new change was merged. Here, we |
| 220 | can thus trigger e.g. an osmo-nitb build for osmo-gsm-tester everytime the |
| 221 | master build has run: + |
| 222 | 'Build after other projects are built': "OpenBSC" |
| 223 | *** Note that most of the Osmocom projects also need to be re-tested when their |
| 224 | dependencies like libosmo* have changed. Triggering on all those changes |
| 225 | typically causes more jenkins runs than necessary: for example, it rebuilds |
| 226 | once per each dependency that has rebuilt due to one libosmocore change. |
| 227 | There is so far no trivial way known to avoid this. It is indeed safest to |
| 228 | rebuild more often. |
| 229 | * 'Build' |
| 230 | ** 'Execute Shell' |
| 231 | + |
| 232 | ---- |
| 233 | #!/bin/sh |
| 234 | set -e -x |
| 235 | ./osmo-gsm-tester/contrib/jenkins-build-osmo-nitb.sh |
| 236 | ---- |
| 237 | + |
| 238 | (Replace 'osmo-nitb' according to which build script this is for) |
| 239 | |
| 240 | * 'Post-build Actions' |
| 241 | ** 'Archive the artifacts': "*.tgz, *.md5" + |
| 242 | (This step is important to be able to use the built binaries in the run job |
| 243 | below.) |
| 244 | |
| 245 | |
| 246 | TIP: When you've created one build job, it is convenient to create further |
| 247 | build jobs by copying the first and, e.g., simply replacing all "osmo-nitb" |
| 248 | with "osmo-bts-trx". |
| 249 | |
| 250 | ==== Add Run Job |
| 251 | |
| 252 | This is the build job that actually runs the tests on the GSM hardware: |
| 253 | |
| 254 | * It sources the artifacts from the build jobs. |
| 255 | * It runs on the osmo-gsm-tester main unit's build slave. |
| 256 | |
| 257 | Here is the configuration for the run job: |
| 258 | |
| 259 | * 'Project name': "osmo-gsm-tester_run" |
| 260 | * 'Discard old builds' + |
| 261 | Configure this to taste, for example: |
| 262 | ** 'Max # of build to keep': "20" |
| 263 | * 'Restrict where this project can be run': "osmo-gsm-tester" + |
| 264 | (to match the 'Label' configured in <<install_add_build_slave>>). |
| 265 | * 'Source Code Management': |
| 266 | ** 'Git' |
| 267 | *** 'Repository URL': "git://git.osmocom.org/osmo-gsm-tester" |
| 268 | *** 'Branch Specifier': "*/master" |
| 269 | *** 'Additional Behaviors' |
| 270 | **** 'Check out to a sub-directory': "osmo-gsm-tester" |
| 271 | **** 'Clean before checkout' |
| 272 | * 'Build Triggers' + |
| 273 | The decision on when to build is complex. For this run job, it is suggested |
| 274 | to rebuild: |
| 275 | ** after each of above build jobs that produced new artifacts: + |
| 276 | 'Build after other projects are built': "osmo-gsm-tester_build-osmo-nitb, |
| 277 | osmo-gsm-tester_build-osmo-bts-sysmo, osmo-gsm-tester_build-osmo-bts-trx" + |
| 278 | (Add each build job name you configured above) |
| 279 | ** as well as once per day: + |
| 280 | 'Build periodically': "H H * * *" |
| 281 | ** and, in addition, whenever the osmo-gsm-tester scripts have been modified: + |
| 282 | 'Poll SCM': "H/5 * * * *" + |
| 283 | (i.e. look every five minutes whether the upstream git has changed) |
| 284 | * 'Build' |
| 285 | ** Copy artifacts from each build job you have set up: |
| 286 | *** 'Copy artifacts from another project' |
| 287 | **** 'Project name': "osmo-gsm-tester_build-osmo-nitb" |
| 288 | **** 'Which build': 'Latest successful build' |
| 289 | **** enable 'Stable build only' |
| 290 | **** 'Artifacts to copy': "*.tgz, *.md5" |
| 291 | *** Add a separate similar 'Copy artifacts...' section for each build job you |
| 292 | have set up. |
| 293 | ** 'Execute Shell' |
| 294 | + |
| 295 | ---- |
| 296 | #!/bin/sh |
| 297 | set -e -x |
| 298 | |
| 299 | # debug: provoke a failure |
| 300 | #export OSMO_GSM_TESTER_OPTS="-s debug -t fail" |
| 301 | |
| 302 | PATH="$PWD/osmo-gsm-tester/src:$PATH" \ |
| 303 | ./osmo-gsm-tester/contrib/jenkins-run.sh |
| 304 | ---- |
| 305 | + |
| 306 | Details: |
| 307 | |
| 308 | *** The 'jenkins-run.sh' script assumes to find the 'osmo-gsm-tester.py' in the |
| 309 | '$PATH'. To use the most recent osmo-gsm-tester code here, we direct |
| 310 | '$PATH' to the actual workspace checkout. This could also run from a sytem |
| 311 | wide install, in which case you could omit the explicit PATH to |
| 312 | "$PWD/osmo-gsm-tester/src". |
| 313 | *** This assumes that there are configuration files for osmo-gsm-tester placed |
| 314 | on the system (see <<config_paths>>). |
| 315 | *** If you'd like to check the behavior of test failures, you can uncomment the |
| 316 | line below "# debug" to produce a build failure on every run. Note that |
| 317 | this test typically produces a quite empty run result, since it launches no |
| 318 | NITB nor BTS. |
| 319 | * 'Post-build Actions' |
| 320 | ** 'Archive the artifacts' |
Neels Hofmeyr | 8d8a136 | 2017-06-18 02:31:38 +0200 | [diff] [blame] | 321 | *** 'Files to archive': "*-run.tgz, *-bin.tgz" + |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 322 | This stores the complete test report with config files, logs, stdout/stderr |
Neels Hofmeyr | 8d8a136 | 2017-06-18 02:31:38 +0200 | [diff] [blame] | 323 | output, pcaps as well as the binaries used for the test run in artifacts. |
| 324 | This allows analysis of older builds, instead of only the most recent build |
| 325 | (which cleans up the jenkins workspace every time). The 'trial-N-run.tgz' |
| 326 | and 'trial-N-bin.tgz' archives are produced by the 'jenkins-run.sh' script, |
| 327 | both for successful and failing runs. |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 328 | |
| 329 | === Install osmo-gsm-tester on Main Unit |
| 330 | |
| 331 | This assumes you have already created the jenkins user (see <<configure_build_slave>>). |
| 332 | |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 333 | ==== User Permissions |
| 334 | |
| 335 | On the main unit, create a group for all users that should be allowed to use |
| 336 | the osmo-gsm-tester, and add users (here 'jenkins') to this group. |
| 337 | |
| 338 | ---- |
| 339 | groupadd osmo-gsm-tester |
| 340 | gpasswd -a jenkins osmo-gsm-tester |
| 341 | ---- |
| 342 | |
| 343 | NOTE: you may also need to add users to the 'usrp' group, see |
| 344 | <<user_config_uhd>>. |
| 345 | |
| 346 | A user added to a group needs to re-login for the group permissions to take |
| 347 | effect. |
| 348 | |
| 349 | This group needs the following permissions: |
| 350 | |
| 351 | ===== Paths |
| 352 | |
| 353 | Assuming that you are using the example config, prepare a system wide state |
| 354 | location in '/var/tmp': |
| 355 | |
| 356 | ---- |
| 357 | mkdir -p /var/tmp/osmo-gsm-tester/state |
| 358 | chown -R :osmo-gsm-tester /var/tmp/osmo-gsm-tester |
| 359 | chmod -R g+rwxs /var/tmp/osmo-gsm-tester |
| 360 | setfacl -d -m group:osmo-gsm-tester:rwx /var/tmp/osmo-gsm-tester/state |
| 361 | ---- |
| 362 | |
| 363 | IMPORTANT: the state directory needs to be shared between all users potentially |
| 364 | running the osmo-gsm-tester to resolve resource allocations. Above 'setfacl' |
| 365 | command sets the access control to keep all created files group writable. |
| 366 | |
| 367 | With the jenkins build as described here, the trials will live in the build |
| 368 | slave's workspace. Other modes of operation (a daemon scheduling concurrent |
| 369 | runs, *TODO*) may use a system wide directory to manage trials to run: |
| 370 | |
| 371 | ---- |
| 372 | mkdir -p /var/tmp/osmo-gsm-tester/trials |
| 373 | chown -R :osmo-gsm-tester /var/tmp/osmo-gsm-tester |
| 374 | chmod -R g+rwxs /var/tmp/osmo-gsm-tester |
| 375 | ---- |
| 376 | |
| 377 | ===== Allow DBus Access to ofono |
| 378 | |
| 379 | Put a DBus configuration file in place that allows the 'osmo-gsm-tester' group |
| 380 | to access the org.ofono DBus path: |
| 381 | |
| 382 | ---- |
| 383 | cat > /etc/dbus-1/system.d/osmo-gsm-tester.conf <<END |
| 384 | <!-- Additional rules for the osmo-gsm-tester to access org.ofono from user |
| 385 | land --> |
| 386 | |
| 387 | <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" |
| 388 | "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> |
| 389 | <busconfig> |
| 390 | |
| 391 | <policy group="osmo-gsm-tester"> |
| 392 | <allow send_destination="org.ofono"/> |
| 393 | </policy> |
| 394 | |
| 395 | </busconfig> |
| 396 | END |
| 397 | ---- |
| 398 | |
| 399 | (No restart of dbus nor ofono necessary.) |
| 400 | |
| 401 | [[install_capture_packets]] |
| 402 | ===== Capture Packets |
| 403 | |
| 404 | In order to allow collecting pcap traces of the network communication for later |
| 405 | reference, allow the osmo-gsm-tester group to capture packets using the 'tcpdump' |
| 406 | program: |
| 407 | |
| 408 | ---- |
| 409 | chgrp osmo-gsm-tester /usr/sbin/tcpdump |
| 410 | chmod 750 /usr/sbin/tcpdump |
| 411 | setcap cap_net_raw,cap_net_admin=eip /usr/sbin/tcpdump |
| 412 | ---- |
| 413 | |
| 414 | Put 'tcpdump' in the '$PATH' -- assuming that 'tcpdump' is available for root: |
| 415 | |
| 416 | ---- |
| 417 | ln -s `which tcpdump` /usr/local/bin/tcpdump |
| 418 | ---- |
| 419 | |
| 420 | TIP: Why a symlink in '/usr/local/bin'? On Debian, 'tcpdump' lives in |
| 421 | '/usr/sbin', which is not part of the '$PATH' for non-root users. To avoid |
| 422 | hardcoding non-portable paths in the osmo-gsm-tester source, 'tcpdump' must be |
| 423 | available in the '$PATH'. There are various trivial ways to modify '$PATH' for |
| 424 | login shells, but the jenkins build slave typically runs in a *non-login* |
| 425 | shell; modifying non-login shell enviroments is not trivially possible without |
| 426 | also interfering with files installed from debian packages. Probably the |
| 427 | easiest way to allow all users and all shells to find the 'tcpdump' binary is |
| 428 | to actually place a symbolic link in a directory that is already part of the |
| 429 | non-login shell's '$PATH'. Above example places such in '/usr/local/bin'. |
| 430 | |
| 431 | Verify that a non-login shell can find 'tcpdump': |
| 432 | |
| 433 | ---- |
| 434 | su jenkins -c 'which tcpdump' |
| 435 | # should print: "/usr/local/bin/tcpdump" |
| 436 | ---- |
| 437 | |
| 438 | WARNING: When logged in via SSH on your main unit, running 'tcpdump' to capture |
| 439 | packets may result in a feedback loop: SSH activity to send tcpdump's output to |
| 440 | your terminal is in turn is picked up in the tcpdump trace, and so forth. When |
| 441 | testing 'tcpdump' access, make sure to have proper filter expressions in place. |
| 442 | |
| 443 | TODO: allow skipping pcaps by configuration if access to tcpdump is not wanted |
| 444 | |
Pau Espin Pedrol | 018e104 | 2017-08-28 11:58:25 +0200 | [diff] [blame^] | 445 | ==== Allow Core Files |
| 446 | |
| 447 | In case a binary run for the test crashes, a core file of the crash should be |
| 448 | written. This requires a limit rule. Create a file with the required rule: |
| 449 | |
| 450 | ---- |
| 451 | sudo -s |
| 452 | echo "@osmo-gsm-tester - core unlimited" > /etc/security/limits.d/osmo-gsm-tester_allow-core.conf |
| 453 | ---- |
| 454 | |
| 455 | Re-login the user to make these changes take effect. |
| 456 | |
| 457 | Set the *kernel.core_pattern* sysctl to *core* (usually the default). For each |
| 458 | binary run by osmo-gsm-tester, a core file will then appear in the same dir that |
| 459 | contains stdout and stderr for that process (because this dir is set as CWD). |
| 460 | |
| 461 | ---- |
| 462 | sysctl -w kernel.core_pattern=core |
| 463 | ---- |
| 464 | |
| 465 | ==== Allow Realtime Priority |
| 466 | |
| 467 | Certain binaries should be run with real-time priority, like 'osmo-bts-trx'. |
| 468 | Add this permission on the main unit: |
| 469 | |
| 470 | ---- |
| 471 | sudo -s |
| 472 | echo "@osmo-gsm-tester - rtprio 99" > /etc/security/limits.d/osmo-gsm-tester_allow-rtprio.conf |
| 473 | ---- |
| 474 | |
| 475 | Re-login the user to make these changes take effect. |
| 476 | |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 477 | [[user_config_uhd]] |
| 478 | ==== UHD |
| 479 | |
| 480 | Grant permission to use the UHD driver to run USRP devices for osmo-bts-trx, by |
| 481 | adding the jenkins user to the 'usrp' group: |
| 482 | |
| 483 | ---- |
| 484 | gpasswd -a jenkins usrp |
| 485 | ---- |
| 486 | |
| 487 | ==== Install Scripts |
| 488 | |
| 489 | IMPORTANT: When using the jenkins build slave as configured above, *there is no |
| 490 | need to install the osmo-gsm-tester sources on the main unit*. The jenkins job |
| 491 | will do so implicitly by checking out the latest osmo-gsm-tester sources in the |
| 492 | workspace for every run. If you're using only the jenkins build slave, you may |
| 493 | skip this section. |
| 494 | |
| 495 | If you prefer to use a fixed installation of the osmo-gsm-tester sources |
| 496 | instead of the jenkins workspace, you can: |
| 497 | |
| 498 | . From the run job configured above, remove the line that says |
| 499 | + |
| 500 | ---- |
| 501 | PATH="$PWD/osmo-gsm-tester/src:$PATH" \ |
| 502 | ---- |
| 503 | + |
| 504 | so that this uses a system wide installation instead. |
| 505 | |
| 506 | . Install the sources e.g. in '/usr/local/src' as indicated below. |
| 507 | |
| 508 | On the main unit, to install the latest in '/usr/local/src': |
| 509 | |
| 510 | ---- |
| 511 | apt-get install git |
| 512 | mkdir -p /usr/local/src |
| 513 | cd /usr/local/src |
| 514 | git clone git://git.osmocom.org/osmo-gsm-tester |
| 515 | ---- |
| 516 | |
| 517 | To allow all users to run 'osmo-gsm-tester.py', from login as well as non-login |
| 518 | shells, the easiest solution is to place a symlink in '/usr/local/bin': |
| 519 | |
| 520 | ---- |
| 521 | ln -s /usr/local/src/osmo-gsm-tester/src/osmo-gsm-tester.py /usr/local/bin/ |
| 522 | ---- |
| 523 | |
| 524 | (See also the tip in <<install_capture_packets>> for a more detailed |
| 525 | explanation.) |
| 526 | |
| 527 | The example configuration provided in the source is suitable for running as-is, |
| 528 | *if* your hardware setup matches (you could technically use that directly by a |
| 529 | symlink e.g. from '/usr/local/etc/osmo-gsm-tester' to the 'example' dir). If in |
| 530 | doubt, rather copy the example, point 'paths.conf' at the 'suites' dir, and |
| 531 | adjust your own configuration as needed. For example: |
| 532 | |
| 533 | ---- |
| 534 | cd /etc |
| 535 | cp -R /usr/local/src/osmo-gsm-tester/example osmo-gsm-tester |
| 536 | sed -i 's#\.\./suites#/usr/local/src/osmo-gsm-tester/suites#' osmo-gsm-tester/paths.conf |
| 537 | ---- |
| 538 | |
| 539 | NOTE: The configuration will be looked up in various places, see |
| 540 | <<config_paths>>. |
| 541 | |
| 542 | |
| 543 | == Hardware Choice and Configuration |
| 544 | |
| 545 | === SysmoBTS |
| 546 | |
| 547 | To use the SysmoBTS in the osmo-gsm-tester, the following systemd services must |
| 548 | be disabled: |
| 549 | |
| 550 | ---- |
Max | be69b6b | 2017-07-03 19:03:25 +0200 | [diff] [blame] | 551 | systemctl mask osmo-nitb osmo-bts-sysmo osmo-pcu sysmobts-mgr |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 552 | ---- |
| 553 | |
| 554 | This stops the stock setup keeping the BTS in operation and hence allows the |
| 555 | osmo-gsm-tester to install and launch its own versions of the SysmoBTS |
| 556 | software. |
| 557 | |
| 558 | ==== IP Address |
| 559 | |
| 560 | To ensure that the SysmoBTS is always reachable at a fixed known IP address, |
| 561 | configure the eth0 to use a static IP address: |
| 562 | |
| 563 | Adjust '/etc/network/interfaces' and replace the line |
| 564 | |
| 565 | ---- |
| 566 | iface eth0 inet dhcp |
| 567 | ---- |
| 568 | |
| 569 | with |
| 570 | |
| 571 | ---- |
| 572 | iface eth0 inet static |
| 573 | address 10.42.42.114 |
| 574 | netmask 255.255.255.0 |
| 575 | gateway 10.42.42.1 |
| 576 | ---- |
| 577 | |
| 578 | You may set the name server in '/etc/resolve.conf' (most likely to the IP of |
| 579 | the gateway), but this is not really needed by the osmo-gsm-tester. |
| 580 | |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 581 | ==== Allow Core Files |
| 582 | |
| 583 | In case a binary run for the test crashes, a core file of the crash should be |
Neels Hofmeyr | ee57f09 | 2017-06-03 15:20:50 +0200 | [diff] [blame] | 584 | written. This requires a limits rule. Append a line to /etc/limits like: |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 585 | |
| 586 | ---- |
Neels Hofmeyr | ee57f09 | 2017-06-03 15:20:50 +0200 | [diff] [blame] | 587 | ssh root@10.42.42.114 |
| 588 | echo "* C16384" >> /etc/limits |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 589 | ---- |
| 590 | |
Neels Hofmeyr | ee57f09 | 2017-06-03 15:20:50 +0200 | [diff] [blame] | 591 | ==== Reboot |
| 592 | |
| 593 | Reboot the BTS and make sure that the IP address for eth0 is now indeed |
| 594 | 10.42.42.114, and that no osmo* programs are running. |
| 595 | |
| 596 | ---- |
| 597 | ip a |
| 598 | ps w | grep osmo |
| 599 | ---- |
| 600 | |
| 601 | ==== SSH Access |
| 602 | |
| 603 | Make sure that the jenkins user on the main unit is able to login on the |
| 604 | sysmoBTS, possibly erasing outdated host keys after a new rootfs was loaded: |
| 605 | |
| 606 | On the main unit, for example do: |
| 607 | |
| 608 | ---- |
| 609 | su - jenkins |
| 610 | ssh root@10.42.42.114 |
| 611 | ---- |
| 612 | |
| 613 | Fix any problems until you get a login on the sysmoBTS. |
| 614 | |
Neels Hofmeyr | b52df17 | 2017-05-14 20:09:35 +0200 | [diff] [blame] | 615 | |
| 616 | [[hardware_modems]] |
| 617 | === Modems |
| 618 | |
| 619 | TODO: describe modem choices and how to run ofono |
| 620 | |
| 621 | [[hardware_trx]] |
| 622 | === osmo-bts-trx |
| 623 | |
| 624 | TODO: describe B200 family |