aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gb
AgeCommit message (Collapse)AuthorFilesLines
2021-07-13gprs_ns2: ensure the NSE becomes dead when FR link went downAlexander Couzens2-0/+58
The FR code is using force unconfigured to change the state of the NSVC when the FR link goes down. The force unconfigured state didn't notified the NSE when changing into this state. Related: SYS#5533 Change-Id: I4d7bbbbce26f7cde99eebe96995c50b1e812e5bd
2021-07-06gprs_ns2_vty: dump_nsvc: change output depending on NSVCIAlexander Couzens1-8/+8
If the NSVCI is valid, there is no signalling or data weight defined (internally this is 1). For NSVC with NSVCI don't print the signalling or data weight. For NSVC without NSVCI, don't print NSVCI at all. Related: OS#5180 Change-Id: Iaadc806a9136436468e2b02eb0bc1f4570a10ecc
2021-07-06gprs_ns2: use gprs_ns2_free_bind() to clean up a bindAlexander Couzens1-0/+4
gprs_ns2_free_bind() takes care of all required steps to clean up a bind. The driver->free_bind() operation only cleans up the driver internal state but not NSVCs and other generic things. Fixes a crash when free'ing a bind from the vty which has active NSVCs. Related: OS#5195 Change-Id: I0a2ad22905bcacb929b9b5f5b034af0da3081826
2021-07-02gprs_ns2: fix crash when changing the MTUAlexander Couzens1-2/+11
When the MTU changes for any fr device, all NSE will recalculate their MTU. If any NSE is alive, libosmocore will crash. Related: OS#5192 Change-Id: I31ba5cefea7bbb0b74060d6664b42c58815ee2a1
2021-06-25gprs_ns2: fix missing notify towards the NSE when NSVC become blockedAlexander Couzens2-0/+72
The NSE wasn't notified when a NSVC went into the BLOCKED state from an UNBLOCKED state. Related: OS#5182 Change-Id: I09634e414e9bb966e6b5809b7de1b59fbabd413d
2021-06-25gprs_ns2: use llist_add_tail to keep orderAlexander Couzens1-4/+4
When configuring multiple NSE/BINDs the order of the configuration should be keeped. Related: OS#5181 Change-Id: Ibbc03f0780b49543b5bd97ee059f11cfd6c2a126
2021-06-04Use new stat item/ctr getter APIsPau Espin Pedrol1-1/+1
Generated with spatch: """ @@ expression E1, E2; @@ - &E2->ctr[E1] + rate_ctr_group_get_ctr(E2, E1) """ """ @@ expression E1, E2, E3; @@ - E2->items[E1] + osmo_stat_item_group_get_item(E2, E1) """ Change-Id: I41297a8df68e28dfc6016330ac82b0ed5dd0ebc1
2021-04-29ns2: Allow setting the socket priority for a UDP bindHarald Welte1-3/+3
Change-Id: Ifdfa086ce1c8d62b256abb3454b70cf53da9dcdb
2021-03-31gprs_ns2: vty: remove a white space in `show binds`Alexander Couzens1-3/+3
Change-Id: Ia3579ec5599f5f5c58eebab03f1ed9e17f171177
2021-03-24gprs_ns2: dump_nsvc: correct indentionAlexander Couzens1-8/+8
As both `show ns entities` and `show ns binds` looking similiar correct the indention. Change-Id: I55794188bec7e62f0341188dbf23ac04006974fe
2021-03-24gprs_ns2_vty: make the `show ns entities` and `show ns binds` look similiarAlexander Couzens1-0/+2
`show ns binds` prints a count of NSVCs. Add the same line to `show ns entities`. Change-Id: I15c58a1c0fe94dda728afb29e7e5ca41e3fa8966
2021-03-24gprs_ns2: always use the same method to print NSVCsAlexander Couzens1-4/+4
The binds also print a list of associated NSVC when dumping the bind. However the binds using their own representation of printing the NSVC which is different to `show ns entities`. Use the same function to print NS-VC. Before: NSVCI 00000: udp)[127.0.0.1]:23000<>[127.0.0.1]:22000 After: NSVCI none: UNCONFIGURED DYNAMIC data_weight=1 sig_weight=1 udp)[127.0.0.1]:23000<>[127.0.0.1]:22000 Change-Id: If31ec6c1c07dc134ab1ddeb915bc89747c7be048
2021-03-24gprs_ns2_vty: Allow creating NSE in sgsn-roleHarald Welte1-1/+1
Change-Id: I694fa6c80d04d13cb1afaae93a9ae43b6dfd2207 Related: OS#3373
2021-02-25tests/gb: Fix printf format errors on ARM 32 bitsPau Espin Pedrol1-6/+6
Seen building on RPI4 32 bits raspbian: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘size_t’ {aka ‘unsigned int’} [-Werror=format=] Change-Id: I62199bfc7f3a78403334f5580f31fa5743223c9b
2021-02-20Drop use of log_set_print_filename() API inside libosmocorePau Espin Pedrol4-8/+5
Let's use log_set_print_filename2() API instead, which has less ackward behavior implications like changing the print status of category-hex. Related: OS#5034 Change-Id: Ifc78e1dcba5baf0b41f6ccbbbd1e3f06552d73da
2021-02-20tests: Set print_category values explicitlyPau Espin Pedrol3-0/+6
This will alow easily changing default values for print_category vs print_category_hex later. In any case, every test relying on logging output validation should always explicitly state the config to avoid issues in the future if default values change. Related: OS#5034 Change-Id: If29b40557d5c2bcda04b964f344070bad58d8f28
2021-02-19gprs_ns2: ensure no duplicate UDP NSVC can be createdAlexander Couzens1-0/+20
Change-Id: I58a95817e2730bbbaa851a43a5b072d1de2db037
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-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-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-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-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 Maier2-0/+884
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-05gprs_ns2: set transfer cap in NS Status primitiveAlexander Couzens2-0/+174
Related: SYS#5153 OS#4835 Change-Id: Ia1046db9e0d50855bff9de670b612ffc57af9995
2021-01-01gprs_ns2: call python vty testsAlexander Couzens2-0/+27
Also checks vty docs Change-Id: Ia8b77ae5bc3fed835dd1fc2cce0acbc41f199d54
2021-01-01utils: add osmo-ns-dummyAlexander Couzens1-0/+33
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 Maier2-0/+189
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
2019-02-26NS: Factor out gprs_nsvc_start_test() and use itHarald Welte1-10/+10
This function performs sending a NS-ALIVE PDU and starting Tns-Test, let's use it in all places where we used to do that. As part of this, also fix a bug where the sendto() return value (number of bytes sent) would actually propagate up all the way to gprs_ns_rx_reset() return value, which in turn affects the test results on stdout. Change-Id: I4d303117f77fabb74bbb91887b9914a81c2a084a
2018-11-19send NS_POUT_UNBLOCK_ACK before signalling S_NS_UNBLOCKStefan Sperling1-5/+5
In gprs_ns_process_msg(), we were dispatching the S_NS_UNBLOCK signal before sending out the NS_POUT_UNBLOCK_ACK message. Signal handlers might send messages to the other side, assuming that NS is now unblocked. However, since such messages will arrive before the UNBLOCK_ACK message the receiver might discard them. This problem has been observed with our TTCN3 BSSGP_Emulation as a peer to osmo-pcu. This patch makes TTCN3 PCU TC_paging() test pass regardless of whether the test or osmo-pcu is started first. Before this patch, this test would only pass if the test was started before osmo-pcu. A remaining problem is that the test does not yet keep passing reliably unless osmo-pcu is restarted between test runs. Change-Id: I3af54a14bb6bcfa167c9a9d9f67835e7f5b9f1bb Related: OS#2890 Related: OS#2388
2018-04-06use osmo_init_logging2() with proper talloc ctxNeels Hofmeyr3-5/+11
Ironically, when deprecating osmo_init_logging() in I216837780e9405fdaec8059c63d10699c695b360, I forgot to change the callers within libosmocore itself, i.e. in the various regression tests. Change-Id: Ia36c248f99353d5baaa2533f46a2f60a8579bdf8
2018-01-08Use existing function for TLLI encodingMax1-4/+4
Use bssgp_msgb_tlli_put() instead of copy-pasted code. Change-Id: I06d60566a19dcae701f8648c19fbd8db6d586f77
2017-11-20bssgp_fc_test: sanitize: free fc struct when doneNeels Hofmeyr1-0/+2
Helps fix sanitizer build on debian 9. Change-Id: I0ef95ee8185a4789f0732b9420243dda5104d181
2017-11-20gprs_bssgp: bssgp_fc_in(): fix mem leak on queue overflowNeels Hofmeyr2-3/+4
All successful and all error code paths of bssgp_fc_in() free the msgb, except the code path calling fc_enqueue() when the msg is dropped (due to queue being full, or failure to allocate). Callers could theoretically catch the -ENOSPC return value and discard the msgb. However, in other code paths, a callback's return value is returned, which is expected to free the msgb, so such callback would have to never return -ENOSPC when it freed the msgb. Much simpler semantics would be to free the msgb in every code path, no matter which kind of error occurred. Who is currently calling bssgp_fc_in and how do they handle the return value? - bssgp_fc_test.c ignores the return value (and hits a mem leak aka sanitizer build failure if the queue is full). - fc_timer_cb() ignores the return value. - bssgp_tx_dl_ud() returns the bssgp_fc_in() rc. - which is returned by a cascade of functions leading up to being returned, for example, by gprs_llgmm_reset(), which is usually called with ignored return code. At this point it is already fairly clear that bssgp_fc_in() should always free the msgb, since the callers don't seem to distinguish even between error or success, let alone between -ENOSPC or other errors. bssgp_fc_test: assert that no msgbs remain unfreed after the tests. Adjust expected results. Helps fix sanitizer build on debian 9. Change-Id: I00c62a104baeaad6a85883c380259c469aebf0df
2017-11-20bssgp_fc_test: sanitizer: free msgb context when doneNeels Hofmeyr2-0/+12
Print remaining msgbs when done, then free the entire tall_msgb_context. To be able to do that, call msgb_talloc_ctx_init() and use its return value. A subsequent patch will fix a known mem leak and add assertions for 0b in 1 blocks remaining in the tall_msgb_context. Helps fix sanitizer build on debian 9. Change-Id: I67d347ab2642b0bfc27b21b44231a7f3146ff641
2017-11-20bssgp_fc_test: clarify by outputting ok / failure messagesNeels Hofmeyr2-3/+99
The test fills up the queue / sends too large PDUs on purpose. Make that obvious by outputting returned errors in the expected output. Cosmetic: - fc_in()'s return value is ignored, hence don't return anything. - add comment. Change-Id: I57d6fce2515a65f6dd037e75af5397079215cb46
2017-11-20bssgp_fc_test: remove rounding to decisecondsNeels Hofmeyr1-10/+0
Ever since this test was changed to use osmo_gettimeofday_override, the times it sees are exact every time and don't need rounding to pass the expected output. Change-Id: I4a9a5d31fc02eb55caf7ba9c141426d8115bb740
2017-11-13Fix/Update copyright notices; Add SPDX annotationHarald Welte2-2/+6
Let's fix some erroneous/accidential references to wrong license, update copyright information where applicable and introduce a SPDX-License-Identifier to all files. Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
2017-10-24rate_ctr: Enforce counter (and ctr_group) names are valid identifiersHarald Welte1-1/+1
As rate counters are automatically exposed on the CTRL interface, we need to make sure they don't contain special characters such as '.' which are not permitted/supported by CTRL. In order to be able to run old versions of osmocom programs with libosmocore versions after this commit, we introduce some special name mangling: Any '.' in the names are replaced with ':' during counter group registration, if valid identifiers can be obtained this way. Change-Id: Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56