Project

General

Profile

FakeTRX » History » Version 5

fixeria, 03/12/2018 07:01 PM

1 1 fixeria
h1. FakeTRX (Virtual Um-interface)
2 1 fixeria
3 1 fixeria
FakeTRX is a virtual Um-interface implementation written in Python, which allows you to connect [[OsmocomBB:]] and [[OsmoBTS:]] without actual RF hardware. The main purpose of this software is to facilitate and simplify the development and testing process. In other words, you don't need to physically run your GSM network and use Calypso based hardware - just run a few scripts and do anything you want / need in your virtual GSM network!
4 1 fixeria
5 1 fixeria
h2. FAQ
6 1 fixeria
7 3 fixeria
h3. What is the difference from [[cellular-infrastructure:Virtual_Um|VIRT-PHY]]?
8 1 fixeria
9 3 fixeria
The main difference is that FakeTRX actually works on GSM L1, while [[cellular-infrastructure:Virtual_Um|VIRT-PHY]] works on higher levels, using GSMTAP and multicast sockets to exchange the data. It means that FakeTRX provides the [[TRX Interface]] for both [[OsmocomBB:]] and [[OsmoBTS:]], and forwards GSM bursts between both sides. So, no need to do any modifications in the [[OsmoBTS:]] source code, just use osmo-bts-trx.
10 1 fixeria
11 1 fixeria
h3. Python?
12 1 fixeria
13 1 fixeria
Of course, Python is slower than C, for example. But it's more than enough for exchanging UDP messages between [[OsmocomBB:]] and [[OsmoBTS:]], and vice versa. Moreover, it can be easily reimplemented in C, if someone interested in better performance.
14 1 fixeria
15 5 fixeria
h3. What about RSSI and ToA (Timing of Arrival)?
16 1 fixeria
17 5 fixeria
Since we are talking about the virtual interface, it's possible to emulate any values for both RSSI and ToA.
18 1 fixeria
19 1 fixeria
h3. Can I run multiple BTS and / or multiple MS instances?
20 1 fixeria
21 1 fixeria
Not yet.
22 1 fixeria
23 1 fixeria
h2. Running
24 1 fixeria
25 1 fixeria
This guide assumes that you already have the Osmocom GSM [[cellular-infrastructure:|network side stack]] compiled and installed. If not, the simplest way is to use the [[osmonitb:|Network in the Box]].
26 1 fixeria
27 1 fixeria
Since [[OsmocomBB:]] was extended with [[TRX Interface]] support, follow the corresponding instructions and compile OsmocomBB with [[TRX Interface#The-trxcon-application|trxcon]] application. After that, you may find the FakeTRX toolkit located in 'src/target/fake_trx/'. See README for more details.
28 1 fixeria
29 1 fixeria
_Tip: feel free to use tmux or screen to avoid a mess with multiple windows_
30 1 fixeria
31 1 fixeria
1. Run the network side stack you have. In this example we will use the [[osmonitb:|Network in the Box]]:
32 1 fixeria
33 1 fixeria
<pre>
34 1 fixeria
$ osmo-nitb -c ./openbsc.cfg -l ./hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM
35 1 fixeria
</pre>
36 1 fixeria
37 1 fixeria
2. Run the fake transceiver:
38 1 fixeria
39 1 fixeria
<pre>
40 1 fixeria
$ cd osmocom-bb/src/target/fake_trx/
41 1 fixeria
$ python ./fake_trx.py
42 1 fixeria
</pre>
43 1 fixeria
44 1 fixeria
3. Start [[OsmoBTS:]]:
45 1 fixeria
46 1 fixeria
<pre>
47 1 fixeria
$ osmo-bts-trx -c ./osmo-bts.cfg
48 1 fixeria
</pre>
49 1 fixeria
50 1 fixeria
Congratulations! Now you have a virtual GSM network running. As you can see, the virtual transceiver emulates the clock source, as this is required for [[OsmoBTS:]]. Also, it handles only a few important commands, such as RXTUNE and TXTUNE, but ignores other irrelevant ones.
51 1 fixeria
52 1 fixeria
4. In order to make [[OsmocomBB:]] applications able to work with FakeTRX, you need to run [[TRX Interface#The-trxcon-application|trxcon]]:
53 1 fixeria
54 1 fixeria
<pre>
55 1 fixeria
$ cd osmocom-bb/src/host/trxcon/
56 4 fixeria
$ ./trxcon
57 1 fixeria
</pre>
58 1 fixeria
59 1 fixeria
5. Finally, run any L2&3 application, e.g. ccch_scan:
60 1 fixeria
61 1 fixeria
<pre>
62 1 fixeria
$ cd osmocom-bb/src/host/layer23/src/misc/
63 1 fixeria
$ ./ccch_scan -a ARFCN -i 127.0.0.1
64 1 fixeria
</pre>
65 1 fixeria
66 1 fixeria
Please note that ARFCN value should match the one your BTS configured to.
67 1 fixeria
68 1 fixeria
Since this step, you should see the broadcast messages coming from the virtual network, like in case of a real one. You can use Wireshark to analyze them.
69 1 fixeria
70 1 fixeria
h2. Running [[mobile]] application
71 1 fixeria
72 1 fixeria
As you should already know, [[mobile]] applications implements a simple mobile phone with SMS, USSD and voice calls. In the virtual network we can benefit from using a virtual SIM card. Just configure one according to your network configuration, for example:
73 1 fixeria
74 1 fixeria
<pre>
75 1 fixeria
test-sim
76 1 fixeria
  imsi 901700000000000
77 1 fixeria
  no barred-access
78 1 fixeria
  rplmn 901 70
79 1 fixeria
</pre>
80 1 fixeria
81 1 fixeria
Make sure you have the virtual network running, then run mobile the same way as in case of a Calypso based phone:
82 1 fixeria
83 1 fixeria
<pre>
84 1 fixeria
$ cd osmocom-bb/src/host/layer23/src/mobile/
85 1 fixeria
$ ./mobile -i 127.0.0.1
86 1 fixeria
</pre>
87 1 fixeria
88 1 fixeria
Now you can use mobile's telnet interface to manage your virtual phone:
89 1 fixeria
90 1 fixeria
<pre>
91 1 fixeria
$ telnet localhost 4247
92 1 fixeria
$ ...
93 1 fixeria
</pre>
94 1 fixeria
95 1 fixeria
h2. Demo
96 1 fixeria
97 1 fixeria
https://www.youtube.com/watch?v=Uxdaui8EkjY
98 1 fixeria
99 1 fixeria
h2. Project status
100 1 fixeria
101 1 fixeria
Further plans:
102 1 fixeria
103 1 fixeria
* Allow multiple BTS to work with multiple BB instances
104 1 fixeria
* Distinguish debug messages (BTS / MS, ID)
105 1 fixeria
* Randomize RSSI for forwarded bursts
106 2 fixeria
* Burst capture to file
107 2 fixeria
* Burst injection
Add picture from clipboard (Maximum size: 48.8 MB)