Commit 8ed88a0a authored by Yann Garcia's avatar Yann Garcia
Browse files

Set UE in correct state, Enahnce templates

parent e41be698
Loading
Loading
Loading
Loading
+1 −1
Changes for etc/AtsNGAP/AtsNGAP_GNB_p_net.cfg_: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ NGAP_Pics.PICS_NGAP_GNB_IUT := true
LibNGAP_Pics.PICS_OFFLINE_MODE      := false # true for offline mode with pcap files, false for online mode with SCTP server
LibNGAP_Pics.PICS_USE_UERANSIMU     := false # true to start UERANSIM gNB and UE simulators, false to not start them
LibNGAP_Pics.PICS_USE_AT_COMMANDS   := true # true to use AT commands to start UERANSIM gNB and UE simulators, false to not use them
NGAP_UtDispatcher.PX_UT_CNF_TIMEOUT := 40.0
NGAP_UtDispatcher.PX_UT_CNF_TIMEOUT := 60.0 # Must cover the modem restart (~30 s), registration and the data call (ACTIVATE_BEARER)

LibNGAP_Pics.PICS_NO_RAN_NODE_NAME                                := true # true to not use RAN node name, false to use it
LibNGAP_Pics.PICS_REGISTRATION_REQUEST_WITH_NO_UE_CONTEXT_REQUEST := true # true to send RegistrationRequest with no UE Context Request IE, false to send it with UE Context Request IE
+30 −1
Changes for ttcn/AtsNGAP/NGAP_Steps.ttcn: 30 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -179,7 +179,8 @@ module NGAP_Steps { // TODO FSCOM f_xxx_UE_SecurityMode to be mmoved into NAG_NG
        /**
         * @brief  Postamble of the test cases where the SUT is a gNB.
         * @details Releases the UE context from the AMF side (f_postambleNGAP_gNB): with a real UE
         *          (PICS_USE_AT_COMMANDS) with the cause "normal release", otherwise with p_Cause. With
         *          (PICS_USE_AT_COMMANDS) with the cause "normal release", otherwise with p_Cause. A real UE is
         *          then switched to flight mode and its deregistration served (f_NGAP_gnb_UE_Deregister). With
         *          PICS_USE_UERANSIMU, also stops the UERANSIM UE and gNB. Deactivates the defaults.
         * @param  p_Cause The cause of the UE context release when no real UE is used.
         */
@@ -189,6 +190,7 @@ module NGAP_Steps { // TODO FSCOM f_xxx_UE_SecurityMode to be mmoved into NAG_NG

            if (PICS_USE_AT_COMMANDS) {
                f_postambleNGAP_gNB(m_cause_nas(normal_release));
                f_NGAP_gnb_UE_Deregister();
            } else {
                f_postambleNGAP_gNB(p_Cause);
            }
@@ -845,6 +847,33 @@ module NGAP_Steps { // TODO FSCOM f_xxx_UE_SecurityMode to be mmoved into NAG_NG
            return true;
        } // End of function f_NGAP_gnb_UE_await_data_call

        /**
         * @brief  Leave the real UE in a known state at the end of a test: deregistered, in flight mode.
         * @details Unless PX_UT_DEREGISTER_TIMEOUT is 0.0: asks the upper tester to switch the modem to flight
         *          mode (DEREGISTER, AT+CFUN=4), without waiting for the confirmation, then serves the
         *          deregistration the UE starts on its own (f_await_deregistration_request_send_ue_context_release):
         *          its DEREGISTRATION REQUEST, the DEREGISTRATION ACCEPT unless it is a switch off, and the release
         *          of its UE context. The UE does not stay registered with, or connected to, the gNB between tests,
         *          its PDU sessions are released, and its stored 5G-GUTI and security context are those of a
         *          completed deregistration. The next test restarts the modem (f_NGAP_gnb_UE_Register).
         *          Best effort: a UE that does not deregister within PX_UT_DEREGISTER_TIMEOUT (e.g. it was not
         *          registered) is only logged, the verdict is left unchanged.
         * @note   The UE keeps its current 5G NAS security context across a deregistration (TS 24.501), so
         *         its next REGISTRATION REQUEST is still integrity protected with it.
         */
        function f_NGAP_gnb_UE_Deregister() runs on gNBNGAPComponent {
            if (PX_UT_DEREGISTER_TIMEOUT == 0.0) {
                return;
            }
            log(">>> f_NGAP_gnb_UE_Deregister");
            fl_UT_ApplyCommand(utPtcMtcPort, cas_UT_Req(DEREGISTER, NO_CNF_REQUIRED));
            if (f_await_deregistration_request_send_ue_context_release(PX_UT_DEREGISTER_TIMEOUT)) {
                log("*** " & __SCOPE__ & ": INFO: UE deregistered, in flight mode ***");
            } else {
                log("*** " & __SCOPE__ & ": INFO: no deregistration served, the UE is left in flight mode ***");
            }
        } // End of function f_NGAP_gnb_UE_Deregister

        /**
         * @brief  ERROR INDICATION, the test system playing the AMF.
         * @details In offline mode (PICS_OFFLINE_MODE), both directions are read from a capture:
+18 −3
Changes for ttcn/AtsNGAP/NGAP_TCFunctions.ttcn: 18 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ module NGAP_TCFunctions {
               */
              function f_TC_NGAP_GNB_PDU_01() runs on gNBNGAPComponent {
                // Local variables
                var PDUSessionID v_pduSessionId := PX_PDU_SESSION_ID; // PDU session to be set up

                // Preamble
                f_NGAP_gnb_init();
@@ -82,6 +83,7 @@ module NGAP_TCFunctions {
                        log("*** " & __SCOPE__ & ": INCONC: No PDU SESSION ESTABLISHMENT REQUEST received from the UE. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    v_pduSessionId := oct2int(v_psi);
                    f_send_pdu_session_resource_setup_request_with_accept(v_psi, v_pti);
                } else {
                    var PDUSessionResourceSetupRequestTransfer v_pdu_session_resource_setup_request_transfer := valueof(
@@ -144,10 +146,23 @@ module NGAP_TCFunctions {
                                                }
                                ));
                {
                    var boolean v_setup := false;
                    // The response must be for this UE, use the TS 38.413 criticalities, set up the requested PDU
                    // session (any optional IE accepted), and report no PDU session as failed
                    var boolean v_setup := f_NGAP_check_received_PDU(
                                                                     mw_ngap_succMsg(
                                                                                     mw_n2_PDUSessionResourceSetupResponse_conformant(
                                                                                                                                      vc_AMF_UE_ID,
                                                                                                                                      vc_RAN_UE_ID,
                                                                                                                                      v_pduSessionId
                                                                     )),
                                                                     "PDU SESSION RESOURCE SETUP RESPONSE"
                                                                     );
                    for (var integer i := 0; i < lengthof(vc_recvNGAP_PDU.successfulOutcome.value_.pDUSessionResourceSetupResponse.protocolIEs); i := i + 1) {
                        if (vc_recvNGAP_PDU.successfulOutcome.value_.pDUSessionResourceSetupResponse.protocolIEs[i].id == id_PDUSessionResourceSetupListSURes) {
                            v_setup := true;
                        if (vc_recvNGAP_PDU.successfulOutcome.value_.pDUSessionResourceSetupResponse.protocolIEs[i].id == id_PDUSessionResourceFailedToSetupListSURes) {
                            log("*** " & __SCOPE__ & ": FAIL: the gNB reports PDU sessions failed to set up: ",
                                vc_recvNGAP_PDU.successfulOutcome.value_.pDUSessionResourceSetupResponse.protocolIEs[i].value_);
                            setverdict(fail, "PDU session resources failed to set up");
                            v_setup := false;
                        }
                    }
                    if (v_setup) {
+4 −0
Changes for ttcn/LibNGAP/lib/LibNGAP_Pixits.ttcn: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -746,6 +746,10 @@ module LibNGAP_Pixits {
     *        see f_NGAP_gnb_UE_await_data_call */
    modulepar float      PX_UT_DATA_CALL_CNF_TIMEOUT := 30.0;

    /** @desc Time, in seconds, the postamble waits for the real UE to deregister once it is switched to flight mode (AT+CFUN=4);
     *        see f_NGAP_gnb_UE_Deregister. 0.0 to leave the UE as it is at the end of the test */
    modulepar float      PX_UT_DEREGISTER_TIMEOUT := 10.0;

    /** @desc Whether, after its restart (AT+CFUN=1,1), the real UE (AT commands) is set to full functionality (AT+CFUN=1) and
     *        forced onto PX_UT_PLMN_MCC/PX_UT_PLMN_MNC (AT+COPS=1); see f_NGAP_gnb_UE_Register.
     *        false: it is only restarted, and registers by itself on the PLMN it selects. */
+132 −0
Changes for ttcn/LibNGAP/lib/LibNGAP_Templates.ttcn: 132 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -281,6 +281,61 @@ module LibNGAP_Templates {
                                                }
                         } // End of template mw_n2_PDUSessionResourceSetupResponse
                         /**
                          * @brief  Any conformant PDU SESSION RESOURCE SETUP RESPONSE setting up the given PDU session (TS 38.413
                          *         clause 9.2.1.2).
                          * @details AMF and RAN UE NGAP IDs first, then the PDU Session Resource Setup Response List holding an item
                          *          for p_pduSessionId, all with the criticalities of the ASN.1 (NGAP-PDU-Contents: "ignore");
                          *          any optional IE may come in between or after. Whether the PDU Session Resource Failed to
                          *          Setup List is absent is not checked here. Unlike mw_n2_PDUSessionResourceSetupResponse
                          *          (criticalities "reject", user location information required), it matches what a conformant
                          *          gNB sends.
                          * @param  p_amfUeNgapID The AMF UE NGAP ID.
                          * @param  p_ranUeNgapID The RAN UE NGAP ID.
                          * @param  p_pduSessionId The PDU session identity that must have been set up.
                          */
                         template (present) SuccessfulOutcome mw_n2_PDUSessionResourceSetupResponse_conformant(
                                                                                                              template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?,
                                                                                                              template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?,
                                                                                                              template (present) PDUSessionID p_pduSessionId := ?
                                                                                                              ) := {
                                procedureCode := id_PDUSessionResourceSetup,
                                criticality   := reject,
                                value_        := {
                                                  PDUSessionResourceSetupResponse := {
                                                                                      protocolIEs := {
                                                                                                      {
                                                                                                        id := id_AMF_UE_NGAP_ID,
                                                                                                        criticality := ignore,
                                                                                                        value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID }
                                                                                                      },
                                                                                                      {
                                                                                                        id := id_RAN_UE_NGAP_ID,
                                                                                                        criticality := ignore,
                                                                                                        value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID }
                                                                                                      },
                                                                                                      *,
                                                                                                      {
                                                                                                        id := id_PDUSessionResourceSetupListSURes,
                                                                                                        criticality := ignore,
                                                                                                        value_ := {
                                                                                                                    PDUSessionResourceSetupListSURes := {
                                                                                                                                                         *,
                                                                                                                                                         {
                                                                                                                                                           pDUSessionID := p_pduSessionId,
                                                                                                                                                           pDUSessionResourceSetupResponseTransfer := ?,
                                                                                                                                                           iE_Extensions := *
                                                                                                                                                         },
                                                                                                                                                         *
                                                                                                                                                        }
                                                                                                                  }
                                                                                                      },
                                                                                                      *
                                                                                      }
                                                  }
                                                }
                         } // End of template mw_n2_PDUSessionResourceSetupResponse_conformant
                         template (present) SuccessfulOutcome mw_n2_PDUSessionResourceSetupResponseFailed(
                                                                                                          template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?,
                                                                                                          template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?,
@@ -2119,6 +2174,40 @@ module LibNGAP_Templates {
                                             }
                         } // End of template mw_n2_UEContextReleaseComplete
                        /**
                         * @brief  Any conformant UE CONTEXT RELEASE COMPLETE for the given UE (TS 38.413 clause 9.2.2.6).
                         * @details The mandatory IEs come first, with the criticalities of the ASN.1 (NGAP-PDU-Contents:
                         *          AMF and RAN UE NGAP IDs "ignore"); any optional IE may follow. Unlike
                         *          mw_n2_UEContextReleaseComplete (criticalities "reject", no optional IE), it matches what a
                         *          conformant gNB sends.
                         * @param  p_amfUeNgapID The AMF UE NGAP ID.
                         * @param  p_ranUeNgapID The RAN UE NGAP ID.
                         */
                        template (present) SuccessfulOutcome mw_n2_UEContextReleaseComplete_conformant(
                                                                                                      template (present) AMF_UE_NGAP_ID p_amfUeNgapID := ?,
                                                                                                      template (present) RAN_UE_NGAP_ID p_ranUeNgapID := ?
                                                                                                      ) := {
                            procedureCode := id_UEContextRelease,
                            criticality   := reject,
                            value_        := {
                                              UEContextReleaseComplete := {
                                                                            protocolIEs := {
                                                                                             {
                                                                                                 id := id_AMF_UE_NGAP_ID,
                                                                                                 criticality := ignore,
                                                                                                 value_ := { AMF_UE_NGAP_ID := p_amfUeNgapID }
                                                                                             },
                                                                                             {
                                                                                                 id := id_RAN_UE_NGAP_ID,
                                                                                                 criticality := ignore,
                                                                                                 value_ := { RAN_UE_NGAP_ID := p_ranUeNgapID }
                                                                                             },
                                                                                             *
                                                                                            }
                                                                            }
                                             }
                         } // End of template mw_n2_UEContextReleaseComplete_conformant
                        /**
                         * @see ETSI TS 138 413 V16.12.0 (2023-05) Clause 9.2.2.6 UE CONTEXT RELEASE COMPLETE
                         */
@@ -5493,6 +5582,49 @@ module LibNGAP_Templates {
                                            }
                        }
                        /**
                         * @brief  Any conformant INITIAL UE MESSAGE (TS 38.413 clause 9.2.5.1).
                         * @details The mandatory IEs (RAN UE NGAP ID, NAS-PDU, User Location Information, RRC Establishment
                         *          Cause), in any order, with the criticalities of the ASN.1 (NGAP-PDU-Contents); any optional
                         *          IE may be present too.
                         * @param  p_RANUeNgapID The RAN UE NGAP ID.
                         * @param  p_nasPdu The NAS-PDU.
                         */
                        template (present) InitiatingMessage mw_n2_initialUeMessage_conformant(
                                                                                              template (present) RAN_UE_NGAP_ID p_RANUeNgapID := ?,
                                                                                              template (present) NAS_PDU p_nasPdu := ?
                                                                                              ) := {
                            procedureCode := id_InitialUEMessage,
                            criticality   := ignore,
                            value_        := {
                                              InitialUEMessage := {
                                                                   protocolIEs := {permutation(
                                                                                   {
                                                                                    id := id_RAN_UE_NGAP_ID,
                                                                                    criticality := reject,
                                                                                    value_ := { RAN_UE_NGAP_ID := p_RANUeNgapID }
                                                                                   },
                                                                                   {
                                                                                    id := id_NAS_PDU,
                                                                                    criticality := reject,
                                                                                    value_ := { NAS_PDU := p_nasPdu }
                                                                                   },
                                                                                   {
                                                                                    id := id_UserLocationInformation,
                                                                                    criticality := reject,
                                                                                    value_ := { UserLocationInformation := ? }
                                                                                   },
                                                                                   {
                                                                                    id := id_RRCEstablishmentCause,
                                                                                    criticality := ignore,
                                                                                    value_ := { RRCEstablishmentCause := ? }
                                                                                   },
                                                                                   *
                                                                                  )}
                                                                   }
                                            }
                        } // End of template mw_n2_initialUeMessage_conformant
                        template (present) InitiatingMessage mw_n2_initialUeMessage(
                                                                                    template (present) RAN_UE_NGAP_ID p_RANUeNgapID := ?,
                                                                                    template (present) NAS_PDU p_nasPdu := ?,
Loading