aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2021-02-19gprs_ns2: implement a simple load sharing for UDPAlexander Couzens2-0/+102
Implement the load sharing based on modulo of the LSP. As long the gprs_ns2 doesn't support the resource distribution function (48.016 ยง 4.4a) this simple approach is good enought. Fixes: OS#4836 Change-Id: I8c2fe5d647694886ac600470fca6ea5d5d210a85
2021-02-19gprs_ns2_vty: add optional argument signalling and data weights to `nsvc udp`Alexander Couzens1-0/+29
A static configured UDP NSVC can have signalling and data weights Related: SYS#5354 Change-Id: Id363937c64e786c55e3136401ebdb44052415e0f
2021-02-19gprs_ns2: rework IP-SNS bindsAlexander Couzens1-0/+1
Introduce a `ip-sns-bind BINDID` vty command within a `nse` vty object. The ip-sns-bind defines the binds which will be used by the dynamic configuration with IP-SNS. This is only the first part which only uses the binds when doing a new SNS configuration. The outgoing add procedure will be supported in a later patch when the SNS fsm supports outgoing procedures. This is a behaviour change of the API and must be synchronized with the osmo-pcu. Otherwise SNS won't work with osmo-pcu. Related: SYS#5354 Change-Id: I9ab8092bf286e7d90e92f5702a5404425e959c84
2021-02-18gsm: Introduce API osmo_gsm48_rest_octets_si13_decodePau Espin Pedrol4-0/+133
Related: SYS#5358 Change-Id: I74fb0a3afc1ac4aadbfc609b882d929401f790eb
2021-02-16gprs_ns2: inform the NS user (BSSGP) about the MTU of a NSEAlexander Couzens2-0/+69
The BSSGP layer needs to know the MTU of the NS UNIDATA payload. The MTU can be 0 if the NSE doesn't contain any NSVC. Every status indication will contain the mtu value. The MTU in the status indication contains the maximum transfer unit of a BSSGP message. From NS side the maximum SDU. Related: OS#4889 Change-Id: I5016b295db6185ec131d83089cf6c806e34ef1b6
2021-02-15gsm: Fix encoding of gsm0808_cell_id_list2 with CGI-PS typesPau Espin Pedrol1-0/+43
CGI-PS type doesn't exist in GSM 08.08 Cell Id lists. That type of cell id is osmocom-specific and used internally. In here CGI-PS is automatically converted to CGI (since the later is an extension of this one). The encode/decode_cell_id_u are left intact (comment added) since those can still be used (and are used by RIM code) to encode/decode TS 48.018 Cell Identifiers. Related: SYS#4909 Change-Id: Id74f4577c397c1ba696f00395858311bd82cb2c8
2021-02-15comsetic: gsm0808_test: Fix trailing whitespacePau Espin Pedrol1-2/+2
Change-Id: I7f48e292fefe555939129f4000303e630a12cc50
2021-02-12tests/gb: Add more complex osmo-ns-dummy.cfgDaniel Willmann1-0/+24
write config will not print out any configuration for bind/nse unless we configure some. This way we can catch more issues with incompatible configs such as https://gerrit.osmocom.org/c/libosmocore/+/22878 Change-Id: Iad422ee013c82a6cb96af8ce4eb3af8b0936a4c9 Related: OS#4887
2021-02-12gprs_ns2: add signalling & data weights for UDP bindsAlexander Couzens1-0/+1
Allow to assign a signalling and data weight to UDP binds. Those weights will be used when doing dynamic configuration over IP-SNS. This is only the first part which only uses the assigned weights when doing a new SNS configuration. The outgoing change weight procedure will be supported in a later patch when the SNS fsm supports outgoing procedures. Related: SYS#5354 Change-Id: I5133e4229377d44772a9af28628a2bc420fea34b
2021-02-01gsm_7bit_encode_n(): fix integer overflow in gsm_septets2octets()Vadim Yanitskiy2-12/+7
Using 'uint8_t' for the length argument is definitely a bad idea. Because of this, packing more than 255 septets would not work as expected. Deprecate the old function and use 'size_t' instead. Change-Id: Ib1aac538afeb0a5c76a1df472d555139a496e12e
2021-02-01gsm_7bit_encode_n(): test encoding of more than 250 septetsVadim Yanitskiy2-0/+70
As can be seen, this unit test reveals problems with encoding of more than 250 septets using gsm_7bit_encode_n(). The problem is that some API functions use type 'uint8_t' for the length, so we basically suffer from integer overflows. Change-Id: I723300578d5ab0c7b94cf49c14d962b2dbf47740
2021-02-01ns2: Move to one common/shared ns2_bind_alloc()Harald Welte1-10/+4
Avoid code duplication between three different drivers by sharing the "core" of the bind initialization in a new, shared ns2_bind_alloc(). Change-Id: I535fc68e94fcd695de827dd922706adc1c5a2cb7
2021-01-28gprs_ns2: refactor: ensure all enums have GPRS_NS2_Alexander Couzens1-9/+9
All public enum should have the prefix GPRS_NS2_. API change which must be synchronized with osmo-pcu, osmo-gbproxy, osmo-sgsn. Change-Id: I548ff12f7277cbb7e1a630a3dc02b738ce89be72
2021-01-25gprs_ns2: drop prefix of all internal exposed functionAlexander Couzens1-5/+5
All functions which are exposed by gprs_ns2_internal.h should not contain the public prefix gprs_. Internal function should only contain ns2_ prefix. Change-Id: Icecc5a918902cd10efac72bbac20780d39aab272
2021-01-25tests: gprs_ns2: add unitdata unit testAlexander Couzens2-0/+148
test sending unitdata over a alive and blocked NSVC. Change-Id: I2c44b711d004d2ca08e05d4f54519ad8dbd77c27
2021-01-21tests/*: fix control reaches end of non-void funcOliver Smith2-0/+2
Prepare to set -std=gnu89 in a future commit, which will cause gcc warn about "control reaches end of non-void function" in main(). Change-Id: I7c33cac30e5859060f083813d8433011f5eaf0d0
2021-01-21gprs_ns2_test: Fix compilation on Debian 8Harald Welte1-1/+2
[ 352s] gb/gprs_ns2_test.c: In function 'test_block_unblock_nsvc': [ 352s] gb/gprs_ns2_test.c:200:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode [ 352s] for (int i=0; i<2; i++) { [ 352s] ^ [ 352s] gb/gprs_ns2_test.c:200:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code Change-Id: I72310886bef4db635078b75715c9d98ee45391cc
2021-01-19gprs_ns2: implement BLOCK/UNBLOCK of a NSVC by vtyAlexander Couzens2-0/+91
The vty should be able to block or unblock a specific NSVC. Further more this case is special for the UNITDATA as those can be still received until the other side response to the BLOCK PDU. Related: OS#4939 Change-Id: Ic0ce3c5fabc8644cc1ee71a8f6dd783fadf7b84d
2021-01-19test: gprs_ns2: free the nsi after each testAlexander Couzens1-0/+1
Change-Id: I700da48d7afe6b1a81484a0725faf0c56073446d
2021-01-19test: gprs_ns2: replace free_bind() with clear_pdus()Alexander Couzens1-4/+4
free_bind() should free up all driver specific state but NOT the bind itself. As the only thing left is clearing the pdus rename the function to it. Change-Id: Iac506734c93aca8be045ac13788d07d1bdc78eb3
2021-01-18bssgp_rim: move bssgp_parse_rim_ri and bssgp_create_rim_ri to gprs_bssgp_rimPhilipp Maier4-189/+191
The function bssgp_parse_rim_ri() and bssgp_create_rim_ri() are located in gprs_bssgp.c, since there is now a gprs_bssgp_rim.c module it makes more sense to put them there. Also adjust the code a bit so that its more intuitive to read. Change-Id: Icd667f41d5735de56cd9fb257670337c679dd258 Related: SYS#5103
2021-01-18bssgp_rim: add encoder/decoder for NACC related RIM containersPhilipp Maier4-1/+896
BSSGP RIM uses a number of nested containers to signal RIM application specific payload information in a generic way. Lets add the container structurs required for NACC. Depends: libosmocore If48f412c32e8e5a3e604a78d12b74787a4786374 Change-Id: Ibbc7fd67658e3040c12abb5706fe9d1f31894352 Related: SYS#5103
2021-01-18gprs_ns2: Give NS-VC FSMs a proper name/identifierHarald Welte1-3/+3
Log output without a proper identifier is mostly useless. Change-Id: Id9d5b0684584d03685900c6298fe70246793de14 Closes: OS#4876
2021-01-18test: gprs_ns2: don't leak the talloc contextAlexander Couzens1-0/+1
Makes the address sanitizer happy Change-Id: Ibf926d8db88cdb403d29de5e666dfb71eefc7b72
2021-01-12tlv_parser: Fix various out-of-bounds accessesHarald Welte2-0/+99
The libosmocore TLV parser had a number of insufficient bounds checks leading to reads beyond the end of the respective input buffer. This patch * adds proper out-of-bounds checks to all TLV types * simplifies some of the existing checks * introduces test cases to test all the corner cases where either TAG, or length, or value are not fully contained in the input buffer. Thanks to Ilja Van Sprundel for reporting these problems. Change-Id: I98b02c914c9e3ecf56050af846292aa6979d7508
2021-01-06Add inter-thread queueHarald Welte4-0/+145
This adds an inter-thread queue "it_q" to libosmocore. With it_q, one can perform thread-safe enqueing of messages to another thread, who will receive the related messages triggered via an eventfd handled in the usual libosmocore select loop abstraction. Change-Id: Ie7d0c5fec715a2a577fae014b0b8a0e9c38418ef
2021-01-05gprs_ns2: set transfer cap in NS Status primitiveAlexander Couzens4-1/+192
Related: SYS#5153 OS#4835 Change-Id: Ia1046db9e0d50855bff9de670b612ffc57af9995
2021-01-01gprs_ns2: call python vty testsAlexander Couzens3-1/+30
Also checks vty docs Change-Id: Ia8b77ae5bc3fed835dd1fc2cce0acbc41f199d54
2021-01-01utils: add osmo-ns-dummyAlexander Couzens2-0/+42
A dummy client to do integration tests of the ns2 layer. It drop all unit data. But allows vty tests. Change-Id: I127c178426bc1a3da8de251740eda93853030d6d
2020-12-16gprs_bssgp: add IE parser/generator for RIM Routing InformationPhilipp Maier3-1/+191
The RIM Routing Information IE (see also 3GPP TS 48.018, section 11.3.70) is used to control the flow of BSSGP rim messages at the SGSN. Change-Id: I6f88a9aeeb50a612d32e9efd23040c9740bc4f11 Related: SYS#5103
2020-12-09logging: Introduce DLBSSGP logging constantHarald Welte1-2/+3
Historically, BSSGP uses a non-constant, user-configurable integer varieable for the logging sub-system. Let's replace this with a statically-allocated library logging constant. This is required if we want to use the subsystem number in e.g. static initialized for osmo_fsm.log_subsys. Change-Id: I506190aae9217c0956e4b5764d1a0c0772268e93
2020-11-15tests: Fix tdef_test on 32bit platformsPau Espin Pedrol2-9/+9
100 minutes = 6000000000 microseconds was too big to be stored in an unsigned long in a 32bit platform, making the test print 4294967295 instead. Let's set a smaller value to have the test happy on 32 bits. Change-Id: Ic0d009f00a69cee59f2d3fc0b40ecdc97d81c75c
2020-11-15Revert "tests: Fix tdef_test on 32bit platforms"Pau Espin Pedrol2-6/+6
This was not the issue, see next commit fixing the correct issue. This reverts commit af10e48c1bf7ec40678b9a4387fc50ab0846b467. Change-Id: Ifa1057ac55fcacdeb55ecdaac1ac3ddcca7d6d65
2020-11-12gsm_04_08: add parser for Mobile Station Classmark 3Philipp Maier2-0/+540
3GPP TS 24.008 section 10.5.1.7 describes a Mobile Station Classmark 3 IE, which is encoded as CSN.1 struct. This means that it can not be parsed by just casting a memory location to a struct pointer, so lets add a parser to parse the CM3 IE. This is fixed version of Ic8b2bfd00330235f5bed00771e421588abfaac1f, which got reverted because it used the keyword "class" as struct member, which lead into problems with c++ builds. This is now fixed. Change-Id: Id8732551b33616227609cd6fcf6c3133751a89eb Related: OS#4796 SYS#5114
2020-11-12tests: Fix tdef_test on 32bit platformsPau Espin Pedrol2-6/+6
60 seconds = 6000000000 microseconds was too big to be stored in an unsigned long in a 32bit platform, making the test print 4294967295 instead. Let's set a smaller value to have the test happy on 32 bits. Change-Id: I97d53f6b7b410cef4b3f3fbe3162626fcdd7b05a
2020-11-11Revert "gsm_04_08: add parser for Mobile Station Classmark 3"Harald Welte2-540/+0
This reverts commit a4939dc8461c0a2d8e67aa3bb95bfb73ad9225b7, which caused massive build failures in C++ programs like osmo-pcu - unsurprisingly, as it calls a struct member "class", which is a reserved keyword in C++. Change-Id: Ia43e56385e7b580f492c560aee8ff8b1e8a0e1d8
2020-11-11tdef: Introduce OSMO_TDEF_US unitPau Espin Pedrol2-2/+36
Some applications may need submillisecond timers, such as those interacting with modbus serial lines (RS-485, RTU), which require timers of values around 1.5 char-time (T1.5), where a data char is composed of 11 bits sent on the line: 1 start bit, 8 data bits, 1 stop bit, and and parity bit (or 2nd stop bits if no parity). For instance, for a baudrate of 9600: 1.5 * 11 / 9600 = 1.718 ms = 1718 us So having a granularity of MS is not enough here. Change-Id: I71848d7c1ee0649929ce07680ee7320bb2a42f0e
2020-11-10gsm_04_08: add parser for Mobile Station Classmark 3Philipp Maier2-0/+540
3GPP TS 24.008 section 10.5.1.7 describes a Mobile Station Classmark 3 IE, which is encoded as CSN.1 struct. This means that it can not be parsed by just casting a memory location to a struct pointer, so lets add a parser to parse the CM3 IE. Change-Id: Ic8b2bfd00330235f5bed00771e421588abfaac1f Related: OS#4796 SYS#5114
2020-10-21vty: introduce the expert mode and a command to enable itVadim Yanitskiy2-2/+86
Some VTY commands are intentionally hidden, e.g. because they might by relatively dangerous if used in production operation. We equip such commands with a special attribute - CMD_ATTR_HIDDEN. The problem is that neiter they appear in the XML VTY reference, nor in the online VTY help, so it's a bit tricky to invoke them. This change introduces so-called 'expert' mode, in which hidden (but not deprecated) commands are getting visible. In the (telnet) VTY session, this mode can be activated by passing an additional argument to well-known 'enable' command: OsmoApp> enable ? [expert-mode] Enable the expert mode (show hidden commands) OsmoApp> enable expert-mode OsmoApp# so then hidden commands will appear together with all the other commands. They will be marked with a special '^' flag: OsmoApp# list with-flags ^ ... foo-hidden [expert-mode] . ... foo-regular-one ! ... foo-immediate ^ u.. app-hidden-unbelievable For the XML reference generation, additional API needs to be introduced. This will be implemented in subsequent patches. Change-Id: Ie69c2a19b22fb31d7bd7f6412f0aeac86ea5048f Related: SYS#4910
2020-10-13gsm: Fix make distcheck with parallel makePau Espin Pedrol1-1/+1
Change-Id: I0bab4cfbc82d2b0aa7bd07769000ab8e4968a00b
2020-10-12add osmo_sockaddr_to_str_buf/osmo_sockaddr_to_strAlexander Couzens2-0/+85
Add helper to format osmo_sockaddr into a string. Change-Id: I917f25ebd1239eae5855d973ced15b93731e33a0
2020-10-09bssmap_le/bsslap tests: We must use %td for ptrdiff_t printingHarald Welte2-9/+9
Otherwise we get (valid!) format string warnings like these on 32bit targets: [ 372s] bssmap_le/bssmap_le_test.c: In function 'test_bssmap_le_enc_dec': [ 372s] bssmap_le/bssmap_le_test.c:141:15: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'int' [-Wformat=] [ 372s] printf("[%ld] %s: ERROR: failed to encode pdu\n", (pdu - bssmap_le_test_pdus), [ 372s] ^ Closes: OS#4786 Change-Id: Ib1c16b8adc5c8c0a2b418db51d12089f9b49a844
2020-10-08command: add library command attribute for libosmo-abisPhilipp Maier1-0/+2
Change-Id: I0efc57f2cb54798ba207ae6fef9af4771d96bfa9 Related: SYS#4937, OS#1601
2020-10-07add BSSMAP-LE coding for Location ServicesNeels Hofmeyr4-0/+199
BSSMAP-LE: add Lb-interface messages between BSC and SMLC: - Reset - Reset Acknowledge - Perform Location Request, possibly containing BSSLAP TA Layer3 - Perform Location Response - Perform Location Abort - Connection Oriented Information containing any BSSLAP APDU Add encoding and decoding tests. Change-Id: I271e59b794bafc0a7ae0eabbf58918f6d7df431d
2020-10-07add BSSLAP coding for Location ServicesNeels Hofmeyr4-0/+121
BSSLAP: there are APDUs transferred in BSSMAP-LE Connection Oriented Information messages on Lb between BSC and SMLC. Add BSSLAP coding for these APDU messages: - TA Layer3 - TA Request - TA Response, possibly containing Location Estimate coded in GAD - Reject - Reset (for intra-BSS handover during TA Request) - Abort (for inter-BSS handover) Add encoding and decoding tests. Change-Id: I6409c4bcac402dc7626a3afce9081c59cd715fe8
2020-10-07add GAD coding for Location ServicesNeels Hofmeyr4-0/+162
GAD, Universal Geographical Area Description: - raw coding for all GAD elements. - SI-units encoding and decoding for Ellipsoid point with uncertainty circle, which I presume is the typical "at most N meters away from cell tower located at X,Y", which corresponds to the TA positioning currently being implemented. - other SI-units GAD element encodings are so far not implemented. Add encoding and decoding tests. In gsm/protocol/gsm_23_032.h are the raw coding structs as defined in 3GPP TS 23.032. In gsm/gad.h are structs carrying consistent units based on meters and degrees, for convenient / less error prone handling of GAD data, and for human readable representations of the GAD data. The separation of the two is desirable because OsmoBSC will receive GAD data from OsmoSMLC on the Lb interface, and pass on this data to the MSC via the A interface. It is better to pass the GAD data as-is without de/encoding. Change-Id: I7a9dd805a91b1ebb6353bde0cd169218acbf223c
2020-10-07add osmo_float_str_to_int() and osmo_int_to_float_str_*()Neels Hofmeyr2-0/+807
This will be useful to handle latitude and longitude numbers for GAD, which is the location estimate representation used for LCS (Location Services). The OsmoSMLC VTY user interface will provide floating-point strings like "23.456" while GAD stores them as micro-degress 23456000. The osmo_gad_to_str* will also convert latitude and longitude to floating-point string. There was code review concerns against adding this API, upon which I tried to use floating point string formats. But I encountered various problems with accuracy and trailing zeros. For global positioning data (latitude and longitude), even inaccuracy on the sixth significant decimal digit causes noticeable positional shift. To achieve sufficient accuracy on the least significant end, I need to use double instead of float. To remove trailing zeros, the idea was to use '%.6g' format, but that can cause rounding. '%.6f' on a double looks ok, but always includes trailing zeros. A test program shows: %.6g of ((double)(int32_t)23230100)/1e6 = "23.2301" <-- good %.6g of ((double)(int32_t)42419993)/1e6 = "42.42" <-- bad rounding %.6g of ((double)(int32_t)23230199)/1e6 = "23.2302" <-- bad rounding %.6f of ((double)(int32_t)23230100)/1e6 = "23.230100" <-- trailing zeros %.6f of ((double)(int32_t)42419993)/1e6 = "42.419993" <-- good %.6f of ((double)(int32_t)23230199)/1e6 = "23.230199" <-- good It looks like when accepting that there will be trailing zeros, using double with '%.6f' would work out, but in the end I am not certain enough that there aren't more hidden rounding / precision glitches. Hence I decided to reinforce the need to add this API: it is glitch free in sufficient precision for latitude and longitude data, because it is based on integer arithmetic. The need for this precision is particular to the (new) OsmoSMLC vty configuration, where reading and writing back user config must not modify the values the user entered. Considering to add these functions to osmo-smlc.git, we might as well add them here to libosmocore utils, and also use them in osmo_gad_to_str_*() functions. Change-Id: Ib9aee749cd331712a4dcdadfb6a2dfa4c26da957
2020-10-07vty/command: restrict the use of '.', '!', and '@' as flagsVadim Yanitskiy2-0/+10
Change-Id: Icb4acbab0a15de2b0ed7b88fb0e227675317146a Related: SYS#4937
2020-10-07vty/command: assign flags to CMD_ATTR_{IMMEDIATE,NODE_EXIT}Vadim Yanitskiy1-11/+9
Change-Id: I77c1ef7ca4c667c769cc53c7ac65c3be5c7e1c86 Related: SYS#4937
2020-10-07tests/vty: verify 'show vty-attributes' / 'list' commandsVadim Yanitskiy2-0/+157
Change-Id: I397cf642b323a9a99b2406aabaa67a7786dc2a50 Related: SYS#4937