Project

General

Profile

FakeTRX » History » Version 38

fixeria, 04/19/2019 06:22 PM

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
FakeTRX is a part of [[OsmocomBB:]]. The source code is available at git.osmocom.org.
8
9
You can browse it via cgit: https://git.osmocom.org/osmocom-bb/tree/src/target/trx_toolkit, and download using git:
10
11
<pre>
12
$ git clone git://git.osmocom.org/osmocom-bb.git
13
</pre>
14
15
Contributions are welcome via [[cellular-infrastructure:Gerrit]].
16 1 fixeria
17
h2. FAQ
18
19 3 fixeria
h3. What is the difference from [[cellular-infrastructure:Virtual_Um|VIRT-PHY]]?
20 1 fixeria
21 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.
22 1 fixeria
23
h3. Python?
24
25 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.
26 19 msuraev
27 5 fixeria
h3. What about RSSI and ToA (Timing of Arrival)?
28 1 fixeria
29 5 fixeria
Since we are talking about the virtual interface, it's possible to emulate any values for both RSSI and ToA.
30 1 fixeria
31
h3. Can I run multiple BTS and / or multiple MS instances?
32
33 28 fixeria
Yes (since #3667 is done)!
34 1 fixeria
35
h2. Running
36
37
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]].
38
39 13 msuraev
{{graphviz_link()
40
digraph G {
41
    rankdir = LR;
42
    subgraph cluster_M {
43 33 fixeria
        L23APP1 [label="L2&3 app (e.g. mobile)"];
44
        L23APP2 [label="L2&3 app (e.g mobile)"];
45
        TTCN3MS [label="TTCN-3 TC (MS side)"];
46 30 fixeria
        TRXcon1 [label="trxcon"];
47
        TRXcon2 [label="trxcon"];
48
        TRXcon3 [label="trxcon"];
49 1 fixeria
        label = "Mobile side";
50 13 msuraev
    }
51 30 fixeria
52
    FakeTRX [label="FakeTRX"];
53
54 1 fixeria
    subgraph cluster_N {
55
        OsmoBSC;
56 33 fixeria
        TTCN3NET [label="TTCN-3 TC (BTS side)"];
57 1 fixeria
        OsmoBTS1 [label="osmo-bts-trx"];
58
        OsmoBTS2 [label="osmo-bts-trx"];
59 30 fixeria
        OsmoBTS3 [label="osmo-bts-trx"];
60 1 fixeria
        label = "Network side";
61
    }
62 30 fixeria
63
    L23APP1 -> TRXcon1 [label="L1CTL"];
64
    L23APP2 -> TRXcon2 [label="L1CTL"];
65
    TTCN3MS -> TRXcon3 [label="L1CTL"];
66
67
    TRXcon1 -> FakeTRX [label="TRX Interface"];
68
    TRXcon2 -> FakeTRX [label="TRX Interface"];
69
    TRXcon3 -> FakeTRX [label="TRX Interface"];
70
71
    FakeTRX -> OsmoBTS1 [label="TRX Interface"];
72
    FakeTRX -> OsmoBTS2 [label="TRX Interface"];
73
    FakeTRX -> OsmoBTS3 [label="TRX Interface"];
74 13 msuraev
    OsmoBTS1 -> OsmoBSC;
75
    OsmoBTS2 -> OsmoBSC;
76 30 fixeria
    OsmoBTS3 -> TTCN3NET;
77 13 msuraev
    }
78
}
79
}}
80 29 fixeria
81 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.
82 1 fixeria
83
_Tip: feel free to use tmux or screen to avoid a mess with multiple windows_
84
85
1. Run the network side stack you have. In this example we will use the [[osmonitb:|Network in the Box]]:
86
87
<pre>
88
$ osmo-nitb -c ./openbsc.cfg -l ./hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM
89
</pre>
90
91 31 fixeria
2. Run the fake_trx.py:
92 1 fixeria
93 6 fixeria
<pre>
94 23 msuraev
$ cd osmocom-bb/src/target/trx_toolkit/
95 31 fixeria
$ python ./fake_trx.py
96 1 fixeria
</pre>
97 11 osmith
98 31 fixeria
3. Start [[OsmoBTS:]]:
99 1 fixeria
100
<pre>
101 23 msuraev
$ osmo-bts-trx -c ./osmo-bts.cfg
102
</pre>
103
104 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.
105
106 31 fixeria
4. In order to "bridge" [[Host_Software|L2&3 applications]] with FakeTRX, you need to run [[TRX Interface#The-trxcon-application|trxcon]]:
107 1 fixeria
108 23 msuraev
<pre>
109 1 fixeria
$ cd osmocom-bb/src/host/trxcon/
110 31 fixeria
$ ./trxcon
111 23 msuraev
</pre>
112 1 fixeria
113
5. Finally, run any L2&3 application, e.g. ccch_scan:
114
115
<pre>
116
$ cd osmocom-bb/src/host/layer23/src/misc/
117
$ ./ccch_scan -a ARFCN -i 127.0.0.1
118
</pre>
119
120
Please note that ARFCN value should match the one your BTS configured to.
121
122 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.
123 1 fixeria
124
h2. Running [[mobile]] application
125 12 osmith
126 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, 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.
127
128
<pre>
129
test-sim
130
  imsi 901700000000000
131
  no barred-access
132
  rplmn 901 70
133
</pre>
134
135
Make sure you have the virtual network running, then run mobile the same way as in case of a Calypso based phone:
136
137
<pre>
138
$ cd osmocom-bb/src/host/layer23/src/mobile/
139
$ ./mobile -i 127.0.0.1
140
</pre>
141
142
Now you can use mobile's telnet interface to manage your virtual phone:
143
144
<pre>
145
$ telnet localhost 4247
146
$ ...
147
</pre>
148
149 34 fixeria
h2. Multiple transceivers
150
151
It's possible to handle multiple MS and/or BTS connections in a single [[FakeTRX]] process using _--trx_ option.
152
153
Additional MS-/BTS-side transceiver:
154
155
<pre>
156
$ ./fake_trx.py --trx 127.0.0.1:6703
157
</pre>
158
159
Two child transceivers of the main BTS:
160
161
<pre>
162
$ ./fake_trx.py --trx 127.0.0.1:5700/1 --trx 127.0.0.1:5700/2
163
</pre>
164
165
Additional transceiver with name:
166
167
<pre>
168
$ ./fake_trx.py --trx foo@127.0.0.1:5703
169
</pre>
170
171
Additional transceiver with IPv6 address:
172
173
<pre>
174
$ ./fake_trx.py --trx ipv6@[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:5700/5
175
</pre>
176
177 1 fixeria
h2. Demo
178
179
https://www.youtube.com/watch?v=Uxdaui8EkjY
180
181
h2. Project status
182 10 fixeria
183
Supported:
184
185
* Simulation and randomization of both RSSI and ToA
186 32 fixeria
* Multiple MS / BTS transceivers (see #3667)
187 10 fixeria
* Burst capture to file (see data_dump.py)
188 1 fixeria
* Injection of bursts and commands
Add picture from clipboard (Maximum size: 48.8 MB)