pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43710?usp=email ) Change subject: smf: Improvements to set up multiple sessions ...................................................................... smf: Improvements to set up multiple sessions Change-Id: Ib483f71fc51d6947de799449ddc40d8825aeba8f --- M smf/SMF_Session_CT.ttcn M smf/SMF_Tests.ttcn 2 files changed, 75 insertions(+), 66 deletions(-) Approvals: pespin: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/smf/SMF_Session_CT.ttcn b/smf/SMF_Session_CT.ttcn index c65ef32..e7a78fc 100644 --- a/smf/SMF_Session_CT.ttcn +++ b/smf/SMF_Session_CT.ttcn @@ -35,6 +35,10 @@ import from SMF_Session_CT_5G all; import from SMF_Tests all; +modulepar { + HEX15n mp_imsi := '999700000000000'H; +} + const OCT8 c_SEID0 := '0000000000000000'O; /* per-session component; we typically have 1..N per testcase */ @@ -91,15 +95,15 @@ FTeids access } template (value) Gtp1uParameters -t_Gtp1uParameters_default(uint32_t idx := 1, +t_Gtp1uParameters_default(uint32_t idx := 0, charstring mp_pfcp_ip_local) := { core := { - local := ts_PFCP_F_TEID_ipv4(int2oct(idx + 8192, 4), + local := ts_PFCP_F_TEID_ipv4(int2oct(idx + 1 + 8192, 4), f_inet_addr(mp_pfcp_ip_local)), remote := omit }, access := { - local := ts_PFCP_F_TEID_ipv4(int2oct(idx, 4), + local := ts_PFCP_F_TEID_ipv4(int2oct(idx + 1, 4), f_inet_addr(mp_pfcp_ip_local)), remote := omit } @@ -138,11 +142,11 @@ } -function f_t_PfcpParams(uint32_t idx := 1, +function f_t_PfcpParams(uint32_t idx := 0, charstring pfcp_local_addr := mp_pfcp_ip_local, template (value) Node_ID local_node_id := ts_PFCP_Node_ID_ipv4(f_inet_addr(mp_pfcp_ip_local))) return PfcpParameters { - var uint64_t local_f_seid := idx; + var uint64_t local_f_seid := idx + 1; var template (value) PfcpParameters pfcp_pars := { pfcp_local_addr := pfcp_local_addr, local_node_id := local_node_id, @@ -219,58 +223,66 @@ SessionPars_NGNAS nas } -template (value) SessionPars -t_SessionPars(hexstring imsi, - template (omit) hexstring msisdn := '1234'H, - GTP2C_RAT_Type rat_type := GTP2C_RAT_EUTRAN, - charstring apn := "internet", - boolean selection_mode := false, - GTP2C_PDN_Type pdn_type := GTP2C_PDN_IPv4, - template (value) PfcpParameters pfcp_pars := f_t_PfcpParams(1)) := { - imsi := imsi, - imsi_str := f_dec_TBCD(imsi_hex2oct(imsi)), - msisdn := msisdn, - rat_type := rat_type, - apn := apn, - selection_mode := selection_mode, - pdn_type := pdn_type, - pco := omit, - epco := omit, - teic_local := '00000000'O, - teic_remote := omit, - bearer := { - ebi := 5, - teid_local := omit, - teid_remote := omit - }, - gy := { - validity_time := 0, - cca_res_code := DIAMETER_SUCCESS - }, - pfcp_pars := pfcp_pars, - namf := { - pdu_sess_id := 1, - ran_gtpu_ip := mp_amf_local_ip, - ran_gtpu_teid := int2oct(1, 4), - cn_gtpu_ip := omit, - cn_gtpu_teid := omit, - ue_ip4 := omit, - ue_ip6 := omit, - ipv6_interface_id := omit - }, - npcf := { - sm_policy_id := f_dec_TBCD(imsi_hex2oct(imsi)) /* imsi_str */ & "-" & int2str(1) - }, - nsmf := { - smContextRef := omit - }, - nudm := { - smf_subscription_id := int2str(1) - }, - nas := { - pti := '00'O, - qos_rules := omit +function f_SessionPars(integer idx := 0, + template (omit) hexstring msisdn := '1234'H, + GTP2C_RAT_Type rat_type := GTP2C_RAT_EUTRAN, + charstring apn := "internet", + boolean selection_mode := false, + GTP2C_PDN_Type pdn_type := GTP2C_PDN_IPv4, + template (omit) PfcpParameters pfcp_pars := omit) +return SessionPars { + var hexstring imsi := f_concat_pad(lengthof(mp_imsi), substr(mp_imsi, 0, lengthof(mp_imsi) - 6), idx); + var charstring imsi_str := f_dec_TBCD(imsi_hex2oct(imsi)); + if (not isvalue(pfcp_pars)) { + pfcp_pars := f_t_PfcpParams(idx := idx); } + var template (value) SessionPars pars := { + imsi := imsi, + imsi_str := imsi_str, + msisdn := msisdn, + rat_type := rat_type, + apn := apn, + selection_mode := selection_mode, + pdn_type := pdn_type, + pco := omit, + epco := omit, + teic_local := '00000000'O, + teic_remote := omit, + bearer := { + ebi := 5, + teid_local := omit, + teid_remote := omit + }, + gy := { + validity_time := 0, + cca_res_code := DIAMETER_SUCCESS + }, + pfcp_pars := pfcp_pars, + namf := { + pdu_sess_id := idx + 1, + ran_gtpu_ip := mp_amf_local_ip, + ran_gtpu_teid := int2oct(idx + 1, 4), + cn_gtpu_ip := omit, + cn_gtpu_teid := omit, + ue_ip4 := omit, + ue_ip6 := omit, + ipv6_interface_id := omit + }, + npcf := { + sm_policy_id := imsi_str & "-" & int2str(idx + 1) + }, + nsmf := { + smContextRef := omit + }, + nudm := { + smf_subscription_id := int2str(idx + 1) + }, + nas := { + pti := '00'O, + qos_rules := omit + } + } + return valueof(pars); } diff --git a/smf/SMF_Tests.ttcn b/smf/SMF_Tests.ttcn index 3114803..32af169 100644 --- a/smf/SMF_Tests.ttcn +++ b/smf/SMF_Tests.ttcn @@ -342,7 +342,7 @@ } testcase TC_createSession_deleteSession() runs on SMF_Test_CT { var SMF_Session_CT vc_conn; - var SessionPars pars := valueof(t_SessionPars('001010123456789'H)); + var SessionPars pars := f_SessionPars(0); f_init(); vc_conn := f_start_handler(refers(f_TC_createSession_deleteSession), pars); vc_conn.done; @@ -356,7 +356,7 @@ } testcase TC_deleteSession_unknown() runs on SMF_Test_CT { var SMF_Session_CT vc_conn; - var SessionPars pars := valueof(t_SessionPars('001010123456789'H)); + var SessionPars pars := f_SessionPars(1); f_init(); vc_conn := f_start_handler(refers(f_TC_deleteSession_unknown), pars); vc_conn.done; @@ -409,7 +409,7 @@ } testcase TC_gy_charging_cc_time() runs on SMF_Test_CT { var SMF_Session_CT vc_conn; - var SessionPars pars := valueof(t_SessionPars('001010123456789'H)); + var SessionPars pars := f_SessionPars(2); pars.gy.validity_time := 3; /* Grant access for 3 seconds, needs to be re-validated afterwards */ f_init(); vc_conn := f_start_handler(refers(f_TC_gy_charging_cc_time), pars); @@ -446,7 +446,7 @@ } testcase TC_gy_ccr_update_rejected() runs on SMF_Test_CT { var SMF_Session_CT vc_conn; - var SessionPars pars := valueof(t_SessionPars('001010123456789'H)); + var SessionPars pars := f_SessionPars(3); pars.gy.validity_time := 3; /* Grant access for 3 seconds, needs to be re-validated afterwards */ f_init(); vc_conn := f_start_handler(refers(f_TC_gy_ccr_update_rejected), pars); @@ -462,8 +462,7 @@ } testcase TC_s2b_createSession_v4_noapco() runs on SMF_Test_CT { var SMF_Session_CT vc_conn; - var SessionPars pars := valueof(t_SessionPars('001010123456789'H, - rat_type := GTP2C_RAT_WLAN)); + var SessionPars pars := f_SessionPars(4, rat_type := GTP2C_RAT_WLAN); f_init(); vc_conn := f_start_handler(refers(f_TC_s2b_createSession_v4_noapco), pars); vc_conn.done; @@ -482,8 +481,7 @@ } testcase TC_s2b_createSession_v4_apco() runs on SMF_Test_CT { var SMF_Session_CT vc_conn; - var SessionPars pars := valueof(t_SessionPars('001010123456789'H, - rat_type := GTP2C_RAT_WLAN)); + var SessionPars pars := f_SessionPars(5, rat_type := GTP2C_RAT_WLAN); f_init(); vc_conn := f_start_handler(refers(f_TC_s2b_createSession_v4_apco), pars); vc_conn.done; @@ -497,8 +495,7 @@ } testcase TC_n11_createSession_deleteSession() runs on SMF_Test_CT { var SMF_Session_CT vc_conn; - var SessionPars pars := valueof(t_SessionPars('001010123456789'H, - rat_type := GTP2C_RAT_NR)); + var SessionPars pars := f_SessionPars(6, rat_type := GTP2C_RAT_NR); f_init(); vc_conn := f_start_handler(refers(f_TC_n11_createSession_deleteSession), pars); vc_conn.done; -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43710?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ib483f71fc51d6947de799449ddc40d8825aeba8f Gerrit-Change-Number: 43710 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de>