aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2022-08-23 17:48:39 +0200
committerDaniel Willmann <dwillmann@sysmocom.de>2022-08-24 10:06:34 +0200
commitc79679a2decf9700bc6ff77d8120bc72e9e0caad (patch)
treeac689c71aac6685c4d687fd28b9d60c29dbb4aec
parent6d2d8885c83737570ddd9d4aa617ef3593556d19 (diff)
hnbgw: Add test to check for duplicate hnb registrations
-rw-r--r--hnbgw/HNBGW_Tests.ttcn46
1 files changed, 33 insertions, 13 deletions
diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index 7429c389..d3d3a36f 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -208,7 +208,7 @@ function f_create_ranap_exp(octetstring l3_enc) runs on ConnHdlr {
}
-const integer NUM_HNB := 1;
+const integer NUM_HNB := 2;
type record HnbConfig {
LocationAreaIdentification lai,
@@ -320,13 +320,6 @@ function f_init_hnodeb(charstring id, integer hnb_idx, RuaOps rua_ops) runs on t
/* global initialization function */
function f_init(charstring id := "HNBGW", float guard_timeout := 30.0) runs on test_CT {
- g_hnb_cfg[0] := {
- lai := {
- mcc_mnc := '00101'H,
- lac := 2342
- },
- sac := 55
- }
T_guard.start(guard_timeout);
activate(as_Tguard());
@@ -336,6 +329,13 @@ function f_init(charstring id := "HNBGW", float guard_timeout := 30.0) runs on t
unitdata_cb := refers(IuhRanapUnitdataCallback)
};
for (var integer i := 0; i < NUM_HNB; i := i+1) {
+ g_hnb_cfg[i] := {
+ lai := {
+ mcc_mnc := '00101'H,
+ lac := 2342 + i
+ },
+ sac := 55
+ };
f_init_hnodeb(testcasename(), i, rua_ops);
}
@@ -374,7 +374,7 @@ friend function f_shutdown_helper() runs on test_CT {
/* helper function to start all of the simulated hNodeBs */
function f_start_hnbs() runs on test_CT {
for (var integer i:= 0; i < NUM_HNB; i := i+1) {
- f_hnbap_register(i);
+ f_hnbap_register(i, i);
}
}
@@ -634,13 +634,13 @@ friend function f_build_rab_ass_resp(TestHdlrParams pars) return RANAP_PDU {
***********************************************************************/
-function f_hnbap_register(integer hnb_idx := 0) runs on test_CT
+function f_hnbap_register(integer hnb_idx := 0, integer cell_id := 0, boolean expect_reject := false) runs on test_CT
{
timer T := 2.0;
HNBAP[hnb_idx].send(tr_HNBAP_HNBRegisterRequest(char2oct("TTCN3 HNodeB"),
'00F110'O,
- int2bit(1 + hnb_idx, 28),
+ int2bit(1 + cell_id, 28),
int2oct(2, 2),
int2oct(3, 1),
int2oct(4, 2)));
@@ -648,13 +648,24 @@ function f_hnbap_register(integer hnb_idx := 0) runs on test_CT
T.start;
alt {
[] HNBAP[hnb_idx].receive(tr_HNBAP_HNBRegisterAccept(?)) {
- setverdict(pass);
+ if (expect_reject) {
+ setverdict(fail, "Rx HNB Register Accept while expecting reject");
+ } else {
+ setverdict(pass);
+ }
+ }
+ [] HNBAP[hnb_idx].receive(tr_HNBAP_HNBRegisterReject(?)) {
+ if (expect_reject) {
+ setverdict(pass);
+ } else {
+ setverdict(fail, "Rx HNB Register Reject while expecting accept");
+ }
}
[] HNBAP[hnb_idx].receive(IUHEM_Event:?) {
repeat;
}
[] T.timeout {
- setverdict(fail, "Timeout waiting for HNB Register Accept");
+ setverdict(fail, "Timeout waiting for HNB Register response");
}
}
}
@@ -665,6 +676,14 @@ testcase TC_hnb_register() runs on test_CT {
f_shutdown_helper();
}
+testcase TC_hnb_register_duplicate() runs on test_CT {
+ f_init();
+ f_hnbap_register(0);
+ f_hnbap_register(1, 0, expect_reject := true);
+ f_verify_talloc_count(HNBGWVTY, {"struct hnb_context"}, expect_count := 1);
+ f_shutdown_helper();
+}
+
/***********************************************************************
* RUA / RANAP Testing
***********************************************************************/
@@ -1322,6 +1341,7 @@ testcase TC_ps_rab_assignment() runs on test_CT {
control {
execute(TC_hnb_register());
+ execute(TC_hnb_register_duplicate());
execute(TC_ranap_cs_initial_ue());
execute(TC_ranap_ps_initial_ue());
execute(TC_ranap_cs_initial_ue_empty_cr());