fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38671?usp=email )
Change subject: hlr: refactor f_SS_expect() ......................................................................
hlr: refactor f_SS_expect()
Prepare for follow-up patches reworking SS related GSUP templates. Avoid passing "omit" for parameter 'ss' of the receive templates because this will no longer work as expected. Clean up code flow.
Change-Id: I162a79e3c7ff9dafb031e3da8a78af313534cac7 --- M hlr/HLR_Tests.ttcn 1 file changed, 37 insertions(+), 35 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved
diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn index 46b98c2..45a8fb3 100644 --- a/hlr/HLR_Tests.ttcn +++ b/hlr/HLR_Tests.ttcn @@ -716,45 +716,20 @@ template SS_FacilityInformation facility := *, template octetstring destination_name := omit) runs on HLR_ConnHdlr return GSUP_PDU { - var GSUP_PDU ret; + var GSUP_IeValue ie; + var GSUP_PDU pdu; timer T := 3.0; - var boolean exp_ss := true; - if (istemplatekind(facility, "omit")) { - exp_ss := false; - } + T.start; alt { - [] GSUP.receive(tr_GSUP_PROC_SS_ERR(imsi, sid, ?, ?)) -> value ret { - setverdict(fail, "Unexpected PROC_SS ERROR Cause"); + [] GSUP.receive(tr_GSUP_PROC_SS_ERR(imsi, sid, ?, ?)) -> value pdu { + setverdict(fail, "Unexpected PROC_SS ERROR: ", pdu); mtc.stop; } - [not exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, omit, destination_name := destination_name)) -> value ret { - setverdict(pass); - } - [exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, omit)) -> value ret { - setverdict(fail, "Unexpected PROC_SS.res without SS IE"); - mtc.stop; - } -/* - [exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, decmatch facility, destination_name := destination_name)) -> value ret { - setverdict(pass); - } -*/ - - [exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, ?, destination_name := destination_name)) -> value ret { - var GSUP_IeValue ss_ie; - f_gsup_find_ie(ret, OSMO_GSUP_SS_INFO_IE, ss_ie); - var SS_FacilityInformation dec_fac := dec_SS_FacilityInformation(ss_ie.ss_info); - log("pattern: ", facility); - if (match(dec_fac, facility)) { - setverdict(pass); - } else { - setverdict(fail, "Unexpected PROC_SS.res with non-matching facility IE"); - mtc.stop; - } - } - [] GSUP.receive { - setverdict(fail, "Unexpected GSUP"); + [] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, + destination_name := destination_name)) -> value pdu; + [] GSUP.receive(GSUP_PDU:?) -> value pdu { + setverdict(fail, "Unexpected GSUP PDU: ", pdu); mtc.stop; } [] T.timeout { @@ -763,7 +738,34 @@ } }
- return ret; + /* case a) SS Info can be any value or not present */ + if (istemplatekind(facility, "*")) { + return pdu; /* skip the remaining SS Info checks */ + } + + /* case b) SS Info shall *not* be present */ + if (istemplatekind(facility, "omit")) { + if (f_gsup_find_ie(pdu, OSMO_GSUP_SS_INFO_IE, ie)) { + setverdict(fail, "Unexpected PROC_SS.res with SS Info IE"); + mtc.stop; + } + return pdu; /* skip the remaining SS Info checks */ + } + + /* case c) SS Info shall be present */ + if (not f_gsup_find_ie(pdu, OSMO_GSUP_SS_INFO_IE, ie)) { + setverdict(fail, "Unexpected PROC_SS.res without SS Info IE"); + mtc.stop; + } + + var SS_FacilityInformation dec_fac := dec_SS_FacilityInformation(ie.ss_info); + if (not match(dec_fac, facility)) { + setverdict(fail, "Unexpected PROC_SS.res with non-matching facility IE"); + mtc.stop; + } + + setverdict(pass); + return pdu; }
function f_perform_CHECK_IMEI(hexstring imsi, hexstring imei,