tests: adopt RLC/MAC tests from osmo-pcu.git

Change-Id: I8cb5364b7311e004c2afc9438cbfac8d43c86cf7
This commit is contained in:
Vadim Yanitskiy 2022-08-05 05:36:07 +07:00
parent 00498acb16
commit 03c0a14c7a
9 changed files with 1229 additions and 0 deletions

9
.gitignore vendored
View File

@ -31,6 +31,15 @@ libtool
ltmain.sh
m4/*.m4
# testsuite
tests/atconfig
tests/package.m4
tests/testsuite.dir
tests/testsuite.log
tests/testsuite
tests/*/*Test
tests/*/*_test
# git-version-gen magic
.tarball-version
.version

View File

@ -9,6 +9,7 @@ AM_CPPFLAGS = \
SUBDIRS = \
include \
src \
tests \
$(NULL)
pkgconfigdir = $(libdir)/pkgconfig

View File

@ -4,6 +4,7 @@ AC_INIT([libosmo-gprs],
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_TESTDIR(tests)
AM_INIT_AUTOMAKE([dist-bzip2])
@ -84,5 +85,7 @@ AC_CONFIG_FILES([libosmo-csn1.pc
src/Makefile
src/csn1/Makefile
src/rlcmac/Makefile
tests/Makefile
tests/rlcmac/Makefile
Makefile])
AC_OUTPUT

48
tests/Makefile.am Normal file
View File

@ -0,0 +1,48 @@
SUBDIRS = \
rlcmac \
$(NULL)
# The `:;' works around a Bash 3.2 bug when the output is not writeable.
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
:;{ \
echo '# Signature of the current package.' && \
echo 'm4_define([AT_PACKAGE_NAME],' && \
echo ' [$(PACKAGE_NAME)])' && \
echo 'm4_define([AT_PACKAGE_TARNAME],' && \
echo ' [$(PACKAGE_TARNAME)])' && \
echo 'm4_define([AT_PACKAGE_VERSION],' && \
echo ' [$(PACKAGE_VERSION)])' && \
echo 'm4_define([AT_PACKAGE_STRING],' && \
echo ' [$(PACKAGE_STRING)])' && \
echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \
echo ' [$(PACKAGE_BUGREPORT)])'; \
echo 'm4_define([AT_PACKAGE_URL],' && \
echo ' [$(PACKAGE_URL)])'; \
} >'$(srcdir)/package.m4'
EXTRA_DIST = \
testsuite.at \
$(srcdir)/package.m4 \
$(TESTSUITE) \
$(NULL)
DISTCLEANFILES = atconfig
TESTSUITE = $(srcdir)/testsuite
check-local: atconfig $(TESTSUITE)
$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
installcheck-local: atconfig $(TESTSUITE)
$(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
$(TESTSUITEFLAGS)
clean-local:
test ! -f '$(TESTSUITE)' || \
$(SHELL) '$(TESTSUITE)' --clean
AUTOM4TE = $(SHELL) $(top_srcdir)/missing --run autom4te
AUTOTEST = $(AUTOM4TE) --language=autotest
$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4
$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
mv $@.tmp $@

25
tests/rlcmac/Makefile.am Normal file
View File

@ -0,0 +1,25 @@
AM_CFLAGS = \
-Wall \
$(LIBOSMOCORE_CFLAGS) \
-I$(top_srcdir)/include/ \
$(NULL)
AM_LDFLAGS = \
-no-install \
$(NULL)
check_PROGRAMS = \
RLCMACTest \
$(NULL)
EXTRA_DIST = \
rlcmac/RLCMACTest.ok \
rlcmac/RLCMACTest.err \
$(NULL)
RLCMACTest_SOURCES = RLCMACTest.c
RLCMACTest_LDADD = \
$(LIBOSMOCORE_LIBS) \
$(top_builddir)/src/csn1/libosmo-csn1.la \
$(top_builddir)/src/rlcmac/libosmo-gprs-rlcmac.la \
$(NULL)

854
tests/rlcmac/RLCMACTest.c Normal file
View File

@ -0,0 +1,854 @@
/* RLCMACTest.c
*
* Copyright (C) 2011 Ivan Klyuchnikov
* Contributions by sysmocom - s.f.m.c. GmbH
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <stdint.h>
#include <stdio.h>
#include <osmocom/core/application.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/msgb.h>
#include <osmocom/csn1/csn1.h>
#include <osmocom/gprs/rlcmac/gprs_rlcmac.h>
static void testRlcMacDownlink(void *test_ctx)
{
printf("*** %s ***\n", __func__);
int rc;
struct bitvec *resultVector = bitvec_alloc(23, test_ctx);
memset(resultVector->data, 0x2b, resultVector->data_len);
const char *testData[] = {
"4e082500e3f1a81d080820800b2b2b2b2b2b2b2b2b2b2b", // Packet Downlink Assignment
"48282407a6a07422720100032b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Assignment
"47240c00400000000000000079eb2ac9402b2b2b2b2b2b", // Packet Uplink Ack Nack
"47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Assignment
"400820001a3904df0680efb3300b2b2b2b2b2b2b2b2b2b", // Packet Downlink Assignment (EGPRS)
"40284f0000001009810c826f4406809dcecb2b2b2b2b2b", // Packet Uplink Assignment (EGPRS)
"4024030f2f0000000087b0042b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Ack Nack (EGPRS)
"4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b", // Polling Request (malformed)
"412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b", // Packet Uplink Ack Nack?
"41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // System Info 13?
"40883c1493120000000012002b2b2b2b2b2b2b2b2b2b2b", // Pkt Paging Request (OS#4838)
};
printf(" DOWNLINK \n");
for (unsigned int i = 0; i < ARRAY_SIZE(testData); i++) {
printf("vector1 = %s\n", testData[i]);
struct bitvec *vector = bitvec_alloc(23, test_ctx);
bitvec_unhex(vector, testData[i]);
RlcMacDownlink_t data;
memset(&data, 0, sizeof(data));
printf("=========Start DECODE===========\n");
rc = osmo_gprs_rlcmac_decode_downlink(vector, &data);
printf("+++++++++Finish DECODE (%d)++++++++++\n", rc);
printf("=========Start ENCODE=============\n");
rc = osmo_gprs_rlcmac_encode_downlink(resultVector, &data);
printf("+++++++++Finish ENCODE (%d)+++++++++++\n", rc);
printf("vector1 = %s\n", osmo_hexdump(vector->data, 23));
printf("vector2 = %s\n", osmo_hexdump(resultVector->data, 23));
if (memcmp(vector->data, resultVector->data, 23) == 0)
printf("vector1 == vector2 : TRUE\n");
else
printf("vector1 == vector2 : FALSE\n");
memset(resultVector->data, 0x2b, resultVector->data_len);
bitvec_free(vector);
}
bitvec_free(resultVector);
}
static void testRlcMacUplink(void *test_ctx)
{
printf("*** %s ***\n", __func__);
int rc;
struct bitvec *resultVector = bitvec_alloc(23, test_ctx);
memset(resultVector->data, 0x2b, resultVector->data_len);
const char *testData[] = {
"400e1e61d11d2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Dummy Control Block
"400b8020000000000000002480e0032b2b2b2b2b2b2b2b", // Packet Downlink Ack/Nack
"4016713dc094270ca2ae57ef909006aa0fc0001f80222b", // Packet Resource Request
"401673c87f24af2632b25964200600000091000b780080", // Packet Resource Request (from keith)
"40200ffc0021ec010b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // EPDAN
"400a9020000000000000003010012a0800132b2b2b2b2b", // Packet Downlink Ack/Nack ?
/* Packet Resource Request (see OS#4955, mistakes in 3GPP TS 44.060) */
"4117ea1b903eaeb2686564b2330820078000102b2b2b2b",
"40167e49f7f8ef2632b2596620060000806d00541c0080",
"4017787174d92eba686564b2ccc30800a000040b2b2b2b",
"4017e5b2cd5a2eca68655e44aec84880139300412b2b2b",
};
printf(" UPLINK \n");
for (unsigned int i = 0; i < ARRAY_SIZE(testData); i++) {
printf("vector1 = %s\n", testData[i]);
struct bitvec *vector = bitvec_alloc(23, test_ctx);
bitvec_unhex(vector, testData[i]);
RlcMacUplink_t data;
memset(&data, 0, sizeof(data));
printf("=========Start DECODE===========\n");
rc = osmo_gprs_rlcmac_decode_uplink(vector, &data);
printf("+++++++++Finish DECODE (%d)++++++++++\n", rc);
printf("=========Start ENCODE=============\n");
rc = osmo_gprs_rlcmac_encode_uplink(resultVector, &data);
printf("+++++++++Finish ENCODE (%d)+++++++++++\n", rc);
printf("vector1 = %s\n", osmo_hexdump(vector->data, 23));
printf("vector2 = %s\n", osmo_hexdump(resultVector->data, 23));
if (memcmp(vector->data, resultVector->data, 23) == 0)
printf("vector1 == vector2 : TRUE\n");
else
printf("vector1 == vector2 : FALSE\n");
memset(resultVector->data, 0x2b, resultVector->data_len);
bitvec_free(vector);
}
bitvec_free(resultVector);
}
static void testCsnLeftAlignedVarBmpBounds(void *test_ctx)
{
printf("*** %s ***\n", __func__);
struct msgb *m = msgb_alloc(80, "test");
static uint8_t exp[] = { 0x7f, 0xff, 0xff, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
struct bitvec *vector = bitvec_alloc(23, test_ctx);
int rc;
bitvec_unhex(vector, "40200bffd161003e0e519ffffffb800000000000000000");
RlcMacUplink_t data;
memset(&data, 0, sizeof(data));
EGPRS_AckNack_Desc_t *urbb =
&data.u.Egprs_Packet_Downlink_Ack_Nack.EGPRS_AckNack.Desc;
rc = osmo_gprs_rlcmac_decode_uplink(vector, &data);
OSMO_ASSERT(rc == 0);
memcpy(msgb_put(m, 13), urbb->URBB, 13);
if (!msgb_eq_data_print(m, exp, 13))
printf("%s failed!\n", __func__);
msgb_free(m);
}
static uint8_t get_ms_class_by_capability(const MS_Radio_Access_capability_t *cap)
{
for (unsigned int i = 0; i < cap->Count_MS_RA_capability_value; i++) {
if (!cap->MS_RA_capability_value[i].u.Content.Exist_Multislot_capability)
continue;
if (!cap->MS_RA_capability_value[i].u.Content.Multislot_capability.Exist_GPRS_multislot_class)
continue;
return cap->MS_RA_capability_value[i].u.Content.Multislot_capability.GPRS_multislot_class;
}
return 0;
}
static uint8_t get_egprs_ms_class_by_capability(const MS_Radio_Access_capability_t *cap)
{
for (unsigned int i = 0; i < cap->Count_MS_RA_capability_value; i++) {
if (!cap->MS_RA_capability_value[i].u.Content.Exist_Multislot_capability)
continue;
if (!cap->MS_RA_capability_value[i].u.Content.Multislot_capability.Exist_EGPRS_multislot_class)
continue;
return cap->MS_RA_capability_value[i].u.Content.Multislot_capability.EGPRS_multislot_class;
}
return 0;
}
static void testRAcap(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
struct bitvec *bv_dec = bitvec_alloc(23, test_ctx);
struct bitvec *bv_enc = bitvec_alloc(23, test_ctx);
unsigned int len_dec, len_enc;
int rc;
/*
MS RA capability 1
0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
.... 0011 011. .... = Length in bits: 0x1b (27)
...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
HSCSD multislot class: Bits are not available (0)
SMS_VALUE (Switch-Measure-Switch): Bits are not available (0)
ECSD multislot class: Bits are not available (0)
DTM GPRS Multi Slot Class: Bits are not available (0)
.... ..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
.... ...0 0011 .... = EGPRS 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... = EGPRS Extended Dynamic Allocation Capability: Not Implemented
*/
bitvec_unhex(bv_dec, "1365146230");
printf("=== Test decoding of MS RA Capability ===\n");
rc = osmo_gprs_rlcmac_decode_ms_ra_cap(bv_dec, &data);
OSMO_ASSERT(rc == 0);
/* Make sure there's 1 value (currently fails due to failed decoding) */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 1);
/* Make sure GPRS / EGPRS multislot class is parsed correctly */
printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data));
printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data));
/* Test encoding of decoded MS RA Capability */
printf("=== Test encoding of MS RA Capability ===\n");
rc = osmo_gprs_rlcmac_encode_ms_ra_cap(bv_enc, &data);
printf("osmo_gprs_rlcmac_encode_ms_ra_cap() returns %d\n", rc);
bv_dec->cur_bit = 4;
len_dec = bitvec_get_uint(bv_dec, 7);
bv_enc->cur_bit = 4;
len_enc = bitvec_get_uint(bv_enc, 7);
/* NOTE: vector2 is expected to be different because there is actually no
* way to distinguish between NULL and 0 in MS_Radio_Access_capability_t.
* The difference is in length indicator: 27 bits vs 65 bits. */
printf("vector1 (len_ind=%u) = %s\n", len_dec, osmo_hexdump(bv_dec->data, bv_dec->data_len));
printf("vector2 (len_ind=%u) = %s\n", len_enc, osmo_hexdump(bv_enc->data, bv_enc->data_len));
/* Mangle the length indicator (set it to 21) */
unsigned int writeIndex = 4;
rc = bitvec_write_field(bv_dec, &writeIndex, 21, 7);
OSMO_ASSERT(rc == 0);
/* Make sure decoding attempt fails */
printf("=== Test decoding of a malformed vector (short length indicator) ===\n");
rc = osmo_gprs_rlcmac_decode_ms_ra_cap(bv_dec, &data);
printf("osmo_gprs_rlcmac_decode_ms_ra_cap() returns %d\n", rc);
}
static void testMalformedRAcap(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
struct bitvec *bv_dec = 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)
.... 0011 101. .... = Length in bits: 0x1d (29)
...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
It doesn't show up in wireshark's tree above because specific parser is
used, but this RA Cap bitstream has Exist_EGPRS_multislot_class = 1 but
it provides no struct with the expected data (malformed, generated
erroneusly through TTCN3). The CSN.1 dceoder should ideally return an
error here, but it doesn't (it returns a >0 value which we convert to 0
in osmo_gprs_rlcmac_decode_ms_ra_cap()).
*/
bitvec_unhex(bv_dec, "13a5146200");
printf("=== Test decoding of MS RA Capability ===\n");
rc = osmo_gprs_rlcmac_decode_ms_ra_cap(bv_dec, &data);
printf("osmo_gprs_rlcmac_decode_ms_ra_cap() returns %d\n", rc);
OSMO_ASSERT(rc == 0);
/* For sake of completeness, check if the decoder could find 1 value
before failing to decode it */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 1);
bitvec_free(bv_dec);
}
/* Reproduce crash from ticket OS#4463 */
static void testRAcap2(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
struct bitvec *bv_dec = bitvec_alloc(23, test_ctx);
int rc;
/*
MS Radio Access Capability
Element ID: 0x13
1... .... = ext: 1
Length: 23
------------------------------------------- Hex bitstream starts here:
MS RA capability 1
0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
.... 1001 001. .... = Length in bits: 0x49 (73)
...1 00.. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: A5 bits follow (1)
A5/1: encryption algorithm available (1)
A5/2: encryption algorithm not available (0)
A5/3: encryption algorithm available (1)
A5/4: encryption algorithm not available (0)
A5/5: encryption algorithm not available (0)
A5/6: encryption algorithm not available (0)
A5/7: encryption algorithm not available (0)
.... ..1. = Controlled early Classmark Sending: Implemented
.... ...1 = Pseudo Synchronisation: 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
HSCSD multislot class: Bits are not available (0)
.... 0111 = SMS_VALUE (Switch-Measure-Switch): 8/4 timeslot (~1154 microseconds) (7)
0001 .... = (SM_VALUE) Switch-Measure: 2/4 timeslot (~288 microseconds) (1)
ECSD multislot class: Bits are not available (0)
.... ...0 = Single Slot DTM: Not supported
1... .... = DTM EGPRS Multi Slot Class: Present
.... .011 00.. .... = GPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
..1. .... = GPRS Extended Dynamic Allocation Capability: Implemented
.... ..01 100. .... = EGPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
...1 .... = EGPRS Extended Dynamic Allocation Capability: Implemented
.... .11. = DTM GPRS Multi Slot Class: Multislot class 11 supported (3)
.11. .... = DTM EGPRS Multi Slot Class: Multislot class 11 supported (3)
...1 .... = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
.... ..0. = COMPACT Interference Measurement Capability: Not Implemented
.... ...1 = Revision Level Indicator: The ME is Release '99 onwards
0... .... = UMTS FDD Radio Access Technology Capability: Not supported
.0.. .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
..0. .... = CDMA 2000 Radio Access Technology Capability: Not supported
...0 .... = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... 1... = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
.... ..0. = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
0... .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 3 (3)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 3 (3)
.... .0.. = Multiple TBF Capability: Not supported
.... ..01 = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
1... .... = Extended RLC/MAC Control Message Segmentation Capability: Supported
.1.. .... = DTM Enhancements Capability: The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures
...0 .... = PS Handover Capability: Not supported
MS RA capability 2
.... .011 1... .... = Access Technology Type: GSM 850 (7)
.010 0010 = Length in bits: 0x22 (34)
100. .... RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
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
.... .1.. = Pseudo Synchronisation: Present
.... ..0. = Voice Group Call Service: no VGCS capability or no notifications wanted
.... ...0 = Voice Broadcast Service: no VBS capability or no notifications wanted
0... .... = Multislot capability struct: Not Present
.1.. .... = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
.... 0... = COMPACT Interference Measurement Capability: Not Implemented
.... .1.. = Revision Level Indicator: The ME is Release '99 onwards
.... ..0. = UMTS FDD Radio Access Technology Capability: Not supported
.... ...0 = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
0... .... = CDMA 2000 Radio Access Technology Capability: Not supported
.0.. .... = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
..1. .... = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
.... 0... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
.... ..0. = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 3 (3)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 3 (3)
...0 .... = Multiple TBF Capability: Not supported
.... 01.. = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
.... ..1. = Extended RLC/MAC Control Message Segmentation Capability: Supported
.... ...1 = DTM Enhancements Capability: The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures
.0.. .... = PS Handover Capability: Not supported
MS RA capability 3
...0 011. = Access Technology Type: GSM 1800 (3)
.... ...0 1000 10.. = Length in bits: 0x22 (34)
.... ..00 1... .... RF Power Capability, GMSK Power Class: 1 W (30 dBm) (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
...1 .... = Pseudo Synchronisation: Present
.... 0... = Voice Group Call Service: no VGCS capability or no notifications wanted
.... .0.. = Voice Broadcast Service: no VBS capability or no notifications wanted
.... ..0. = Multislot capability struct: Not Present
.... ...1 = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
..0. .... = COMPACT Interference Measurement Capability: Not Implemented
...1 .... = Revision Level Indicator: The ME is Release '99 onwards
.... 0... = UMTS FDD Radio Access Technology Capability: Not supported
.... .0.. = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... ..0. = CDMA 2000 Radio Access Technology Capability: Not supported
.... ...0 = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
1... .... = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
..0. .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
.... 0... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 3 (3)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 3 (3)
.0.. .... = Multiple TBF Capability: Not supported
..01 .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
.... 1... = Extended RLC/MAC Control Message Segmentation Capability: Supported
.... .1.. = DTM Enhancements Capability: The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures
.... ...0 = PS Handover Capability: Not supported
*/
bitvec_unhex(bv_dec, "1933432b37159ef90879cba28c6421e72688b190879c00");
printf("=== Test decoding of multi-band MS RA Capability ===\n");
rc = osmo_gprs_rlcmac_decode_ms_ra_cap(bv_dec, &data);
printf("osmo_gprs_rlcmac_decode_ms_ra_cap() returns %d\n", rc);
OSMO_ASSERT(rc == 0);
/* Make sure there's 3 values */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 3);
/* Make sure GPRS / EGPRS multislot class is parsed correctly */
printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data));
printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data));
bitvec_free(bv_dec);
}
/* RAcap larger than 23 bytes */
static void testRAcap3(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
struct bitvec *bv_dec = bitvec_alloc(31, test_ctx);
int rc;
/*
MS Radio Access Capability
Element ID: 0x13
1... .... = ext: 1
Length: 31
------------------------------------------- Hex bitstream starts here:
MS RA capability 1
0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
.... 1010 111. .... = Length in bits: 0x57 (87)
...1 00.. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: A5 bits follow (1)
A5/1: encryption algorithm available (1)
A5/2: encryption algorithm not available (0)
A5/3: encryption algorithm available (1)
A5/4: encryption algorithm not available (0)
A5/5: encryption algorithm not available (0)
A5/6: encryption algorithm not available (0)
A5/7: encryption algorithm not available (0)
.... ..1. = Controlled early Classmark Sending: Implemented
.... ...1 = Pseudo Synchronisation: 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
HSCSD multislot class: Bits are not available (0)
SMS_VALUE (Switch-Measure-Switch): Bits are not available (0)
ECSD multislot class: Bits are not available (0)
DTM GPRS Multi Slot Class: Bits are not available (0)
.... .011 00.. .... = GPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
..1. .... = GPRS Extended Dynamic Allocation Capability: Implemented
.... ..01 100. .... = EGPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
...1 .... = EGPRS Extended Dynamic Allocation Capability: Implemented
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..0. .... = UMTS FDD Radio Access Technology Capability: Not supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: 0x00 (0) - This field effect all other multislot fields. To understand the value please read TS 24.008 5.6.0 Release 5 Chap 10.5.5.12 Page 406
.... 0... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.0.. .... = Multiple TBF Capability: Not supported
..01 .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
.... 0... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
.... .0.. = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... ...0 = PS Handover Capability: Not supported
0... .... = DTM Handover Capability: Not supported
..0. .... = Flexible Timeslot Assignment: Not supported
...0 .... = GAN PS Handover Capability: Not supported
.... 0... = RLC Non-persistent Mode: Not supported
.... .0.. = Reduced Latency Capability: Not supported
.... ..00 = Uplink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink (0)
00.. .... = Downlink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink (0)
..0. .... = E-UTRA FDD support: Not supported
...0 .... = E-UTRA TDD support: Not supported
.... 00.. = GERAN to E-UTRA support in GERAN packet transfer mode: None (0)
.... ..0. = Priority-based reselection support: Not supported
0... .... = Indication of Upper Layer PDU Start Capability for RLC UM: Not supported
.0.. .... = Enhanced Multiplexing for Single TBF Capability: Not supported
..0. .... = Multiple TTI Capability: Not supported
...0 .... = Reporting of UTRAN CSG cells in packet transfer mode: Not supported
.... 0... = Reporting of E-UTRAN CSG cells in packet transfer mode: Not supported
.... .0.. = Dynamic Timeslot Reduction Capability: Not supported
.... ..0. = Enhanced Multiplexing for Single RLC Entity Capability: Not supported
.... ...0 = Fast Downlink Frequency Switching Capability: Not supported
01.. .... = TIGHTER Capability: TIGHTER supported for speech and signalling channels only (1)
MS RA capability 2
...0 111. = Access Technology Type: GSM 850 (7)
.... ...0 1111 10.. = Length in bits: 0x3e (62)
.... ..10 0... .... RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
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
...1 .... = Pseudo Synchronisation: Present
.... 0... = Voice Group Call Service: no VGCS capability or no notifications wanted
.... .0.. = Voice Broadcast Service: no VBS capability or no notifications wanted
.... ..0. = Multislot capability struct: Not Present
.... ...1 = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
..0. .... = COMPACT Interference Measurement Capability: Not Implemented
...1 .... = Revision Level Indicator: The ME is Release '99 onwards
.... 0... = UMTS FDD Radio Access Technology Capability: Not supported
.... .0.. = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... ..0. = CDMA 2000 Radio Access Technology Capability: Not supported
.... ...0 = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
1... .... = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
..0. .... = Modulation based multislot class support: Not supported
High Multislot Capability: 0x00 (0) - This field effect all other multislot fields. To understand the value please read TS 24.008 5.6.0 Release 5 Chap 10.5.5.12 Page 406
.... ..0. = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
...0 .... = Multiple TBF Capability: Not supported
.... 01.. = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
.... ..0. = Extended RLC/MAC Control Message Segmentation Capability: Not supported
.... ...0 = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.0.. .... = PS Handover Capability: Not supported
..0. .... = DTM Handover Capability: Not supported
.... 0... = Flexible Timeslot Assignment: Not supported
.... .0.. = GAN PS Handover Capability: Not supported
.... ..0. = RLC Non-persistent Mode: Not supported
.... ...0 = Reduced Latency Capability: Not supported
00.. .... = Uplink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink (0)
..00 .... = Downlink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink (0)
.... 0... = E-UTRA FDD support: Not supported
.... .0.. = E-UTRA TDD support: Not supported
.... ..00 = GERAN to E-UTRA support in GERAN packet transfer mode: None (0)
0... .... = Priority-based reselection support: Not supported
..0. .... = Indication of Upper Layer PDU Start Capability for RLC UM: Not supported
...0 .... = Enhanced Multiplexing for Single TBF Capability: Not supported
.... 0... = Multiple TTI Capability: Not supported
.... .0.. = Reporting of UTRAN CSG cells in packet transfer mode: Not supported
.... ..0. = Reporting of E-UTRAN CSG cells in packet transfer mode: Not supported
.... ...0 = Dynamic Timeslot Reduction Capability: Not supported
0... .... = Enhanced Multiplexing for Single RLC Entity Capability: Not supported
.0.. .... = Fast Downlink Frequency Switching Capability: Not supported
..01 .... = TIGHTER Capability: TIGHTER supported for speech and signalling channels only (1)
MS RA capability 3
.... .010 0... .... = Access Technology Type: GSM 1900 (4)
.011 1110 = Length in bits: 0x3e (62)
001. .... RF Power Capability, GMSK Power Class: 1 W (30 dBm) (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
.... .1.. = Pseudo Synchronisation: Present
.... ..0. = Voice Group Call Service: no VGCS capability or no notifications wanted
.... ...0 = Voice Broadcast Service: no VBS capability or no notifications wanted
0... .... = Multislot capability struct: Not Present
.1.. .... = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
.... 0... = COMPACT Interference Measurement Capability: Not Implemented
.... .1.. = Revision Level Indicator: The ME is Release '99 onwards
.... ..0. = UMTS FDD Radio Access Technology Capability: Not supported
.... ...0 = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
0... .... = CDMA 2000 Radio Access Technology Capability: Not supported
.0.. .... = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
..1. .... = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
.... 0... = Modulation based multislot class support: Not supported
High Multislot Capability: 0x00 (0) - This field effect all other multislot fields. To understand the value please read TS 24.008 5.6.0 Release 5 Chap 10.5.5.12 Page 406
0... .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... .0.. = Multiple TBF Capability: Not supported
.... ..01 = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance - phase I supported (1)
0... .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
.0.. .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
...0 .... = PS Handover Capability: Not supported
.... 0... = DTM Handover Capability: Not supported
.... ..0. = Flexible Timeslot Assignment: Not supported
.... ...0 = GAN PS Handover Capability: Not supported
0... .... = RLC Non-persistent Mode: Not supported
.0.. .... = Reduced Latency Capability: Not supported
..00 .... = Uplink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink (0)
.... 00.. = Downlink EGPRS2: The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink (0)
.... ..0. = E-UTRA FDD support: Not supported
.... ...0 = E-UTRA TDD support: Not supported
00.. .... = GERAN to E-UTRA support in GERAN packet transfer mode: None (0)
..0. .... = Priority-based reselection support: Not supported
.... 0... = Indication of Upper Layer PDU Start Capability for RLC UM: Not supported
.... .0.. = Enhanced Multiplexing for Single TBF Capability: Not supported
.... ..0. = Multiple TTI Capability: Not supported
.... ...0 = Reporting of UTRAN CSG cells in packet transfer mode: Not supported
0... .... = Reporting of E-UTRAN CSG cells in packet transfer mode: Not supported
.0.. .... = Dynamic Timeslot Reduction Capability: Not supported
..0. .... = Enhanced Multiplexing for Single RLC Entity Capability: Not supported
...0 .... = Fast Downlink Frequency Switching Capability: Not supported
.... 01.. = TIGHTER Capability: TIGHTER supported for speech and signalling channels only (1)
*/
bitvec_unhex(bv_dec, "1af3432b25964240100000006efa319090040000001a3e2c64240100000004");
printf("=== Test decoding of MS RA Capability 3===\n");
rc = osmo_gprs_rlcmac_decode_ms_ra_cap(bv_dec, &data);
printf("osmo_gprs_rlcmac_decode_ms_ra_cap() returns %d\n", rc);
OSMO_ASSERT(rc == 0);
/* Make sure there's 3 values */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 3);
/* Make sure GPRS / EGPRS multislot class is parsed correctly */
printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data));
printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data));
bitvec_free(bv_dec);
}
/* RAcap larger than 23 bytes */
static void testRAcap4(void *test_ctx)
{
printf("*** %s ***\n", __func__);
MS_Radio_Access_capability_t data;
memset(&data, 0, sizeof(data));
struct bitvec *bv_dec = bitvec_alloc(22, test_ctx);
int rc;
/*
MS Radio Access Capability
Element ID: 0x13
1... .... = ext: 1
Length: 22
------------------------------------------- Hex bitstream starts here:
MS RA capability 1
0001 .... = Access Technology Type: GSM E --note that GSM E covers GSM P (1)
.... 0111 101. .... = Length in bits: 0x3d (61)
...1 00.. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
A5 Bits: A5 bits follow (1)
A5/1: encryption algorithm available (1)
A5/2: encryption algorithm not available (0)
A5/3: encryption algorithm available (1)
A5/4: encryption algorithm not available (0)
A5/5: encryption algorithm not available (0)
A5/6: encryption algorithm not available (0)
A5/7: encryption algorithm not available (0)
.... ..1. = Controlled early Classmark Sending: Implemented
.... ...1 = Pseudo Synchronisation: 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
HSCSD multislot class: Bits are not available (0)
SMS_VALUE (Switch-Measure-Switch): Bits are not available (0)
ECSD multislot class: Bits are not available (0)
DTM GPRS Multi Slot Class: Bits are not available (0)
.... .011 00.. .... = GPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
..1. .... = GPRS Extended Dynamic Allocation Capability: Implemented
.... ..01 100. .... = EGPRS multislot class: Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1 (12)
...1 .... = EGPRS Extended Dynamic Allocation Capability: Implemented
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..1. .... = UMTS FDD Radio Access Technology Capability: Supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
..0. .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... ...0 = Multiple TBF Capability: Not supported
00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0)
..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... .0.. = PS Handover Capability: Not supported
.... ..0. = DTM Handover Capability: Not supported
MS RA capability 2
.001 1... = Access Technology Type: GSM 1800 (3)
.... .010 0100 .... = Length in bits: 0x24 (36)
.... 001. RF Power Capability, GMSK Power Class: 1 W (30 dBm) (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
.1.. .... = Pseudo Synchronisation: Present
..0. .... = Voice Group Call Service: no VGCS capability or no notifications wanted
...0 .... = Voice Broadcast Service: no VBS capability or no notifications wanted
.... 0... = Multislot capability struct: Not Present
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..1. .... = UMTS FDD Radio Access Technology Capability: Supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
..0. .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... ...0 = Multiple TBF Capability: Not supported
00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0)
..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... .0.. = PS Handover Capability: Not supported
.... ..0. = DTM Handover Capability: Not supported
MS RA capability 3
.011 1... = Access Technology Type: GSM 850 (7)
.... .010 0100 .... = Length in bits: 0x24 (36)
.... 100. RF Power Capability, GMSK Power Class: 2 W (33 dBm) (4)
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
.1.. .... = Pseudo Synchronisation: Present
..0. .... = Voice Group Call Service: no VGCS capability or no notifications wanted
...0 .... = Voice Broadcast Service: no VBS capability or no notifications wanted
.... 0... = Multislot capability struct: Not Present
.... .1.. = 8PSK Power Capability Bits: Present
8PSK Power Capability: Power class E2 (2)
0... .... = COMPACT Interference Measurement Capability: Not Implemented
.1.. .... = Revision Level Indicator: The ME is Release '99 onwards
..1. .... = UMTS FDD Radio Access Technology Capability: Supported
...0 .... = UMTS 3.84 Mcps TDD Radio Access Technology Capability: Not supported
.... 0... = CDMA 2000 Radio Access Technology Capability: Not supported
.... .0.. = UMTS 1.28 Mcps TDD Radio Access Technology Capability: Not supported
.... ..1. = GERAN Feature Package 1: Supported
Extended DTM EGPRS Multi Slot Class: Bits are not available (0)
0... .... = Modulation based multislot class support: Not supported
High Multislot Capability: Bits are not available (0)
..0. .... = GERAN Iu mode: Not supported
GMSK Multislot Power Profile: GMSK_MULTISLOT_POWER_PROFILE 0 (0)
8-PSK Multislot Power Profile: 8-PSK_MULTISLOT_POWER_PROFILE 0 (0)
.... ...0 = Multiple TBF Capability: Not supported
00.. .... = Downlink Advanced Receiver Performance: Downlink Advanced Receiver Performance not supported (0)
..0. .... = Extended RLC/MAC Control Message Segmentation Capability: Not supported
...0 .... = DTM Enhancements Capability: The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures
.... .0.. = PS Handover Capability: Not supported
.... ..0. = DTM Handover Capability: Not supported
*/
bitvec_unhex(bv_dec, "17b3432b25966200019a42c6620001ba48c662000100");
printf("=== Test decoding of MS RA Capability 4===\n");
rc = osmo_gprs_rlcmac_decode_ms_ra_cap(bv_dec, &data);
printf("osmo_gprs_rlcmac_decode_ms_ra_cap() returns %d\n", rc);
OSMO_ASSERT(rc == 0);
/* Make sure there's 3 values */
OSMO_ASSERT(data.Count_MS_RA_capability_value == 3);
/* Make sure GPRS / EGPRS multislot class is parsed correctly */
printf("GPRS multislot class = %u\n", get_ms_class_by_capability(&data));
printf("EGPRS multislot class = %u\n", get_egprs_ms_class_by_capability(&data));
bitvec_free(bv_dec);
}
static void testEGPRSPktChReq(void *test_ctx)
{
EGPRS_PacketChannelRequest_t req;
int rc;
printf("*** %s ***\n", __func__);
static const uint16_t EGPRSPktChReqs[] = {
/* < One Phase Access Request : '0'B
< MultislotClass : '10101'B >
< Priority : '10'B >
< RandomBits : '101'B > > */
0x2b5,
/* < One Phase Access Request : '0'B
< MultislotClass : '01010'B >
< Priority : '01'B >
< RandomBits : '010'B > > */
0x14a,
/* < Short Access Request : '100'B
< NumberOfBlocks : '001'B >
< Priority : '01'B >
< RandomBits : '000'B > > */
0x428,
/* < Two Phase Access Request : '110000'B
< Priority : '00'B >
< RandomBits : '000'B > > */
0x600,
/* < Two Phase Access Request : '110000'B
< Priority : '11'B >
< RandomBits : '111'B > > */
0x61f,
/* < Signalling : '110011'B
< RandomBits : '10101'B > > */
0x675,
/* < Signalling : '110011'B
< RandomBits : '10001'B > > */
0x671,
/* < Emergency call : '110111'B
< RandomBits : '11001'B > > */
0x6f9,
/* < Unknown (test) : '111111'B
< RandomBits : '01010'B > > */
0x7ea,
};
for (size_t i = 0; i < ARRAY_SIZE(EGPRSPktChReqs); i++) {
rc = osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(EGPRSPktChReqs[i], &req);
printf("osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(0x%03x) returns %d\n", EGPRSPktChReqs[i], rc);
if (rc == 0)
printf(" ==> %s\n", get_value_string(osmo_gprs_rlcmac_egprs_pkt_ch_req_type_names, req.Type));
}
}
static const struct log_info_cat test_log_categories[] = { };
static const struct log_info test_log_info = {
.cat = test_log_categories,
.num_cat = ARRAY_SIZE(test_log_categories),
};
int main(int argc, char *argv[])
{
void *ctx = talloc_named_const(NULL, 1, "RLCMACTest");
osmo_init_logging2(ctx, &test_log_info);
log_parse_category_mask(osmo_stderr_target, "DLGLOBAL,1:DLCSN1,1:");
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
log_set_print_category_hex(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 1);
log_set_print_level(osmo_stderr_target, 1);
log_set_use_color(osmo_stderr_target, 0);
testRlcMacDownlink(ctx);
testRlcMacUplink(ctx);
testCsnLeftAlignedVarBmpBounds(ctx);
testRAcap(ctx);
testMalformedRAcap(ctx);
testRAcap2(ctx);
testRAcap3(ctx);
testEGPRSPktChReq(ctx);
testRAcap4(ctx);
talloc_free(ctx);
}

File diff suppressed because one or more lines are too long

219
tests/rlcmac/RLCMACTest.ok Normal file
View File

@ -0,0 +1,219 @@
*** testRlcMacDownlink ***
DOWNLINK
vector1 = 4e082500e3f1a81d080820800b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 4e 08 25 00 e3 f1 a8 1d 08 08 20 80 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 4e 08 25 00 e3 f1 a8 1d 08 08 20 80 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 48282407a6a07422720100032b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 48 28 24 07 a6 a0 74 22 72 01 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 48 28 24 07 a6 a0 74 22 72 01 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 47240c00400000000000000079eb2ac9402b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 47 24 0c 00 40 00 00 00 00 00 00 00 79 eb 2a c9 40 2b 2b 2b 2b 2b 2b
vector2 = 47 24 0c 00 40 00 00 00 00 00 00 00 79 eb 2a c9 40 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 47 28 3c 36 75 13 ba 33 30 04 24 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 47 28 3c 36 75 13 ba 33 30 04 24 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 400820001a3904df0680efb3300b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 08 20 00 1a 39 04 df 06 80 ef b3 30 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 08 20 00 1a 39 04 df 06 80 ef b3 30 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 40284f0000001009810c826f4406809dcecb2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 28 4f 00 00 00 10 09 81 0c 82 6f 44 06 80 9d ce cb 2b 2b 2b 2b 2b
vector2 = 40 28 4f 00 00 00 10 09 81 0c 82 6f 44 06 80 9d ce cb 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 4024030f2f0000000087b0042b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 24 03 0f 2f 00 00 00 00 87 b0 04 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 24 03 0f 2f 00 00 00 00 87 b0 04 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (-8)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 49 13 e0 08 50 88 40 13 a8 04 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 49 13 00 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : FALSE
vector1 = 412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 41 24 30 00 7f ff ff ff ff ff ff ff ef d1 9c 7b a1 2b 2b 2b 2b 2b 2b
vector2 = 41 24 30 00 7f ff ff ff ff ff ff ff ef d1 9c 7b a1 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 41 94 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 41 94 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 40883c1493120000000012002b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 88 3c 14 93 12 00 00 00 00 12 00 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 88 3c 14 93 12 00 00 00 00 12 01 95 95 95 95 95 95 95 95 95 95 95
vector1 == vector2 : FALSE
*** testRlcMacUplink ***
UPLINK
vector1 = 400e1e61d11d2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 0e 1e 61 d1 1d 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 0e 1e 61 d1 1d 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 400b8020000000000000002480e0032b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 0b 80 20 00 00 00 00 00 00 00 24 80 e0 03 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 0b 80 20 00 00 00 00 00 00 00 24 80 e0 03 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 4016713dc094270ca2ae57ef909006aa0fc0001f80222b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (-5)+++++++++++
vector1 = 40 16 71 3d c0 94 27 0c a2 ae 57 ef 90 90 06 aa 0f c0 00 1f 80 22 2b
vector2 = 40 16 71 3d c0 94 27 48 a2 ae 57 ef 90 90 06 aa 00 00 1f 80 00 3f 00
vector1 == vector2 : FALSE
vector1 = 401673c87f24af2632b25964200600000091000b780080
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 16 73 c8 7f 24 af 26 32 b2 59 64 20 06 00 00 00 91 00 0b 78 00 80
vector2 = 40 16 73 c8 7f 24 af 0e 32 b2 59 64 20 06 00 00 24 40 02 de 00 20 2b
vector1 == vector2 : FALSE
vector1 = 40200ffc0021ec010b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 20 0f fc 00 21 ec 01 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector2 = 40 20 0f fc 00 21 ec 01 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
vector1 == vector2 : TRUE
vector1 = 400a9020000000000000003010012a0800132b2b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
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
vector1 = 4117ea1b903eaeb2686564b2330820078000102b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 41 17 ea 1b 90 3e ae b2 68 65 64 b2 33 08 20 07 80 00 10 2b 2b 2b 2b
vector2 = 41 17 ea 1b 90 3e af 22 68 65 64 b2 33 00 00 00 00 82 00 78 00 01 01
vector1 == vector2 : FALSE
vector1 = 40167e49f7f8ef2632b2596620060000806d00541c0080
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 16 7e 49 f7 f8 ef 26 32 b2 59 66 20 06 00 00 80 6d 00 54 1c 00 80
vector2 = 40 16 7e 49 f7 f8 ef 0e 32 b2 59 66 20 06 00 00 9b 40 15 07 00 20 2b
vector1 == vector2 : FALSE
vector1 = 4017787174d92eba686564b2ccc30800a000040b2b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (0)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (0)+++++++++++
vector1 = 40 17 78 71 74 d9 2e ba 68 65 64 b2 cc c3 08 00 a0 00 04 0b 2b 2b 2b
vector2 = 40 17 78 71 74 d9 2f 2a 68 65 64 b2 cc c0 00 00 00 30 80 0a 00 00 40
vector1 == vector2 : FALSE
vector1 = 4017e5b2cd5a2eca68655e44aec84880139300412b2b2b
=========Start DECODE===========
+++++++++Finish DECODE (-5)++++++++++
=========Start ENCODE=============
+++++++++Finish ENCODE (-5)+++++++++++
vector1 = 40 17 e5 b2 cd 5a 2e ca 68 65 5e 44 ae c8 48 80 13 93 00 41 2b 2b 2b
vector2 = 40 17 e5 b2 cd 5a 2f 4a 68 65 5e 44 ae c8 00 00 00 00 48 80 13 93 00
vector1 == vector2 : FALSE
*** testCsnLeftAlignedVarBmpBounds ***
*** testRAcap ***
=== Test decoding of MS RA Capability ===
GPRS multislot class = 3
EGPRS multislot class = 3
=== Test encoding of MS RA Capability ===
osmo_gprs_rlcmac_encode_ms_ra_cap() returns 0
vector1 (len_ind=27) = 13 65 14 62 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
vector2 (len_ind=65) = 18 25 14 62 30 00 00 00 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
=== Test decoding of a malformed vector (short length indicator) ===
osmo_gprs_rlcmac_decode_ms_ra_cap() returns -5
*** testMalformedRAcap ***
=== Test decoding of MS RA Capability ===
osmo_gprs_rlcmac_decode_ms_ra_cap() returns 0
*** testRAcap2 ***
=== Test decoding of multi-band MS RA Capability ===
osmo_gprs_rlcmac_decode_ms_ra_cap() returns 0
GPRS multislot class = 12
EGPRS multislot class = 12
*** testRAcap3 ***
=== Test decoding of MS RA Capability 3===
osmo_gprs_rlcmac_decode_ms_ra_cap() returns 0
GPRS multislot class = 12
EGPRS multislot class = 12
*** testEGPRSPktChReq ***
osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(0x2b5) returns 0
==> One Phase Access
osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(0x14a) returns 0
==> One Phase Access
osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(0x428) returns 0
==> Short Access
osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(0x600) returns 0
==> Two Phase Access
osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(0x61f) returns 0
==> Two Phase Access
osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(0x675) returns 0
==> Signalling
osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(0x671) returns 0
==> Signalling
osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(0x6f9) returns 0
==> Emergency call
osmo_gprs_rlcmac_decode_egprs_pkt_ch_req(0x7ea) returns -8
*** testRAcap4 ***
=== Test decoding of MS RA Capability 4===
osmo_gprs_rlcmac_decode_ms_ra_cap() returns 0
GPRS multislot class = 12
EGPRS multislot class = 12

9
tests/testsuite.at Normal file
View File

@ -0,0 +1,9 @@
AT_INIT
AT_BANNER([Regression tests])
AT_SETUP([rlcmac])
AT_KEYWORDS([rlcmac])
cat $abs_srcdir/rlcmac/RLCMACTest.ok > expout
cat $abs_srcdir/rlcmac/RLCMACTest.err > experr
AT_CHECK([$OSMO_QEMU $abs_top_builddir/tests/rlcmac/RLCMACTest], [0], [expout], [experr])
AT_CLEANUP