[MERGED] osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-10 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged.

Change subject: msc_vlr_test_call: reproduce OS#3062
..


msc_vlr_test_call: reproduce OS#3062

A related ttcn3 test is added in Ic80646e1fba37bb6163ca3a7eead7980b4ad7a51

Related: OS#3062
Change-Id: Ice7197b48d4e163a3c4d97b559fdcd7e88c4107e
---
M tests/msc_vlr/msc_vlr_test_call.c
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_tests.c
M tests/msc_vlr/msc_vlr_tests.h
4 files changed, 436 insertions(+), 0 deletions(-)

Approvals:
  Neels Hofmeyr: Verified
  Harald Welte: Looks good to me, approved



diff --git a/tests/msc_vlr/msc_vlr_test_call.c 
b/tests/msc_vlr/msc_vlr_test_call.c
index 6359865..9d4126e 100644
--- a/tests/msc_vlr/msc_vlr_test_call.c
+++ b/tests/msc_vlr/msc_vlr_test_call.c
@@ -31,6 +31,12 @@
mncc_tx_to_cc(net, msg_type, mncc);
 }
 
+static void on_call_release_mncc_sends_to_cc(uint32_t msg_type, struct 
gsm_mncc *mncc)
+{
+   mncc->msg_type = msg_type;
+   on_call_release_mncc_sends_to_cc_data = mncc;
+}
+
 #define IMSI "90170010650"
 
 static void standard_lu()
@@ -334,6 +340,80 @@
comment_end();
 }
 
+static void test_call_mt2()
+{
+   struct gsm_mncc mncc = {
+   .imsi = IMSI,
+   .callref = 0x423,
+   };
+
+   comment_start();
+
+   fake_time_start();
+
+   standard_lu();
+
+   BTW("after a while, MNCC asks us to setup a call, causing Paging");
+   
+   paging_expect_imsi(IMSI);
+   paging_sent = false;
+   mncc_sends_to_cc(MNCC_SETUP_REQ, );
+
+   VERBOSE_ASSERT(paging_sent, == true, "%d");
+   VERBOSE_ASSERT(paging_stopped, == false, "%d");
+
+   btw("MS replies with Paging Response, and VLR sends Auth Request");
+   auth_request_sent = false;
+   auth_request_expect_rand = "c187a53a5e6b9d573cac7c74451fd46d";
+   auth_request_expect_autn = "1843a645b98d5b2d666af46c45d9";
+   ms_sends_msg("062707"
+"03575886" /* classmark 2 */
+"08991007106005" /* IMSI */);
+   VERBOSE_ASSERT(auth_request_sent, == true, "%d");
+
+   btw("MS sends Authen Response, VLR accepts and sends 
SecurityModeControl");
+   expect_security_mode_ctrl(NULL, "1159ec926a50e98c034a6b7d7c9f418d");
+   ms_sends_msg("0554" "7db47cf7" "2104" "f81e4dc7"); /* 2nd vector's res, 
s.a. */
+   VERBOSE_ASSERT(security_mode_ctrl_sent, == true, "%d");
+
+   btw("MS sends SecurityModeControl acceptance, VLR accepts, sends CC 
Setup");
+   dtap_expect_tx("0305" /* CC: Setup */);
+   ms_sends_security_mode_complete();
+   VERBOSE_ASSERT(paging_stopped, == true, "%d");
+
+   cc_to_mncc_expect_tx(IMSI, MNCC_CALL_CONF_IND);
+   ms_sends_msg("8348" /* CC: Call Confirmed */
+"0406600402000581" /* Bearer Capability */
+"15020100" /* Call Control Capabilities */
+"40080402600400021f00" /* Supported Codec List */);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+
+   fake_time_passes(1, 23);
+
+   cc_to_mncc_expect_tx("", MNCC_ALERT_IND);
+   ms_sends_msg("8381" /* CC: Alerting */);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+
+   fake_time_passes(15, 23);
+
+   btw("The call failed, the BSC sends a BSSMAP Clear Request");
+   on_call_release_mncc_sends_to_cc(MNCC_REL_REQ, );
+   cc_to_mncc_expect_tx("", MNCC_REL_CNF);
+   dtap_expect_tx("032d"); /* CC: Release */
+   expect_iu_release();
+   msc_clear_request(g_conn, 0);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+   OSMO_ASSERT(iu_release_sent);
+
+   EXPECT_CONN_COUNT(0);
+
+   /* Make sure a pending release timer doesn't fire later to access freed 
data */
+   fake_time_passes(15, 23);
+
+   clear_vlr();
+   comment_end();
+}
+
 static void test_call_mo_to_unknown()
 {
struct gsm_mncc mncc = {
@@ -497,6 +577,7 @@
 msc_vlr_test_func_t msc_vlr_tests[] = {
test_call_mo,
test_call_mt,
+   test_call_mt2,
test_call_mo_to_unknown,
test_call_mo_to_unknown_timeout,
NULL
diff --git a/tests/msc_vlr/msc_vlr_test_call.err 
b/tests/msc_vlr/msc_vlr_test_call.err
index 281f418..6142464 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -757,6 +757,352 @@
 full talloc report on 'msgb' (total  0 bytes in   1 blocks)
 talloc_total_blocks(tall_bsc_ctx) == 12
 
+= test_call_mt2
+- Total time passed: 0.00 s
+- Location Update request causes a GSUP Send Auth Info request to HLR
+  MSC <--RAN_UTRAN_IU-- MS: GSM48_MT_MM_LOC_UPD_REQUEST
+  new conn
+DREF unknown: MSC conn use + compl_l3 == 1 (0x1)
+DRLL Dispatching 04.08 message GSM48_MT_MM_LOC_UPD_REQUEST (0x5:0x8)
+DREF unknown: MSC conn use + fsm == 2 (0x5)
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: Allocated
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: 

osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice7197b48d4e163a3c4d97b559fdcd7e88c4107e
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-09 Thread Neels Hofmeyr

Patch Set 2: Verified+1

add V+1 manually, the jenkins result wasn't counted

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice7197b48d4e163a3c4d97b559fdcd7e88c4107e
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-09 Thread Neels Hofmeyr

msc_vlr_test_call: reproduce OS#3062

A related ttcn3 test is added in Ic80646e1fba37bb6163ca3a7eead7980b4ad7a51

Related: OS#3062
Change-Id: Ice7197b48d4e163a3c4d97b559fdcd7e88c4107e
---
M tests/msc_vlr/msc_vlr_test_call.c
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_tests.c
M tests/msc_vlr/msc_vlr_tests.h
4 files changed, 436 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/03/7703/2

diff --git a/tests/msc_vlr/msc_vlr_test_call.c 
b/tests/msc_vlr/msc_vlr_test_call.c
index 6359865..9d4126e 100644
--- a/tests/msc_vlr/msc_vlr_test_call.c
+++ b/tests/msc_vlr/msc_vlr_test_call.c
@@ -31,6 +31,12 @@
mncc_tx_to_cc(net, msg_type, mncc);
 }
 
+static void on_call_release_mncc_sends_to_cc(uint32_t msg_type, struct 
gsm_mncc *mncc)
+{
+   mncc->msg_type = msg_type;
+   on_call_release_mncc_sends_to_cc_data = mncc;
+}
+
 #define IMSI "90170010650"
 
 static void standard_lu()
@@ -334,6 +340,80 @@
comment_end();
 }
 
+static void test_call_mt2()
+{
+   struct gsm_mncc mncc = {
+   .imsi = IMSI,
+   .callref = 0x423,
+   };
+
+   comment_start();
+
+   fake_time_start();
+
+   standard_lu();
+
+   BTW("after a while, MNCC asks us to setup a call, causing Paging");
+   
+   paging_expect_imsi(IMSI);
+   paging_sent = false;
+   mncc_sends_to_cc(MNCC_SETUP_REQ, );
+
+   VERBOSE_ASSERT(paging_sent, == true, "%d");
+   VERBOSE_ASSERT(paging_stopped, == false, "%d");
+
+   btw("MS replies with Paging Response, and VLR sends Auth Request");
+   auth_request_sent = false;
+   auth_request_expect_rand = "c187a53a5e6b9d573cac7c74451fd46d";
+   auth_request_expect_autn = "1843a645b98d5b2d666af46c45d9";
+   ms_sends_msg("062707"
+"03575886" /* classmark 2 */
+"08991007106005" /* IMSI */);
+   VERBOSE_ASSERT(auth_request_sent, == true, "%d");
+
+   btw("MS sends Authen Response, VLR accepts and sends 
SecurityModeControl");
+   expect_security_mode_ctrl(NULL, "1159ec926a50e98c034a6b7d7c9f418d");
+   ms_sends_msg("0554" "7db47cf7" "2104" "f81e4dc7"); /* 2nd vector's res, 
s.a. */
+   VERBOSE_ASSERT(security_mode_ctrl_sent, == true, "%d");
+
+   btw("MS sends SecurityModeControl acceptance, VLR accepts, sends CC 
Setup");
+   dtap_expect_tx("0305" /* CC: Setup */);
+   ms_sends_security_mode_complete();
+   VERBOSE_ASSERT(paging_stopped, == true, "%d");
+
+   cc_to_mncc_expect_tx(IMSI, MNCC_CALL_CONF_IND);
+   ms_sends_msg("8348" /* CC: Call Confirmed */
+"0406600402000581" /* Bearer Capability */
+"15020100" /* Call Control Capabilities */
+"40080402600400021f00" /* Supported Codec List */);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+
+   fake_time_passes(1, 23);
+
+   cc_to_mncc_expect_tx("", MNCC_ALERT_IND);
+   ms_sends_msg("8381" /* CC: Alerting */);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+
+   fake_time_passes(15, 23);
+
+   btw("The call failed, the BSC sends a BSSMAP Clear Request");
+   on_call_release_mncc_sends_to_cc(MNCC_REL_REQ, );
+   cc_to_mncc_expect_tx("", MNCC_REL_CNF);
+   dtap_expect_tx("032d"); /* CC: Release */
+   expect_iu_release();
+   msc_clear_request(g_conn, 0);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+   OSMO_ASSERT(iu_release_sent);
+
+   EXPECT_CONN_COUNT(0);
+
+   /* Make sure a pending release timer doesn't fire later to access freed 
data */
+   fake_time_passes(15, 23);
+
+   clear_vlr();
+   comment_end();
+}
+
 static void test_call_mo_to_unknown()
 {
struct gsm_mncc mncc = {
@@ -497,6 +577,7 @@
 msc_vlr_test_func_t msc_vlr_tests[] = {
test_call_mo,
test_call_mt,
+   test_call_mt2,
test_call_mo_to_unknown,
test_call_mo_to_unknown_timeout,
NULL
diff --git a/tests/msc_vlr/msc_vlr_test_call.err 
b/tests/msc_vlr/msc_vlr_test_call.err
index 281f418..6142464 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -757,6 +757,352 @@
 full talloc report on 'msgb' (total  0 bytes in   1 blocks)
 talloc_total_blocks(tall_bsc_ctx) == 12
 
+= test_call_mt2
+- Total time passed: 0.00 s
+- Location Update request causes a GSUP Send Auth Info request to HLR
+  MSC <--RAN_UTRAN_IU-- MS: GSM48_MT_MM_LOC_UPD_REQUEST
+  new conn
+DREF unknown: MSC conn use + compl_l3 == 1 (0x1)
+DRLL Dispatching 04.08 message GSM48_MT_MM_LOC_UPD_REQUEST (0x5:0x8)
+DREF unknown: MSC conn use + fsm == 2 (0x5)
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: Allocated
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: Received Event 
SUBSCR_CONN_E_START
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: state_chg to 
SUBSCR_CONN_S_NEW
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_NEW}: Updated ID from LU

osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-09 Thread Neels Hofmeyr

Patch Set 1:

note related ttcn3 test: https://gerrit.osmocom.org/7712

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice7197b48d4e163a3c4d97b559fdcd7e88c4107e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-09 Thread Neels Hofmeyr

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

msc_vlr_test_call: reproduce OS#3062

Change-Id: Ice7197b48d4e163a3c4d97b559fdcd7e88c4107e
---
M tests/msc_vlr/msc_vlr_test_call.c
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_tests.c
M tests/msc_vlr/msc_vlr_tests.h
4 files changed, 436 insertions(+), 0 deletions(-)


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

diff --git a/tests/msc_vlr/msc_vlr_test_call.c 
b/tests/msc_vlr/msc_vlr_test_call.c
index 6359865..9d4126e 100644
--- a/tests/msc_vlr/msc_vlr_test_call.c
+++ b/tests/msc_vlr/msc_vlr_test_call.c
@@ -31,6 +31,12 @@
mncc_tx_to_cc(net, msg_type, mncc);
 }
 
+static void on_call_release_mncc_sends_to_cc(uint32_t msg_type, struct 
gsm_mncc *mncc)
+{
+   mncc->msg_type = msg_type;
+   on_call_release_mncc_sends_to_cc_data = mncc;
+}
+
 #define IMSI "90170010650"
 
 static void standard_lu()
@@ -334,6 +340,80 @@
comment_end();
 }
 
+static void test_call_mt2()
+{
+   struct gsm_mncc mncc = {
+   .imsi = IMSI,
+   .callref = 0x423,
+   };
+
+   comment_start();
+
+   fake_time_start();
+
+   standard_lu();
+
+   BTW("after a while, MNCC asks us to setup a call, causing Paging");
+   
+   paging_expect_imsi(IMSI);
+   paging_sent = false;
+   mncc_sends_to_cc(MNCC_SETUP_REQ, );
+
+   VERBOSE_ASSERT(paging_sent, == true, "%d");
+   VERBOSE_ASSERT(paging_stopped, == false, "%d");
+
+   btw("MS replies with Paging Response, and VLR sends Auth Request");
+   auth_request_sent = false;
+   auth_request_expect_rand = "c187a53a5e6b9d573cac7c74451fd46d";
+   auth_request_expect_autn = "1843a645b98d5b2d666af46c45d9";
+   ms_sends_msg("062707"
+"03575886" /* classmark 2 */
+"08991007106005" /* IMSI */);
+   VERBOSE_ASSERT(auth_request_sent, == true, "%d");
+
+   btw("MS sends Authen Response, VLR accepts and sends 
SecurityModeControl");
+   expect_security_mode_ctrl(NULL, "1159ec926a50e98c034a6b7d7c9f418d");
+   ms_sends_msg("0554" "7db47cf7" "2104" "f81e4dc7"); /* 2nd vector's res, 
s.a. */
+   VERBOSE_ASSERT(security_mode_ctrl_sent, == true, "%d");
+
+   btw("MS sends SecurityModeControl acceptance, VLR accepts, sends CC 
Setup");
+   dtap_expect_tx("0305" /* CC: Setup */);
+   ms_sends_security_mode_complete();
+   VERBOSE_ASSERT(paging_stopped, == true, "%d");
+
+   cc_to_mncc_expect_tx(IMSI, MNCC_CALL_CONF_IND);
+   ms_sends_msg("8348" /* CC: Call Confirmed */
+"0406600402000581" /* Bearer Capability */
+"15020100" /* Call Control Capabilities */
+"40080402600400021f00" /* Supported Codec List */);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+
+   fake_time_passes(1, 23);
+
+   cc_to_mncc_expect_tx("", MNCC_ALERT_IND);
+   ms_sends_msg("8381" /* CC: Alerting */);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+
+   fake_time_passes(15, 23);
+
+   btw("The call failed, the BSC sends a BSSMAP Clear Request");
+   on_call_release_mncc_sends_to_cc(MNCC_REL_REQ, );
+   cc_to_mncc_expect_tx("", MNCC_REL_CNF);
+   dtap_expect_tx("032d"); /* CC: Release */
+   expect_iu_release();
+   msc_clear_request(g_conn, 0);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+   OSMO_ASSERT(iu_release_sent);
+
+   EXPECT_CONN_COUNT(0);
+
+   /* Make sure a pending release timer doesn't fire later to access freed 
data */
+   fake_time_passes(15, 23);
+
+   clear_vlr();
+   comment_end();
+}
+
 static void test_call_mo_to_unknown()
 {
struct gsm_mncc mncc = {
@@ -497,6 +577,7 @@
 msc_vlr_test_func_t msc_vlr_tests[] = {
test_call_mo,
test_call_mt,
+   test_call_mt2,
test_call_mo_to_unknown,
test_call_mo_to_unknown_timeout,
NULL
diff --git a/tests/msc_vlr/msc_vlr_test_call.err 
b/tests/msc_vlr/msc_vlr_test_call.err
index 281f418..6142464 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -757,6 +757,352 @@
 full talloc report on 'msgb' (total  0 bytes in   1 blocks)
 talloc_total_blocks(tall_bsc_ctx) == 12
 
+= test_call_mt2
+- Total time passed: 0.00 s
+- Location Update request causes a GSUP Send Auth Info request to HLR
+  MSC <--RAN_UTRAN_IU-- MS: GSM48_MT_MM_LOC_UPD_REQUEST
+  new conn
+DREF unknown: MSC conn use + compl_l3 == 1 (0x1)
+DRLL Dispatching 04.08 message GSM48_MT_MM_LOC_UPD_REQUEST (0x5:0x8)
+DREF unknown: MSC conn use + fsm == 2 (0x5)
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: Allocated
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: Received Event 
SUBSCR_CONN_E_START
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: state_chg to 
SUBSCR_CONN_S_NEW
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_NEW}: Updated ID from LU
+DMM LOCATION UPDATING REQUEST: