diff options
author | Harald Welte <laforge@osmocom.org> | 2024-03-27 21:54:20 +0100 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2024-04-02 20:22:14 +0000 |
commit | af3e21687a16545ecc9600066c3a00bf285c91d1 (patch) | |
tree | f3254f17baf1d72189030161ceb5e60ae3f4a9a6 | |
parent | 37ee0ed83ca11a50a46cb582482ea72401b3253f (diff) |
hnbgw: Introduce tests about UE registration
We didn't have any test coverage for HNBAP UE registration so far.
Let's start with two basic tests:
* normal / successful case
* abnormal case: UE Register without prior HNB Register
Change-Id: Ice2743d376ab8041646259fa25117d6fd0e8c2fd
-rw-r--r-- | hnbgw/HNBGW_Tests.ttcn | 53 | ||||
-rw-r--r-- | library/hnbap/HNBAP_Templates.ttcn | 166 |
2 files changed, 219 insertions, 0 deletions
diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn index 91677b16..cfdf923c 100644 --- a/hnbgw/HNBGW_Tests.ttcn +++ b/hnbgw/HNBGW_Tests.ttcn @@ -33,6 +33,7 @@ import from Osmocom_VTY_Functions all; import from TELNETasp_PortType all; import from HNBAP_Templates all; +import from HNBAP_IEs all; import from HNBAP_PDU_Descriptions all; import from RUA_IEs all; @@ -923,6 +924,38 @@ function f_hnbap_hnb_register(integer hnb_idx := 0, integer cell_id := 0, boolea } } +function f_hnbap_ue_register(integer hnb_idx := 0, template (present) UE_Identity ue_id, boolean expect_reject := false) runs on test_CT +{ + timer T := 2.0; + + HNBAP[hnb_idx].send(ts_HNBAP_UERegisterRequest(ue_id)); + + T.start; + alt { + [] HNBAP[hnb_idx].receive(tr_HNBAP_UERegisterAccept(ue_id)) { + if (expect_reject) { + setverdict(fail, "Rx UE Register Accept while expecting reject"); + } else { + setverdict(pass); + } + } + [] HNBAP[hnb_idx].receive(tr_HNBAP_UERegisterReject(ue_id, ?)) { + if (expect_reject) { + setverdict(pass); + } else { + setverdict(fail, "Rx UE Register Reject while expecting accept"); + } + } + [] HNBAP[hnb_idx].receive(IUHEM_Event:?) { + repeat; + } + [] T.timeout { + setverdict(fail, "Timeout waiting for UE Register response"); + } + } +} + + testcase TC_hnb_register() runs on test_CT { g_num_hnbs := 1; f_init(start_hnb := false); @@ -965,6 +998,24 @@ testcase TC_hnb_reregister_reuse_sctp_assoc() runs on test_CT { f_shutdown_helper(); } +/* regular UE registration */ +testcase TC_ue_register() runs on test_CT { + var UE_Identity ue_id := { iMSI := imsi_hex2oct(f_gen_imsi(1)) }; + g_num_hnbs := 1; + f_init(start_hnb := true); + f_hnbap_ue_register(0, ue_id); + f_shutdown_helper(); +} + +/* UE registration from unregistered HNB */ +testcase TC_ue_register_before_hnb_register() runs on test_CT { + var UE_Identity ue_id := { iMSI := imsi_hex2oct(f_gen_imsi(1)) }; + g_num_hnbs := 1; + f_init(start_hnb := false); + f_hnbap_ue_register(0, ue_id, expect_reject := true); + f_shutdown_helper(); +} + /*********************************************************************** * RUA / RANAP Testing ***********************************************************************/ @@ -2715,6 +2766,8 @@ control { execute(TC_hnb_register()); execute(TC_hnb_register_duplicate()); execute(TC_hnb_register_duplicate_reuse_sctp_assoc()); + execute(TC_ue_register()); + execute(TC_ue_register_before_hnb_register()); execute(TC_ranap_cs_initial_ue()); execute(TC_ranap_ps_initial_ue()); execute(TC_ranap_cs_initial_ue_empty_cr()); diff --git a/library/hnbap/HNBAP_Templates.ttcn b/library/hnbap/HNBAP_Templates.ttcn index 2576d174..7a86e0c9 100644 --- a/library/hnbap/HNBAP_Templates.ttcn +++ b/library/hnbap/HNBAP_Templates.ttcn @@ -232,6 +232,172 @@ ts_HNBAP_HNBRegisterReject(template (value) Cause cause) := { } } +/* 9.1.6 UE REGISTER REQUEST */ +template (present) HNBAP_PDU +tr_HNBAP_UERegisterRequest(template (present) UE_Identity ue_id) := { + initiatingMessage := { + procedureCode := id_UERegister, + criticality := reject, + value_ := { + uERegisterRequest := { + protocolIEs := { + { + id := HNBAP_Constants.id_UE_Identity, + criticality := reject, + value_ := { UE_Identity := ue_id } + }, { + id := HNBAP_Constants.id_Registration_Cause, + criticality := ignore, + value_ := { Registration_Cause := normal } + }, { + id := HNBAP_Constants.id_UE_Capabilities, + criticality := ignore, + value_ := { + UE_Capabilities := { + access_stratum_release_indicator := ?, + csg_capability := ? + } + } + } + }, + protocolExtensions := * /* TODO: CriticalityDiagnostics, BackoffTimer */ + } + } + } +} + +template (value) HNBAP_PDU +ts_HNBAP_UERegisterRequest(template (value) UE_Identity ue_id) := { + initiatingMessage := { + procedureCode := id_UERegister, + criticality := reject, + value_ := { + uERegisterRequest := { + protocolIEs := { + { + id := HNBAP_Constants.id_UE_Identity, + criticality := reject, + value_ := { UE_Identity := ue_id } + }, { + id := HNBAP_Constants.id_Registration_Cause, + criticality := ignore, + value_ := { Registration_Cause := normal } + }, { + id := HNBAP_Constants.id_UE_Capabilities, + criticality := ignore, + value_ := { + UE_Capabilities := { + access_stratum_release_indicator := rel_8_and_beyond, + csg_capability := not_csg_capable, + iE_Extensions := omit + } + } + } + }, + protocolExtensions := omit /* TODO: CriticalityDiagnostics, BackoffTimer */ + } + } + } +} + +/* 9.1.7 UE REGISTER ACCEPT */ +template (present) HNBAP_PDU +tr_HNBAP_UERegisterAccept(template (present) UE_Identity ue_id) := { + successfulOutcome := { + procedureCode := id_UERegister, + criticality := reject, + value_ := { + uERegisterAccept := { + protocolIEs := { + { + id := HNBAP_Constants.id_UE_Identity, + criticality := reject, + value_ := { UE_Identity := ue_id } + }, { + id := HNBAP_Constants.id_Context_ID, + criticality := reject, + value_ := { Context_ID := ? } + }, * + }, + protocolExtensions := * /* TODO: CriticalityDiagnostics, BackoffTimer */ + } + } + } +} + +template (value) HNBAP_PDU +ts_HNBAP_UERegisterAccept(template (value) UE_Identity ue_id, + template (value) BIT24 context_id) := { + successfulOutcome := { + procedureCode := id_UERegister, + criticality := reject, + value_ := { + uERegisterAccept := { + protocolIEs := { + { + id := HNBAP_Constants.id_UE_Identity, + criticality := reject, + value_ := { UE_Identity := ue_id } + }, { + id := HNBAP_Constants.id_Context_ID, + criticality := reject, + value_ := { Context_ID := context_id } + } + }, + protocolExtensions := omit /* TODO: CriticalityDiagnostics, BackoffTimer */ + } + } + } +} + +/* 9.1.8 UE REGISTER REJECT */ +template (present) HNBAP_PDU +tr_HNBAP_UERegisterReject(template (present) UE_Identity ue_id, template (present) Cause cause := ?) := { + unsuccessfulOutcome := { + procedureCode := id_UERegister, + criticality := reject, + value_ := { + uERegisterReject := { + protocolIEs := { + { + id := HNBAP_Constants.id_UE_Identity, + criticality := reject, + value_ := { UE_Identity := ue_id } + }, { + id := HNBAP_Constants.id_Cause, + criticality := ignore, + value_ := { Cause := cause } + }, * + }, + protocolExtensions := * /* TODO: CriticalityDiagnostics, BackoffTimer */ + } + } + } +} +template (value) HNBAP_PDU +ts_HNBAP_UERegisterReject(template (value) UE_Identity ue_id, template (value) Cause cause) := { + unsuccessfulOutcome := { + procedureCode := id_UERegister, + criticality := reject, + value_ := { + uERegisterReject := { + protocolIEs := { + { + id := HNBAP_Constants.id_UE_Identity, + criticality := reject, + value_ := { UE_Identity := ue_id } + }, { + id := HNBAP_Constants.id_Cause, + criticality := ignore, + value_ := { Cause := cause } + } + }, + protocolExtensions := omit /* TODO: CriticalityDiagnostics, BackoffTimer */ + } + } + } +} + /* 9.1.9 HNB DE-REGISTER */ template (value) HNBAP_PDU ts_HNBAP_HNBDe_Register(template (value) Cause cause) := { |