Change in osmo-pcu[master]: tests/rlcmac: Add test to showcase that decode_gsm_ra_cap() fails

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Jan 28 21:34:41 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/16993 )

Change subject: tests/rlcmac: Add test to showcase that decode_gsm_ra_cap() fails
......................................................................

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
---
M src/gsm_rlcmac.cpp
M src/gsm_rlcmac.h
M tests/rlcmac/RLCMACTest.cpp
M tests/rlcmac/RLCMACTest.ok
4 files changed, 49 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/gsm_rlcmac.cpp b/src/gsm_rlcmac.cpp
index ef7abcd..339279c 100644
--- a/src/gsm_rlcmac.cpp
+++ b/src/gsm_rlcmac.cpp
@@ -5510,10 +5510,10 @@
   }
 }
 
-void decode_gsm_ra_cap(bitvec * vector, MS_Radio_Access_capability_t *data)
+int decode_gsm_ra_cap(bitvec * vector, MS_Radio_Access_capability_t *data)
 {
   csnStream_t      ar;
   unsigned readIndex = 0;
   csnStreamInit(&ar, 0, 8 * vector->data_len);
-  /*ret =*/ csnStreamDecoder(&ar, CSNDESCR(MS_Radio_Access_capability_t), vector, readIndex, data);
+  return csnStreamDecoder(&ar, CSNDESCR(MS_Radio_Access_capability_t), vector, readIndex, data);
 }
diff --git a/src/gsm_rlcmac.h b/src/gsm_rlcmac.h
index a4750e8..0ac1207 100644
--- a/src/gsm_rlcmac.h
+++ b/src/gsm_rlcmac.h
@@ -5137,5 +5137,5 @@
  void encode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data);
  void decode_gsm_rlcmac_uplink_data(bitvec * vector, RlcMacUplinkDataBlock_t * data);
  void encode_gsm_rlcmac_downlink_data(bitvec * vector, RlcMacDownlinkDataBlock_t * data);
- void decode_gsm_ra_cap(bitvec * vector, MS_Radio_Access_capability_t * data);
+ int decode_gsm_ra_cap(bitvec * vector, MS_Radio_Access_capability_t * data);
 #endif /* __PACKET_GSM_RLCMAC_H__ */
diff --git a/tests/rlcmac/RLCMACTest.cpp b/tests/rlcmac/RLCMACTest.cpp
index e48a27c..b51d735 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 @@
 }
 using namespace std;
 
+void *tall_pcu_ctx;
+
 void printSizeofRLCMAC()
 {
 	printf("*** %s ***\n", __func__);
@@ -203,6 +207,45 @@
 	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 @@
 	testRlcMacDownlink(ctx);
 	testRlcMacUplink(ctx);
 	testCsnLeftAlignedVarBmpBounds(ctx);
+	testRAcap(ctx);
 	talloc_free(ctx);
 }
diff --git a/tests/rlcmac/RLCMACTest.ok b/tests/rlcmac/RLCMACTest.ok
index 2af4d90..5793d57 100644
--- a/tests/rlcmac/RLCMACTest.ok
+++ b/tests/rlcmac/RLCMACTest.ok
@@ -123,3 +123,5 @@
 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

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/16993
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I92c86397f988afaa791871d823a45fa85054f3bb
Gerrit-Change-Number: 16993
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200128/062b0736/attachment.htm>


More information about the gerrit-log mailing list