aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2018-08-29neighbor_ident_vty.c: fix CI format, should be 16bitNeels Hofmeyr1-14/+14
In the 'lac-ci' and 'cgi' neighbor identity VTY parameters, fix the CI part to <0-65535>. Use 65535 as CI in the neighbor_ident.vty test to verify the range. Change-Id: Ie93bfe176b9d2d9445966e4ab0b928b9aa62a77f
2018-07-28cosmetic: rename bsc_api.h to gsm_08_08.hNeels Hofmeyr1-1/+1
See also I91922f557072d0fb8cfe213a8a7b50f3bb23dea0, which renames osmo_bsc_api.c to gsm_08_08.c. Change-Id: I7179eb27183ee213f8fc8d548895b67aa43dc6a2
2018-07-28cosmetic: reduce bsc_api.hNeels Hofmeyr1-0/+1
Remove as much as possible from bsc_api.h. Use '#pragma once'. Tweak head comment. BSC_API_CONN_POL_{ACCEPT,REJECT}: only user is static complete_layer3(), just use a bool return value instead. msc_connected(): only used in osmo_bsc_api.c, make static there. Instead of including gsm_data.h, declare structs opaquely, include stdint.h. codec_pref_test.c used this as indirect gsm_data.h include via osmo_bsc.h, include gsm_data.h there directly. osmo_bsc.h: instead of including bsc_api.h, declare opaque structs. gsm_04_08_rr.h: declare opaque structs to replace indirect include of gsm_data.h. Change-Id: Ia9c0f9828317236048e40ec9ecf9990592e2190a
2018-07-28cosmetic: dissolve bsc_api.cNeels Hofmeyr1-1/+0
gsm0808_page() is just a thin wrapper for rsl_paging_cmd(), the only caller is page_ms() from paging.c. Directly call rsl_paging_cmd() instead. Move gsm0808_cipher_mode() to the only caller in osmo_bsc_bssap.c, make static. Change-Id: Ib7ce026b52d4ba3e53a8b2824e74ea92432c48c5
2018-07-28create separate logging categories for lchan,ts,as FSMsNeels Hofmeyr1-0/+18
Change-Id: Ie889b8860a4a63c7c22ef65025f690d64cd7330c
2018-07-28lchan_fsm: split off lchan_rtp_fsm, establish RTP a bit earlierNeels Hofmeyr2-0/+2
Change-Id: Id7a4407d9b63be05ce63f5f2768b7d7e3d5c86fb
2018-07-28fix nanobts: timeslot FSM: use flags to remember OML,RSL statusNeels Hofmeyr1-0/+1
Before this patch, the timeslot FSM receives OML and RSL ready events. Afterwards, it relies on examining the RSL and OML status to match the received events. This doesn't work for the ip.access nanobts, which fails to change the CHANNEL OM's operational status even though it has sent an Opstart ACK. We receive OML CHANNEL Opstart ACK, but the mo's state left at OP_STATE=Disabled. We apparently cannot rely on the gsm_abis_mo state as assumed before this patch, since changing the state depends on each BTS vendor's OML implementation. Also, implementation wise, it is better to not include assumptions on RSL and OML implementations in the timeslot FSM. Simply receive the OML and RSL ready events and remember that they arrived in dedicated flags. Remove the no longer needed oml_is_ts_ready() callback from struct gsm_bts_model added in: commit 91aa68f762218906e45be4817c6ea54b480da5e1 "dyn TS: init only when both RSL and the Channel OM are established" I99f29d2ba079f6f4b77f0af12d9784588d2f56b3 This keeps osmo-bts operational while fixing ip.access nanobts, where the CHANNEL OM's state prevented the timeslot FSM from entering operation. Change-Id: I4843d03b3237cdcca0ad2041ef6895ff253d8419
2018-07-28large refactoring: use FSMs for lchans; add inter-BSC HONeels Hofmeyr10-98/+149
Add FSMs: - timeslot_fsm: handle dynamic timeslots and OML+RSL availability. - lchan_fsm: handle an individual lchan activation, RTP stream and release, signal the appropriate calling FSMs on success, failure, release. - mgw_endpoint_fsm: handle one entire endpoint with several CI. - assignment_fsm: BSSMAP Assignment Request. - handover_fsm: all of intra, inter-MO and inter-MT handover. Above FSMs absorb large parts of the gscon FSM. The gscon FSM was surpassing the maximum amount events (32), and it is more logical to treat assignment, handover and MGW procedures in separate FSMs. - Add logging macros for each FSM type: - LOG_TS() - LOG_LCHAN() - LOG_MGWEP(), LOG_CI() - LOG_ASSIGNMENT() - LOG_HO() These log with the osmo_fsm_inst where present. New style decision: logging without a final newline char is awkward, especially for gsmtap logging and when other logs interleave LOGPC() calls; we have various cases where the final \n goes missing, and also this invokes the log category checking N times instead of once. So I decided to make these macros *always* append a newline, but only if there is no final newline yet. I hope that the compiler optimizes the strlen() of the constant format strings away. Thus I can log with or without typing "\n" and always get an \n termination anyway. General: - replace osmo_timers, state enums and program-wide osmo_signal_dispatch() with dedicated FSM timeouts, states and events. - introduce a common way to handle Tnnn timers: gsm_timers.h/.c: struct T_def. These can be used (with some macro magic) to define a state's timeout once, and not make mistakes for each osmo_fsm_inst_state_chg(). Details: bsc_subscr_conn_fsm.c: - move most states of this FSM to lchan_fsm, assignment_fsm, handover_fsm and mgw_endpoint_fsm. - There is exactly one state for an ongoing Assignment, with all details handled in conn->assignment.fi. The state relies on the assignment_fsm's timeout. - There is one state for an ongoing Handover; except for an incoming Handover from a remote BSS, the gscon remains in ST_INIT until the new lchan and conn are both established. - move bssmap_add_lcls_status() to osmo_bsc_lcls.c abis_rsl.c: - move all dynamic timeslot logic away into timeslot_fsm. Only keep plain send/receive functions in abis_rsl.c - reduce some rsl functions to merely send a message, rename to "_tx_". - rsl_ipacc_mdcx(): add '_tx_' in the name; move parts that change the lchan state out into the lchan_fsm, the lchan->abis_ip.* are now set there prior to invoking this function. - move all timers and error/release handling away into various FSMs. - tweak ipa_smod_s_for_lchan() and ipa_rtp_pt_for_lchan() to not require an lchan passed, but just mode,type that they require. Rename to ipacc_speech_mode*() and ipacc_payload_type(). - add rsl_forward_layer3_info, used for inter-BSC HO MO, to just send the RR message received during BSSMAP Handover Command. - move various logging to LOG_LCHAN() in order to log with the lchan FSM instance. One drawback is that the lchan FSM is limited to one logging category, i.e. this moves some logging from DRR to DRSL. It might actually make sense to combine those categories. - lose LOGP...LOGPC logging cascades: they are bad for gsmtap logging and for performance. - handle_classmark_chg(): change logging, move cm2 len check out of the cm3 condition (I hope that's correct). - gsm48_send_ho_cmd(): split off gsm48_make_ho_cmd() which doesn't send right away, so that during inter-bsc HO we can make an RR Handover Command to send via the MSC to the remote BSS. assignment_fsm.c: - the Chan Mode Modify in case of re-using the same lchan is not implemented yet, because this was also missing in the previous implementation (OS#3357). osmo_bsc_api.c: - simplify bsc_mr_config() and move to lchan_fsm.c, the only caller; rename to lchan_mr_config(). (bsc_mr_config() used to copy the values to mr_bts_lv twice, once by member assignment and then again with a memcpy.) - During handover, we used to copy the MR config from the old lchan. Since we may handover between FR and HR, rather set the MR Config anew every time, so that FR rates are always available on FR lchans, and never on HR lchans. Depends: I03ee7ce840ecfa0b6a33358e7385528aabd4873f (libosmocore), I1f2918418c38918c5ac70acaa51a47adfca12b5e (libosmocore) Change-Id: I82e3f918295daa83274a4cf803f046979f284366
2018-07-28add gsm_timers, for Tnnn definitions usable by FSMsNeels Hofmeyr6-0/+14
Change-Id: If212fcd042051b6fa53484254223614c5b93a9c6
2018-07-28rename gsm_04_08_utils.[hc] to gsm_04_08_rrNeels Hofmeyr2-2/+2
"utils" suggests thin helpers to aid using a proper API, while this .c file actually *is* the proper RR API. Rename from "utils" to "rr". Change-Id: I0ffff63d57f03cb324df8e40e41caea5b55a2c85
2018-07-28fix / clarify rsl dtap cacheNeels Hofmeyr1-0/+3
In certain situations like handover or assignment, DTAP must not go out via RSL directly but is cached to be submitted later. Make sure that all RSL DTAP sending adheres to this: gscon_submit_rsl_dtap() is the new "public" API to request an RSL DTAP to be sent. Depending on the gscon's state, this ends up in the cache or is sent directly. When caching, there is no way to tell whether sending will succeed or not, so semantically it does not make sense to even return a result code. Just return void. Change all "public" callers to gscon_submit_rsl_dtap(). Merge gsm0808_submit_dtap() and submit_dtap() guts to gsm0808_send_rsl_dtap(), static in bsc_subscr_conn_fsm.c: directly send DTAP, assume a conn->lchan to be present, or otherwise trigger a BSSMAP Clear Request. The static submit_dtap() becomes a thin convenience wrapper. Move ho_dtap_cache* functions to bsc_subscr_conn_fsm.c and rename to gscon_dtap_cache_* -- they are not only for handover, also for assignment. Function gsm0808_submit_dtap() m Introduce function gscon_submit_rsl_dtap() Change-Id: I6ffd7aa641c8905292c769400048c96aa0949585
2018-07-28inter-BSC HO: neighbor_ident API: drop 9bit BSICNeels Hofmeyr3-171/+91
9-bit BSIC exist in the 3GPP specs, but we don't use them anywhere. Rather remove that choice from the API and UI. Change-Id: I29b92f47da2636d3a19f073755f9382fa98f9010
2018-07-28inter-BSC HO: add neighbor_ident API to manage neighbor-BSS-cellsNeels Hofmeyr8-0/+814
Depends: Ia71ba742108b5ff020997bfb612ad5eb30d04fcd (libosmocore) Change-Id: I0153d7069817fba9146ddc11214de2757d7d37bf
2018-07-22codec_pref: check bts codec supportPhilipp Maier2-13/+444
The vty option bts->codec-support allows the user to set the supported codecs per BTS level. However, those values are currently only used to make the handover decision but the logic that handles the BSSMAP ASSIGNMENT REQUEST does not check those flags. - Do not ignore bts->codec-support flags on BSSMAP ASSIGNMENT REQUEST Change-Id: I285234e9c81de74d9fb9907fca2c443b08537435 Closes: OS#3361
2018-07-22codec_pref: move match_codec_pref() to separate c-file and add unit-testPhilipp Maier5-0/+1246
At the moment there are three sources that may advertise a list of supported audio codec/rate settings. There is the MS that advertises advertises a speech codec list and the MSC that sends a channel type information element over A and there are also settings in the bsc configuration file that may restrict the codec/rate types that are allowed to use. The function match_codec_pref() looks at all of the three buckets and selects a codec that satisfies all three. This is already a somewhat complicated process, overit is very isolated, so lets give it its own c-file. Due to the lack of unit-tests it is very hard to make changes here so lets add also unit-test to make sure that regressions are catched early. - Put match_codec_pref() and all its helper functions into a separate c-file. - Add a unit test. Change-Id: Iabedfdcec8b99a319f2d57cbea45c5e36c7b6e29 Related: OS#3361
2018-07-21ho cfg: fix unit stringsNeels Hofmeyr1-14/+14
Change-Id: Ie98a68de207aea69befd24af3f302b6ef9e6f8e4
2018-06-10remove traces of osmo-bsc_nat in python test (osmoappdesc/test_runner)Harald Welte1-78/+0
Change-Id: I9127ddb7b29eb82defd3a8afac9c1dbfd424fb72
2018-06-08cosmetic: handover_test: add IMSI to subscr for loggingNeels Hofmeyr1-1/+11
Change-Id: I52fa8f3183c93ed362d8252d20daf00c60a117c8
2018-06-08cosmetic: bsc_subscr_alloc: log initial getNeels Hofmeyr1-0/+3
Instead of silently setting the use count to 1, instead increment with an explicit bsc_subsct_get(), which then logs the event along with the place that created the subscriber. Change-Id: Ia72f8010b7b2e1ca44e3b005c0f2c05f3eeae8d5
2018-06-07remove struct bsc_apiNeels Hofmeyr2-3/+27
struct bsc_api was used to provide an abstract API for both osmo-bsc and osmo-msc, between BSC and MSC. That's no longer needed, so get rid of it, to prevent code turbulences it creates for no reason. Change-Id: I3fd5888c63a0b4f95520a498320aa105a6d60579
2018-06-07dissolve libbsc: move all to src/osmo-bsc, link .o filesNeels Hofmeyr11-16/+75
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to allow linking from utils/* and ipaccess/* without pulling in unccessary dependencies. Some utilities use gsm_network and gsm_bts structs, which already include data structures for fairly advanced uses. Move initialization that only osmo-bsc needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so that the leaner tools can use the old gsm_* versions without the need to link everything (e.g. handover and lchan alloc code). In some instances, there need to be stubs if to cut off linking "just before the RSL level" and prevent dependencies from creeping in. - abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is osmo-bsc, the utils are merely concerned with OML, if at all. - paging_flush_bts(): ip.access nanobts models call this when the RSL link is dropped. Only osmo-bsc actually needs to do anything there. - on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related to OML, while this action to take on init would pull in RSL dependencies. utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests implement stubs inline where required. From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/. In order for this to work, the osmo-bsc subdir must be built before the other source trees. (An alternative would be to include the .c files as sources, but that would re-compile them in every source tree. Not a large burden really, but unless linking .o files gives problems, let's have the quicker build.) Minor obvious cleanups creep in with this patch, I will not bother to name them individually now unless code review asks me to. Rationale: 1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc is distracting. 2) Recently, ridiculous linking requirements have made adding new functions cumbersome, because libbsc has started depending on osmo-bsc/*.c implementations: on gscon FSM and bssap functions. For example, neither bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP message composition. It makes no sense to link the entire osmo-bsc to it, nor do we want to keep adding stubs to each linking realm. Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-06-07bsc_test: drop "scan to MSC" code pathNeels Hofmeyr1-7/+0
The TEST_SCAN_TO_MSC is completely unused, but still the code linked bsc_scan_bts_msg() for the unused code path. This is unlikely to ever be expanded. Remove TEST_SCAN_TO_MSC and reduce linking requirements. (I am this close to dropping the test entirely to avoid continuous linking annoyance, but ok, since nothing else tests timezones AFAIK, keeping it.) Change-Id: I27521950432e412f919cde811c9473557d0ec25e
2018-06-07tests: remove channel_testNeels Hofmeyr5-164/+0
Rationale: channel_test is trivial and useless, probably only exists as a legacy from openbsc.git. - it tests two printf()s of "(bts=45,trx=0,ts=3,ss=4)", hardly useful. - it tests ts_subslots() behavior for dyn ts, which will soon be replaced by a most trivial mapping that does no longer need complex dyn ts state evaluation (when introducing the new timeslot FSM to handle dyn TS switchover). Change-Id: Ib2232da8e7fa964b92492d7b778320401dc97703
2018-06-07tests: remove bssap_testNeels Hofmeyr6-246/+0
Rationale: - All it does is compose four Paging Requests and feed it into the osmo-bsc bssap_udt, and expects the cell identifier to be decoded properly. - To do so it employs a comparatively huge linking effort. This linking effort is becoming annoying in my ongoing work and is just not worth it. - We have comprehensive cell identifier tests in ttcn3, verifying that the proper cells are paged, and that actually for *all* cell identifier types. Change-Id: I07cf23b66de36cfa1142a11b9f85e9c0190ee314
2018-05-27Remove 'struct bsc_msc_connection' + fix IPA-encapsulated CTRLHarald Welte1-0/+4
The bsc_msc_connection dates back to the old pre-libosmo-sigtran days, and 90% of the field members weren't used at all (even the new sigtran specific ones!). Let's merge what remains into struct bsc_msc_data. As a side effect, the already dysfunctional "dest A.B.C.D" VTY command has been removed from the MSC node. There's quite a bit of fall-out in the CTRL interface, which was the code with strongest ties to bsc_msc_connection. This was resolved by properly porting CTRL handling over to libosmo-sigtran, meaning that an IPA/SCCPlite connected MSC can now again send CTRL GET/SET commands, and can also receive those selective few TRAPs that old osmo-bsc-sccplite also sent to its MSC[s]. Change-Id: I6b7354f3b23a26bb4eab12213ca3d3b614c8154f Related: OS#2012
2018-05-27remove remaining bits of osmo-bsc_natHarald Welte14-2503/+0
osmo-bsc_nat is too heavily tied into legacy SCCPlite code, as it is not using libosmo-sigtran/osmo_ss7 so far. It's also full of customer-specific code and it's shared use of some libbsc code here has been complicating osmo-bsc development. The current plan is to continue to use osmo-bsc_nat from openbsc.git for those legacy users that need it, and not use osmo-bsc_nat in new 3GPP AoIP setups. Should we ever get a strong demand for an AoIP based bsc_nat, we can still revisit this later. Change-Id: Ia05dc76336a64a7f08962843b9a7cc19f2c83387
2018-05-04resurrect meas_feed.c: vty, vty-testNeels Hofmeyr1-0/+19
At this point, meas-feed is usable again, however, osmo-bsc is not able to include the IMSI in every report like osmo-nitb did. In consequence, the meas-vis and meas-web tools are unable to handle the current measurement reports: these so far use the IMSI to list reports, and all reports without an IMSI are collapsed onto the same line, swapping values. So though osmo-bsc now sends usable measurement reports via meas-feed, two avenues to improve should be pursued: OS#3192: the visualization tools should use bts,ts,ss numbers, not IMSI. OS#2969: osmo-bsc should always know a mobile identity. Related: OS#2968 Change-Id: I186c7a995dd2b81746c32a58b55da64ed195a1ce
2018-04-17use osmo_init_logging2Pau Espin Pedrol3-5/+8
Change-Id: Ifbbfede185aec6573fe7d8bcb49dc5be9f7e7d0b
2018-04-16Cosmetic: Fix typo: Siganlling->SignallingKeith1-1/+1
Change-Id: I92b39eebfba396ee7690e99de09ee20593b7139d
2018-04-02cosmetic: remove dead codePhilipp Maier1-41/+0
There is a lot of dead code in osmo_bsc_msc.c that used to handle the IPA multiplexed SSCP lite A interface. - remove portions of the dead code - remove IPA Ping related VTY commands Change-Id: I5cf3fec31cc774c902f3cfe6d16fb85ef301694a
2018-03-28ctx cleanup: use non-NULL talloc ctx for osmo_init_logging2()Neels Hofmeyr7-15/+37
Fix various sanitizer complaints about memory leaks using a sanitizer build with gcc (Debian 7.3.0-12) 7.3.0. Also fix deprecation warnings on osmo_init_logging(). Depends: I216837780e9405fdaec8059c63d10699c695b360 (libosmocore) Change-Id: I970c6f8a0e36a8b63e42349dbc92baff649e5cef
2018-03-28cosmetic: gsm0408_test: drop unused arg from bts_init()Neels Hofmeyr1-7/+8
Change-Id: I0c59d7b3240cf7a8ae1677d237dca9dd364188cb
2018-03-28move init from gsm_bts_alloc_register() to gsm_bts_alloc(); fix gsm0408_testNeels Hofmeyr1-2/+2
gsm_bts_alloc() ought to do all static initialization, so that e.g. unit tests can use an initialized bts struct that is fully usable, just not registered at the gsm_network. For example, two INIT_LLIST_HEAD() and various system information data pointers (pointing to proper places within the same bts struct) should definitely never be omitted. This fixes the remaining errors of gsm0408_test's SI tests, as revealed by a sanitizer build using gcc (Debian 7.3.0-12) 7.3.0. Fixes: ../../../../src/osmo-bsc/src/libbsc/system_information.c:613:3: runtime error: null pointer passed as argument 1, which is declared to never be null Initializing the bts->si_common.rach_control results in different expected bytes for SI2. The initialized values are bts->si_common.rach_control.re = 1; /* no re-establishment */ bts->si_common.rach_control.tx_integer = 9; /* 12 slots spread - 217/115 slots delay */ bts->si_common.rach_control.max_trans = 3; /* 7 retransmissions */ bts->si_common.rach_control.t2 = 4; /* no emergency calls */ Causing a change to e5 04. 04 is t2 = 4, and the remaining values are verified by: uint8_t re :1, cell_bar :1, tx_integer :4, max_trans :2; >>> hex(1 + (9 << 2) + (3 << 6)) '0xe5' Change-Id: I13ef24bbe0f1fbe49465e67a0b67d6fd69fff3b1
2018-03-28fix gsm0408_test: properly free bts struct after each testNeels Hofmeyr2-10/+23
Add missing deletion of osmo_stat_item_group_free(bts->bts_statg). Add missing bts free after test_si_ba_ind(). Log deallocation, update expected test output. This fixes some of the errors of gsm0408_test's SI tests, as revealed by a sanitizer build using gcc (Debian 7.3.0-12) 7.3.0. Fixes: ================================================================= ==19273==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d0000004b8 at pc 0x7f1561a94621 bp 0x7ffe7a7a64a0 sp 0x7ffe7a7a6498 WRITE of size 8 at 0x60d0000004b8 thread T0 #0 0x7f1561a94620 in __llist_add ../../../src/libosmocore/include/osmocom/core/linuxlist.h:75 #1 0x7f1561a94620 in llist_add ../../../src/libosmocore/include/osmocom/core/linuxlist.h:90 #2 0x7f1561a94620 in osmo_stat_item_group_alloc ../../../src/libosmocore/src/stat_item.c:141 #3 0x5574f6a19935 in gsm_bts_alloc ../../../../src/osmo-bsc/src/libbsc/gsm_data.c:728 #4 0x5574f6a12920 in bts_init ../../../../src/osmo-bsc/tests/gsm0408/gsm0408_test.c:123 #5 0x5574f6a0ddb3 in test_si2q_e ../../../../src/osmo-bsc/tests/gsm0408/gsm0408_test.c:192 #6 0x5574f6a0ddb3 in main ../../../../src/osmo-bsc/tests/gsm0408/gsm0408_test.c:824 #7 0x7f156061aa86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21a86) #8 0x5574f6a10339 in _start (/n/s/dev/make/osmo-bsc/tests/gsm0408/gsm0408_test+0xfc339) Change-Id: I1ebbd8cc0622ce1a061e933813829b1f770072dc
2018-03-27change return type of page_subscriber() to voidStefan Sperling1-1/+1
We deliberately ignore errors from page_subscriber() so there is no point in having a non-void return value. Provide more context in the error message logged if paging failed. Add a comment in an implementation override of base_grace_paging_request() in the test suite to make return value semantics more clear. Change-Id: Ie18c2ba53d2055d3eaff8c9ed939eb844af6dd2e Related: I48f5efbcddd98e15256edfca06ba0ae6acb5bab1
2018-03-26bssap: Log non handled paging requestsPau Espin Pedrol1-1/+1
Return code in bssap_test is changed to ack it was sent and prevent the log from being printed. Change-Id: Ie8075d076cc34570fefce3beb577567707a29d4e
2018-03-22gsm0408_test: drop LAI encoding testNeels Hofmeyr2-28/+0
The LAI encoding test in gsm0408_test.c uses deprecated API, and a more thorough test for LAI encoding has been added in libosmocore/test/gsm0408/. Change-Id: I8a55d717ab15ba23943a2639accaadc33a4f731a
2018-03-17tests: handover_test.c: Add missing headerPau Espin Pedrol1-0/+2
Fixes following compilation warning: osmo-bsc/tests/handover/handover_test.c:48:83: warning: ‘struct mgcp_conn_peer’ declared inside parameter list will not be visible outside of this definition or declaration int __real_mgcp_conn_modify(struct osmo_fsm_inst *fi, uint32_t parent_evt, struct mgcp_conn_peer *conn_peer); ^~~~~~~~~~~~~~ Change-Id: I1b5e91adee3daaec71122a7691a214aa8240bce2
2018-03-16introduce an osmo_fsm for gsm_subscriber_connectionHarald Welte10-4/+104
In the current implementation of osmo-bsc, the subscriber connection is not handled (very) statefully. However, there is some state keeping in the code that handles the mgcp connection, but there are still to much loose ends which allow odd situations to happen, which then lead severe error situations (see also closes tags at the end) This commit adds a number of improvements to fix those problems. - Use an osmo-fsm to control the gsm_subscriber_connection state and make sure that certain operations can only take place at certain states (e.g let connection oriented SCCP traffic only pass when an SCCP connection actually exists. Remove the old osmo_bsc_mgcp.c code. Use the recently developed MGCP client FSM to handle the MGCP connections. Also make sure that stuff that already works does not break. This in particular refers to the internal handover capability and the respective unit-tests. See also OS#2823, OS#2768 and OS#2898 - Fix logic to permit assignment to a signalling channel. (OS#2762) - Introduce T993210 to release lchan + subscr_conn if MSC fails to respond The GSM specs don't have an explicit timer for this, so let's introdcue a custom timer (hence starting with 99). This timeout catches the following situation: * we send a SCCP CR with COMPL_L3_INFO from the MS to the MSC, * the MSC doesn't respond (e.g. SCCP routing failure, program down, ...) The MS is supposed to timeout with T3210, 3220 or 3230. But the BSC shouldn't trust the MS but have some timer on its own. SCCP would have a timer T(conn est), but that one is specified to be 1-2min and hence rather long. See also: OS#2775 - Terminate bsc_subscr_conn_fsm on SCCP N-DISC.ind from MSC If the MSC is disconnecting the SCCP channel, we must terminate the FSM which in turn will release all lchan's and other state. This makes TC_chan_rel_hard_rlsd pass, see also OS#2731 As a side-effect, this fixes TC_chan_act_ack_est_ind_refused(), where the MSC is answering with CREF to our CR/COMPL_L3. - Release subscriber connection on RLL RELEASE IND of SAPI0 on main DCCH The subscriber connection isn't really useful for anything after the SAPI0 main signalling link has been released. We could try to re-establish, but our best option is probably simply releasing the subscriber_conn and anything related to it. This will make TC_chan_rel_rll_rel_ind pass, see also OS#2730 This commit has been tested using the BSC_Tests TTCN3 testsuit and the following tests were passed: TC_chan_act_noreply TC_chan_act_ack_noest TC_chan_act_ack_est_ind_noreply TC_chan_act_ack_est_ind_refused TC_chan_act_nack TC_chan_exhaustion TC_ctrl TC_chan_rel_conn_fail TC_chan_rel_hard_clear TC_chan_rel_hard_rlsd TC_chan_rel_a_reset TC_rll_est_ind_inact_lchan TC_rll_est_ind_inval_sapi1 TC_rll_est_ind_inval_sapi3 TC_rll_est_ind_inval_sacch TC_assignment_cic_only TC_assignment_csd TC_assignment_ctm TC_assignment_fr_a5_0 TC_assignment_fr_a5_1_codec_missing TC_assignment_fr_a5_1 TC_assignment_fr_a5_3 TC_assignment_fr_a5_4 TC_paging_imsi_nochan TC_paging_tmsi_nochan TC_paging_tmsi_any TC_paging_tmsi_sdcch TC_paging_tmsi_tch_f TC_paging_tmsi_tch_hf TC_paging_imsi_nochan_cgi TC_paging_imsi_nochan_lac_ci TC_paging_imsi_nochan_ci TC_paging_imsi_nochan_lai TC_paging_imsi_nochan_lac TC_paging_imsi_nochan_all TC_paging_imsi_nochan_plmn_lac_rnc TC_paging_imsi_nochan_rnc TC_paging_imsi_nochan_lac_rnc TC_paging_imsi_nochan_lacs TC_paging_imsi_nochan_lacs_empty TC_paging_imsi_a_reset TC_paging_counter TC_rsl_drop_counter TC_classmark TC_unsol_ass_fail TC_unsol_ass_compl TC_unsol_ho_fail TC_err_82_short_msg TC_ho_int Authors: Harald Welte <laforge@gnumonks.org> Philipp Maier <pmaier@sysmocom.de> Neels Hofmeyr <neels@hofmeyr.de> Closes: OS#2730 Closes: OS#2731 Closes: OS#2762 Closes: OS#2768 Closes: OS#2775 Closes: OS#2823 Closes: OS#2898 Closes: OS#2936 Change-Id: I68286d26e2014048b054f39ef29c35fef420cc97
2018-03-08handover_test: explicitly wrap abis_rsl_sendmsg()Neels Hofmeyr2-2/+8
Until now, handover_test simply defines an abis_rsl_sendmsg() function to override the one from libosmo-babis. To me this amounts to implicit linker magic (aka luck). The common pattern we're using for this scenario is to explicitly wrap an existing function by instructing the linker. Also do this for abis_rsl_sendmsg() in handover_test.c to clarify. Change-Id: I05ce33a4e42bc82b9ce5060e2f811033f5a1f8d8
2018-03-07implement support for 3-digit MNC with leading zerosNeels Hofmeyr7-33/+27
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout the code base to be able to handle an MNC < 100 that has three digits (leading zeros). The changes to abis_test and gsm0408_test show that this code now handles 3-digit MNC correctly, by not dropping the leading zero as 0xf in the encoded PLMN. Re-implement CTRL commands 'mcc', 'mnc' and 'mcc-mnc-apply' to preserve the presence of the third digit of the MNC. Always reply with all leading zeros. Adjust the expected results in ctrl_test_runner.py, to show that it works. In VTY and CTRL, the parsing of MCC and MNC is inherently made stricter by use of osmo_{mcc,mnc}_from_str() -- they will no longer allow surplus characters and detect errno returned by strtol() (in contrast to atoi()). Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore), Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore), I020a4f11791c61742a3d795f782805f7b7e8733e (libosmocore) Change-Id: I8e722103344186fde118b26d8353db95a4581daa
2018-03-05cosmetic: bsc_network_init(): imply default 001-01 PLMNNeels Hofmeyr5-5/+5
All callers pass mcc=1, mnc=1, so just have it as default. (Prepare for net->country_code etc to be replaced by net->plmn) Change-Id: Ic16bc0bab3f2d4721e86a1a04f9d9f988d777df2
2018-03-05gsm48_ra_id_by_bts(): struct gsm48_ra_id* instead of bufNeels Hofmeyr1-1/+1
Move from using deprecated gsm48_construct_ra(), which uses a buf, to gsm48_encode_ra(), which uses a gsm48_ra_id argument. Pass struct gsm48_ra_id around instead of a buf. struct gsm48_ra_id is the "encoded" representation of the bytes in a typical MCC-MNC-LAC-RAC (04.08 Routing Area Id IE, 3GPP TS 24.008 § 10.5.5.15). Using the struct spares using magic numbers for byte offsets. In the process, fix a sanitizer warning for unaligned access by using memcpy() instead of pointer assignment: osmo-bsc/src/libbsc/abis_nm.c:2857:27: runtime error: store to misaligned address 0x7ffe8e0d6695 for type 'uint16_t', which requires 2 byte alignment Note that (besides removing a now unnecessary cast) the gsm0408_test and abis_test tests of RAI / CGI encoding remain stable, which indicates that the new code is still correct. Change-Id: I0d3908fb8ca1e2e669d257b5d59b40675fa85d06
2018-03-05ctrl_test_runner: add tests for 3-digit MNCNeels Hofmeyr1-0/+38
Expand MCC-MNC test cases: show that the CTRL interface currently does not preserve the third digit of the MNC if it is zero. These will be fixed by I8e722103344186fde118b26d8353db95a4581daa Change-Id: I5b097dbb6329f284e3b4914a744d5c3ad628f715
2018-03-05add test for abis_nm_ipaccess_cgi()Neels Hofmeyr2-0/+94
Change-Id: I90fefd5073ee07fc975a810859a32142b8b27904
2018-03-05add test for gsm48_ra_id_by_bts()Neels Hofmeyr2-0/+121
Change-Id: I7bd55126848ed2c246d64cf672e1e6772da64be7
2018-02-27osmo-bts/nanobts: Set RACH_Busy Threshold to -90 dBmHarald Welte2-3/+3
In the past we used to set this to "-10 dBm" which means that basically no RACH ever passed that treshold and in the associated CCCH LOAD IND the number of busy slots was always zero. Let's set the default to -90dBm. The user can of course always configure a different value in the VTY. This means that now any RACH slot signal level >= 90 dBm counts as "busy" in those CCCH LOAD IND (RACH). Change-Id: Ib9cbb786d19acc74f0951930b0dc9284854c6000 Closes: OS#3004 Related: OS#3003
2018-02-21HO: fix minor issues found by coverityNeels Hofmeyr1-13/+13
handover_decision_2: - lchan->conn should never be NULL, but if it is, don't crash in LOGPHO* macros. - make certain to avoid modulo-zero. It's cosmetic since that config item is not allowed to be zero. handover_test: - check return value of gsm_generate_si(). - safer evaluation of main()'s argv. Fixes: CID#182929, CID#182928, CID#182927, CID#182926 Change-Id: I68e8ed3a1e8659edb47ac3e8a10508f17a3f5670
2018-02-20fix handover_test link errorStefan Sperling1-1/+1
Fix undefined references during link stage when building handover_test. The archive libbsc.a needs to be listed before the various .so files. Change-Id: Ie7e1d4815d72b8e0bbc6ccd68078a78de19d73b0
2018-02-19HO: vty: clearly mark 'handover foo' as legacy alias for 'handover1 foo'Neels Hofmeyr1-1/+0
The ALIAS_DEPRECATED causes the legacy commands to no longer show up in the command listing, hence making it more clear which commands are general and which are for hodec1 only: == BEFORE: == OsmoBSC(config-net)# list ... handover (0|1|default) handover algorithm (1|2|default) handover1 window rxlev averaging (<1-10>|default) ... handover2 window rxlev averaging (<1-10>|default) ... handover2 retries (<0-9>|default) handover window rxlev averaging (<1-10>|default) <-- legacy handover window rxqual averaging (<1-10>|default) handover window rxlev neighbor averaging (<1-10>|default) handover power budget interval (<1-99>|default) handover power budget hysteresis (<0-999>|default) handover maximum distance (<0-9999>|default) handover2 congestion-check (disabled|<1-999>|now) OsmoBSC(config-net)# handover ? 0 Disable in-call handover 1 Enable in-call handover default Enable/disable handover: Use default (0), remove explicit setting on this node algorithm Choose algorithm for handover decision window Measurement averaging settings <-- legacy power Neighbor cell power triggering maximum Maximum Timing-Advance value (i.e. MS distance) before triggering HO OsmoBSC(config-net)# handover? handover Handover general config <-- unchanged == AFTER: == OsmoBSC(config-net)# list ... handover (0|1|default) handover algorithm (1|2|default) handover1 window rxlev averaging (<1-10>|default) ... handover2 window rxlev averaging (<1-10>|default) ... handover2 retries (<0-9>|default) handover2 congestion-check (disabled|<1-999>|now) <-- no more legacy OsmoBSC(config-net)# handover ? 0 Disable in-call handover 1 Enable in-call handover default Enable/disable handover: Use default (0), remove explicit setting on this node algorithm Choose algorithm for handover decision <-- no more legacy OsmoBSC(config-net)# handover? handover Handover general config <-- unchanged The "Legacy" doc string actually never shows on the VTY console, but it will show in the reference manual. (Even with ALIAS(), a 'handover?' would only show the "Handover general config" doc string, so no loss there from using ALIAS_DEPRECATED().) Change-Id: I86be674d82242f9ca73a4d0040015c1c79f2422d