epdg: Introduce test TC_hss_initiated_deregister_new_server_assigned

Related: OS#6042
Change-Id: Ia5bf7708d11421710f3a88669d94c4f01060cdd6
This commit is contained in:
Pau Espin 2024-03-11 12:16:13 +01:00
parent 36fc368dad
commit f4f25967ee
7 changed files with 185 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import from GSUP_Emulation all;
import from DIAMETER_Types all;
import from DIAMETER_Templates all;
import from DIAMETER_rfc4004_Templates all;
import from DIAMETER_ts29_229_Templates all;
import from DIAMETER_ts29_272_Templates all;
import from DIAMETER_ts29_273_Templates all;
import from DIAMETER_Emulation all;
@ -470,6 +471,32 @@ private altstep as_DIA_SWx_SA_success(template (present) CxDx_3GPP_Server_Assign
}
}
/* Send RTR as HSS to AAA server, expect back RTA */
private function f_DIA_SWx_RT(template (value) CxDx_3GPP_Reason_Code reason_code,
template (present) GenericAVP exp_result_tmpl := tr_AVP_ResultCode(DIAMETER_SUCCESS)) runs on EPDG_ConnHdlr {
var PDU_DIAMETER rx_dia;
var UINT32 hbh_id := f_rnd_octstring(4);
var UINT32 ete_id := f_rnd_octstring(4);
var octetstring reason_info := char2oct("test");
/* Unlike STR, STA contains no IMSI. Register ete_id in DIAMETER_Emulation,
* so AIA is forwarded back to us in DIAMETER port instead of MTC_CT.DIAMETER_UNIT.
*/
f_epdg_connhldr_SWx_expect_eteid(ete_id);
SWx.send(ts_DIA_SWx_RTR(g_pars.imsi, reason_code, reason_info,
hbh_id := hbh_id,
ete_id := ete_id));
alt {
[] SWx.receive(tr_DIA_SWx_RTA(exp_result_tmpl, hbh_id := hbh_id, ete_id := ete_id)) -> value rx_dia {}
[] SWx.receive(PDU_DIAMETER:?) -> value rx_dia {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected Diameter SWx msg rx: ", rx_dia));
}
}
}
/* Send AAR as PGW to AAA server, expect back AAA */
private function f_S6b_AA_success() runs on EPDG_ConnHdlr {
var PDU_DIAMETER rx_dia;
@ -1025,6 +1052,25 @@ testcase TC_s2b_CreateSession_rejected() runs on MTC_CT {
setverdict(pass);
}
/* 3GPP TS 29.273 Network Initiated De-Registration by HSS, Administrative */
private function f_TC_hss_initiated_deregister_new_server_assigned(charstring id) runs on EPDG_ConnHdlr {
f_initial_attach();
/* Procedure should be performed properly: */
f_DIA_SWx_RT(NEW_SERVER_ASSIGNED, tr_AVP_ResultCode(DIAMETER_SUCCESS));
/* Subscriber was already removed, it should fail if requested again: */
var DIAMETER_ts29_229_ExperimentalResultcode erc := DIAMETER_ERROR_USER_UNKNOWN;
f_DIA_SWx_RT(NEW_SERVER_ASSIGNED, tr_AVP_ExperimentalResult(vendor_id_3GPP, int2oct(enum2int(erc), 4)));
f_sleep(3.0);
}
testcase TC_hss_initiated_deregister_new_server_assigned() runs on MTC_CT {
var EPDG_ConnHdlrPars pars := f_init_pars();
var EPDG_ConnHdlr vc_conn;
f_init();
vc_conn := f_start_handler(refers(f_TC_hss_initiated_deregister_new_server_assigned), pars);
vc_conn.done;
setverdict(pass);
}
private function f_TC_concurrent_ues(charstring id) runs on EPDG_ConnHdlr {
COORD.send(COORD_CMD_READY);
COORD.receive(COORD_CMD_START);
@ -1121,6 +1167,7 @@ control {
execute ( TC_ho_lte_to_wifi() );
execute ( TC_ho_wifi_to_lte() );
execute ( TC_s2b_CreateSession_rejected() );
execute ( TC_hss_initiated_deregister_new_server_assigned() );
execute ( TC_concurrent_ues2() );
execute ( TC_concurrent_ues100() );
execute ( TC_upf_echo_req() );

View File

@ -7,6 +7,7 @@
<testcase classname='EPDG_Tests' name='TC_ho_lte_to_wifi' time='MASKED'/>
<testcase classname='EPDG_Tests' name='TC_ho_wifi_to_lte' time='MASKED'/>
<testcase classname='EPDG_Tests' name='TC_s2b_CreateSession_rejected' time='MASKED'/>
<testcase classname='EPDG_Tests' name='TC_hss_initiated_deregister_new_server_assigned' time='MASKED'/>
<testcase classname='EPDG_Tests' name='TC_concurrent_ues2' time='MASKED'/>
<testcase classname='EPDG_Tests' name='TC_concurrent_ues100' time='MASKED'/>
<testcase classname='EPDG_Tests' name='TC_upf_echo_req' time='MASKED'/>

View File

@ -55,7 +55,7 @@ FILES+="Osmocom_CTRL_Types.ttcn "
FILES+="L3_Common.ttcn "
FILES+="DNS_Helpers.ttcn "
FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_Emulation.ttcn "
FILES+="DIAMETER_Templates.ttcn DIAMETER_rfc4004_Templates.ttcn DIAMETER_rfc5447_Templates.ttcn DIAMETER_ts29_272_Templates.ttcn DIAMETER_ts29_273_Templates.ttcn "
FILES+="DIAMETER_Templates.ttcn DIAMETER_rfc4004_Templates.ttcn DIAMETER_rfc5447_Templates.ttcn DIAMETER_ts29_229_Templates.ttcn DIAMETER_ts29_272_Templates.ttcn DIAMETER_ts29_273_Templates.ttcn "
FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc
IPA_Emulation.ttcnpp "
FILES+="PCO_Types.ttcn GSUP_Types.ttcn GSUP_Templates.ttcn GSUP_Emulation.ttcn "

View File

@ -682,7 +682,7 @@ template (present) GenericAVP tr_AVP_UserName(template (present) octetstring uid
}
}
}
template (value) GenericAVP ts_AVP_UserNameImsi(hexstring imsi) := ts_AVP_UserName(char2oct(hex2str(imsi)));
template (value) GenericAVP ts_AVP_UserNameImsi(template (value) hexstring imsi) := ts_AVP_UserName(char2oct(hex2str(valueof(imsi))));
template (present) GenericAVP tr_AVP_UserNameImsi(template (present) hexstring imsi := ?) := tr_AVP_UserName(char2oct_tmpl(hex2str_tmpl(imsi)));

View File

@ -0,0 +1,78 @@
module DIAMETER_ts29_229_Templates {
/* (C) 2023 by sysmocom s.f.m.c. GmbH <info@sysmocom.de
* All rights reserved.
*
* Released under the terms of GNU General Public License, Version 2 or
* (at your option) any later version.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
* Templates for AVPs and messages for TS 29.273
*/
import from General_Types all;
import from DIAMETER_Types all;
import from DIAMETER_Templates all;
import from DIAMETER_rfc5447_Templates all;
import from DIAMETER_ts29_272_Templates all;
import from Osmocom_Types all;
import from Misc_Helpers all;
/* 3GPP TS 29.229 section 6.2. Errors in Result-Code AVP values */
type enumerated DIAMETER_ts29_229_ExperimentalResultcode {
/* Success */
DIAMETER_FIRST_REGISTRATION (2001),
DIAMETER_SUBSEQUENT_REGISTRATION (2002),
DIAMETER_UNREGISTERED_SERVICE (2003),
DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED (2004),
/* Permanent Failures */
DIAMETER_ERROR_USER_UNKNOWN (5001),
DIAMETER_ERROR_IDENTITIES_DONT_MATCH (5002),
DIAMETER_ERROR_IDENTITY_NOT_REGISTERED (5003),
DIAMETER_ERROR_ROAMING_NOT_ALLOWED (5004),
DIAMETER_ERROR_IDENTITY_ALREADY_REGISTERED (5005),
DIAMETER_ERROR_AUTH_SCHEME_NOT_SUPPORTED (5006),
DIAMETER_ERROR_IN_ASSIGNMENT_TYPE (5007),
DIAMETER_ERROR_TOO_MUCH_DATA (5008),
DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA (5009),
DIAMETER_ERROR_FEATURE_UNSUPPORTED (5011),
DIAMETER_ERROR_SERVING_NODE_FEATURE_UNSUPPORTED (5012)
}
/* TS 29.229 6.3.16 Deregistration-Reason */
template (value) GenericAVP ts_AVP_CxDx_3GPP_Deregistration_Reason(template (value) CxDx_3GPP_Reason_Code reason,
template (value) octetstring info) := {
avp := {
avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Non_3GPP_User_Data),
avp_data := {
avp_CxDx_3GPP_Deregistration_Reason := {
ts_AVP_CxDx_3GPP_Reason_Code(reason),
ts_AVP_CxDx_3GPP_Reason_Info(info)
}
}
}
}
/* TS 29.229 6.3.17 Reason-Code AVP */
template (value) GenericAVP ts_AVP_CxDx_3GPP_Reason_Code(template (value) CxDx_3GPP_Reason_Code reason) := {
avp := {
avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Reason_Code),
avp_data := {
avp_CxDx_3GPP_Reason_Code := reason
}
}
}
/* 6.3.18 Reason-Info AVP */
template (value) GenericAVP ts_AVP_CxDx_3GPP_Reason_Info(template (value) octetstring info) := {
avp := {
avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Reason_Info),
avp_data := {
avp_CxDx_3GPP_Reason_Info := info
}
}
}
}

View File

@ -15,6 +15,7 @@ import from General_Types all;
import from DIAMETER_Types all;
import from DIAMETER_Templates all;
import from DIAMETER_rfc5447_Templates all;
import from DIAMETER_ts29_229_Templates all;
import from DIAMETER_ts29_272_Templates all;
import from Osmocom_Types all;
import from Misc_Helpers all;
@ -269,6 +270,61 @@ ts_DIA_SWx_SAA(template (value) hexstring imsi,
*/
});
/* Registration-Termination-Request (RTR) , 8.2.2.4 Network Initiated De-Registration by HSS Procedure */
template (value) PDU_DIAMETER
ts_DIA_SWx_RTR(template (value) hexstring imsi,
template (value) CxDx_3GPP_Reason_Code reason_code := PERMANENT_TERMINATION,
template (value) octetstring reason_info := ''O,
template (value) uint32_t vendor_app_id := c_DIAMETER_3GPP_SWx_AID,
template (value) octetstring sess_id := c_def_sess_id,
template (value) charstring orig_host := "hss.localdomain",
template (value) charstring orig_realm := "localdomain",
template (value) charstring dest_host := "aaa.localdomain",
template (value) charstring dest_realm := "localdomain",
template (value) UINT32 hbh_id := '00000000'O,
template (value) UINT32 ete_id := '00000000'O) :=
ts_DIAMETER(flags := '11000000'B,
cmd_code := Registration_Termination,
app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
hbh_id := hbh_id,
ete_id := ete_id,
avps := {
ts_AVP_SessionId(sess_id),
ts_AVP_VendorSpecAppId(vendor_id_3GPP, valueof(vendor_app_id)),
ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
ts_AVP_OriginHost(orig_host),
ts_AVP_OriginRealm(orig_realm),
ts_AVP_DestinationHost(dest_host),
ts_AVP_DestinationRealm(dest_realm),
ts_AVP_UserNameImsi(imsi),
ts_AVP_CxDx_3GPP_Deregistration_Reason(reason_code, reason_info)
/* TODO:
* *[ Supported-Features ]
*/
});
template (present) PDU_DIAMETER
tr_DIA_SWx_RTA(template (present) GenericAVP tmpl_result := ?,
template (present) octetstring sess_id := ?,
template (present) charstring orig_host := ?,
template (present) charstring orig_realm := ?,
template (present) charstring dest_host := ?,
template (present) charstring dest_realm := ?,
template (present) UINT32 hbh_id := ?,
template (present) UINT32 ete_id := ?) :=
tr_DIAMETER(flags := '0???????'B,
cmd_code := Registration_Termination,
app_id := int2oct(c_DIAMETER_3GPP_SWx_AID, 4),
hbh_id := hbh_id, ete_id := ete_id,
avps := superset(
tr_AVP_SessionId(sess_id),
tr_AVP_VendorSpecAppId(?, ?),
tmpl_result,
tr_AVP_AuthSessionState(NO_STATE_MAINTAINED),
tr_AVP_OriginHost(orig_host),
tr_AVP_OriginRealm(orig_realm)
));
/*******************************
* S6b 3GPP TS 29.273 section 9
*******************************/

View File

@ -64,7 +64,7 @@ FILES+="GTPv2_PrivateExtensions.ttcn GTPv2_Templates.ttcn "
FILES+="GTPv2_CodecPort.ttcn GTPv2_CodecPort_CtrlFunctDef.cc GTPv2_CodecPort_CtrlFunct.ttcn GTPv2_Emulation.ttcn "
FILES+="DNS_Helpers.ttcn "
FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_Emulation.ttcn "
FILES+="DIAMETER_Templates.ttcn DIAMETER_rfc4004_Templates.ttcn DIAMETER_rfc5447_Templates.ttcn DIAMETER_ts29_212_Templates.ttcn DIAMETER_ts29_272_Templates.ttcn DIAMETER_ts29_273_Templates.ttcn DIAMETER_ts32_299_Templates.ttcn "
FILES+="DIAMETER_Templates.ttcn DIAMETER_rfc4004_Templates.ttcn DIAMETER_rfc5447_Templates.ttcn DIAMETER_ts29_212_Templates.ttcn DIAMETER_ts29_212_Templates.ttcn DIAMETER_ts29_229_Templates.ttcn DIAMETER_ts29_272_Templates.ttcn DIAMETER_ts29_273_Templates.ttcn DIAMETER_ts32_299_Templates.ttcn "
gen_links $DIR $FILES
ignore_pp_results