Neels Hofmeyr | 697a617 | 2018-08-22 17:32:21 +0200 | [diff] [blame] | 1 | === WHAT IS THIS? |
| 2 | |
| 3 | * quickly configure, launch and tear down an entire Osmocom core network on |
| 4 | your box (see net/README). |
| 5 | |
| 6 | This is the set of tools I wrote for myself and use every day to run and test |
| 7 | the Osmocom core network. I hope this helps, and I would appreciate |
| 8 | contributions of any improvements you may have! |
| 9 | |
| 10 | |
| 11 | === Quick Start |
| 12 | |
| 13 | cp config_2g3g config_mine |
| 14 | $EDITOR config_mine |
| 15 | # update IP addresses and device names as required |
| 16 | |
| 17 | mkdir my_network |
| 18 | cd my_network |
Neels Hofmeyr | 57e4288 | 2018-08-23 15:19:35 +0200 | [diff] [blame] | 19 | ../fill_config.py ../config_mine ../tmpl_std |
Neels Hofmeyr | 697a617 | 2018-08-22 17:32:21 +0200 | [diff] [blame] | 20 | |
| 21 | ./run.sh |
| 22 | # Launches numerous x-terminals with one component running in each. |
| 23 | # Logs and pcap traces are being taken automatically. |
| 24 | |
| 25 | # hit enter in the original first terminal to tear down all programs. |
| 26 | # Enter a name to save logs, otherwise all logging will be stored |
| 27 | # under autolog/<timestamp> |
| 28 | |
| 29 | Then possibly modify the config and refresh: |
| 30 | |
| 31 | # tweak config? |
| 32 | $EDITOR ../config_mine |
Neels Hofmeyr | 57e4288 | 2018-08-23 15:19:35 +0200 | [diff] [blame] | 33 | ../fill_config.py |
Neels Hofmeyr | 697a617 | 2018-08-22 17:32:21 +0200 | [diff] [blame] | 34 | # picks up same ../config_mine and ../tmpl_std from last time |
| 35 | |
| 36 | # own templates? |
| 37 | cp -r ../tmpl_std ../tmpl_mine |
| 38 | $EDITOR ../tmpl_mine/* |
Neels Hofmeyr | 57e4288 | 2018-08-23 15:19:35 +0200 | [diff] [blame] | 39 | ../fill_config.py ../tmpl_mine |
Neels Hofmeyr | 697a617 | 2018-08-22 17:32:21 +0200 | [diff] [blame] | 40 | # picks up same ../config_mine from last time, and ../tmpl_mine from cmdline |
| 41 | |
| 42 | |
Neels Hofmeyr | 5a9bf17 | 2018-08-23 15:31:44 +0200 | [diff] [blame] | 43 | If you wanted to change to dynamic timeslots, you can: |
| 44 | |
| 45 | cd .. |
| 46 | mkdir tmpl_dyn |
| 47 | cd tmpl_dyn |
| 48 | ln -s ../tmpl_std/* . |
| 49 | rm ./osmo-bsc.cfg |
| 50 | cp ../tmpl_std/osmo-bsc.cfg . |
| 51 | sed -i 's#TCH/F#TCH/F_TCH/H_PDCH#' osmo-bsc.cfg |
| 52 | |
| 53 | cd ../my_network |
| 54 | ../fill_config.py ../tmpl_dyn |
| 55 | |
| 56 | |
| 57 | If you moved your laptop to a different location, you can: |
| 58 | |
| 59 | cp ../config_mine ../config_foo |
| 60 | $EDITOR ../config_foo # set new IP address(es) |
| 61 | ../fill_config.py ../config_foo |
| 62 | |
Neels Hofmeyr | 697a617 | 2018-08-22 17:32:21 +0200 | [diff] [blame] | 63 | |
| 64 | === Config file templates |
| 65 | |
| 66 | A *directory* contains template files that are filled with specific values by the |
Neels Hofmeyr | 57e4288 | 2018-08-23 15:19:35 +0200 | [diff] [blame] | 67 | fill_config.py script. See e.g. tmpl_std/. |
Neels Hofmeyr | 697a617 | 2018-08-22 17:32:21 +0200 | [diff] [blame] | 68 | |
Neels Hofmeyr | 5a9bf17 | 2018-08-23 15:31:44 +0200 | [diff] [blame] | 69 | A *file* contains local config items as name=val pairs that are put into the |
| 70 | templates. See e.g. config_2g3g. |
Neels Hofmeyr | 697a617 | 2018-08-22 17:32:21 +0200 | [diff] [blame] | 71 | |
Neels Hofmeyr | 57e4288 | 2018-08-23 15:19:35 +0200 | [diff] [blame] | 72 | The fill_config.py script helps to fill the templates with the config values. Simply |
| 73 | invoke fill_config.py with a dir argument (templates dir) and a file argument (specific |
Oliver Smith | fd7446f | 2018-10-22 11:59:55 +0200 | [diff] [blame] | 74 | config values). The dir argument can be used in the templates with ${NET_DIR}, |
| 75 | temporary files (sockets etc.) should be placed inside this folder. |
Neels Hofmeyr | 697a617 | 2018-08-22 17:32:21 +0200 | [diff] [blame] | 76 | |
| 77 | If one or both are omitted, the script tries to re-use the most recent paths, |
| 78 | they were stored in local files '.last_config' and '.last_templates'. |
| 79 | |
| 80 | The result is a complete set of .cfg files that match your local machine and |
| 81 | network config. |
| 82 | |
| 83 | |
| 84 | === Launch |
| 85 | |
| 86 | A run.sh script template (tmpl_std/run.sh) also gets filled with specifics and |
| 87 | placed next to the .cfg files. |
| 88 | |
| 89 | run.sh uses sudo to start tcpdump, configure ip forwarding and masquerading |
| 90 | (for the GGSN's APN tunnel required for data services). |
| 91 | |
| 92 | When you launch run.sh, many xterms are launched, and when hitting enter, all |
| 93 | of them get destroyed again. This is obviously intended to be run on your |
| 94 | desktop computer or laptop, not on a remote box. It may also make sense to |
| 95 | launch all of them in the current shell, and maybe or maybe not switch off |
| 96 | stderr logging; or to launch each component in a tmux window or whatnot -- if |
| 97 | you figure out something in that line, I would be glad to get contributions and |
| 98 | incorporate that. |
| 99 | |
| 100 | |
| 101 | === Logging and pcaps |
| 102 | |
| 103 | The run.sh script automatically stores all configs, logs and pcap traces in |
| 104 | ./autolog/<timestamp> dirs. After closing the components (by hitting enter), |
| 105 | you may also enter a name for the logs, after which they are stored in |
| 106 | ./logs/<name>. The idea is to keep all important logs with a name, and that you |
| 107 | can every now and then just 'rm -rf ./autolog' to make space. |
| 108 | |
| 109 | |
| 110 | === 3G |
| 111 | |
| 112 | You may notice that the templates include nano3G.txt files. These include a |
| 113 | convenient listing of commands to connect to an ip.access nano3G DMI and |
| 114 | connect it to the HNBGW as configured by the templates. |
| 115 | |
| 116 | |
| 117 | === 2G BTS |
| 118 | |
| 119 | At the time of writing, there are no osmo-bts.cfg files, since this is intended |
| 120 | for the core network and BSC components only. Feel free to add! |
| 121 | |
| 122 | Typically you'd need to edit only the /etc/osmocom/osmo-bts.cfg to match your |
| 123 | IP address and ipa unit-id: |
| 124 | |
| 125 | bts 0 |
Neels Hofmeyr | 5a9bf17 | 2018-08-23 15:31:44 +0200 | [diff] [blame] | 126 | oml remote-ip 192.168.0.23 |
| 127 | ipa unit-id 1234 0 |