Project

General

Profile

FakeTRX » History » Version 33

fixeria, 01/17/2019 02:30 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
h2. FAQ
6
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
h3. Python?
12
13
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
15 19 msuraev
Once multiple instances are supported, we can benchmark to see what's the preformance bottleneck.
16
17 5 fixeria
h3. What about RSSI and ToA (Timing of Arrival)?
18 1 fixeria
19 5 fixeria
Since we are talking about the virtual interface, it's possible to emulate any values for both RSSI and ToA.
20 1 fixeria
21
h3. Can I run multiple BTS and / or multiple MS instances?
22
23 28 fixeria
Yes (since #3667 is done)!
24 1 fixeria
25
h2. Running
26
27
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]].
28
29 13 msuraev
{{graphviz_link()
30
digraph G {
31
    rankdir = LR;
32
    subgraph cluster_M {
33 33 fixeria
        L23APP1 [label="L2&3 app (e.g. mobile)"];
34
        L23APP2 [label="L2&3 app (e.g mobile)"];
35
        TTCN3MS [label="TTCN-3 TC (MS side)"];
36 30 fixeria
        TRXcon1 [label="trxcon"];
37
        TRXcon2 [label="trxcon"];
38
        TRXcon3 [label="trxcon"];
39 1 fixeria
        label = "Mobile side";
40 13 msuraev
    }
41 30 fixeria
42
    FakeTRX [label="FakeTRX"];
43
44 1 fixeria
    subgraph cluster_N {
45
        OsmoBSC;
46 33 fixeria
        TTCN3NET [label="TTCN-3 TC (BTS side)"];
47 1 fixeria
        OsmoBTS1 [label="osmo-bts-trx"];
48
        OsmoBTS2 [label="osmo-bts-trx"];
49 30 fixeria
        OsmoBTS3 [label="osmo-bts-trx"];
50 1 fixeria
        label = "Network side";
51
    }
52 30 fixeria
53
    L23APP1 -> TRXcon1 [label="L1CTL"];
54
    L23APP2 -> TRXcon2 [label="L1CTL"];
55
    TTCN3MS -> TRXcon3 [label="L1CTL"];
56
57
    TRXcon1 -> FakeTRX [label="TRX Interface"];
58
    TRXcon2 -> FakeTRX [label="TRX Interface"];
59
    TRXcon3 -> FakeTRX [label="TRX Interface"];
60
61
    FakeTRX -> OsmoBTS1 [label="TRX Interface"];
62
    FakeTRX -> OsmoBTS2 [label="TRX Interface"];
63
    FakeTRX -> OsmoBTS3 [label="TRX Interface"];
64 13 msuraev
    OsmoBTS1 -> OsmoBSC;
65
    OsmoBTS2 -> OsmoBSC;
66 30 fixeria
    OsmoBTS3 -> TTCN3NET;
67 13 msuraev
    }
68
}
69
}}
70 29 fixeria
71 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.
72 1 fixeria
73
_Tip: feel free to use tmux or screen to avoid a mess with multiple windows_
74
75
1. Run the network side stack you have. In this example we will use the [[osmonitb:|Network in the Box]]:
76
77
<pre>
78
$ osmo-nitb -c ./openbsc.cfg -l ./hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM
79
</pre>
80
81 31 fixeria
2. Run the fake_trx.py:
82 1 fixeria
83 6 fixeria
<pre>
84 23 msuraev
$ cd osmocom-bb/src/target/trx_toolkit/
85 31 fixeria
$ python ./fake_trx.py
86 1 fixeria
</pre>
87 11 osmith
88 31 fixeria
3. Start [[OsmoBTS:]]:
89 1 fixeria
90
<pre>
91 23 msuraev
$ osmo-bts-trx -c ./osmo-bts.cfg
92
</pre>
93
94 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.
95
96 31 fixeria
4. In order to "bridge" [[Host_Software|L2&3 applications]] with FakeTRX, you need to run [[TRX Interface#The-trxcon-application|trxcon]]:
97 1 fixeria
98 23 msuraev
<pre>
99 1 fixeria
$ cd osmocom-bb/src/host/trxcon/
100 31 fixeria
$ ./trxcon
101 23 msuraev
</pre>
102 1 fixeria
103
5. Finally, run any L2&3 application, e.g. ccch_scan:
104
105
<pre>
106
$ cd osmocom-bb/src/host/layer23/src/misc/
107
$ ./ccch_scan -a ARFCN -i 127.0.0.1
108
</pre>
109
110
Please note that ARFCN value should match the one your BTS configured to.
111
112 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.
113 1 fixeria
114
h2. Running [[mobile]] application
115 12 osmith
116 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.
117
118
<pre>
119
test-sim
120
  imsi 901700000000000
121
  no barred-access
122
  rplmn 901 70
123
</pre>
124
125
Make sure you have the virtual network running, then run mobile the same way as in case of a Calypso based phone:
126
127
<pre>
128
$ cd osmocom-bb/src/host/layer23/src/mobile/
129
$ ./mobile -i 127.0.0.1
130
</pre>
131
132
Now you can use mobile's telnet interface to manage your virtual phone:
133
134
<pre>
135
$ telnet localhost 4247
136
$ ...
137
</pre>
138
139
h2. Demo
140
141
https://www.youtube.com/watch?v=Uxdaui8EkjY
142
143
h2. Project status
144 10 fixeria
145
Supported:
146
147
* Simulation and randomization of both RSSI and ToA
148 32 fixeria
* Multiple MS / BTS transceivers (see #3667)
149 10 fixeria
* Burst capture to file (see data_dump.py)
150 1 fixeria
* Injection of bursts and commands
Add picture from clipboard (Maximum size: 48.8 MB)