Project

General

Profile

FakeTRX » History » Version 24

msuraev, 11/15/2018 12:17 PM

1 1 fixeria
h1. FakeTRX (Virtual Um-interface)
2
3 8 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 nor use any kind of special hardware - just run a few scripts and do anything you want / need in your virtual GSM network!
4 1 fixeria
5 24 msuraev
Normally trxcon [[TRX Interface]] would be used for GR-GSM to implement client (mobile) side of the transceiver. The OsmoTRX implements server (BTS) side of transceiver and is used by osmo-bts-trx. FakeTRX acts as a bridge between them altering Uplink/Downlink headers as necessary which removes the need for actual hardware.
6
7 1 fixeria
h2. FAQ
8
9 3 fixeria
h3. What is the difference from [[cellular-infrastructure:Virtual_Um|VIRT-PHY]]?
10 1 fixeria
11 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.
12 1 fixeria
13 20 msuraev
h4. Interoperability with [[cellular-infrastructure:Virtual_Um|VIRT-PHY]]
14
15
TBD.
16
17 1 fixeria
h3. Python?
18
19
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.
20
21 19 msuraev
Once multiple instances are supported, we can benchmark to see what's the preformance bottleneck.
22
23 5 fixeria
h3. What about RSSI and ToA (Timing of Arrival)?
24 1 fixeria
25 5 fixeria
Since we are talking about the virtual interface, it's possible to emulate any values for both RSSI and ToA.
26 1 fixeria
27
h3. Can I run multiple BTS and / or multiple MS instances?
28
29 17 msuraev
Not yet. Related tickets: https://osmocom.org/issues/3666 https://osmocom.org/issues/3667
30 1 fixeria
31
h2. Running
32
33
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]].
34
35 13 msuraev
{{graphviz_link()
36
digraph G {
37
    rankdir = LR;
38
    subgraph cluster_M {
39
        mobile1 [label="Mobile"];
40
        mobile2 [label="Mobile"];
41
        TRXcon1 [label="TRXcon"];
42
        TRXcon2 [label="TRXcon"];
43
        label = "Mobile side";
44
    }
45
    subgraph cluster_N {
46
        OsmoBSC;
47
        OsmoBTS1 [label="osmo-bts-trx"];
48
        OsmoBTS2 [label="osmo-bts-trx"];
49
        FakeTRX1 [label="FakeTRX"];
50
        FakeTRX2 [label="FakeTRX"];
51
        label = "Network side";
52
    }
53 15 msuraev
    FakeTRX1 -> OsmoBTS1 [label="TRX Interface"];
54
    FakeTRX2 -> OsmoBTS2 [label="TRX Interface"];
55 13 msuraev
    OsmoBTS1 -> OsmoBSC;
56
    OsmoBTS2 -> OsmoBSC;
57 14 msuraev
    mobile1 -> TRXcon1 [label="L1CTL"];
58
    mobile2 -> TRXcon2 [label="L1CTL"];
59 13 msuraev
    TRXcon1 -> FakeTRX1 [label="TRX Interface"];
60
    TRXcon2 -> FakeTRX2 [label="TRX Interface"];
61
    }
62
}
63
}}
64
65 6 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/trx_toolkit/'. See README for more details.
66 1 fixeria
67
_Tip: feel free to use tmux or screen to avoid a mess with multiple windows_
68
69
1. Run the network side stack you have. In this example we will use the [[osmonitb:|Network in the Box]]:
70
71
<pre>
72
$ osmo-nitb -c ./openbsc.cfg -l ./hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM
73
</pre>
74
75
2. Run the fake transceiver:
76
77
<pre>
78 6 fixeria
$ cd osmocom-bb/src/target/trx_toolkit/
79 23 msuraev
$ python ./fake_trx.py -R 127.0.0.3 -r 127.0.0.23 -b 127.0.0.13
80 1 fixeria
</pre>
81
82 23 msuraev
Here we assume that osmo-bts-trx is available on 127.0.0.3, osmocom-bb (mobile or other program) is available on 127.0.0.23 and we use 127.0.0.13 as our own address. This allow us to run multiple transceivers (and mobiles) in parallel. In simple setups with only single fake_trx all IP-related parameters can be omitted.
83
84 11 osmith
3. Start [[OsmoBTS:]] (in case you want to [[cellular-infrastructure:build from source]], enable the TRX backend with @./configure --enable-trx=yes@).
85 1 fixeria
86
<pre>
87
$ osmo-bts-trx -c ./osmo-bts.cfg
88
</pre>
89
90 23 msuraev
If using explicit IP addresses as specified above, your osmo-bts.cfg should have following options set:
91
<pre>
92
phy 0
93
 osmotrx ip local 127.0.0.3
94
 osmotrx ip remote 127.0.0.13
95
</pre>
96
97 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.
98
99
4. In order to make [[OsmocomBB:]] applications able to work with FakeTRX, you need to run [[TRX Interface#The-trxcon-application|trxcon]]:
100
101
<pre>
102
$ cd osmocom-bb/src/host/trxcon/
103 23 msuraev
$ ./trxcon --trx-remote 127.0.0.13 --trx-bind 127.0.0.23
104 1 fixeria
</pre>
105 23 msuraev
106
Here we assume that trxcon is available on 127.0.0.13 and we use 127.0.0.23 as our own address. This allow us to run multiple transceivers (and mobiles) in parallel. In simple setups with only single fake_trx/trxcon all IP-related parameters can be omitted.
107 1 fixeria
108
5. Finally, run any L2&3 application, e.g. ccch_scan:
109
110
<pre>
111
$ cd osmocom-bb/src/host/layer23/src/misc/
112
$ ./ccch_scan -a ARFCN -i 127.0.0.1
113
</pre>
114
115
Please note that ARFCN value should match the one your BTS configured to.
116
117
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.
118
119
h2. Running [[mobile]] application
120
121 12 osmith
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.
122 1 fixeria
123
<pre>
124
test-sim
125
  imsi 901700000000000
126
  no barred-access
127
  rplmn 901 70
128
</pre>
129
130
Make sure you have the virtual network running, then run mobile the same way as in case of a Calypso based phone:
131
132
<pre>
133
$ cd osmocom-bb/src/host/layer23/src/mobile/
134
$ ./mobile -i 127.0.0.1
135
</pre>
136
137
Now you can use mobile's telnet interface to manage your virtual phone:
138
139
<pre>
140
$ telnet localhost 4247
141
$ ...
142
</pre>
143
144 18 msuraev
h3. Voice call example
145
146
TBD.
147
148
149 1 fixeria
h2. Demo
150
151
https://www.youtube.com/watch?v=Uxdaui8EkjY
152
153
h2. Project status
154
155 10 fixeria
Supported:
156
157
* Simulation and randomization of both RSSI and ToA
158
* Burst capture to file (see data_dump.py)
159
* Injection of bursts and commands
160
161 1 fixeria
Further plans:
162
163 21 msuraev
* Allow multiple BTS to work with multiple BB instances: https://osmocom.org/issues/3666 https://osmocom.org/issues/3667
164 22 msuraev
* Distinguish between various debug messages (BTS / MS, ID)
Add picture from clipboard (Maximum size: 48.8 MB)