[[bts-examples]]
== OsmoBSC example configuration files

The `osmo-bsc/doc/examples/osmo-bsc` directory in the OpenBSC source
tree contains a collection of example configuration files, sorted by BTS
type.

This chapter is illustrating some excerpts from those examples

[[bts_example_nbts]]
=== Example configuration for OsmoBSC with one single-TRX nanoBTS

.OsmoBSC with one single-TRX nanoBTS
====

----
e1_input
 e1_line 0 driver ipa <1>
network
 network country code 1
 mobile network code 1
 encryption a5 0
 neci 1
 handover 0
 bts 0
  type nanobts <2>
  band DCS1800 <3>
  cell_identity 0
  location_area_code 0x0001
  training_sequence_code 7
  base_station_id_code 63
  ms max power 15
  cell reselection hysteresis 4
  rxlev access min 0
  channel allocator mode set-all ascending
  rach tx integer 9
  rach max transmission 7
  ipa unit-id 1801 0 <4>
  oml ipa stream-id 255 line 0
  gprs mode none
  trx 0
   rf_locked 0
   arfcn 871 <5>
   nominal power 23
   max_power_red 20 <6>
   rsl e1 tei 0
    timeslot 0
     phys_chan_config CCCH+SDCCH4
    timeslot 1
     phys_chan_config SDCCH8
    timeslot 2
     phys_chan_config TCH/F
    timeslot 3
     phys_chan_config TCH/F
    timeslot 4
     phys_chan_config TCH/F
    timeslot 5
     phys_chan_config TCH/F
    timeslot 6
     phys_chan_config TCH/F
    timeslot 7
     phys_chan_config TCH/F
----
====

<1> You have to configure one virtual E1 line with the
    IPA driver in order to use Abis/IP.  One e1_line is
    sufficient for any number of A-bis/IP BTSs, there is no
    limit like in physical E1 lines.
<2> The BTS type must be set using `type nanobts`
<3> The GSM band must be set according to the BTS hardware.
<4> The IPA Unit ID parameter must be set to what has been configured on
    the BTS side using the __BTS Manager__ or `ipaccess-config`.
<5> The ARFCN of the BTS.
<6> All known nanoBTS units have a nominal transmit power of 23 dBm.  If
    a `max_power_red` of 20 (dB) is configured, the resulting output
    power at the BTS Tx port is 23 - 20 = 3 dBm.

[NOTE]
====
The `nominal_power` setting does __not__ influence the transmitted power
to the BTS!  It is a setting by which the system administrator tells the
BSC about the nominal output power of the BTS.  The BSC uses this as
basis for calculations.
====


[[bts_example_nbts_multi]]
=== Example configuration for OsmoBSC with multi-TRX nanoBTS

.OsmoBSC configured for dual-TRX (stacked) nanoBTS
====

----
e1_input
 e1_line 0 driver ipa
network
 network country code 1
 mobile network code 1
 encryption a5 0
 neci 1
 handover 0
 bts 0
  type nanobts
  band DCS1800
  cell_identity 0
  location_area_code 0x0001
  training_sequence_code 7
  base_station_id_code 63
  ms max power 15
  cell reselection hysteresis 4
  rxlev access min 0
  channel allocator mode set-all ascending
  rach tx integer 9
  rach max transmission 7
  ipa unit-id 1800 0 <1>
  oml ipa stream-id 255 line 0
  gprs mode none
  trx 0
   rf_locked 0
   arfcn 871
   nominal power 23
   max_power_red 0
   rsl e1 tei 0
    timeslot 0
     phys_chan_config CCCH+SDCCH4
    timeslot 1
     phys_chan_config SDCCH8
    timeslot 2
     phys_chan_config TCH/F
    timeslot 3
     phys_chan_config TCH/F
    timeslot 4
     phys_chan_config TCH/F
    timeslot 5
     phys_chan_config TCH/F
    timeslot 6
     phys_chan_config TCH/F
    timeslot 7
     phys_chan_config TCH/F
  trx 1
   rf_locked 0
   arfcn 873
   nominal power 23
   max_power_red 0
   rsl e1 tei 0
    timeslot 0
     phys_chan_config SDCCH8
    timeslot 1
     phys_chan_config TCH/F
    timeslot 2
     phys_chan_config TCH/F
    timeslot 3
     phys_chan_config TCH/F
    timeslot 4
     phys_chan_config TCH/F
    timeslot 5
     phys_chan_config TCH/F
    timeslot 6
     phys_chan_config TCH/F
    timeslot 7
     phys_chan_config TCH/F
----
====

<1> In this example, the IPA Unit ID is specified as `1800 0`. Thus, the
    first nanoBTS unit (`trx 0`) needs to be configured to 1800/0/0 and
    the second nanoBTS unit (`trx 1`) needs to be configured to 1800/0/1.
    You can configure the BTS unit IDs using the `ipaccess-config`
    utility included in OsmoBSC.

[NOTE]
====
For building a multi-TRX setup, you also need to connect the TIB cables
between the two nanoBTS units, as well as the coaxial/RF AUX cabling.
====

[[example_e1_cfg]]
=== Example configuration for OsmoBSC with E1 BTS

The following configuration sample illustrates the usage of BTSs that are
connected via an E1/T1 backhaul.

.OsmoBSC configured for single-TRX E1 Ericsson DUG20
====
----
e1_input <1>
 e1_line 0 driver dahdi
 e1_line 0 port 3
network
 network country code 1
 mobile network code 1
 encryption a5 0
 neci 1
 handover 0
 bts 0
  type rbs2000
  band GSM900
  om2000 version-limit oml gen 12 rev 10 <2>
  cell_identity 0
  location_area_code 0x0001
  training_sequence_code 7
  base_station_id_code 63
  ms max power 15
  cell reselection hysteresis 4
  rxlev access min 0
  channel allocator mode set-all ascending
  rach tx integer 9
  rach max transmission 7
  oml e1 line 0 timeslot 1 sub-slot full <3>
  oml e1 tei 62 <4>
  gprs mode none
  is-connection-list add 4 512 12 <5>
  is-connection-list add 16 524 12
  is-connection-list add 28 536 12
  is-connection-list add 40 548 12
  trx 0
   rf_locked 0
   arfcn 123
   nominal power 42
   max_power_red 12
   rsl e1 line 0 timeslot 1 sub-slot full <6>
   rsl e1 tei 0 <7>
   timeslot 0
    phys_chan_config CCCH+SDCCH4
    hopping enabled 0
    e1 line 0 timeslot 1 sub-slot full <8>
   timeslot 1
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 2 sub-slot 1 <9>
   timeslot 2
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 2 sub-slot 2
   timeslot 3
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 2 sub-slot 3
   timeslot 4
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 3 sub-slot 0
   timeslot 5
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 3 sub-slot 1
   timeslot 6
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 3 sub-slot 2
   timeslot 7
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 3 sub-slot 3
----
====

<1> In this example we use a dahdi E1 card. This card has 4 ports. Here we use port numer 3. It should be noted that the dahdi driver also requires additional configuration, which is not covered by this manual.

<2> In this example we use an E1 Ericsson DUG20, which uses an OML dialect, called "OM2000".

<3> The first usable timeslot on an E1 line is TS1. In this example we will assume that TS1-TS3 are connected to the BTS stright through. TS1 will handle all signaling traffic. Here we assign this timeslot to OML.

<4> OML always requires a TEI (Terminal Equipment Identifier) to set up. This number can be found in the manual of the BTS.

<5> This BTS has an built in “Interface Switch” (IS) that offers flexible way to reconfigure the interconnection between the internal components of the BTS and the external E1 line. This depends on the exact BTS type and configuration. See also <<cfg_ericsson_rbs_is>>

<6> Similar to OML we assign TS1 to RSL as well.

<7> Like with OML, RSL also requires a TEI to be configured. Usually each TRX will have a specific TEI assigned.

<8> CCCH+SDCCH4 will also be mapped on TS1. The traffic for those control channels will be multiplexed alongside the RSL and OML traffic.

<9> The bandwidth of one E1 timeslot matches the bandwidth of 4 GSM air interface timeslots. The E1 timeslot is split up into four sub-slots, which are then assigned to one GSM air interface timeslot each. Since the first timeslot on the first TRX is already used for signaling we begin the sub-slot counting with sub-slot 1 for alignment reasons.

=== Example configuration for OsmoBSC with Ericsson RBS E1 BTS and EGPRS

The following example illustrates the usage of Ericsson RBS2000/RBS6000 BTSs.
This classic E1 BTS has no built in PCU and therefore requires the configuration
of a BSC co-located OsmoPCU (see also: <<cfg_bsc_co_located_pcu>>).

It should also be noted that the Ericsson RBS2000/RBS6000 series is the first
BTS of this type to be supported by OsmoBTS and OsmoPCU. The implementation has
been made possible through funding by the NLnet Foundation.

Ericsson RBS2000/RBS6000 BTSs feature two GPRS modes. A 16kbps GPRS mode where
only CS1 and CS2 are supported and an EGPRS mode where MCS1 to MCS9 are
supported. OsmoPCU offers support for both modes but since the 16kbps mode only
supports classic GPRS with CS1 and CS2 it is more of experimental interest
and shall not be discussed further. The following example will describe how
to configure the 64kbps mode with EGPRS.

In the following example we also expect that the user is already familliar
with the E1 configuration example above (see also: <<example_e1_cfg>>)

.OsmoBSC configured for single-TRX E1 Ericsson DUG20 with EGPRS
====
----
e1_input
 e1_line 0 driver dahdi
 e1_line 0 port 3
network
 network country code 1
 mobile network code 1
 encryption a5 0
 neci 1
 handover 0
 pcu-socket /tmp/pcu_bts <1>
 bts 0
  type rbs2000
  band GSM900
  om2000 version-limit oml gen 12 rev 10
  cell_identity 0
  location_area_code 0x0001
  training_sequence_code 7
  base_station_id_code 63
  ms max power 15
  cell reselection hysteresis 4
  rxlev access min 0
  channel allocator mode set-all ascending
  rach tx integer 9
  rach max transmission 7
  oml e1 line 0 timeslot 1 sub-slot full
  oml e1 tei 62
  gprs mode egprs <2>
  gprs routing area 0
  gprs network-control-order nc0
  gprs cell bvci 2
  gprs nsei 101
  gprs nsvc 0 nsvci 101
  gprs nsvc 0 local udp port 23100
  gprs nsvc 0 remote udp port 23000
  gprs nsvc 0 remote ip 127.0.0.1
  is-connection-list add 4 712 36 <3>
  trx 0
   rf_locked 0
   arfcn 123
   nominal power 42
   max_power_red 12
   rsl e1 line 0 timeslot 1 sub-slot full
   rsl e1 tei 0
   timeslot 0
    phys_chan_config CCCH+SDCCH4
    hopping enabled 0
    e1 line 0 timeslot 1 sub-slot full
   timeslot 1
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 3 sub-slot full <4>
   timeslot 2
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 4 sub-slot full
   timeslot 3
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 5 sub-slot full
   timeslot 4
    phys_chan_config TCH/F_TCH/H_SDCCH8_PDCH <5>
    hopping enabled 0
    e1 line 0 timeslot 6 sub-slot full
   timeslot 5
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 7 sub-slot full
   timeslot 6
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 8 sub-slot full
   timeslot 7
    phys_chan_config TCH/F
    hopping enabled 0
    e1 line 0 timeslot 9 sub-slot full
----
====

<1> This configures the PCU socket path (see also: <<cfg_bsc_co_located_pcu>>)

<2> This configures the general GPRS parameters. The configuration is no
different from BTS with built-in PCU.

<3> The Ericsson RBS2000/RBS6000 series has an built in “Interface Switch” (IS)
that offers flexible way to reconfigure the interconnection between the internal
components of the BTS and the external E1 line. Since 16kbps subslots cannot
supply the bandwidth required for EGPRS the IS must be configured to connect
the 64kbps interface of the TRU to the external E1 line. For a more detailed
description of the IS see <<cfg_ericsson_rbs_is>>.

<4> Since we are using the 64kbps TRU interface we must configure a full E1
timeslot per air interface time slot. For Speech this will have no effect on
the TRAU frame format. The only difference is that always the first 16kbps
subslot of the assigned E1 timeslot is used. OsmoMGW will be instructed
accordingly by OsmoBSC, so no re-configuration of OsmoMGW is required.

<5> In this example we will use air interface TS 4 as PDCH. As mentioned
earlier Ericsson RBS2000/RBS6000 supports the 'DYNAMIC/OSMOCOM' timeslot model.
PDCH timeslots must be configured as dynamic timeslots. It is not possible to
configure static PDCHs. Therefore the phys_chan_config must be set to
TCH/F_TCH/H_SDCCH8_PDCH in order to use the air interface timeslot as PDCH.

NOTE: As of March 2023 the BSC co-located PCU support for Ericsson RBS was
tested only with a single BTS. Even though OsmoBSC and OsmoPCU should be able
to handle multiple BTS, unexpected bahviour should be taken into account.

=== E1 Line number and MGCP trunk number
The switching of the voice channels is done via OsmoMGW, which acts as a media
converter between E1 and VoIP (RTP). OsmoBSC will use the E1 line number to
address the trunk via MGCP.

When configuring OsmoMGW, one needs to make sure that the trunk number that is
set up on OsmoMGW, matches the line number that is set up on OsmoBSC. When those
numbers mismatch the trunk cannot be addressed correctly.

.OsmoMGW trunk configuration that matches the OsmoBSC configuration above
====
----
  trunk 0
   rtp keep-alive once
   no rtp keep-alive
   line 0
----
====