VLR: send CHECK-IMEI to EIR/HLR

When check-imei-req is enabled in the VTY config, do not accept IMEIs
sent by the ME directly anymore. Send the IMEI to the EIR/HLR and wait
for its ACK or NACK.

OsmoHLR also accepts all IMEIs at this point, but this allows to
optionally store the IMEI in the HLR DB.

Depends: Ib240474b0c3c603ba840cf26babb38a44dfc9364 (osmo-hlr)
Related: OS#3733
Change-Id: Ife868ed71c36cdd02638072abebf61fc949080a7
diff --git a/tests/msc_vlr/msc_vlr_test_no_authen.c b/tests/msc_vlr/msc_vlr_test_no_authen.c
index 3162149..d52d3d6 100644
--- a/tests/msc_vlr/msc_vlr_test_no_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_no_authen.c
@@ -428,11 +428,15 @@
 	EXPECT_ACCEPTED(false);
 	thwart_rx_non_initial_requests();
 
-	btw("MS replies with an Identity Response");
-	expect_bssap_clear();
+	btw("MS replies with an Identity Response, VLR sends the IMEI to HLR");
+	gsup_expect_tx("30010809710000004026f050090824433224433224f0");
 	/* 3GPP TS 23.003: 6.2.1 Composition of IMEI: the IMEI ends with a
 	 * spare digit that shall be sent as zero by the MS. */
 	ms_sends_msg("0559084a32244332244302");
+
+	btw("HLR accepts the IMEI");
+	expect_bssap_clear();
+	gsup_rx("32010809710000004026f0510100", NULL);
 	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	btw("LU was successful, and the conn has already been closed");
@@ -499,9 +503,13 @@
 	EXPECT_ACCEPTED(false);
 	thwart_rx_non_initial_requests();
 
-	btw("MS replies with an Identity Response");
+	btw("MS replies with an Identity Response, VLR sends the IMEI to HLR");
+	gsup_expect_tx("30010809710000004026f050090824433224433224f0");
 	ms_sends_msg("0559084a32244332244302");
 
+	btw("HLR accepts the IMEI");
+	gsup_rx("32010809710000004026f0510100", NULL);
+
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
@@ -652,9 +660,13 @@
 	EXPECT_ACCEPTED(false);
 	thwart_rx_non_initial_requests();
 
-	btw("MS replies with an Identity Response");
-	expect_bssap_clear();
+	btw("MS replies with an Identity Response, VLR sends the IMEI to HLR");
+	gsup_expect_tx("30010809710000004026f050090824433224433224f0");
 	ms_sends_msg("0559084a32244332244302");
+
+	btw("HLR accepts the IMEI");
+	expect_bssap_clear();
+	gsup_rx("32010809710000004026f0510100", NULL);
 	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	btw("LU was successful, and the conn has already been closed");
@@ -874,9 +886,13 @@
 	EXPECT_ACCEPTED(false);
 	thwart_rx_non_initial_requests();
 
-	btw("MS replies with an Identity Response");
+	btw("MS replies with an Identity Response, VLR sends the IMEI to HLR");
+	gsup_expect_tx("30010809710000004026f050090824433224433224f0");
 	ms_sends_msg("0559084a32244332244302");
 
+	btw("HLR accepts the IMEI");
+	gsup_rx("32010809710000004026f0510100", NULL);
+
 	btw("a LU Accept with a new TMSI was sent, waiting for TMSI Realloc Compl");
 	EXPECT_CONN_COUNT(1);
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");