aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gsm0808
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-02-15 16:26:37 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2021-02-15 16:42:46 +0100
commit524898504af2251b740be9621d184db1b9b875ee (patch)
tree9ce979f530a3e1febcd6dc7b355517afe8ec566d /tests/gsm0808
parent85a0f1143d0e2bb9ad34c675bcca384e8e84badf (diff)
gsm: Fix encoding of gsm0808_cell_id_list2 with CGI-PS types
CGI-PS type doesn't exist in GSM 08.08 Cell Id lists. That type of cell id is osmocom-specific and used internally. In here CGI-PS is automatically converted to CGI (since the later is an extension of this one). The encode/decode_cell_id_u are left intact (comment added) since those can still be used (and are used by RIM code) to encode/decode TS 48.018 Cell Identifiers. Related: SYS#4909 Change-Id: Id74f4577c397c1ba696f00395858311bd82cb2c8
Diffstat (limited to 'tests/gsm0808')
-rw-r--r--tests/gsm0808/gsm0808_test.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index 7eb53c2b..04b3b727 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -1760,6 +1760,48 @@ static void test_gsm0808_enc_dec_cell_id_global()
msgb_free(msg);
}
+static void test_gsm0808_enc_dec_cell_id_global_ps()
+{
+ struct gsm0808_cell_id enc_cgi = {
+ .id_discr = CELL_IDENT_WHOLE_GLOBAL,
+ .id.global = {
+ .lai = {
+ .plmn = { .mcc = 123, .mnc = 456 },
+ .lac = 0x2342
+ },
+ .cell_identity = 0x423,
+ }
+ };
+ struct gsm0808_cell_id enc_cgi_ps = {
+ .id_discr = CELL_IDENT_WHOLE_GLOBAL_PS,
+ .id.global_ps = {
+ .rai = {
+ .lac = {
+ .plmn = { .mcc = 123, .mnc = 456 },
+ .lac = 0x2342
+ },
+ .rac = 0xcc,
+ },
+ .cell_identity = 0x423,
+ }
+ };
+ struct msgb *msg_cgi, *msg_cgi_ps;
+ uint8_t rc_enc;
+
+ msg_cgi = msgb_alloc(1024, "output buffer (CGI)");
+ rc_enc = gsm0808_enc_cell_id(msg_cgi, &enc_cgi);
+ OSMO_ASSERT(rc_enc > 0);
+
+ msg_cgi_ps = msgb_alloc(1024, "output buffer (CGI-PS)");
+ rc_enc = gsm0808_enc_cell_id(msg_cgi_ps, &enc_cgi_ps);
+ OSMO_ASSERT(rc_enc > 0);
+
+ OSMO_ASSERT(msgb_eq(msg_cgi, msg_cgi_ps));
+
+ msgb_free(msg_cgi);
+ msgb_free(msg_cgi_ps);
+}
+
static void test_gsm0808_sc_cfg_from_gsm48_mr_cfg_single(struct gsm48_multi_rate_conf *cfg)
{
uint16_t s15_s0;
@@ -2462,6 +2504,7 @@ int main(int argc, char **argv)
test_gsm0808_enc_dec_cell_id_ci();
test_gsm0808_enc_dec_cell_id_lac_and_ci();
test_gsm0808_enc_dec_cell_id_global();
+ test_gsm0808_enc_dec_cell_id_global_ps();
test_gsm0808_sc_cfg_from_gsm48_mr_cfg();
test_gsm48_mr_cfg_from_gsm0808_sc_cfg();