From 300f2dc71aad15aead172bf5b7222e3e90ba8fe7 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Thu, 7 Jan 2021 17:27:12 +0100 Subject: PCU_Tests: Add TC_rim_ran_info_req_single_rep Add a test to verify the correct function of a RAN information request in single report mode. --- library/Osmocom_Gb_Types.ttcn | 112 +++++++++++++++++++++++++++++++++++++++++- library/PCUIF_Types.ttcn | 23 +++++++-- pcu/PCU_Tests.ttcn | 84 ++++++++++++++++++++++++++++++- pcu/SGSN_Components.ttcn | 5 ++ 4 files changed, 217 insertions(+), 7 deletions(-) diff --git a/library/Osmocom_Gb_Types.ttcn b/library/Osmocom_Gb_Types.ttcn index f97b9b03..05311276 100644 --- a/library/Osmocom_Gb_Types.ttcn +++ b/library/Osmocom_Gb_Types.ttcn @@ -2479,7 +2479,14 @@ octetstring sdu) := { }, rIMApplicationIdentity := app_id } - + template RIM_Application_Identity tr_RIM_Application_Identity(template OCT1 app_id := ?) := { + iEI := '4B'O, + ext := '1'B, + lengthIndicator := { + length1 := 1 + }, + rIMApplicationIdentity := app_id + } /* 3GPP TS 48.018 11.3.62 */ template (value) RIM_Sequence_Number ts_RIM_Sequence_Number(integer seq) := { @@ -2490,6 +2497,20 @@ octetstring sdu) := { }, rIMSequenceNumber := int2oct(seq, 4) } + function tr_RIM_Sequence_Number(template integer seq := ?) return template RIM_Sequence_Number { + var template RIM_Sequence_Number ret; + ret.iEI := '4C'O; + ret.ext := '1'B; + ret.lengthIndicator := { length1 := 4 }; + if (istemplatekind(seq, "*")) { + ret.rIMSequenceNumber := *; + } else if (istemplatekind(seq, "?")) { + ret.rIMSequenceNumber := ?; + } else { + ret.rIMSequenceNumber := int2oct(valueof(seq), 4); + } + return ret; + } /* 3GPP TS 48.018 11.3.62a.1 */ template (value) RAN_Information_Request_RIM_Container @@ -2553,10 +2574,34 @@ octetstring sdu) := { applContainer_or_ApplErrContainer := app_cont_or_app_err, sON_Transfer_Application_Identity := son_app_id } + template RAN_Information_RIM_Container + tr_RAN_Information_RIM_Container(template RIM_Application_Identity app_id := ?, + template RIM_Sequence_Number seq := ?, + template RIM_PDU_Indications ind := ?, + template RIM_Protocol_Version_Number ver := omit, + template ApplContainer_or_ApplErrContainer app_cont_or_app_err := omit, + template SON_Transfer_Application_Identity_TLV son_app_id := omit) := { + + iEI := '58'O, + ext := '1'B, + lengthIndicator := { + length1 := ? + }, + rIM_Application_Identity := app_id, + rIM_Sequence_Number := seq, + rIM_PDU_Indications := ind, + rIM_Protocol_Version_Number := ver, + applContainer_or_ApplErrContainer := app_cont_or_app_err, + sON_Transfer_Application_Identity := son_app_id + } template (value) ApplContainer_or_ApplErrContainer tsu_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC cont) := { nacc := cont } + template ApplContainer_or_ApplErrContainer + tru_ApplContainer_or_ApplErrContainer_NACC(template ApplContainer_or_ApplErrContainer_NACC cont := ?) := { + nacc := cont + } template (value) ApplContainer_or_ApplErrContainer tsu_ApplContainer_or_ApplErrContainer_SI3(template (value) ApplContainer_or_ApplErrContainer_SI3 cont) := { si3 := cont @@ -2569,6 +2614,10 @@ octetstring sdu) := { tsu_ApplContainer_NACC(template (value) BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := { application_Container := ts_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi) } + template ApplContainer_or_ApplErrContainer_NACC + tru_ApplContainer_NACC(template BssgpCellId cid := ?, template boolean psi_type := ?, template integer si_psi_num := ?, template octetstring si_psi := ?) := { + application_Container := tr_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi) + } template (value) ApplContainer_or_ApplErrContainer_NACC tsu_ApplErrContainer_NACC(template (value) BssgpCellId cid, integer cause, @@ -2730,6 +2779,31 @@ octetstring sdu) := { number_of_SI_PSI := int2bit(si_psi_num, 7), sI_PSI := si_psi } + function tr_RAN_Information_Application_Container_NACC(template BssgpCellId cid := ?, template boolean psi_type := ?, + template integer si_psi_num := ?, template octetstring si_psi := ?) + return template RAN_Information_Application_Container_NACC { + var template RAN_Information_Application_Container_NACC ret; + ret.iEI := '4E'O; + ret.ext := '1'B; + ret.lengthIndicator := { length1 := ? }; + ret.reporting_Cell_Identifier := t_Cell_Identifier_V(cid); + if (istemplatekind(psi_type, "*")) { + ret.typeBit := *; + } else if (istemplatekind(psi_type, "?")) { + ret.typeBit := ?; + } else { + ret.typeBit := bool2bit(valueof(psi_type)); + } + if (istemplatekind(si_psi_num, "*")) { + ret.number_of_SI_PSI := *; + } else if (istemplatekind(si_psi_num, "?")) { + ret.number_of_SI_PSI := ?; + } else { + ret.number_of_SI_PSI := int2bit(valueof(si_psi_num), 7); + } + ret.sI_PSI := si_psi; + return ret; + } /* 3GPP TS 48.018 11.3.63.2.2 */ template (value) RAN_Information_Application_Container_SI3 @@ -2967,6 +3041,28 @@ octetstring sdu) := { pDU_Type_Extension := type_ext, reserved := '0000'B } + function tr_RIM_PDU_Indications(template boolean ack := ?, template BIT3 type_ext := ?) return template RIM_PDU_Indications { + var template RIM_PDU_Indications ret; + ret.iEI := '4F'O; + ret.ext := '1'B; + ret.lengthIndicator := { length1 := 1 }; + if (istemplatekind(ack, "*")) { + ret.ack := *; + } else if (istemplatekind(ack, "?")) { + ret.ack := ?; + } else { + ret.ack := bool2bit(valueof(ack)); + } + if (istemplatekind(type_ext, "*")) { + ret.pDU_Type_Extension := *; + } else if (istemplatekind(type_ext, "?")) { + ret.pDU_Type_Extension := ?; + } else { + ret.pDU_Type_Extension := valueof(type_ext); + } + ret.reserved := '0000'B; + return ret; + } /* 3GPP TS 48.018 11.3.67 */ template (value) RIM_Protocol_Version_Number ts_RIM_Protocol_Version_Number(integer ver) := { @@ -2977,6 +3073,20 @@ octetstring sdu) := { }, rIMProtocolVersionNumber := int2oct(ver, 1) } + function tr_RIM_Protocol_Version_Number(template integer ver := ?) return template RIM_Protocol_Version_Number { + var template RIM_Protocol_Version_Number ret; + ret.iEI := '55'O; + ret.ext := '1'B; + ret.lengthIndicator := { length1 := 1 }; + if (istemplatekind(ver, "*")) { + ret.rIMProtocolVersionNumber := *; + } else if (istemplatekind(ver, "?")) { + ret.rIMProtocolVersionNumber := ?; + } else { + ret.rIMProtocolVersionNumber := int2oct(valueof(ver), 1); + } + return ret; + } /* 3GPP TS 48.018 11.3.70 */ const HEX1 RIM_ADDR_GERAN_CELL_ID := '0'H; diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn index d6e0867e..6c1ec323 100644 --- a/library/PCUIF_Types.ttcn +++ b/library/PCUIF_Types.ttcn @@ -215,12 +215,19 @@ type record PCUIF_info_ind { record length(2) of uint16_t nsvci, record length(2) of uint16_t local_port, record length(2) of uint16_t remote_port, - PCUIF_RemoteAddr remote_addr + PCUIF_RemoteAddr remote_addr, + + record length(23) of uint8_t si1, + uint8_t si1_is_set, + record length(23) of uint8_t si3, + uint8_t si3_is_set, + record length(23) of uint8_t si13, + uint8_t si13_is_set } with { - /* NOTE: TITAN is not smart enough to handle 'version < 10' and 'version > 9', + /* NOTE: TITAN is not smart enough to handle 'version < 11' and 'version > 10', * so we cannot support more than two versions at the same time here. Sigh. */ - variant (trx) "CROSSTAG(v09, version = 9; v10, version = 10)" - variant (remote_addr) "CROSSTAG(v09, version = 9; v10, version = 10)" + variant (trx) "CROSSTAG(v09, version = 10; v10, version = 11)" + variant (remote_addr) "CROSSTAG(v09, version = 10; v10, version = 11)" }; type union PCUIF_RemoteAddr { @@ -908,7 +915,13 @@ template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?, nsvci := ?, local_port := ?, remote_port := ?, - remote_addr := ? + remote_addr := ?, + si1 := ?, + si1_is_set := ?, + si3 := ?, + si3_is_set := ?, + si13 := ?, + si13_is_set := ? } } } diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn index 13b33b26..5d822d61 100644 --- a/pcu/PCU_Tests.ttcn +++ b/pcu/PCU_Tests.ttcn @@ -102,7 +102,13 @@ friend template (value) PCUIF_info_ind ts_PCUIF_INFO_default(template (value) PC local_port := { mp_nsconfig.nsvc[0].provider.ip.remote_udp_port, 0 }, remote_port := { mp_nsconfig.nsvc[0].provider.ip.local_udp_port, 0 }, remote_addr := f_PCUIF_ver_INFO_RemoteAddr( - f_PCUIF_AF2addr_type(mp_nsconfig.nsvc[0].provider.ip.address_family), mp_nsconfig.nsvc[0].provider.ip.local_ip) + f_PCUIF_AF2addr_type(mp_nsconfig.nsvc[0].provider.ip.address_family), mp_nsconfig.nsvc[0].provider.ip.local_ip), + si1 := { 85, 6, 25, 143, 177, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 0, 0, 43 }, + si1_is_set := 1, + si3 := { 73, 6, 27, 117, 48, 0, 241, 16, 35, 110, 201, 3, 60, 39, 71, 64, 121, 0, 0, 60, 11, 43, 43 }, + si3_is_set := 1, + si13 := { 1, 6, 0, 144, 0, 24, 90, 111, 201, 224, 132, 16, 171, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, + si13_is_set := 1 } type record lqual_range { @@ -3566,6 +3572,80 @@ testcase TC_paging_cs_multi_ms_imsi_tmsi() runs on RAW_PCU_Test_CT { f_shutdown(__BFILE__, __LINE__, final := true); } +/* Send a RIM RAN info request to the PCU and verify the response */ +testcase TC_rim_ran_info_req_single_rep() runs on RAW_PCU_Test_CT { + const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; + var PCUIF_info_ind info_ind; + timer T := 2.0; + + /* Initialize NS/BSSGP side */ + f_init_bssgp(); + + /* Initialize the PCU interface abstraction */ + f_init_raw(testcasename()); + + /* Establish BSSGP connection to the PCU */ + f_bssgp_establish(); + + var template RIM_Routing_Address dst_addr; + var template RIM_Routing_Address src_addr; + var template RAN_Information_Request_RIM_Container req_cont; + var template RAN_Information_RIM_Container res_cont; + var template PDU_BSSGP bssgp_rim_pdu; + var template PDU_BSSGP bssgp_rim_pdu_expect; + var template RAN_Information_RIM_Container rim_cont_expect; + + var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; + src_addr := t_RIM_Routing_Address_cid(src_cid); + dst_addr := t_RIM_Routing_Address_cid(mp_gb_cfg.bvc[0].cell_id); + + var octetstring si1_expect := '198fb100000000000000000000000000007900002b'O; + var octetstring si3_expect := '1b753000f110236ec9033c2747407900003c0b2b2b'O; + var octetstring si13_expect := '009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O; + var octetstring si_expect := si1_expect & si3_expect & si13_expect; + + req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), + ts_RIM_Sequence_Number(1), + ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), + ts_RIM_Protocol_Version_Number(1), + tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), + omit); + bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), + ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), + req_cont); + + + rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), + tr_RIM_Sequence_Number(1), + tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), + tr_RIM_Protocol_Version_Number(1), + tru_ApplContainer_or_ApplErrContainer_NACC(tru_ApplContainer_NACC(mp_gb_cfg.bvc[0].cell_id, false, 3, si_expect)), + omit); + + bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), + tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), + rim_cont_expect); + RIM.send(bssgp_rim_pdu); + T.start; + alt { + [] RIM.receive(bssgp_rim_pdu_expect) { } + [] RIM.receive { + setverdict(fail, "Unexpected BSSGP RIM PDU received"); + } + [] T.timeout { + setverdict(fail, "No BSSGP RIM PDU received"); + mtc.stop; + } + } + + /* FIXME: work around a race condition between PCUIF and BSSGP */ + f_sleep(0.2); /* i.e. give the IUT some time to process everything */ + + f_shutdown(__BFILE__, __LINE__, final := true); +} + + + control { execute( TC_pcuif_suspend() ); execute( TC_pcuif_suspend_active_tbf() ); @@ -3639,6 +3719,8 @@ control { execute( TC_multiplex_dl_gprs_egprs() ); execute( TC_pcuif_info_ind_subsequent() ); + + execute( TC_rim_ran_info_req_single_rep() ); } } diff --git a/pcu/SGSN_Components.ttcn b/pcu/SGSN_Components.ttcn index 08d9231c..a4f23f3a 100644 --- a/pcu/SGSN_Components.ttcn +++ b/pcu/SGSN_Components.ttcn @@ -90,6 +90,9 @@ type component bssgp_CT extends BSSGP_Client_CT { var BSSGP_CT bssgp_component; port BSSGP_CT_PROC_PT PROC; var boolean g_initialized := false; + + /* used by RIM related test */ + port BSSGP_PT RIM; } /* FIXME: merge this into BSSGP_Client_CT ? */ @@ -126,6 +129,8 @@ function f_init_bssgp() runs on bssgp_CT { f_bssgp_client_register(mmctx.imsi, mmctx.tlli); } connect(self:BSSGP_GLOBAL[0], bssgp_component:GLOBAL); + /* connect RIM related port */ + connect(bssgp_component:RIM, self:RIM); } /* Establish BSSGP connection to PCU */ -- cgit v1.2.3