OpenBTS: Database SQLite

From OnnoWiki
Revision as of 19:38, 12 February 2012 by Onnowpurbo (talk | contribs) (New page: External Databases OpenBTS P2.8 uses a set of sqlite3 database files to make its configuration and status information available to external applications. Sqlite3 is a self-contained, serve...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External Databases OpenBTS P2.8 uses a set of sqlite3 database files to make its configuration and status information available to external applications. Sqlite3 is a self-contained, serverless SQL database, originally developed for guided missile systems and now used many well-known applications, including the Blackberry, Symbian, iOS and Android operating systems. For more information on sqlite3, see the www.sqlite.org web site. 4.1 Editing Sqlite3 Databases The following methods can be used to edit or view the OpenBTS sqlite3 database files: • The sqlite3 command line tool. Range Networks access points include the sqlite3 command line tool that can be used to inspect and modify these databases using SQL syntax. – The database can be manipulated directly using SQL syntax in real time. – For offline editing, sqlite3 can export SQL code to a text file with “.dump”. The text can then be edited and reimported with “.read”. • Third-party database editors. Generic GUI-based editors are available for sqlite3 database files. Examples: – “SQLite Database Browser” – A free browser for OS X and Linux available from sourceforge.net. – “RazorSQL” – A commercial database GUI available from razorsql.com. – Firefox – Mozilla offers a free Firefox add-on called SQLite Manager that allows the Firefox web browser to be used to view and edit sqlite3 databases, available from addons.mozilla.org. • OpenBTS itself. The OpenBTS CLI “config” and “unconfig” commands (Section 5.5) can be used to edit the configuration table (Section 4.2) in real time. Configuration changes from the CLI are written back the to OpenBTS.db database and are persistent. 4.2 The Configuration Table The parameters that control the OpenBTS application are stored in a database table called the configura- tion table. Some parameters are dynamic, meaning that a parameter change will have an immediate effec. 24 4.2. THE CONFIGURATION TABLE 25 Some of these parameters are static and changes to them do not take effect until OpenBTS is restarted. Some of these static parameters are matched to the hardware of a specific implementation and should not be changed at all. Comments within the configuration database describe each parameter and under what conditions it can be changed. Flags within the database schema indicate which parameters are static. The schema for the P2.8 configuration table is: CREATE TABLE CONFIG ( KEYSTRING TEXT UNIQUE NOT NULL, VALUESTRING TEXT, STATIC INTEGER DEFAULT 0, OPTIONAL INTEGER DEFAULT 0, COMMENTS TEXT DEFAULT ’’ ) Note that the database itself contains comments, available to the operator at all times and repeated in this manual. To change a dynamic configuration parameter in real time, edit the table using one of the methods described in Section 4.1. The effect will be immediate, although in-progress transactions may continue to use the parameters with which they started. (For example, a change in SIP.Proxy.Speech will not affect in-progress telephone calls, but any new calls will use the new proxy.) To change a static configuration parameter. edit the table using one of the methods described in Section 4.1 and then restart the OpenBTS application. In standard-configuration embedded Linux systems, this restart can be accomplished with the “exit” command, described in Section 5.5.8 or by rebooting the BTS unit. In some cases, NULL is a valid value for a configuration parameter. In SQL terminology, the NULL value is a special tag that indicates that a value is not defined. This is not the same as the string “NULL”, which is an actual string value with a value of “NULL”. To make a value NULL from the CLI, use the “unconfig” command. The configuration parameters are listed here briefly, but some parameters of particular importance are covered in later sections. • CLI.Prompt – Prompt for the OpenBTS command line interface. • Control.Emergency.Destination.Host – SIP destination host to be used for the ”To:” header of emer- gency calls. This host may be different from the address given for SIP.Proxy.Emergency. • Control.Emergency.Destination.User – SIP destination user or extension to be used for the ”To:” header of emegency calls. IMS specifies ”sos”, but correct value must be matched to your switch configuration and PSAP interface. • Control.Emergency.GatewaySwitch – Gateway SIP switch for inbound calls from other networks. This host is used to form the return path for emergency calls, so it should be a host address that will route from your serving PSAP. • Control.Emergency.Geolocation – If defined, send this location as an RFC-4119 XML GEOPRIV object during SIP emergency call establishment. Format is dd:mm:ss[NS] ddd:dd:dd[EW]. • Control.Emergency.QueueTime – Maximum time to wait for a channel to open up for an emegency call in a congested system, in milliseconds. 26 CHAPTER 4. EXTERNAL DATABASES • Control.Emergency.RFC5031 – If not NULL, use the RFC-5031 URN sip:sos@SIP.Proxy.Emergency as the request URN for outbound emergency calls over SIP, regardless of the value of Emergency.Destination.User. The ”To:” header will still be Emergency.Destination.User@Emergency.Destination.Host. • Control.Emergency.Source.User – SIP identity to use if no IMSI is available. IMS specifies ”anony- mous” but other values might be more useful depending on your configuration. • Control.GSMTAP.TargetIP – Target IP address for GSMTAP packets; the IP address of Wireshark, if you use it for GSM. • Control.LUR.AttachDetach – Attach/detach flag. Set to 1 to use attach/detach procedure, 0 other- wise. This will make initial LUR more prompt. It will also cause an un-regstration if the handset powers off and really heavy LUR loads in areas with spotty coverage. • Control.LUR.CachedAuthentication – If not NULL, use RAND-SRES pairs cached in the TMSI table for authentication. If this method is used, it is important that the TMSI Table be in persistent storage. • Control.LUR.DefaultAuthenticationAccept – If not NULL, provisioned handsets will be accepted for authentication in the absence of any defined authentication method. For commercial networks this value should probably be NULL. • Control.LUR.FailedRegistration.Message – If defined, send this text message, followed by the IMSI, to unprovisioned handsets that are denied registration. • Control.LUR.FailedRegistration.ShortCode – The return address for the failed registration message. If the message is defined, this must also be defined. • Control.LUR.NormalRegistration.Message – If defined, send this text message, followed by the IMSI, to provisioned handsets when they attach on Um. • Control.LUR.NormalRegistration.ShortCode – The return address for the normal registration mes- sage. If the message is defined, this must also be defined. • Control.LUR.OpenRegistration – A regular expression. If not NULL, allow unprovisioned handsets with matching IMSIs to attach in Um. • Control.LUR.OpenRegistration.Message – If defined, send this text message, followed by the IMSI, to unprovisioned handsets when they attach on Um due to open registration. • Control.LUR.OpenRegistration.ShortCode – The return address for the open registration message. If the message is defined, this must also be defined. • Control.LUR.QueryClassmark – If not NULL, query every MS for classmark during LUR. • Control.LUR.QueryIMEI – If not NULL, query every MS for IMSI during LUR. • Control.LUR.SR-HTTPAuthentication – If not NULL, use the HTTP interface of the subscriber registry server for authentication. • Control.LUR.SendTMSIs – If not NULL, send new TMSI assignments to handsets that are allowed to attach. 4.2. THE CONFIGURATION TABLE 27 • Control.LUR.UnprovisionedRejectCause – Reject cause for location updating failures for unprovi- sioned phones. Reject causes come from GSM 04.08 10.5.3.6. Reject cause 0x04, IMSI not in VLR, is usually the right one. • Control.NumSQLTries – Number of times to retry SQL queries before declaring a database access failure. • Control.Reporting.PhysStatusTable – File path for channel status reporting database. Static. • Control.Reporting.TMSITable – File path for TMSITable database. Static. • Control.TMSITable.MaxAge – Maximum allowed age for a TMSI in hours. • Control.TMSITable.MaxSize – Maximum size of TMSI table before oldest TMSIs are discarded. • Control.TestCall.Port – Port for exchanging L3 packets with the testcall feature. • Control.VEA – If not NULL, user very early assignment for speech call establishment. See GSM 04.08 Section 7.3.2 for a detailed explanation of assignment types. If VEA is selection, GSM.CellSelection.NECI should be set to 1. See GSM 04.08 Sections 9.1.8 and 10.5.2.4 for an explanation of the NECI bit. • GSM.CCCH.AGCH.QMax – Maximum number of access grants to be queued for transmission on AGCH before declaring congrestion. • GSM.CCCH.CCCH-CONF – CCCH configuration type. See GSM 10.5.2.11 for encoding. Value of 1 means we are using a C-V beacon. Any other value selects a C-IV beacon. • GSM.CCCH.PCH.Reserve – Number of CCCH subchannels to reserve for paging. • GSM.CellSelection.CELL-RESELECT-HYSTERESIS – Cell Reselection Hysteresis. See GSM 04.08 10.5.2.4, Table 10.5.23 for encoding. Encoding is 2N dB, values of N are 0...7 for 0...14 dB. • GSM.CellSelection.MS-TXPWR-MAX-CCH – Cell selection parameters. See GSM 04.08 10.5.2.4. • GSM.CellSelection.NCCsPermitted – NCCs Permitted. An 8-bit mask of allowed NCCs. Unless you are coordinating with another carrier, this should probably just select your own NCC. • GSM.CellSelection.NECI – NECI, New Establishment Causes. This must be set to ”1” if you want to support very early assignment. See GSM 04.08 10.5.2.4, Table 10.5.23 and 04.08 9.1.8, Table 9.9. • GSM.CellSelection.Neighbors – ARFCNs of neighboring cells. • GSM.CellSelection.RXLEV-ACCESS-MIN – Cell selection parameters. See GSM 04.08 10.5.2.4. • GSM.Channels.C1sFirst – If not NULL, allocate C-I slots first, starting at C0T1. Otherwise, allocate C-VII slots first. Static. • GSM.Channels.NumC1s – Number of Combination-I timeslots to configure. The C-I slot carries a single full-rate TCH, used for speech calling. Static. • GSM.Channels.NumC7s – Number of Combination-VII timeslots to configure. The C-VII slot carries 8 SDCCHs, useful to handle high registration loads or SMS. If C0T0 is C-IV, you must have at least one C-VII also. Static. 28 CHAPTER 4. EXTERNAL DATABASES • GSM.Identity.BSIC.BCC – GSM basestation color code; lower 3 bits of the BSIC. BCC values in a multi-BTS network should be assigned so that BTS units with overlapping coverage do not share a BCC. This value will also select the training sequence used for all slots on this unit. • GSM.Identity.BSIC.NCC – GSM network color code; upper 3 bits of the BSIC. Assigned by your national regulator. Must be distinct from NCCs of other GSM operators in your area. • GSM.Identity.CI – Cell ID, 16 bits. Should be unique. • GSM.Identity.LAC – Location area code, 16 bits, values 0xFFxx are reserved. For multi-BTS net- works, assign a unique LAC to each BTS unit. (That is not the normal procedure in conventional GSM networks, but is the correct procedure in OpenBTS networks.) • GSM.Identity.MCC – Mobile country code, 2 or 3 digits. Defined in ITU-T E.212. • GSM.Identity.MNC – Mobile network code; Must be 3 dgits. Assigned by your national regulator. • GSM.Identity.ShortName – Network short name, displayed on some phones. Optional but must be defined if you also want the network to send time-of-day. • GSM.Identity.ShowCountry – If not NULL, tell the phone to show the country name based on the MCC. • GSM.MS.Power.Damping – Damping value for MS power control loop. • GSM.MS.Power.Max – Maximum commanded MS power level in dBm. • GSM.MS.Power.Min – Minimum commanded MS power level in dBm. • GSM.MS.TA.Damping – Damping value for timing advance control loop. • GSM.MS.TA.Max – Maximum allowed timing advance in symbol periods. Ignore RACH bursts with delays greater than this. Can be used to limit service range. • GSM.MaxSpeechLatency – Maximum allowed speech buffering latency, in 20 ms frames. If the jitter is larger than this delay, frames will be lost. • GSM.RACH.AC – Access class flags. This is the raw parameter sent on the BCCH. See GSM 04.08 10.5.2.29 for encoding. Set to 0 to allow full access. If you do not have proper PSAP integration, set to 0x0400 to indicate no support for emergency calls. • GSM.RACH.MaxRetrans – Maximum RACH retransmission attempts. This is the raw parameter sent on the BCCH. See GSM 04.08 10.5.2.29 for encoding. • GSM.RACH.TxInteger – Parameter to spread RACH busts over time. This is the raw parameter sent on the BCCH. See GSM 04.08 10.5.2.29 for encoding. • GSM.RADIO-LINK-TIMEOUT – L1 radio link timeout. This is the raw parameter sent on the BCCH; see GSM 10.5.2.3 for encoding. Should be coordinated with T3109. • GSM.RRLP.ACCURACY – Requested accuracy of location request. K in 10(1.1**K-1). See 3GPP 03.32, sect 6.2 • GSM.RRLP.ALMANAC.REFRESH.TIME – How often the almanac is refreshed, in hours 4.2. THE CONFIGURATION TABLE 29 • GSM.RRLP.ALMANAC.URL – URL of almanac source. • GSM.RRLP.EPHEMERIS.REFRESH.TIME – How often the ephemeris is refreshed, in hours. • GSM.RRLP.EPHEMERIS.URL – URL of ephemeris source. • GSM.RRLP.RESPONSETIME – Mobile timeout. (OpenBTS timeout is 130 sec = max response time + 2.) N in 2**N. See 3GPP 04.31 sect A.2.2.1 • GSM.RRLP.SEED.ALTITUDE – Seed altitude in meters wrt geoidal surface. • GSM.RRLP.SEED.LATITUDE – Seed latitude in degrees. -90 (south pole) .. +90 (north pole) • GSM.RRLP.SEED.LONGITUDE – Seed longitude in degrees. -180 (west of greenwich) .. 180 (east) • GSM.RRLP.SERVER.URL – URL of RRLP server. • GSM.Radio.Band – The GSM operating band. Valid values are 850 (GSM850), 900 (PGSM900), 1800 (DCS1800) and 1900 (PCS1900). For most Range models, this value is dictated by the hardware and should not be changed. Static. • GSM.Radio.C0 – The C0 ARFCN. Static. • GSM.Radio.MaxExpectedDelaySpread – Expected worst-case delay spread in symbol periods, roughly 3.7 us or 1.1 km per unit. • GSM.Radio.PowerManager.MaxAttenDB – Maximum transmitter attenuation level, in dB wrt full scale on the D/A output. This sets the minimum power output level in the output power control loop. • GSM.Radio.PowerManager.MinAttenDB – Minimum transmitter attenuation level, in dB wrt full scale on the D/A output. This sets the maximum power output level in the output power control loop. • GSM.Radio.PowerManager.NumSamples – Number of samples averaged by the output power control loop. • GSM.Radio.PowerManager.SamplePeriod – Sample period for the output power control loop. • GSM.Radio.PowerManager.TargetT3122 – Target value for T3122, the random access hold-off timer, for the power control loop. • GSM.Radio.RSSITarget – Target uplink RSSI for MS power control loop, in dB wrt to A/D full scale. Should be 6-10 dB above the noise floor. • GSM.Radio.RxGain – Receiver gain setting in dB. Ideal value is dictacted by the hardware. This database parameter is static but the receiver gain can be modified in real time with the CLI rxgain command. Static. • GSM.Timer.T3113 – Paging timer T3113 in ms. This is the timeout for a handset to respond to a paging request. This should usually be the same as SIP.Timer.B in your VoIP network. • GSM.Timer.T3122Max – Maximum allowed value for T3122, the RACH holdoff timer, in milliseconds. • GSM.Timer.T3122Min – Minimum allowed value for T3122, the RACH holdoff timer, in milliseconds. 30 CHAPTER 4. EXTERNAL DATABASES • GSM.Timer.T3212 – Registration timer T3212 period in minutes. Should be a factor of 6. Set to 0 to disable periodic registration. Should be smaller than SIP registration period. • Log.Alarms.Max – Maximum number of alarms to remember inside the application. • Log.Level – Default logging level when no other level is defined for a file. • Log.Level.CallControl.cpp – Default configuration logs a trace at L3. • Log.Level.MobilityManagement.cpp – Default configuration logs a trace at L3. • Log.Level.RadioResource.cpp – Default configuration logs a trace at L3. • Log.Level.SMSControl.cpp – Default configuration logs a trace at L3. • NTP.Server – NTP server(s) for time-of-day clock syncing. For multiple servers, use a space-delimited list. If left undefined, NTP will not be used, but it is strongly recommended. • RTP.Range – Range of RTP port pool. Pool is RTP.Start to RTP.Range-1. Static. • RTP.Start – Base of RTP port pool. Pool is RTP.Start to RTP.Range-1. Static. • SIP.DTMF.RFC2833 – If not NULL, use RFC-2833 (RTP event signalling) for in-call DTMF. • SIP.DTMF.RFC2833.PayloadType – Payload type to use for RFC-2833 telephone event packets. If SIP.DTMF.2833 is defined, this must also be defined. • SIP.DTMF.RFC2967 – If not NULL, use RFC-2967 (SIP INFO method) for in-call DTMF. • SIP.Local.IP – IP address of the OpenBTS machine as seen by its proxies. If these are all local, this can be localhost. Static. • SIP.Local.Port – IP port that OpenBTS uses for its SIP interface. Static. • SIP.MaxForwards – Maximum allowed number of referrals. • SIP.Proxy.Emergency – The IP host and port of the proxy to be used for emergency calls. • SIP.Proxy.Registration – The IP host and port of the proxy to be used for registration and authen- tication. This is the subscriber registry, for example. • SIP.Proxy.SMS – The IP host and port of the proxy to be used for text messaging. This is smqueue, for example. • SIP.Proxy.Speech – The IP host and port of the proxy to be used for normal speech calls. This is Asterisk, for example. • SIP.RegistrationPeriod – Registration period in minutes for MS SIP users. Should be longer than GSM T3212. • SIP.SMSC – The SMSC handler in smqueue. This is the entity that handles full 3GPP MIME- encapsulted TPDUs. If not defined, use direct numeric addressing. Normally the value is NULL if SMS.MIMIEType is ”text/plain” or ”smsc” if SMS.MIMEType is ”application/vnd.3gpp”. • SIP.Timer.A – INVITE retransmit period in ms. 4.3. TMSI TABLE 31 • SIP.Timer.B – INVITE transaction timeout in ms. This value should usually match GSM.Timer.T3113. • SIP.Timer.E – Non-INVITE initial request retransmit period in ms. • SIP.Timer.F – Non-INVITE initial request timeout in ms. • SIP.Timer.H – ACK timeout period in ms. • SIP.Timer.I – ACK retransmit period in ms. • SIP.Timer.J – Non-INVITE non-initial request retransmit period in ms. • SIP.myPort – Port used by the SIP Authentication Server • SMS.DefaultDestSMSC – Use this to fill in L4 SMSC address in SMS submission. • SMS.FakeSrcSMSC – Use this to fill in L4 SMSC address in SMS delivery. • SMS.MIMEType – This is the MIME Type that OpenBTS will use for RFC-3428 SIP MESSAGE payloads. Valid values are ”application/vnd.3gpp.sms” and ”text/plain”. • SubscriberRegistry.A3A8 – URL of upstream subscriber registry server. Blank (not NULL) if there is none. • SubscriberRegistry.HTTP.Server – URL of the subscriber registry server. • SubscriberRegistry.Manager.Title – Title of subscriber registry database manager web page. • SubscriberRegistry.Manager.Url – URL of the subscriber registry database manager. • SubscriberRegistry.Manager.VisibleColumns – Field names in subscriber registry visible in the database manager. • SubscriberRegistry.db – The location of the sqlite3 database holding the subscriber registry. • TRX.IP – IP address of the transceiver application. Static. • TRX.Port – IP port of the transceiver application. Static. • TRX.RadioFrequencyOffset – Fine-tuning adjustment for the transceiver. Static. 4.3 TMSI Table To reduce dependence on a backhaul link, OpenBTS tracks TMSIs internally. To accomplish this, OpenBTS tracks TMSI-IMSI relationships in an sqlite3 database table called the TMSI table. TMSIs are assigned by a counter in increasing order. OpenBTS allocates a TMSI in the TMSI table for every MS that sends a Location Updating Request, whether the MS is allowed to register or not. The TMSI table is treated as read-write by OpenBTS but should be treated as read-only by other ap- plications. The path of the database file used for this table is defined in the configuration parameter Control.DBPath.TMSITable. In flash-based systems, this table should be stored in a ramdisk partition and its standard location is in /var/run. The schema is: 32 CHAPTER 4. EXTERNAL DATABASES CREATE TABLE IF NOT EXISTS TMSI_TABLE ( TMSI INTEGER PRIMARY KEY AUTOINCREMENT -- this value is used as the TMSI CREATED INTEGER NOT NULL, -- Unix time of record creation ACCESSED INTEGER NOT NULL, -- Unix time of last encounter IMSI TEXT UNIQUE NOT NULL, -- IMSI of the SIM IMEI TEXT, -- IMEI of the MS, if requested L3TI INTEGER DEFAULT 0, -- L3 transaction identifier last used with this MS A5_SUPPORT INTEGER, -- encryption support in the MS, if requested POWER_CLASS INTEGER, -- power class of the MS. if requested OLD_TMSI INTEGER, -- previous TMSI from another cell or network PREV_MCC INTEGER, -- previous network MCC PREV_MNC INTEGER, -- previous network MNC PREV_LAC INTEGER, -- previous network LAC RANDUPPER INTEGER -- cached authentication token RANDLOWER INTEGER -- cached authentication token SRES INTEGER, -- cached authentication token DEG_LAT FLOAT, -- cached RRLP result DEG_LONG FLOAT -- cached RRLP result ) 4.4 Channel Table OpenBTS reports real-time physical status information for active dedicated channels to an external sqlite3 database table called PHYSTATUS. This table is treated as write-only by OpenBTS but should be treated as read-only by other applications. The entry for a channel is updated every time a system information message is received on the channel’s associated SACCH. The path of the database file used for this table is defined in the configuration parameter GSM.DBPath.PhysStatusTable. The schema is: CREATE TABLE IF NOT EXISTS PHYSTATUS ( CN_TN_TYPE_AND_OFFSET STRING PRIMARY KEY, -- cross-refs TRANSACTION_TABLE ARFCN INTEGER DEFAULT NULL, -- actual ARFCN ACCESSED INTEGER DEFAULT 0, -- Unix time of last update RXLEV_FULL_SERVING_CELL INTEGER DEFAULT NULL, -- from most recent measurement report RXLEV_SUB_SERVING_CELL INTEGER DEFAULT NULL, -- from most recent measurement report RXQUAL_FULL_SERVING_CELL_BER FLOAT DEFAULT NULL, -- from most recent measurement report RXQUAL_SUB_SERVING_CELL_BER FLOAT DEFAULT NULL, -- from most recent measurement report RSSI FLOAT DEFAULT NULL, -- RSSI relative to full scale input TIME_ERR FLOAT DEFAULT NULL, -- timing advance error in symbol periods TRANS_PWR INTEGER DEFAULT NULL, -- MS tx power in dBm TIME_ADVC INTEGER DEFAULT NULL, -- MS timing advance in symbol periods FER FLOAT DEFAULT NULL -- uplink FER ) The CN TN TYPE AND OFFSET field is a channel description string of the form C<n>T<n> <channelType>-<subchannelIndex> 4.4. CHANNEL TABLE For example • “C0T1 TCH/F” is a full rate traffic channel on timeslot 1 of the C0 ARFCN and • “C0T0 SDCCH-0/4” is the #0 SDCCH (of 4 available) on C0T0. Strings of the same format are used in the transaction table.




Pranala Menarik

Persiapan Hardware

OpenBTS 2.6

OpenBTS 2.8

Ettus E110

Lain Lain

Catatan Legal dan Pendukung

Catatan Sejarah