[PATCH] osmo-msc[master]: VLR tests: add simple LU generator

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

Max gerrit-no-reply at lists.osmocom.org
Thu Feb 15 16:03:31 UTC 2018


Review at  https://gerrit.osmocom.org/6484

VLR tests: add simple LU generator

Generate LU REQ using function instead of hardcoded hex strings.

Change-Id: Iab8b07b3276b6f6ac0387df14abb98355ea0e99a
Related: OS#2864
---
M tests/msc_vlr/msc_vlr_test_gsm_authen.c
M tests/msc_vlr/msc_vlr_test_gsm_ciph.c
M tests/msc_vlr/msc_vlr_test_hlr_reject.c
M tests/msc_vlr/msc_vlr_test_hlr_timeout.c
M tests/msc_vlr/msc_vlr_test_ms_timeout.c
M tests/msc_vlr/msc_vlr_test_no_authen.c
M tests/msc_vlr/msc_vlr_test_reject_concurrency.c
M tests/msc_vlr/msc_vlr_test_rest.c
M tests/msc_vlr/msc_vlr_tests.c
M tests/msc_vlr/msc_vlr_tests.h
10 files changed, 432 insertions(+), 61 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/84/6484/1

diff --git a/tests/msc_vlr/msc_vlr_test_gsm_authen.c b/tests/msc_vlr/msc_vlr_test_gsm_authen.c
index 660a38b..4ccd7e3 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_gsm_authen.c
@@ -34,7 +34,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -224,7 +232,14 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -500,7 +515,14 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -596,7 +618,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -711,13 +741,14 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("080108" "09710000000156f0");
-	ms_sends_msg("0508" /* MM LU */
-		     "7" /* ciph key seq: no key available */
-		     "0" /* LU type: normal */
-		     "ffffff" "0000" /* LAI, LAC */
-		     "30" /* classmark 1: GSM phase 2 */
-		     "089910070000106005" /* IMSI */
-		     );
+
+	tx_loc_upd_req(imsi,
+		       0 /* LU type: normal */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       0, 7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
index 09c8369..0b3652a 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
+++ b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
@@ -35,7 +35,14 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -247,7 +254,14 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -485,7 +499,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -586,7 +608,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -684,7 +714,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_hlr_reject.c b/tests/msc_vlr/msc_vlr_test_hlr_reject.c
index 2d9b863..ac33bf9 100644
--- a/tests/msc_vlr/msc_vlr_test_hlr_reject.c
+++ b/tests/msc_vlr/msc_vlr_test_hlr_reject.c
@@ -32,7 +32,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -58,7 +66,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -89,7 +105,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -144,7 +168,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -175,7 +207,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -231,7 +271,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -259,7 +307,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -294,7 +350,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -349,7 +413,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -389,7 +461,15 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -412,7 +492,15 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_hlr_timeout.c b/tests/msc_vlr/msc_vlr_test_hlr_timeout.c
index 4dc453b..a609a1f 100644
--- a/tests/msc_vlr/msc_vlr_test_hlr_timeout.c
+++ b/tests/msc_vlr/msc_vlr_test_hlr_timeout.c
@@ -36,7 +36,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -73,7 +81,15 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_ms_timeout.c b/tests/msc_vlr/msc_vlr_test_ms_timeout.c
index 569bbf5..aa733c9 100644
--- a/tests/msc_vlr/msc_vlr_test_ms_timeout.c
+++ b/tests/msc_vlr/msc_vlr_test_ms_timeout.c
@@ -34,7 +34,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -94,7 +102,15 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -195,7 +211,15 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_no_authen.c b/tests/msc_vlr/msc_vlr_test_no_authen.c
index 55c14cd..91b3172 100644
--- a/tests/msc_vlr/msc_vlr_test_no_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_no_authen.c
@@ -35,7 +35,15 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -174,7 +182,15 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -393,7 +409,15 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -461,7 +485,15 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -537,7 +569,15 @@
 	btw("Location Update request causes an IMEISV ID request back to the MS");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051803");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(dtap_tx_confirmed);
 
 	btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
@@ -597,7 +637,15 @@
 	btw("Location Update request causes an IMEISV ID request back to the MS");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051803");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(dtap_tx_confirmed);
 
 	btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
@@ -674,7 +722,15 @@
 	btw("Location Update request causes an IMEISV ID request back to the MS");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051803");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(dtap_tx_confirmed);
 
 	btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
@@ -729,7 +785,15 @@
 	btw("Location Update request causes an IMEISV ID request back to the MS");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051803");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(dtap_tx_confirmed);
 
 	btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
@@ -812,7 +876,15 @@
 	btw("Location Update request causes an IMEISV ID request back to the MS");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051803");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(dtap_tx_confirmed);
 
 	btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
diff --git a/tests/msc_vlr/msc_vlr_test_reject_concurrency.c b/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
index c7af200..30885dd 100644
--- a/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
+++ b/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
@@ -31,7 +31,15 @@
 	btw("Location Update Request on one connection");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 	EXPECT_CONN_COUNT(1);
@@ -40,7 +48,15 @@
 	conn1 = g_conn;
 	g_conn = NULL;
 	expect_bssap_clear();
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 	VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
 	EXPECT_CONN_COUNT(1);
@@ -67,12 +83,20 @@
 	comment_end(nr, imsi);
 }
 
-void _normal_lu_part1()
+static inline void _normal_lu_part1(const char *imsi)
 {
 	btw("Location Update Request");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 	EXPECT_CONN_COUNT(1);
@@ -96,10 +120,10 @@
 	EXPECT_CONN_COUNT(0);
 }
 
-void _normal_lu()
+void _normal_lu(const char *imsi)
 {
 	BTW("Subscriber does a normal LU");
-	_normal_lu_part1();
+	_normal_lu_part1(imsi);
 	_normal_lu_part2();
 }
 
@@ -192,10 +216,18 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu_part1();
+	_normal_lu_part1(imsi);
 
 	BTW("Another Location Update Request from the same subscriber on the same conn is dropped silently");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 	EXPECT_CONN_COUNT(1);
 
@@ -210,7 +242,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu_part1();
+	_normal_lu_part1(imsi);
 
 	BTW("A CM Service Request in the middle of a LU is rejected");
 	cm_service_result_sent = RES_NONE;
@@ -231,7 +263,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu_part1();
+	_normal_lu_part1(imsi);
 
 	BTW("An erratic Paging Response is dropped silently");
 	ms_sends_msg("06270703305882089910070000006402");
@@ -249,13 +281,21 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_normal_cm_service_req();
 
 	btw("A LU request on an open conn is dropped silently");
 	/* TODO: accept periodic LU on an already open conn? */
 	lu_result_sent = RES_NONE;
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 	EXPECT_CONN_COUNT(1);
 
@@ -273,7 +313,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_normal_cm_service_req();
 
 	btw("A second CM Service Request on the same conn is accepted without another auth dance");
@@ -296,7 +336,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_normal_cm_service_req();
 
 	BTW("An erratic Paging Response on the same conn is dropped silently");
@@ -321,7 +361,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_page(imsi);
 	_paging_resp_part1();
 
@@ -338,13 +378,21 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_page(imsi);
 	_paging_resp_part1();
 
 	BTW("MS sends erratic LU Request, which is dropped silently");
 	lu_result_sent = RES_NONE;
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 	EXPECT_CONN_COUNT(1);
 
@@ -358,7 +406,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_page(imsi);
 	_paging_resp_part1();
 
diff --git a/tests/msc_vlr/msc_vlr_test_rest.c b/tests/msc_vlr/msc_vlr_test_rest.c
index 8bf8c3a..3fb9f89 100644
--- a/tests/msc_vlr/msc_vlr_test_rest.c
+++ b/tests/msc_vlr/msc_vlr_test_rest.c
@@ -85,7 +85,15 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -115,7 +123,15 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_req(imsi,
+		       2 /* LU type: IMSI ATTACH */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       1 /* LAC */,
+		       7 /* ciph key seq: no key available */);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index c3d3d37..26bdd67 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -765,6 +765,42 @@
 	msgb_free(msg);
 }
 
+void tx_loc_upd_req(const char *imsi, uint8_t lu_type, uint8_t rev_lv,
+		    bool a5_1, bool es_ind, uint8_t pwr_lv, uint16_t mcc, uint16_t mnc, uint8_t lac, uint8_t key_seq)
+{
+	struct msgb *nmsg = gsm48_msgb_alloc_name("3GPP TS 24.008 LU");
+	struct gsm48_hdr *ngh;
+	struct gsm48_loc_upd_req *nlu; /* NOTE: mi_len is part of struct */
+	uint8_t buf[11];
+
+	ngh = (struct gsm48_hdr *)msgb_put(nmsg, sizeof(*ngh));
+	nlu = (struct gsm48_loc_upd_req *)msgb_put(nmsg, sizeof(*nlu));
+
+	ngh->proto_discr = GSM48_PDISC_MM;
+	ngh->msg_type = GSM48_MT_MM_LOC_UPD_REQUEST;
+
+	/* location updating type */
+	nlu->type = lu_type;
+
+	/* cipering key */
+	nlu->key_seq = key_seq;
+
+	gsm48_generate_lai(&nlu->lai, mcc, mnc, lac);
+
+	/* classmark 1 */
+	gsm48_encode_classmark1(&nlu->classmark1, rev_lv, es_ind, a5_1, pwr_lv);
+
+	/* MI */
+	gsm48_generate_mid(buf, imsi, GSM_MI_TYPE_IMSI);
+
+	msgb_put(nmsg, buf[1]); /* length is part of nlu */
+	memcpy(&nlu->mi_len, buf + 1, 1 + buf[1]);
+
+	ms_sends_msg(msgb_hexdump(nmsg));
+
+	msgb_free(nmsg);
+}
+
 const struct timeval fake_time_start_time = { 123, 456 };
 
 void fake_time_start()
diff --git a/tests/msc_vlr/msc_vlr_tests.h b/tests/msc_vlr/msc_vlr_tests.h
index a59b5d9..2ac20ce 100644
--- a/tests/msc_vlr/msc_vlr_tests.h
+++ b/tests/msc_vlr/msc_vlr_tests.h
@@ -135,6 +135,8 @@
 void paging_expect_imsi(const char *imsi);
 void paging_expect_tmsi(uint32_t tmsi);
 void tx_identity_resp(const char *imsi, uint8_t mi_type, uint8_t seq);
+void tx_loc_upd_req(const char *imsi, uint8_t lu_type, uint8_t rev_lv,
+		    bool a5_1, bool es_ind, uint8_t pwr_lv, uint16_t mcc, uint16_t mnc, uint8_t lac, uint8_t key_seq);
 void ms_sends_msg(const char *hex);
 void ms_sends_security_mode_complete();
 void gsup_rx(const char *rx_hex, const char *expect_tx_hex);

-- 
To view, visit https://gerrit.osmocom.org/6484
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab8b07b3276b6f6ac0387df14abb98355ea0e99a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list