Project

General

Profile

FakeTRX » History » Version 43

laforge, 07/25/2022 07:46 AM
gitea

1 1 fixeria
h1. FakeTRX (Virtual Um-interface)
2
3 37 fixeria
FakeTRX is a virtual Um-interface implementation written in Python, that allows to connect both [[OsmocomBB:]] and [[OsmoBTS:]] without the actual RF hardware. The main purpose of this software is to facilitate and simplify development and testing process. In other words, you don't need to physically run your GSM network nor use any kind of special hardware - just run a few scripts and do anything you want / need in your virtual GSM network!
4
5
h2. Source code
6
7 43 laforge
FakeTRX is a part of [[OsmocomBB:]]. The source code is available at gitea.osmocom.org.
8 37 fixeria
9 43 laforge
You can browse it via gitea: https://gitea.osmocom.org/phone-side/osmocom-bb/src/branch/master/src/target/trx_toolkit, and download using git:
10 37 fixeria
11
<pre>
12 43 laforge
$ git clone https://gitea.osmocom.org/phone-side/osmocom-bb
13 37 fixeria
14
Contributions are welcome via [[cellular-infrastructure:Gerrit]].
15 1 fixeria
16
h2. FAQ
17
18 3 fixeria
h3. What is the difference from [[cellular-infrastructure:Virtual_Um|VIRT-PHY]]?
19 1 fixeria
20 36 fixeria
The main difference is that FakeTRX basically works on GSM L1 and deals with bursts, while [[cellular-infrastructure:Virtual_Um|VIRT-PHY]] works on GSM L2, using GSMTAP and multicast sockets to exchange MAC-blocks. FakeTRX provides the [[TRX Interface]] for both [[OsmocomBB:]] and [[OsmoBTS:]], and forwards GSM bursts between both sides. So, there is no need to do any modifications in the [[OsmoBTS:]] source code, just use osmo-bts-trx.
21 1 fixeria
22
h3. Python?
23
24 38 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/C++, if someone needs better performance.
25 19 msuraev
26 40 fixeria
h3. Python2 or Python3?
27
28
The current implementation is known to work with both versions of Python. FakeTRX is not using any version-specific features or modules.
29
30 5 fixeria
h3. What about RSSI and ToA (Timing of Arrival)?
31 1 fixeria
32 39 fixeria
Since we are talking about the virtual Um-interface, it's possible to emulate different parameters of the physical RF interface:
33
34
* ToA (Timing of Arrival) - measured difference between expected and actual time of burst arrival in units of 1/256 of GSM symbol periods.
35
* RSSI (Received Signal Strength Indication) - measured "power" of the signal (per burst) in dBm.
36
* Path loss - bit errors, burst clipping, interference, etc.
37
38
By default, ToA is 0 and RSSI is -60 dBm. All simulation parameters mentioned above can be changed at runtime using the control commands with prefix 'FAKE_'. For more details, see documentation of the main FakeTRX class.
39 1 fixeria
40
h3. Can I run multiple BTS and / or multiple MS instances?
41
42 28 fixeria
Yes (since #3667 is done)!
43 1 fixeria
44
h2. Running
45
46
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]].
47
48 13 msuraev
{{graphviz_link()
49
digraph G {
50
    rankdir = LR;
51
    subgraph cluster_M {
52 33 fixeria
        L23APP1 [label="L2&3 app (e.g. mobile)"];
53
        L23APP2 [label="L2&3 app (e.g mobile)"];
54
        TTCN3MS [label="TTCN-3 TC (MS side)"];
55 30 fixeria
        TRXcon1 [label="trxcon"];
56
        TRXcon2 [label="trxcon"];
57
        TRXcon3 [label="trxcon"];
58 1 fixeria
        label = "Mobile side";
59 13 msuraev
    }
60 30 fixeria
61
    FakeTRX [label="FakeTRX"];
62
63 1 fixeria
    subgraph cluster_N {
64
        OsmoBSC;
65 33 fixeria
        TTCN3NET [label="TTCN-3 TC (BTS side)"];
66 1 fixeria
        OsmoBTS1 [label="osmo-bts-trx"];
67
        OsmoBTS2 [label="osmo-bts-trx"];
68 30 fixeria
        OsmoBTS3 [label="osmo-bts-trx"];
69 1 fixeria
        label = "Network side";
70
    }
71 30 fixeria
72
    L23APP1 -> TRXcon1 [label="L1CTL"];
73
    L23APP2 -> TRXcon2 [label="L1CTL"];
74
    TTCN3MS -> TRXcon3 [label="L1CTL"];
75
76
    TRXcon1 -> FakeTRX [label="TRX Interface"];
77
    TRXcon2 -> FakeTRX [label="TRX Interface"];
78
    TRXcon3 -> FakeTRX [label="TRX Interface"];
79
80
    FakeTRX -> OsmoBTS1 [label="TRX Interface"];
81
    FakeTRX -> OsmoBTS2 [label="TRX Interface"];
82
    FakeTRX -> OsmoBTS3 [label="TRX Interface"];
83 13 msuraev
    OsmoBTS1 -> OsmoBSC;
84
    OsmoBTS2 -> OsmoBSC;
85 30 fixeria
    OsmoBTS3 -> TTCN3NET;
86 13 msuraev
    }
87
}
88
}}
89 29 fixeria
90 30 fixeria
[[TRX Interface]] is a part of the upstream [[OsmocomBB:]], just make sure that you have compiled the latest version of [[TRX Interface#The-trxcon-application|trxcon]] application. FakeTRX is a part of TRX toolkit, that is located in 'src/target/trx_toolkit/'. See README for more details.
91 1 fixeria
92
_Tip: feel free to use tmux or screen to avoid a mess with multiple windows_
93
94
1. Run the network side stack you have. In this example we will use the [[osmonitb:|Network in the Box]]:
95
96
<pre>
97
$ osmo-nitb -c ./openbsc.cfg -l ./hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM
98
</pre>
99
100 31 fixeria
2. Run the fake_trx.py:
101 1 fixeria
102 6 fixeria
<pre>
103 23 msuraev
$ cd osmocom-bb/src/target/trx_toolkit/
104 31 fixeria
$ python ./fake_trx.py
105 1 fixeria
</pre>
106 11 osmith
107 31 fixeria
3. Start [[OsmoBTS:]]:
108 1 fixeria
109
<pre>
110 41 Hoernchen
$ osmo-bts-trx -c ./osmo-bts-trx.cfg
111 23 msuraev
</pre>
112
113 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.
114
115 31 fixeria
4. In order to "bridge" [[Host_Software|L2&3 applications]] with FakeTRX, you need to run [[TRX Interface#The-trxcon-application|trxcon]]:
116 1 fixeria
117 23 msuraev
<pre>
118 1 fixeria
$ cd osmocom-bb/src/host/trxcon/
119 31 fixeria
$ ./trxcon
120 23 msuraev
</pre>
121 1 fixeria
122
5. Finally, run any L2&3 application, e.g. ccch_scan:
123
124
<pre>
125
$ cd osmocom-bb/src/host/layer23/src/misc/
126
$ ./ccch_scan -a ARFCN -i 127.0.0.1
127
</pre>
128
129
Please note that ARFCN value should match the one your BTS configured to.
130
131 31 fixeria
At this stage, 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.
132 1 fixeria
133
h2. Running [[mobile]] application
134 12 osmith
135 42 fixeria
As you may already know, [[mobile]] application implements GSM 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, see the example below. If you are starting with the default config from the source tree (@osmocom-bb/doc/examples/mobile/default.cfg@), make sure to change @sim reader@ to @sim test@ in the @ms 1@ section.
136 1 fixeria
137
<pre>
138
test-sim
139
  imsi 901700000000000
140
  no barred-access
141
  rplmn 901 70
142
</pre>
143
144
Make sure you have the virtual network running, then run mobile the same way as in case of a Calypso based phone:
145
146
<pre>
147
$ cd osmocom-bb/src/host/layer23/src/mobile/
148
$ ./mobile -i 127.0.0.1
149
</pre>
150
151
Now you can use mobile's telnet interface to manage your virtual phone:
152
153
<pre>
154
$ telnet localhost 4247
155
$ ...
156
</pre>
157
158 34 fixeria
h2. Multiple transceivers
159
160
It's possible to handle multiple MS and/or BTS connections in a single [[FakeTRX]] process using _--trx_ option.
161
162
Additional MS-/BTS-side transceiver:
163
164
<pre>
165
$ ./fake_trx.py --trx 127.0.0.1:6703
166
</pre>
167
168
Two child transceivers of the main BTS:
169
170
<pre>
171
$ ./fake_trx.py --trx 127.0.0.1:5700/1 --trx 127.0.0.1:5700/2
172
</pre>
173
174
Additional transceiver with name:
175
176
<pre>
177
$ ./fake_trx.py --trx foo@127.0.0.1:5703
178
</pre>
179
180
Additional transceiver with IPv6 address:
181
182
<pre>
183
$ ./fake_trx.py --trx ipv6@[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:5700/5
184
</pre>
185
186 1 fixeria
h2. Demo
187
188
https://www.youtube.com/watch?v=Uxdaui8EkjY
189
190
h2. Project status
191 10 fixeria
192
Supported:
193
194
* Simulation and randomization of both RSSI and ToA
195 32 fixeria
* Multiple MS / BTS transceivers (see #3667)
196 10 fixeria
* Burst capture to file (see data_dump.py)
197 1 fixeria
* Injection of bursts and commands
Add picture from clipboard (Maximum size: 48.8 MB)