sgsn: create 3 instances of BSSGP at the same time
Allows to use different BSSGP connection within a single
test.
Change-Id: I01d7f264a0a52e248d6e754485c807266c0b14bf
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 6bf2d60..3616a62 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -60,8 +60,11 @@
BssgpConfig cfg
};
+type record length(3) of GbInstance GbInstances;
+type record length(3) of BssgpCellId BssgpCellIds;
+
type component test_CT {
- var GbInstance g_gb[3];
+ var GbInstances g_gb;
var GSUP_Emulation_CT vc_GSUP;
var IPA_Emulation_CT vc_GSUP_IPA;
@@ -101,15 +104,15 @@
OCT4 tlli,
OCT4 tlli_old optional,
RoutingAreaIdentificationV ra optional,
- BssgpCellId bssgp_cell_id,
+ BssgpCellIds bssgp_cell_id,
AuthVector vec optional,
SGSN_ConnHdlrNetworkPars net,
float t_guard
};
-private function f_init_gb(inout GbInstance gb, charstring id) runs on test_CT {
- gb.vc_NS := NS_CT.create(id & "-NS");
- gb.vc_BSSGP := BSSGP_CT.create(id & "-BSSGP");
+private function f_init_gb(inout GbInstance gb, charstring id, integer offset) runs on test_CT {
+ gb.vc_NS := NS_CT.create(id & "-NS" & int2str(offset));
+ gb.vc_BSSGP := BSSGP_CT.create(id & "-BSSGP" & int2str(offset));
/* connect lower end of BSSGP emulation with NS upper port */
connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP);
/* connect lower end of NS emulation to NS codec port (on top of IPL4) */
@@ -224,7 +227,9 @@
sgsn_role := false
};
- f_init_gb(g_gb[0], "SGSN_Test-Gb0");
+ f_init_gb(g_gb[0], "SGSN_Test-Gb0", 0);
+ f_init_gb(g_gb[1], "SGSN_Test-Gb1", 1);
+ f_init_gb(g_gb[2], "SGSN_Test-Gb2", 2);
f_init_gsup("SGSN_Test");
f_init_gtp("SGSN_Test");
f_init_vty();
@@ -234,7 +239,7 @@
type function void_fn(charstring id) runs on BSSGP_ConnHdlr;
/* helper function to create, connect and start a BSSGP_ConnHdlr component */
-function f_start_handler(void_fn fn, charstring id, GbInstance gb, integer imsi_suffix,
+function f_start_handler(void_fn fn, charstring id, GbInstances gb, integer imsi_suffix,
float t_guard := 30.0)
runs on test_CT return BSSGP_ConnHdlr {
var BSSGP_ConnHdlr vc_conn;
@@ -252,15 +257,19 @@
tlli := f_gprs_tlli_random(),
tlli_old := omit,
ra := omit,
- bssgp_cell_id := gb.cfg.cell_id,
+ bssgp_cell_id := { gb[0].cfg.cell_id, gb[1].cfg.cell_id, gb[2].cfg.cell_id },
vec := omit,
net := net_pars,
t_guard := t_guard
};
vc_conn := BSSGP_ConnHdlr.create(id);
- connect(vc_conn:BSSGP[0], gb.vc_BSSGP:BSSGP_SP);
- connect(vc_conn:BSSGP_PROC[0], gb.vc_BSSGP:BSSGP_PROC);
+ connect(vc_conn:BSSGP[0], gb[0].vc_BSSGP:BSSGP_SP);
+ connect(vc_conn:BSSGP_PROC[0], gb[0].vc_BSSGP:BSSGP_PROC);
+ connect(vc_conn:BSSGP[1], gb[1].vc_BSSGP:BSSGP_SP);
+ connect(vc_conn:BSSGP_PROC[1], gb[1].vc_BSSGP:BSSGP_PROC);
+ connect(vc_conn:BSSGP[2], gb[2].vc_BSSGP:BSSGP_SP);
+ connect(vc_conn:BSSGP_PROC[2], gb[2].vc_BSSGP:BSSGP_PROC);
connect(vc_conn:GSUP, vc_GSUP:GSUP_CLIENT);
connect(vc_conn:GSUP_PROC, vc_GSUP:GSUP_PROC);
@@ -286,7 +295,7 @@
g_pars := pars;
/* register with BSSGP core */
- f_bssgp_client_register(g_pars.imsi, g_pars.tlli, g_pars.bssgp_cell_id);
+ f_bssgp_client_register(g_pars.imsi, g_pars.tlli, g_pars.bssgp_cell_id[0]);
/* tell GSUP dispatcher to send this IMSI to us */
f_create_gsup_expect(hex2str(g_pars.imsi));
/* tell GTP dispatcher to send this IMSI to us */
@@ -417,9 +426,9 @@
function f_process_attach_accept(PDU_GMM_AttachAccept aa) runs on BSSGP_ConnHdlr {
/* mandatory IE */
var hexstring aa_plmn := f_RAI_to_plmn_hexstr(aa.routingAreaIdentification);
- if (not (g_pars.bssgp_cell_id.ra_id.lai.mcc_mnc == aa_plmn)) {
+ if (not (g_pars.bssgp_cell_id[0].ra_id.lai.mcc_mnc == aa_plmn)) {
setverdict(fail, "mismatching PLMN in Attach Accept: " & hex2str(aa_plmn)
- & "; expected " & hex2str(g_pars.bssgp_cell_id.ra_id.lai.mcc_mnc));
+ & "; expected " & hex2str(g_pars.bssgp_cell_id[0].ra_id.lai.mcc_mnc));
mtc.stop;
}
g_pars.ra := aa.routingAreaIdentification;
@@ -524,7 +533,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb[0], 1);
+ vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb, 1);
vc_conn.done;
}
@@ -532,7 +541,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init('023042'H);
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb[0], 1001);
+ vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb, 1001);
vc_conn.done;
}
@@ -544,7 +553,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach_umts_aka_umts_res), testcasename(), g_gb[0], 1002);
+ vc_conn := f_start_handler(refers(f_TC_attach_umts_aka_umts_res), testcasename(), g_gb, 1002);
vc_conn.done;
}
@@ -556,7 +565,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach_umts_aka_gsm_sres), testcasename(), g_gb[0], 1003);
+ vc_conn := f_start_handler(refers(f_TC_attach_umts_aka_gsm_sres), testcasename(), g_gb, 1003);
vc_conn.done;
}
@@ -582,7 +591,7 @@
testcase TC_attach_auth_id_timeout() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_auth_id_timeout), testcasename(), g_gb[0], 2, 40.0);
+ vc_conn := f_start_handler(refers(f_TC_attach_auth_id_timeout), testcasename(), g_gb, 2, 40.0);
vc_conn.done;
}
@@ -602,7 +611,7 @@
testcase TC_attach_auth_sai_timeout() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_auth_sai_timeout), testcasename(), g_gb[0], 3);
+ vc_conn := f_start_handler(refers(f_TC_attach_auth_sai_timeout), testcasename(), g_gb, 3);
vc_conn.done;
}
@@ -623,7 +632,7 @@
testcase TC_attach_auth_sai_reject() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_auth_sai_reject), testcasename(), g_gb[0], 4);
+ vc_conn := f_start_handler(refers(f_TC_attach_auth_sai_reject), testcasename(), g_gb, 4);
vc_conn.done;
}
@@ -652,7 +661,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach_gsup_lu_timeout), testcasename(), g_gb[0], 5);
+ vc_conn := f_start_handler(refers(f_TC_attach_gsup_lu_timeout), testcasename(), g_gb, 5);
vc_conn.done;
}
@@ -682,7 +691,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach_gsup_lu_reject), testcasename(), g_gb[0], 6);
+ vc_conn := f_start_handler(refers(f_TC_attach_gsup_lu_reject), testcasename(), g_gb, 6);
vc_conn.done;
}
@@ -707,7 +716,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach_combined), testcasename(), g_gb[0], 7);
+ vc_conn := f_start_handler(refers(f_TC_attach_combined), testcasename(), g_gb, 7);
vc_conn.done;
}
@@ -731,7 +740,7 @@
f_init();
f_sleep(1.0);
f_vty_config(SGSNVTY, "sgsn", "auth-policy accept-all");
- vc_conn := f_start_handler(refers(f_TC_attach_accept_all), testcasename(), g_gb[0], 8);
+ vc_conn := f_start_handler(refers(f_TC_attach_accept_all), testcasename(), g_gb, 8);
vc_conn.done;
}
@@ -741,7 +750,7 @@
/* Simulate a foreign IMSI */
g_pars.imsi := '001010123456789'H;
- f_bssgp_client_register(g_pars.imsi, g_pars.tlli, g_pars.bssgp_cell_id);
+ f_bssgp_client_register(g_pars.imsi, g_pars.tlli, g_pars.bssgp_cell_id[0]);
g_pars.net.expect_auth := false;
@@ -766,10 +775,10 @@
f_sleep(1.0);
f_vty_config(SGSNVTY, "sgsn", "auth-policy closed");
/* test with foreign IMSI: Must Reject */
- vc_conn := f_start_handler(refers(f_TC_attach_closed_foreign), testcasename(), g_gb[0], 9);
+ vc_conn := f_start_handler(refers(f_TC_attach_closed_foreign), testcasename(), g_gb, 9);
vc_conn.done;
/* test with home IMSI: Must Accept */
- vc_conn := f_start_handler(refers(f_TC_attach_accept_all), testcasename(), g_gb[0], 10);
+ vc_conn := f_start_handler(refers(f_TC_attach_accept_all), testcasename(), g_gb, 10);
vc_conn.done;
}
@@ -790,7 +799,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_rau_unknown), testcasename(), g_gb[0], 11);
+ vc_conn := f_start_handler(refers(f_TC_rau_unknown), testcasename(), g_gb, 11);
vc_conn.done;
}
@@ -819,7 +828,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach_rau), testcasename(), g_gb[0], 12);
+ vc_conn := f_start_handler(refers(f_TC_attach_rau), testcasename(), g_gb, 12);
vc_conn.done;
}
@@ -864,7 +873,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_detach_unknown_nopoweroff), testcasename(), g_gb[0], 13);
+ vc_conn := f_start_handler(refers(f_TC_detach_unknown_nopoweroff), testcasename(), g_gb, 13);
vc_conn.done;
}
@@ -876,7 +885,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_detach_unknown_poweroff), testcasename(), g_gb[0], 14);
+ vc_conn := f_start_handler(refers(f_TC_detach_unknown_poweroff), testcasename(), g_gb, 14);
vc_conn.done;
}
@@ -891,7 +900,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_detach_nopoweroff), testcasename(), g_gb[0], 15);
+ vc_conn := f_start_handler(refers(f_TC_detach_nopoweroff), testcasename(), g_gb, 15);
vc_conn.done;
}
@@ -906,7 +915,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_detach_poweroff), testcasename(), g_gb[0], 16);
+ vc_conn := f_start_handler(refers(f_TC_detach_poweroff), testcasename(), g_gb, 16);
vc_conn.done;
}
@@ -1196,7 +1205,7 @@
testcase TC_attach_pdp_act() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_pdp_act), testcasename(), g_gb[0], 17);
+ vc_conn := f_start_handler(refers(f_TC_attach_pdp_act), testcasename(), g_gb, 17);
vc_conn.done;
}
@@ -1224,7 +1233,7 @@
testcase TC_pdp_act_unattached() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_pdp_act_unattached), testcasename(), g_gb[0], 18);
+ vc_conn := f_start_handler(refers(f_TC_pdp_act_unattached), testcasename(), g_gb, 18);
vc_conn.done;
}
@@ -1243,7 +1252,7 @@
testcase TC_attach_pdp_act_user() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user), testcasename(), g_gb[0], 19);
+ vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user), testcasename(), g_gb, 19);
vc_conn.done;
}
@@ -1262,7 +1271,7 @@
testcase TC_attach_pdp_act_ggsn_reject() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_ggsn_reject), testcasename(), g_gb[0], 20);
+ vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_ggsn_reject), testcasename(), g_gb, 20);
vc_conn.done;
}
@@ -1283,7 +1292,7 @@
testcase TC_attach_pdp_act_user_deact_mo() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_deact_mo), testcasename(), g_gb[0], 21);
+ vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_deact_mo), testcasename(), g_gb, 21);
vc_conn.done;
}
@@ -1304,7 +1313,7 @@
testcase TC_attach_pdp_act_user_deact_mt() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_deact_mt), testcasename(), g_gb[0], 22);
+ vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_deact_mt), testcasename(), g_gb, 22);
vc_conn.done;
}
@@ -1323,7 +1332,7 @@
testcase TC_attach_second_attempt() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_forget_tlli_attach), testcasename(), g_gb[0], 22);
+ vc_conn := f_start_handler(refers(f_TC_attach_forget_tlli_attach), testcasename(), g_gb, 22);
vc_conn.done;
}
@@ -1363,7 +1372,7 @@
var BSSGP_ConnHdlr vc_conn;
g_use_echo := true
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_echo), testcasename(), g_gb[0], 23, 30.0);
+ vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_echo), testcasename(), g_gb, 23, 30.0);
vc_conn.done;
g_use_echo := false
}
@@ -1403,7 +1412,7 @@
testcase TC_attach_restart_ctr_create() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_create), testcasename(), g_gb[0], 24, 30.0);
+ vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_create), testcasename(), g_gb, 24, 30.0);
vc_conn.done;
}
@@ -1439,7 +1448,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_mt_t3395_expire), testcasename(), g_gb[0], 25, 60.0);
+ vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_mt_t3395_expire), testcasename(), g_gb, 25, 60.0);
vc_conn.done;
}
@@ -1487,7 +1496,7 @@
testcase TC_attach_pdp_act_user_error_ind_ggsn() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_error_ind_ggsn), testcasename(), g_gb[0], 26);
+ vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_error_ind_ggsn), testcasename(), g_gb, 26);
vc_conn.done;
}
@@ -1499,7 +1508,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_update), testcasename(), g_gb[0], 31);
+ vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_update), testcasename(), g_gb, 31);
vc_conn.done;
}
@@ -1530,7 +1539,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_withdraw), testcasename(), g_gb[0], 29);
+ vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_withdraw), testcasename(), g_gb, 29);
vc_conn.done;
}
@@ -1560,7 +1569,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_unknown_subscriber_withdraw), testcasename(), g_gb[0], 30);
+ vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_unknown_subscriber_withdraw), testcasename(), g_gb, 30);
vc_conn.done;
}
@@ -1576,7 +1585,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_unknown_subscriber_update), testcasename(), g_gb[0], 30);
+ vc_conn := f_start_handler(refers(f_TC_hlr_location_cancel_request_unknown_subscriber_update), testcasename(), g_gb, 30);
vc_conn.done;
}
@@ -1595,7 +1604,7 @@
var charstring imsi := hex2str(f_gen_imsi(id));
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_detach_check_subscriber_list), testcasename(), g_gb[0], id);
+ vc_conn := f_start_handler(refers(f_TC_attach_detach_check_subscriber_list), testcasename(), g_gb, id);
vc_conn.done;
f_vty_transceive_not_match(SGSNVTY, "show subscriber cache", pattern "* IMSI: {imsi}*");
@@ -1642,7 +1651,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach_no_imei_response), testcasename(), g_gb[0], 32, 60.0);
+ vc_conn := f_start_handler(refers(f_TC_attach_no_imei_response), testcasename(), g_gb, 32, 60.0);
vc_conn.done;
}
@@ -1690,7 +1699,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach_no_imsi_response), testcasename(), g_gb[0], 35, 60.0);
+ vc_conn := f_start_handler(refers(f_TC_attach_no_imsi_response), testcasename(), g_gb, 35, 60.0);
vc_conn.done;
}
@@ -1708,7 +1717,7 @@
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb[0], id);
+ vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb, id);
vc_conn.done;
f_vty_transceive_match(SGSNVTY, "show subscriber cache", pattern "* IMSI: {imsi}*");
@@ -1723,7 +1732,7 @@
f_bssgp_client_unregister(g_pars.imsi);
/* Simulate a foreign IMSI */
g_pars.imsi := '001010123456789'H;
- f_bssgp_client_register(g_pars.imsi, g_pars.tlli, g_pars.bssgp_cell_id);
+ f_bssgp_client_register(g_pars.imsi, g_pars.tlli, g_pars.bssgp_cell_id[0]);
/* there is no auth */
g_pars.net.expect_auth := false;
@@ -1762,11 +1771,11 @@
f_vty_config(SGSNVTY, "sgsn", "auth-policy closed");
f_vty_config(SGSNVTY, "sgsn", "imsi-acl del 001010123456789");
/* test with foreign IMSI: Must Reject */
- vc_conn := f_start_handler(refers(f_TC_attach_closed_foreign), testcasename(), g_gb[0], 9);
+ vc_conn := f_start_handler(refers(f_TC_attach_closed_foreign), testcasename(), g_gb, 9);
vc_conn.done;
f_vty_config(SGSNVTY, "sgsn", "imsi-acl add 001010123456789");
/* test with same IMSI: Must Accept */
- vc_conn := f_start_handler(refers(f_TC_attach_closed_imsi_added), testcasename(), g_gb[0], 10);
+ vc_conn := f_start_handler(refers(f_TC_attach_closed_imsi_added), testcasename(), g_gb, 10);
vc_conn.done;
}
@@ -1803,7 +1812,7 @@
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
- vc_conn := f_start_handler(refers(f_TC_attach_check_complete_resend), testcasename(), g_gb[0], 36, 60.0);
+ vc_conn := f_start_handler(refers(f_TC_attach_check_complete_resend), testcasename(), g_gb, 36, 60.0);
vc_conn.done;
}