blob: 14daba48b7ada2b1a4a9736c1216630eddddec61 [file] [log] [blame]
Neels Hofmeyrc0827c42017-04-23 15:04:19 +02001== Introduction with Examples
2
3The osmo-gsm-tester is software to run automated tests of real GSM hardware,
4foremost to verify that ongoing Osmocom software development continues to work
5with various BTS models, while being flexibly configurable and extendable.
6
7A 'main unit' (general purpose computer) is connected via ethernet and/or USB to
8any number of BTS models and to any number of GSM modems via USB. The modems
9and BTS instances' RF transceivers are typically wired directly to each other
10via RF distribution chambers to bypass the air medium and avoid disturbing real
11production cellular networks. Furthermore, the setup may include adjustable RF
12attenuators to model various distances between modems and base stations.
13
14The osmo-gsm-tester software runs on the main unit to orchestrate the various
15GSM hardware and run predefined test scripts. It typically receives binary
16packages from a jenkins build service. It then automatically configures and
17launches an Osmocom core network on the main unit and sets up and runs BTS
18models as well as modems to form a complete ad-hoc GSM network. On this setup,
19predefined test suites, combined with various scenario definitions, are run to
20verify stability of the system.
21
22The osmo-gsm-tester is implemented in Python (version 3). It uses the ofono
23daemon to control the modems connected via USB. BTS software is either run
24directly on the main unit (e.g. for osmo-bts-trx, osmo-bts-octphy), run via SSH
25(e.g. for a sysmoBTS) or assumed to run on a connected BTS model (e.g. for
26ip.access nanoBTS).
27
28.Typical osmo-gsm-tester setup
29[graphviz]
30----
31digraph G {
32 rankdir=LR;
33 jenkins
34 subgraph cluster_gsm_hardware {
35 label = "GSM Hardware";
36 style=dotted
37
Neels Hofmeyr73207e12017-05-05 02:50:45 +020038 modem0 [shape=box label="Modems..."]
39 modem1 [shape=box label="Modems..."]
Neels Hofmeyrc0827c42017-04-23 15:04:19 +020040 osmo_bts_sysmo [label="sysmocom sysmoBTS\nrunning osmo-bts-sysmo" shape=box]
41 B200 [label="Ettus B200" shape=box]
Pau Espin Pedrol48d25642017-11-02 14:03:58 +010042 sysmoCell5K [label="sysmocom sysmoCell5000" shape=box]
Neels Hofmeyrc0827c42017-04-23 15:04:19 +020043 octphy [label="Octasic octphy BTS" shape=box]
44 nanoBTS [label="ip.access nanoBTS" shape=box]
45 rf_distribution [label="RF distribution"]
46
Pau Espin Pedrol48d25642017-11-02 14:03:58 +010047 {modem0 modem1 osmo_bts_sysmo B200 octphy nanoBTS sysmoCell5K}->rf_distribution [dir=both arrowhead="curve" arrowtail="curve"]
Neels Hofmeyrc0827c42017-04-23 15:04:19 +020048 }
49 subgraph cluster_main_unit {
50 label = "Main Unit"
51 osmo_gsm_tester [label="Osmo-GSM-Tester\ntest suites\n& scenarios"]
Neels Hofmeyr73207e12017-05-05 02:50:45 +020052 subgraph {
53 rank=same
54 ofono [label="ofono daemon"]
Pau Espin Pedrol48d25642017-11-02 14:03:58 +010055 osmo_trx [label="osmo-trx"]
56 osmo_bts_trx [label="osmo-bts-trx"]
Neels Hofmeyr73207e12017-05-05 02:50:45 +020057 osmo_bts_octphy [label="osmo-bts-octphy"]
Pau Espin Pedrol48d25642017-11-02 14:03:58 +010058 OsmoNITB [label="BSC + Core Network\n(Osmo{NITB,MSC,BSC,HLR,...})"]
Neels Hofmeyr73207e12017-05-05 02:50:45 +020059 }
Neels Hofmeyrc0827c42017-04-23 15:04:19 +020060 }
61
62
63 jenkins->osmo_gsm_tester [label="trial\n(binaries)"]
64 osmo_gsm_tester->jenkins [label="results"]
Pau Espin Pedrol48d25642017-11-02 14:03:58 +010065 ofono->{modem0 modem1} [label="USB"]
66 osmo_gsm_tester->{OsmoNITB osmo_bts_trx osmo_bts_octphy}
67 osmo_gsm_tester->osmo_bts_sysmo [taillabel="SSH"]
68 osmo_gsm_tester->ofono [taillabel="DBus"]
69 osmo_trx->B200 [label="USB"]
70 osmo_bts_trx->{osmo_trx sysmoCell5K} [dir=both label="UDP"]
Neels Hofmeyrc0827c42017-04-23 15:04:19 +020071 osmo_bts_octphy->octphy [label="raw eth"]
Pau Espin Pedrol48d25642017-11-02 14:03:58 +010072 {osmo_bts_sysmo nanoBTS}->OsmoNITB [label="IP"]
Neels Hofmeyr73207e12017-05-05 02:50:45 +020073 {B200 octphy}->OsmoNITB [label="eth" style=invis]
74 {osmo_bts_trx osmo_bts_octphy}->OsmoNITB
75}
76----
77
78.Example of how to select resources and configurations: scenarios may pick specific resources (here BTS and ARFCN), remaining requirements are picked as available (here two modems and a NITB interface)
79[graphviz]
80----
81digraph G {
82 rankdir=TB;
83
84 suite_scenarios [label="Suite+Scenarios selection\nsms:sysmo+band1800"]
85
86 subgraph {
87 rank=same;
88 suite
89 scenarios
90 }
91
92 subgraph cluster_scenarios {
93 label = "Scenarios";
94 u_sysmoBTS [label="Scenario: sysmo\nbts: type: osmo-bts-sysmo"]
95 u_trx [label="Scenario: trx\nbts: type: osmo-bts-trx"]
96 u_arfcn [label="Scenario: band1800\narfcn: band: GSM-1800"]
97 }
98
99 subgraph cluster_suite {
100 label = "Suite: sms";
Neels Hofmeyr5d0330f2017-05-18 18:38:50 +0200101 requires [label="Requirements (suite.conf):\nmodem: times: 2\nbts\nip_address\narfcn"]
Neels Hofmeyr73207e12017-05-05 02:50:45 +0200102 subgraph cluster_tests {
103 label = "Test Scripts (py)";
104 mo_mt_sms
105 etc
106 }
107 }
108
109 subgraph cluster_resources {
110 label = "Resources";
111 rankdir=TB;
112 nitb_addr1 [label="NITB interface addr\n10.42.42.1"]
113 nitb_addr2 [label="NITB interface addr\n10.42.42.2"]
114 Modem0
115 Modem1
116 Modem2
117 sysmoBTS [label="osmo-bts-sysmo"]
118 osmo_bts_trx [label="osmo-bts-trx"]
119 arfcn1 [label="arfcn: 512\nband: GSM-1800"]
120 arfcn2 [label="arfcn: 540\nband: GSM-1900"]
121
122 arfcn1->arfcn2 [style=invis]
123 nitb_addr1->nitb_addr2 [style=invis]
124 Modem0 -> Modem1 -> Modem2 [style=invis]
125 sysmoBTS -> osmo_bts_trx [style=invis]
126 }
127
128 suite_scenarios -> {suite scenarios}
129 scenarios -> { u_arfcn u_sysmoBTS }
130
131 suite -> requires
132 requires -> Modem0
133 requires -> Modem1
134 requires -> sysmoBTS
135 requires -> arfcn1
136 requires -> nitb_addr1
137
138 { u_sysmoBTS u_arfcn } -> requires [label="influences\nresource\nselection"]
139}
140----
141
142.Example of a "trial" containing binaries built by a jenkins
143[graphviz]
144----
145digraph G {
146 subgraph cluster_trial {
147 label = "Trial (binaries)"
148 sysmo [label="osmo-bts-sysmo.build-23.tgz\n(osmo-bts-sysmo\n+ deps\ncompiled for sysmoBTS)"]
Pau Espin Pedrolcb474072017-11-02 14:13:54 +0100149 trx [label="osmo-bts.build-5.tgz\n(osmo-bts-octphy + osmo-bts-trx\n+ deps\ncompiled for main unit)"]
Neels Hofmeyr73207e12017-05-05 02:50:45 +0200150 nitb [label="osmo-nitb.build-42.tgz\n(osmo-nitb\n+ deps\ncompiled for main unit)"]
151 checksums [label="checksums.md5"]
152
153 checksums -> {sysmo trx nitb}
154 }
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200155}
156----
157
158=== Typical Test Script
159
160A typical single test script (part of a suite) may look like this:
161
162----
163#!/usr/bin/env python3
Pau Espin Pedrol4c476592017-11-17 17:16:54 +0100164from osmo_gsm_tester.testenv import *
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200165
Pau Espin Pedrolc8cd1fa2017-11-02 14:15:46 +0100166hlr = suite.hlr()
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200167bts = suite.bts()
Pau Espin Pedrolc8cd1fa2017-11-02 14:15:46 +0100168mgcpgw = suite.mgcpgw(bts_ip=bts.remote_addr())
169msc = suite.msc(hlr, mgcpgw)
170bsc = suite.bsc(msc)
171stp = suite.stp()
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200172ms_mo = suite.modem()
173ms_mt = suite.modem()
174
Pau Espin Pedrolc8cd1fa2017-11-02 14:15:46 +0100175hlr.start()
176stp.start()
177msc.start()
178mgcpgw.start()
179
180bsc.bts_add(bts)
181bsc.start()
182
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200183bts.start()
184
Pau Espin Pedrolc8cd1fa2017-11-02 14:15:46 +0100185hlr.subscriber_add(ms_mo)
186hlr.subscriber_add(ms_mt)
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200187
Pau Espin Pedrolc8cd1fa2017-11-02 14:15:46 +0100188ms_mo.connect(msc.mcc_mnc())
189ms_mt.connect(msc.mcc_mnc())
190
191ms_mo.log_info()
192ms_mt.log_info()
Pau Espin Pedrol422f8ba2017-06-14 15:57:12 +0200193
194print('waiting for modems to attach...')
Pau Espin Pedrolc8cd1fa2017-11-02 14:15:46 +0100195wait(ms_mo.is_connected, msc.mcc_mnc())
196wait(ms_mt.is_connected, msc.mcc_mnc())
197wait(msc.subscriber_attached, ms_mo, ms_mt)
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200198
Pau Espin Pedrol422f8ba2017-06-14 15:57:12 +0200199sms = ms_mo.sms_send(ms_mt)
200wait(ms_mt.sms_was_received, sms)
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200201----
202
203=== Resource Resolution
204
Pau Espin Pedroldc53c9c2017-11-02 14:19:32 +0100205- A global configuration 'resources.conf' defines which hardware is connected to the
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200206 osmo-gsm-tester main unit.
207- Each suite contains a number of test scripts. The amount of resources a test
208 may use is defined by the test suite's 'suite.conf'.
209- Which specific modems, BTS models, NITB IP addresses etc. are made available
Pau Espin Pedroldc53c9c2017-11-02 14:19:32 +0100210 to a test run is typically determined by 'suite.conf' and a combination of scenario
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200211 configurations -- or picked automatically if not.
212
213[[resources_conf_example]]
214=== Typical 'resources.conf'
215
216A global configuration of hardware may look like below; for details, see
217<<resources_conf>>.
218
219----
Neels Hofmeyr5d0330f2017-05-18 18:38:50 +0200220ip_address:
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200221- addr: 10.42.42.2
222- addr: 10.42.42.3
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100223- addr: 10.42.42.4
224- addr: 10.42.42.5
225- addr: 10.42.42.6
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200226
227bts:
228- label: sysmoBTS 1002
229 type: osmo-bts-sysmo
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100230 ipa_unit_id: 1
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200231 addr: 10.42.42.114
232 band: GSM-1800
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100233 ciphers:
234 - a5_0
235 - a5_1
236 - a5_3
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200237
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100238- label: Ettus B200
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200239 type: osmo-bts-trx
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100240 ipa_unit_id: 6
241 addr: 10.42.42.50
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200242 band: GSM-1800
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100243 launch_trx: true
244 ciphers:
245 - a5_0
246 - a5_1
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200247
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100248- label: sysmoCell 5000
249 type: osmo-bts-trx
250 ipa_unit_id: 7
251 addr: 10.42.42.51
252 band: GSM-1800
253 trx_remote_ip: 10.42.42.112
254 ciphers:
255 - a5_0
256 - a5_1
257
258- label: OCTBTS 3500
259 type: osmo-bts-octphy
260 ipa_unit_id: 8
261 addr: 10.42.42.52
262 band: GSM-1800
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200263 trx_list:
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100264 - hw_addr: 00:0c:90:2e:80:1e
265 net_device: eth1
266 - hw_addr: 00:0c:90:2e:87:52
267 net_device: eth1
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200268
269arfcn:
270 - arfcn: 512
271 band: GSM-1800
272 - arfcn: 514
273 band: GSM-1800
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100274 - arfcn: 516
275 band: GSM-1800
276 - arfcn: 546
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200277 band: GSM-1900
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100278 - arfcn: 548
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200279 band: GSM-1900
280
281modem:
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100282- label: sierra_1
283 path: '/sierra_1'
284 imsi: '901700000009031'
285 ki: '80A37E6FDEA931EAC92FFA5F671EFEAD'
286 auth_algo: 'xor'
287 ciphers:
288 - a5_0
289 - a5_1
290 features:
291 - 'sms'
292 - 'voice'
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200293
Pau Espin Pedrolc9cbbc62017-11-02 14:23:35 +0100294- label: gobi_0
295 path: '/gobi_0'
296 imsi: '901700000009030'
297 ki: 'BB70807226393CDBAC8DD3439FF54252'
298 auth_algo: 'xor'
299 ciphers:
300 - a5_0
301 - a5_1
302 features:
303 - 'sms'
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200304----
305
306=== Typical 'suites/*/suite.conf'
307
308The configuration that reserves a number of resources for a test suite may look
309like this:
310
311----
312resources:
Neels Hofmeyr5d0330f2017-05-18 18:38:50 +0200313 ip_address:
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200314 - times: 1
315 bts:
316 - times: 1
317 modem:
318 - times: 2
Pau Espin Pedrol3ed03912017-11-02 14:25:39 +0100319 features:
320 - sms
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200321----
322
323It may also request e.g. specific BTS models, but this is typically left to
324scenario configurations.
325
326=== Typical 'scenarios/*.conf'
327
328For a suite as above run as-is, any available resources are picked. This may be
329combined with any number of scenario definitions to constrain which specific
330resources should be used, e.g.:
331
332----
333resources:
334 bts:
335 - type: osmo-bts-sysmo
336----
337
Neels Hofmeyr5d0330f2017-05-18 18:38:50 +0200338Which 'ip_address' or 'modem' is used in particular doesn't really matter, so
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200339it can be left up to the osmo-gsm-tester to pick these automatically.
340
341Any number of such scenario configurations can be combined in the form
342'<suite_name>:<scenario>+<scenario>+...', e.g. 'my_suite:sysmo+tch_f+amr'.
343
344=== Typical Invocations
345
346Each invocation of osmo-gsm-tester deploys a set of pre-compiled binaries for
347the Osmocom core network as well as for the Osmocom based BTS models. To create
348such a set of binaries, see <<trials>>.
349
350Examples for launching test trials:
351
352- Run the default suites (see <<default_suites>>) on a given set of binaries:
353
354----
355osmo-gsm-tester.py path/to/my-trial
356----
357
358- Run an explicit choice of 'suite:scenario' combinations:
359
360----
361osmo-gsm-tester.py path/to/my-trial -s sms:sysmo -s sms:trx -s sms:nanobts
362----
363
364- Run one 'suite:scenario' combination, setting log level to 'debug' and
365 enabling logging of full python tracebacks, and also only run just the
366 'mo_mt_sms.py' test from the suite, e.g. to investigate a test failure:
367
368----
369osmo-gsm-tester.py path/to/my-trial -s sms:sysmo -l dbg -T -t mo_mt
370----
371
372A test script may also be run step-by-step in a python debugger, see
373<<debugging>>.
374
375=== Resource Reservation for Concurrent Trials
376
377While a test suite runs, the used resources are noted in a global state
378directory in a reserved-resources file. This way, any number of trials may be
379run consecutively without resource conflicts. Any test trial will only use
380resources that are currently not reserved by any other test suite. The
381reservation state is human readable.
382
383The global state directory is protected by a file lock to allow access by
384separate processes.
385
386Also, the binaries from a trial are never installed system-wide, but are run
387with a specific 'LD_LIBRARY_PATH' pointing at the trial's 'inst', so that
Pau Espin Pedrol627aea52017-11-02 15:03:58 +0100388several trials can run consecutively without conflicting binary versions. For
389some specific binaries which require extra permissions (such as osmo-bts-octphy
390requiring 'CAP_NET_RAW'), 'patchelf' program is used to modify the binary
391'RPATH' field instead because the OS dynamic linker skips 'LD_LIBRARY_PATH' for
392binaries with special permissions.
Neels Hofmeyrc0827c42017-04-23 15:04:19 +0200393
394Once a test suite run is complete, all its reserved resources are torn down (if
395the test scripts have not done so already), and the reservations are released
396automatically.
397
398If required resources are unavailable, the test trial fails. For consecutive
399test trials, a test run needs to either wait for resources to become available,
400or test suites need to be scheduled to make sense. (*<- TODO*)