aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-01-23 21:00:19 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-01-28 13:29:42 +0100
commitcdbc5dbd1cba638f0ad5aa475d0bf97fe5c4bcff (patch)
tree3515796b64968f0f6f44d1ce3d8a9e0a31c8c59c /tests
parentea39fade07c7b7e9f28e61baab8ddbbb3a3591c1 (diff)
tests/rlcmac: Add test to showcase that decode_gsm_ra_cap() fails
Currently code using that function in osmo-pcu is disabled, allegadly because SGSN was sending incorrect values, but it looks more like a CSN1 issue. Related: OS#1525, OS#3499 Change-Id: I92c86397f988afaa791871d823a45fa85054f3bb
Diffstat (limited to 'tests')
-rw-r--r--tests/rlcmac/RLCMACTest.cpp44
-rw-r--r--tests/rlcmac/RLCMACTest.ok2
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/rlcmac/RLCMACTest.cpp b/tests/rlcmac/RLCMACTest.cpp
index e48a27c6..b51d7354 100644
--- a/tests/rlcmac/RLCMACTest.cpp
+++ b/tests/rlcmac/RLCMACTest.cpp
@@ -23,9 +23,11 @@
#include <iostream>
#include <cstdlib>
#include <cstring>
+#include <assert.h>
#include "csn1.h"
#include "gsm_rlcmac.h"
#include "gprs_rlcmac.h"
+#include "decoding.h"
extern "C" {
extern const struct log_info gprs_log_info;
@@ -38,6 +40,8 @@ extern const struct log_info gprs_log_info;
}
using namespace std;
+void *tall_pcu_ctx;
+
void printSizeofRLCMAC()
{
printf("*** %s ***\n", __func__);
@@ -203,6 +207,45 @@ void testCsnLeftAlignedVarBmpBounds(void *test_ctx)
msgb_free(m);
}
+void testRAcap(void *test_ctx)
+{
+ printf("*** %s ***\n", __func__);
+ MS_Radio_Access_capability_t data;
+ memset(&data, 0, sizeof(data));
+ bitvec *vector = bitvec_alloc(23, test_ctx);
+ int rc;
+/*
+ MS RA capability 1
+ 0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
+ .... 0010 101. .... = Length in bits: 0x15 (21)
+ ...0 01.. RF Power Capability, GMSK Power Class: Not specified (1)
+ A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (0)
+ .... ...1 = Controlled early Classmark Sending: Implemented
+ 0... .... = Pseudo Synchronisation: Not Present
+ .0.. .... = Voice Group Call Service: no VGCS capability or no notifications wanted
+ ..0. .... = Voice Broadcast Service: no VBS capability or no notifications wanted
+ ...1 .... = Multislot capability struct: Present
+ .... ..00 011. .... = GPRS multislot class: Max Rx-Slot/TDMA:2 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:3 Tta:3 Ttb:2 Tra:3 Trb:1 Type:1 (3)
+ ...0 .... = GPRS Extended Dynamic Allocation Capability: Not Implemented
+*/
+ bitvec_unhex(vector, "12a5146200");
+
+ rc = decode_gsm_ra_cap(vector, &data);
+ printf("decode_gsm_ra_cap fails? %s\n", rc !=0 ? "yes" : "no");
+#if 0
+ /* FIXME: OS#1525, OS#3499: csn1 fails to parse this MS RA Cap IE value */
+ assert (rc == 0);
+
+ /* Make sure there's 1 value (currently fails due to failed decoding) */
+ osmo_assert(cap->Count_MS_RA_capability_value == 1);
+
+ /* Make sure MS multislot class is parsed correctly (currently fails due
+ to failed decoding and count being 0) */
+ uint8_t ms_class = Decoding::get_ms_class_by_capability(&data);
+ assert(ms_class == 3);
+#endif
+}
+
int main(int argc, char *argv[])
{
void *ctx = talloc_named_const(NULL, 1, "RLCMACTest");
@@ -213,5 +256,6 @@ int main(int argc, char *argv[])
testRlcMacDownlink(ctx);
testRlcMacUplink(ctx);
testCsnLeftAlignedVarBmpBounds(ctx);
+ testRAcap(ctx);
talloc_free(ctx);
}
diff --git a/tests/rlcmac/RLCMACTest.ok b/tests/rlcmac/RLCMACTest.ok
index 2af4d90f..5793d57d 100644
--- a/tests/rlcmac/RLCMACTest.ok
+++ b/tests/rlcmac/RLCMACTest.ok
@@ -123,3 +123,5 @@ vector1 = 40 0a 90 20 00 00 00 00 00 00 00 30 10 01 2a 08 00 13 2b 2b 2b 2b 2b
vector2 = 40 0a 90 20 00 00 00 00 00 00 00 30 10 01 2a 08 00 13 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
*** testCsnLeftAlignedVarBmpBounds ***
+*** testRAcap ***
+decode_gsm_ra_cap fails? yes