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/.

pespin gerrit-no-reply at lists.osmocom.org
Fri Jan 24 12:03:36 UTC 2020


pespin has uploaded this change for review. ( 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, 35 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/93/16993/1

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..63b2e27 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,31 @@
 	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;
+
+	bitvec_unhex(vector, "12a5146200");
+
+	rc = decode_gsm_ra_cap(vector, &data);
+	printf("decode_gsm_ra_cap fails? %s\n", rc !=0 ? "yes" : "no");
+	/* 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);
+
+}
+
 int main(int argc, char *argv[])
 {
 	void *ctx = talloc_named_const(NULL, 1, "RLCMACTest");
@@ -213,5 +242,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: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200124/63acbf4e/attachment.htm>


More information about the gerrit-log mailing list