aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gsm0808/gsm0808_test.ok
AgeCommit message (Collapse)AuthorFilesLines
2023-02-28improve test output for gsm0808_sc_cfg_from_gsm48_mr_cfg()Neels Hofmeyr1-402/+402
Improve the test output to make it easier to confirm that the fix in an upcoming patch (I900fda192742fa8f6dd54e9131ef1704b14cc41a) is indeed correct. Spell out each S0-S15 mode along with the bitmask. Rejigger the format of printing the mr_cfg flags, so that the AMR modes line up vertically with the S0-S15 modes. This clearly shows that the mr_cfg <-> s15_s0 conversion is wrong. For example, in this test only 4k75 is enabled, yet we allow configs featuring 6 other rates: Input: cfg.smod=0 spare=0 icmi=0 nscb=0 ver=0 m4_75=1 ------- ------- ------- ------- ------- ------- ------- Result (fr): S15-S0 = 0x5701 = 0b0101011100000001 S0 4.75 S8 4.75 5.90 S9 4.75 5.90 6.70 S10 4.75 5.90 6.70 7.40 S12 4.75 5.90 6.70 10.2 S14 4.75 5.90 7.95 12.2 Result (hr): S15-S0 = 0x0701 = 0b0000011100000001 S0 4.75 S8 4.75 5.90 S9 4.75 5.90 6.70 S10 4.75 5.90 6.70 7.40 In this test, an s15_s0 featuring a configuration with 6k70 allowed does not result in m6_70 == 1: Input: S15-S0 = 0x0c12 = 0b0000110000010010 S1 4.75 5.90 7.40 12.2 S4 7.40 S10 4.75 5.90 6.70 7.40 S11 4.75 5.90 6.70 7.40 Output: cfg.smod=0 spare=0 icmi=1 nscb=0 ver=1 m4_75=1 ------- m5_90=1 ------- m7_40=1 ------- ------- m12_2=1 Almost every conversion contains errors like this. Related: I900fda192742fa8f6dd54e9131ef1704b14cc41a Change-Id: Iec7c491d9fadd37d9e43fbaac8e709c2029f8a8e
2022-03-18gsm0808_test: Add new unit test showing dec errorPau Espin Pedrol1-0/+1
This unit tests shows how decoding of such message fails. Fix will be provided in a follow up patch to make the test pass. Related: SYS#5891 Change-Id: Ib4ff71d5e01d464febb062c5bfe3e06ee5a19ecd
2020-05-17gsm0808: Implement helper functions for CONFUSION BSSMAP message decoding.Alexander Chemeris1-0/+6
Also add a test for an actual CONFUSION message parsing. Change-Id: If8afd2d096fb66c6c2f255a08fc1129de3d09cec
2019-03-11gsm0808_utils: fix gsm48 multirate to S-bit converterPhilipp Maier1-19/+47
The function gsm0808_sc_cfg_from_gsm48_mr_cfg() is used to convert a gsm48 multirate struct into a set of S-bits (S0 to S15). However, the conversion function currently does not take into account that bit S1 actually stands for four rates at once (Config-NB-Code = 1). Lets make sure that S1 is only set when the multirate configuration permits all four required rates. Change-Id: I6ad531d4e70c2252e32e2bbaca8e14a7ec6d9840 Related: SYS#4470
2019-03-11gsm0808_utils: fix gsm48 multirate configuration generatorPhilipp Maier1-26/+187
The function gsm0808_sc_cfg_from_gsm48_mr_cfg() takes an S15 to S0 bitmask and converts that bitmask into an AMR multirate configuration struct. Unfortunately the current implementation implements 3GPP TS 28.062, Table 7.11.3.1.3-2 wrongly in some aspects. Lets fix this. - Fix wrong interpretation of the bitpatterns - 5,15K is invalid and must never be selected - Make sure that no more than 4 rates are selected in the active set - Extend unit-test Change-Id: I6fd7f4073b84093742c322752f2fd878d1071e15 Related: SYS#4470
2019-03-08add gsm0808_cell_id_from_cgi(), gsm0808_cell_id_to_cgi()Neels Hofmeyr1-0/+92
CGI to Cell ID: for example, for Paging, osmo-msc has a CGI for a subscriber and needs to send out a Cell Identifier IE. Makes sense to add this conversion here. Cell ID to CGI: for a Layer 3 Complete, a subscriber sends the current cell in the form of a Cell Identifier, which we store as a CGI, if necessary enriched with the local PLMN. Add enum with bitmask values to identify parts of a CGI, for the return value of gsm0808_cell_id_to_cgi(). Can't use enum CELL_IDENT for that, because it doesn't have a value for just a PLMN (and is not a bitmask). Change-Id: Ib9af67b100c4583342a2103669732dab2e577b04
2019-02-26LCLS: add string dump helpersMax1-1/+3
Add functions to dump LCLS (without GCR) and GCR. Dumping entire struct results in inconveniently long string hence the separate functions. Both use talloc functions so they expect caller to take care of providing proper allocation context and freeing memory. Change-Id: Ic3609224c8f3282d667e75f68bc20327e36eb9e6
2019-02-18gsm0808: Add unit tests for test_create_clear_command2()Harald Welte1-0/+2
Change-Id: Ie3f34b78edc91a013152742bebbd839586a787fe Related: OS#3805
2019-01-28gsm0808: add BSSMAP Cell Identifier matching APINeels Hofmeyr1-0/+186
Add * osmo_lai_cmp() (to use in gsm0808_cell_id_u_matches()) * osmo_cgi_cmp() (to use in gsm0808_cell_id_u_matches()) * gsm0808_cell_id_u_match() (to re-use for single IDs and lists) * gsm0808_cell_ids_match() * gsm0808_cell_id_matches_list() * Unit tests in gsm0808_test.c Rationale: For inter-BSC handover, it is interesting to find matches between *differing* Cell Identity kinds. For example, if a cell as CGI 23-42-3-5, and a HO for LAC-CI 3-5 should be handled, we need to see the match. This is most interesting for osmo-msc, i.e. to direct the BSSMAP Handover Request towards the correct BSC or MSC. It is also interesting for osmo-bsc's VTY interface, to be able to manage cells' neighbors and to trigger manual handovers by various Cell Identity handles, as the user would expect them. Change-Id: I5535f0d149c2173294538df75764dd181b023312
2018-12-14LCLS: add gsm0808_create_ass2()Max1-0/+1
It allows setting additional assignment parameters explicitly. Change-Id: Id89765df3f8c12f55f73f1d7a9d90c8883eb3bba Related: OS#2487
2018-12-14LCLS, TS 48.008: add GCR IE encoding/decodingMax1-0/+3
* add functions to encode Global Call. Ref. from TS 29.205 as 3GPP TS 48.008 ยง3.2.2.115 information element * add corresponding tests Change-Id: I82ce0207dc8de50689a8806c6471ad7fbae6219d
2018-12-08gsm0808: add encoder for cause codes and use itPhilipp Maier1-0/+2
At the moment the all gsm0808 cause codes are encoded directly using the tlv API directly to put a one byte TLV field. This works ok for most situations where the cause code consists of a single byte. However, gsm0808 specifies a two byte cause code model where cause codes may be extended up to two bytes. Instead of implementing the encoding over and over and again, let's rather have an encoder function we can call. - Add an encoder function that can generate single byte and extended cause codeds and makes the length decision automatically. - Use only this function to append cause codes Change-Id: I71d58fad89502a43532f60717ca022c15c73f8bb
2018-11-19Support cipher mode reject with extended causeMax1-0/+1
* add function to generate cipher mode reject with extended (2-byte) Cause IE * add function to get (extended) Cause value * add corresponding (extended cause) test * update existing (non-extended cause) test * use enum as a parameter for existing non-extended version to make interface more unified Change-Id: Id5509b94a18180a44f45300caaa02b843c166fa3 Related: OS#3187
2018-09-25gsm0808: add function to convert AMR S15-S0 to gsm0408 settingsPhilipp Maier1-0/+133
Add a function to convert S0-S15 bits to struct gsm48_multi_rate_conf, which hold the codec settings for AMR. Change-Id: I973736273c236eee84decf15868190e339c3fed4 Related: OS#3548
2018-09-19gsm0808: add function to convert amr gsm0408 setings to gsm0808Philipp Maier1-0/+225
Add a function to convert struct gsm48_multi_rate_conf, which holds the codec settings for AMR, to S0-S15 bit representation as defined in 3GPP TS 48.008 3.2.2.49 This resurrects change-id I4e656731b16621736c7a2f4e64d9ce63b1064e98 which was reverted in I9e0d405e303ed86d23703ca6362e958dddb2f861 due to gsm0808_test failing. The test failure is fixed by properly clearing the struct gsm48_multirate_cfg prior to running tests (add memset(0)). Change-Id: Ia782e21c206c15e840226d79b4209d13658ee916 Related: OS#3548
2018-09-16Revert "gsm0808: add function to convert amr gsm0408 setings to gsm0808"Neels Hofmeyr1-225/+0
This reverts commit 2fd4fe6aa109c8df50baac465f0393a303a64dd2. As shown in https://jenkins.osmocom.org/jenkins/view/master/job/master-libosmocore/475/a2=default,a3=default,arch=amd64,label=osmocom-master-debian9/console This commit breaks gsm0808_test with: stderr: --- expout 2018-09-16 22:37:31.382280438 +0200 +++ /n/s/dev/make/libosmocore/tests/testsuite.dir/at-groups/21/stdout 2018-09-16 22:37:31.426281372 +0200 @@ -78,9 +78,9 @@ Input: m4_75= 0 smod= 0 m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 + m5_90= 0 icmi= 1 m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 + m7_40= 0 ver= 6 m7_95= 0 m10_2= 0 m12_2= 0 @@ -92,9 +92,9 @@ Input: m4_75= 1 smod= 0 m5_15= 0 spare= 0 - m5_90= 0 icmi= 0 + m5_90= 0 icmi= 1 m6_70= 0 nscb= 0 - m7_40= 0 ver= 0 + m7_40= 0 ver= 6 m7_95= 0 m10_2= 0 m12_2= 0 @@ -106,9 +106,9 @@ Input: m4_75= 0 smod= 0 m5_15= 1 spare= 0 - m5_90= 0 icmi= 0 + m5_90= 0 icmi= 1 [...] Change-Id: I9e0d405e303ed86d23703ca6362e958dddb2f861
2018-09-14gsm0808: add function to convert amr gsm0408 setings to gsm0808Philipp Maier1-0/+225
Add a function to convert struct gsm48_multi_rate_conf, which holds the codec settings for AMR, to S0-S15 bit representation as defined in 3GPP TS 48.008 3.2.2.49 Change-Id: I4e656731b16621736c7a2f4e64d9ce63b1064e98 Related: OS#3548
2018-04-18add gsm0808_cell_{id,id_list}_name() and friendsNeels Hofmeyr1-64/+26
Provide comprehensive API to obtain string representations of Cell Identifiers and -Lists. Change gsm0808_test.c to use the new functions (which simplifies the output a bit), so that we don't duplicate printing code in gsm0808_test.c, and so that the not-so-trivial printing code is also tested. In gsm0808_test, also test gsm0808_cell_id_list_name_buf()'s return value and truncation behavior. The rationale for gsm0808_cell_id_list_name(), i.e. printing an entire list of cell identifiers, is that even though the maximum is 127 elements, a list of more than a few elements is hardly ever expected in practice (even more than one element isn't actually expected: either "entire BSS" or a single LAC). It is thus useful to log the entire list when it shows up in Paging and Handover. Change-Id: I9b2106805422f96c5cc96ebb9178451355582df3
2018-04-13test_gsm0808_enc_dec_cell_id_list_lac(): populate all LACsNeels Hofmeyr1-1/+1
Change-Id: I7535166a2827c03a954fe72d5d99217e4f25868f
2018-04-13test_gsm0808_enc_dec_cell_id_list_lac(): validate encoded bytesNeels Hofmeyr1-0/+1
Change-Id: I81b1ffbe6a5ec566c112492c2cbaf99c018c45bb
2018-04-13add gsm0808_{enc,dec}_cell_idNeels Hofmeyr1-0/+7
Clarify semantics and micro-optimise for the case of single Cell Identifer IEs. Test in gsm0808_test.c So far we have gsm0808_enc_cell_id_list2(), but there also exist instances of single Cell Identifiers (3GPP TS 48.008 3.2.2.17). It is possible to decode the same using the cell identifier list API, but this forces the caller to also keep a full struct gsm0808_cell_id_list2 with all its 127 entries around. E.g. for handover, there are two Cell Identifiers (Serving and Target); I'd need two full cell id lists for each, and these would be dynamically allocated for each handover operation, whether it uses them or not. Related: OS#2283 (inter-BSC HO, BSC side) Change-Id: I9f9c528965775698ab62ac386af0516192c4b0cc
2018-04-13add gsm0808_cell_id_list_add() to combine two cell identifier listsNeels Hofmeyr1-0/+85
This will be used by the upcoming neighbor_ident API in osmo-bsc, where the vty interface allows composing neihbor BSS cell identifier lists, and we want to allow adding individual items from individual user commands. It will also be useful to accumulate cell identifiers in case a subscriber sees multiple alternative cells from a neighboring BSS, and we want to pass these on to the MSC in a Handover Required. Related: OS#2283 (inter-BSC HO, BSC side) Change-Id: I5781f5fa5339c92ab2e2620489b002829d206925
2017-04-08gsm0808: make gsm0808_create_reset_ack() accessiblePhilipp Maier1-0/+1
The create function to generate the RESET ACKNOWLEDGE message is not accessible from outside, as it does not appear in limosmogsm.map. It also has not testcase. This commit adds gsm0808_create_reset_ack() to the map file and also adds a testcase. Change-Id: I82d3411484f82b4a9205d407fa0442244678f183
2017-04-08gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQSTPhilipp Maier1-0/+1
gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_ASSIGMENT_RQST messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_assignment() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I4d1d455a1e1cf95407e23ded7b7defbcf2dd6ff0
2017-04-08gsm0808: Add create functions for BSS_MAP_MSG_PAGINGPhilipp Maier1-0/+1
gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_PAGING messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_paging() function, that generates an A/AoiP BSS_MAP_MSG_PAGING message. Change-Id: I9afecf0109305ca5153bf081bb29cd94071dd2b7
2017-04-08gsm0808: Add create functions for CIPHER MODE COMMANDPhilipp Maier1-0/+1
gsm0808.h/c lacks functionality to generate CIPHER MODE COMMAND messages. These messages are required if the code is used in an MSC implementation. This commit adds a gsm0808_create_cipher() function, that generates an A/AoiP CIPHER MODE COMMAND message. Change-Id: I8eb1c357860c3e740b0f5d17e1c256bc87920958
2017-04-08gsm0808: Add AoIP specific elements to gsm0808_create_... functionsPhilipp Maier1-0/+3
the classic A implementation in libosmocore lacks support for AoIP message elements. This patch adds support for AoIP by adding a set of new gsm0808_create_..., which support the missing AoIP message elements Change-Id: I77f866abec1822d19871052f3c647ad782785b34
2012-01-22tests: Introduce a very basic gsm0808 testHolger Hans Peter Freyther1-0/+15
This tests verifies the content of the GSM 08.08 messages, it does not verify the remaining headroom (which the SCCP/IPA code relies on being plenty to prepend the header). More to come in the future.