Project

General

Profile

FakeTRX » History » Revision 23

Revision 22 (msuraev, 10/24/2018 02:06 PM) → Revision 23/44 (msuraev, 11/15/2018 11:56 AM)

h1. FakeTRX (Virtual Um-interface) 

 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! 

 h2. FAQ 

 h3. What is the difference from [[cellular-infrastructure:Virtual_Um|VIRT-PHY]]? 

 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. 

 h4. Interoperability with [[cellular-infrastructure:Virtual_Um|VIRT-PHY]] 

 TBD. 

 h3. Python? 

 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. 

 Once multiple instances are supported, we can benchmark to see what's the preformance bottleneck. 

 h3. What about RSSI and ToA (Timing of Arrival)? 

 Since we are talking about the virtual interface, it's possible to emulate any values for both RSSI and ToA. 

 h3. Can I run multiple BTS and / or multiple MS instances? 

 Not yet. Related tickets: https://osmocom.org/issues/3666 https://osmocom.org/issues/3667 

 h2. Running 

 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]]. 

 {{graphviz_link() 
 digraph G { 
     rankdir = LR; 
     subgraph cluster_M { 
         mobile1 [label="Mobile"]; 
         mobile2 [label="Mobile"]; 
         TRXcon1 [label="TRXcon"]; 
         TRXcon2 [label="TRXcon"]; 
         label = "Mobile side"; 
     } 
     subgraph cluster_N { 
         OsmoBSC; 
         OsmoBTS1 [label="osmo-bts-trx"]; 
         OsmoBTS2 [label="osmo-bts-trx"]; 
         FakeTRX1 [label="FakeTRX"]; 
         FakeTRX2 [label="FakeTRX"]; 
         label = "Network side"; 
     } 
     FakeTRX1 -> OsmoBTS1 [label="TRX Interface"]; 
     FakeTRX2 -> OsmoBTS2 [label="TRX Interface"]; 
     OsmoBTS1 -> OsmoBSC; 
     OsmoBTS2 -> OsmoBSC; 
     mobile1 -> TRXcon1 [label="L1CTL"]; 
     mobile2 -> TRXcon2 [label="L1CTL"]; 
     TRXcon1 -> FakeTRX1 [label="TRX Interface"]; 
     TRXcon2 -> FakeTRX2 [label="TRX Interface"]; 
     } 
 } 
 }} 

 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. 

 _Tip: feel free to use tmux or screen to avoid a mess with multiple windows_ 

 1. Run the network side stack you have. In this example we will use the [[osmonitb:|Network in the Box]]: 

 <pre> 
 $ osmo-nitb -c ./openbsc.cfg -l ./hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM 
 </pre> 

 2. Run the fake transceiver: 

 <pre> 
 $ cd osmocom-bb/src/target/trx_toolkit/ 
 $ python ./fake_trx.py -R 127.0.0.3 -r 127.0.0.23 -b 127.0.0.13 
 </pre> 

 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. 

 3. Start [[OsmoBTS:]] (in case you want to [[cellular-infrastructure:build from source]], enable the TRX backend with @./configure --enable-trx=yes@). 

 <pre> 
 $ osmo-bts-trx -c ./osmo-bts.cfg 
 </pre> 

 If using explicit IP addresses as specified above, your osmo-bts.cfg should have following options set: 
 <pre> 
 phy 0 
  osmotrx ip local 127.0.0.3 
  osmotrx ip remote 127.0.0.13 
 </pre> 

 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. 

 4. In order to make [[OsmocomBB:]] applications able to work with FakeTRX, you need to run [[TRX Interface#The-trxcon-application|trxcon]]: 

 <pre> 
 $ cd osmocom-bb/src/host/trxcon/ 
 $ ./trxcon --trx-remote 127.0.0.13 --trx-bind 127.0.0.23 
 </pre> 

 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. 

 5. Finally, run any L2&3 application, e.g. ccch_scan: 

 <pre> 
 $ cd osmocom-bb/src/host/layer23/src/misc/ 
 $ ./ccch_scan -a ARFCN -i 127.0.0.1 
 </pre> 

 Please note that ARFCN value should match the one your BTS configured to. 

 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. 

 h2. Running [[mobile]] application 

 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. 

 <pre> 
 test-sim 
   imsi 901700000000000 
   no barred-access 
   rplmn 901 70 
 </pre> 

 Make sure you have the virtual network running, then run mobile the same way as in case of a Calypso based phone: 

 <pre> 
 $ cd osmocom-bb/src/host/layer23/src/mobile/ 
 $ ./mobile -i 127.0.0.1 
 </pre> 

 Now you can use mobile's telnet interface to manage your virtual phone: 

 <pre> 
 $ telnet localhost 4247 
 $ ... 
 </pre> 

 h3. Voice call example 

 TBD. 


 h2. Demo 

 https://www.youtube.com/watch?v=Uxdaui8EkjY 

 h2. Project status 

 Supported: 

 * Simulation and randomization of both RSSI and ToA 
 * Burst capture to file (see data_dump.py) 
 * Injection of bursts and commands 

 Further plans: 

 * Allow multiple BTS to work with multiple BB instances: https://osmocom.org/issues/3666 https://osmocom.org/issues/3667 
 * Distinguish between various debug messages (BTS / MS, ID)
Add picture from clipboard (Maximum size: 48.8 MB)