MSC: Use VTY to enable/disable authentication + TMSI allocation

Change-Id: Ifaa0f119d37b18b804c563c045755cc23d509617
diff --git a/msc_tests/MSC_Tests.ttcn b/msc_tests/MSC_Tests.ttcn
index 3c0a460..e0ee84c 100644
--- a/msc_tests/MSC_Tests.ttcn
+++ b/msc_tests/MSC_Tests.ttcn
@@ -20,6 +20,9 @@
 import from Osmocom_CTRL_Types all;
 import from Osmocom_CTRL_Adapter all;
 
+import from TELNETasp_PortType all;
+import from Osmocom_VTY_Functions all;
+
 import from MNCC_Emulation all;
 import from MNCC_Types all;
 
@@ -49,6 +52,8 @@
 
 	/* only to get events from IPA underneath GSUP */
 	port IPA_CTRL_PT GSUP_IPA_EVENT;
+	/* VTY to MSC */
+	port TELNETasp_PT MSCVTY;
 }
 
 modulepar {
@@ -117,6 +122,10 @@
 	f_ipa_ctrl_start(mp_msc_ip, mp_msc_ctrl_port);
 	f_init_mncc("MSC_Test");
 	f_init_gsup("MSC_Test");
+
+	map(self:MSCVTY, system:MSCVTY);
+	f_vty_set_prompts(MSCVTY);
+	f_vty_transceive(MSCVTY, "enable");
 }
 
 template PDU_BSSAP ts_BSSAP_BSSMAP := {
@@ -343,6 +352,17 @@
 	T.timeout;
 }
 
+function f_vty_config(TELNETasp_PT pt, charstring config_node, charstring cmd)
+{
+	/* enter config mode; enter node */
+	f_vty_enter_config(pt);
+	f_vty_transceive(pt, config_node);
+	/* execute command */
+	f_vty_transceive(pt, cmd);
+	/* leave config mode */
+	f_vty_transceive(pt, "end");
+}
+
 private function f_tc_lu_imsi_noauth_tmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
 	g_pars := pars;
 	f_perform_lu(false, true, true);
@@ -350,6 +370,8 @@
 testcase TC_lu_imsi_noauth_tmsi() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication optional");
+	f_vty_config(MSCVTY, "msc", "assign-tmsi");
 
 	vc_conn := f_start_handler(refers(f_tc_lu_imsi_noauth_tmsi), testcasename(), 1);
 	vc_conn.done;
@@ -362,6 +384,8 @@
 testcase TC_lu_imsi_noauth_notmsi() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication optional");
+	f_vty_config(MSCVTY, "msc", "no assign-tmsi");
 
 	vc_conn := f_start_handler(refers(f_tc_lu_imsi_noauth_notmsi), testcasename(), 2);
 	vc_conn.done;
@@ -391,6 +415,7 @@
 testcase TC_lu_imsi_reject() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication optional");
 
 	vc_conn := f_start_handler(refers(f_tc_lu_imsi_reject), testcasename(), 3);
 	vc_conn.done;
@@ -421,6 +446,7 @@
 testcase TC_lu_imsi_timeout_gsup() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication optional");
 
 	vc_conn := f_start_handler(refers(f_tc_lu_imsi_timeout_gsup), testcasename(), 4);
 	vc_conn.done;
@@ -433,6 +459,7 @@
 testcase TC_lu_imsi_auth_tmsi() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication required");
 
 	vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth_tmsi), testcasename(), 5);
 	vc_conn.done;
@@ -475,6 +502,7 @@
 testcase TC_cmserv_imsi_unknown() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication optional");
 	vc_conn := f_start_handler(refers(f_tc_cmserv_imsi_unknown), testcasename(), 5);
 	vc_conn.done;
 }
@@ -525,6 +553,7 @@
 testcase TC_lu_and_mo_call() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication optional");
 
 	vc_conn := f_start_handler(refers(f_tc_lu_and_mo_call), testcasename(), 6);
 	vc_conn.done;
@@ -558,6 +587,7 @@
 testcase TC_lu_auth_sai_timeout() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication required");
 
 	vc_conn := f_start_handler(refers(f_tc_lu_auth_sai_timeout), testcasename(), 7);
 	vc_conn.done;
@@ -591,6 +621,7 @@
 testcase TC_lu_auth_sai_err() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication required");
 
 	vc_conn := f_start_handler(refers(f_tc_lu_auth_sai_err), testcasename(), 8);
 	vc_conn.done;
@@ -687,6 +718,7 @@
 testcase TC_lu_by_imei() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication optional");
 
 	vc_conn := f_start_handler(refers(f_tc_lu_by_imei), testcasename(), 9);
 	vc_conn.done;
@@ -734,6 +766,7 @@
 testcase TC_lu_by_tmsi_noauth_unknown() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication optional");
 
 	vc_conn := f_start_handler(refers(f_tc_lu_tmsi_noauth_unknown), testcasename(), 1);
 	vc_conn.done;
@@ -893,6 +926,7 @@
 testcase TC_emerg_call_imsi() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
 	f_init();
+	f_vty_config(MSCVTY, "network", "authentication optional");
 
 	vc_conn := f_start_handler(refers(f_tc_emerg_call_imsi), testcasename(), 6);
 	vc_conn.done;