[PATCH] osmo-ttcn3-hacks[master]: msc: TC_lu_auth_2G_fail: Test auth failure in 2G auth

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jan 24 21:42:46 UTC 2018


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

msc: TC_lu_auth_2G_fail: Test auth failure in 2G auth

Change-Id: I54ef4137c0b95658b1e844ac1bb13729f27fd0d1
---
M library/GSUP_Types.ttcn
M msc_tests/MSC_Tests.ttcn
2 files changed, 47 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/45/6045/1

diff --git a/library/GSUP_Types.ttcn b/library/GSUP_Types.ttcn
index a8134eb..7f239ca 100644
--- a/library/GSUP_Types.ttcn
+++ b/library/GSUP_Types.ttcn
@@ -243,6 +243,9 @@
 	tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, {
 			tr_GSUP_IE_IMSI(imsi), * });
 
+template GSUP_PDU tr_GSUP_AUTH_FAIL_IND(hexstring imsi) :=
+	tr_GSUP(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT, {
+			tr_GSUP_IE_IMSI(imsi), * });
 
 template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := {
 	tag := iei,
diff --git a/msc_tests/MSC_Tests.ttcn b/msc_tests/MSC_Tests.ttcn
index b1a7d1b..367cd79 100644
--- a/msc_tests/MSC_Tests.ttcn
+++ b/msc_tests/MSC_Tests.ttcn
@@ -1043,6 +1043,50 @@
 	vc_conn.done;
 }
 
+/* Test LU (with authentication enabled), with wrong response from MS */
+private function f_tc_lu_auth_2G_fail(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
+	g_pars := pars;
+
+	var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi)
+
+	/* tell GSUP dispatcher to send this IMSI to us */
+	f_create_gsup_expect(hex2str(g_pars.imsi));
+
+	/* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */
+	f_bssap_compl_l3(l3_lu);
+
+	/* Send Early Classmark, just for the fun of it */
+	BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3));
+
+	var AuthVector vec := f_gen_auth_vec_2g();
+	var GSUP_IE auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G(vec.rand, vec.sres, vec.kc));
+	GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi));
+	GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple));
+
+	BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_AUTH_REQ(vec.rand)));
+	/* Send back wrong auth response */
+	BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MT_MM_AUTH_RESP_2G('00000000'O)));
+
+	/* Expect GSUP AUTH FAIL REP to HLR */
+	GSUP.receive(tr_GSUP_AUTH_FAIL_IND(g_pars.imsi));
+
+	/* Expect LU REJECT with Cause == Illegal MS */
+	BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej('03'O)));
+	BSSAP.receive(tr_BSSMAP_ClearCommand);
+	BSSAP.send(ts_BSSMAP_ClearComplete);
+	BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND);
+	setverdict(pass);
+}
+testcase TC_lu_auth_2G_fail() runs on MTC_CT {
+	var BSC_ConnHdlr vc_conn;
+	f_init();
+	f_vty_config(MSCVTY, "network", "authentication required");
+	f_vty_config(MSCVTY, "msc", "assign-tmsi");
+
+	vc_conn := f_start_handler(refers(f_tc_lu_auth_2G_fail), testcasename(), 23);
+	vc_conn.done;
+}
+
 
 /* TODO:
    * continue to send repeated MO signalling messages to keep channel open: does MSC tmeout?

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54ef4137c0b95658b1e844ac1bb13729f27fd0d1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list