Commit 0ae84a2b authored by Yann Garcia's avatar Yann Garcia
Browse files

Enhance management of TAI

parent 8b99f510
Loading
Loading
Loading
Loading
+1 −1
Changes for etc/AtsNGAP/AtsNGAP_GNB.cfg_: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ LibNGAP_Pixits.PX_UT_PLMN_MNC := '40'H
LibNGAP_Pixits.PX_RAN_NODE_NAME    := "gnb0012345"
LibNGAP_Pixits.PX_GNB_ID           := '0000011000010010111001'B
LibNGAP_Pixits.PX_RAN_NODE_NAME    := "UERANSIM-gnb-999-70-1"
LibNGAP_Pixits.PX_TACode           := '005998'O
LibNGAP_Pixits.PX_TACode           := '00176E'O # TAC of the gNB under test: 5998 decimal = 0x00176E (3 octets, hexadecimal); used in the TAI list of the REGISTRATION ACCEPT
LibNGAP_Pixits.PX_SST              := '01'O
LibNGAP_Pixits.PX_SD               := '000001'O
LibNGAP_Pixits.PX_PAGING_DRX       := v128
+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
@@ -34,7 +34,7 @@ LibNGAP_Pixits.PX_UT_PLMN_MNC := '40'H
LibNGAP_Pixits.PX_RAN_NODE_NAME    := "gnb0012345"
LibNGAP_Pixits.PX_GNB_ID           := '0000011000010010111001'B
LibNGAP_Pixits.PX_RAN_NODE_NAME    := "UERANSIM-gnb-999-70-1"
LibNGAP_Pixits.PX_TACode           := '005998'O
LibNGAP_Pixits.PX_TACode           := '00176E'O # TAC of the gNB under test: 5998 decimal = 0x00176E (3 octets, hexadecimal); used in the TAI list of the REGISTRATION ACCEPT
LibNGAP_Pixits.PX_SST              := '01'O
LibNGAP_Pixits.PX_SD               := '000001'O
LibNGAP_Pixits.PX_PAGING_DRX       := v128
+9 −2
Changes for ttcn/AtsNGAP/NGAP_Steps.ttcn: 9 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -1091,8 +1091,10 @@ module NGAP_Steps { // TODO FSCOM f_xxx_UE_SecurityMode to be mmoved into NAG_NG

        /**
         * @brief  Offline replay (PICS_OFFLINE_MODE) of the user plane of f_NGAP_gnb_UE_ping: check the G-PDUs of the capture.
         * @details Without PICS_USE_GTPU, nothing is checked. Otherwise every G-PDU replayed on N3_P is read, until none comes
         *          for 2 s; the replay delivers both directions:
         * @details Without PICS_USE_GTPU, nothing is checked. Otherwise the G-PDUs replayed on N3_P are read until the expected
         *          ones are there (PX_UT_PING_COUNT echo requests, and as many echo replies with PX_GTPU_ANSWER_ECHO_REQUESTS),
         *          or none comes for 2 s: N2 is replayed meanwhile, and a longer wait would let the defaults consume the
         *          next N2 messages. The replay delivers both directions:
         *          - to the downlink tunnel of the gNB (vc_dlGtpTunnel): the echo replies the test system sent, checked by
         *            f_NGAP_gnb_check_downlink_gpdu;
         *          - otherwise: the uplink G-PDUs of the gNB, checked by f_NGAP_gnb_check_uplink_gpdu as online.
@@ -1126,9 +1128,14 @@ module NGAP_Steps { // TODO FSCOM f_xxx_UE_SecurityMode to be mmoved into NAG_NG
                        v_echoRequests := v_echoRequests + 1;
                    }
                    t_quiet.stop;
                    // Stop as soon as the expected G-PDUs are there: the N2 replay goes on meanwhile, and a later N2
                    // message (e.g. the DEREGISTRATION REQUEST) would be consumed by the defaults while this alt waits
                    if ((v_echoRequests < PX_UT_PING_COUNT)
                        or (PX_GTPU_ANSWER_ECHO_REQUESTS and (v_echoReplies < PX_UT_PING_COUNT))) {
                        t_quiet.start;
                        repeat;
                    }
                }
                [] t_quiet.timeout {
                }
            }
+44 −8
Changes for ttcn/LibNGAP/lib_system/LibNGAP_Functions.ttcn: 44 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -328,6 +328,43 @@ module LibNGAP_Functions {
                       )));
    }

    /**
     * @brief  Keep the TAI of the UE (vc_ueTai) from the User Location Information of the INITIAL UE MESSAGE just received.
     * @details The gNB reports the TAI of the cell of the UE in the NR User Location Information (TS 38.413 clause 9.3.1.16).
     *          It is logged, with a note if it differs from the configured PX_NAS_MCC/PX_NAS_MNC/PX_TACode. Without an NR
     *          User Location Information, vc_ueTaiKnown is left false (f_ue_tai then falls back to the PIXITs).
     */
    function f_get_ue_tai() runs on NGNASComponent {
        var integer v_idx := f_NGAP_getIEIndex(vc_recvNGAP_PDU, id_UserLocationInformation);

        vc_ueTaiKnown := false;
        if ((v_idx < 0) or not ischosen(vc_recvNGAP_PDU.initiatingMessage.value_.InitialUEMessage.protocolIEs[v_idx].value_.userLocationInformation.userLocationInformationNR)) {
            log("f_get_ue_tai: no NR User Location Information, the TAI of the PIXITs is used");
            return;
        }
        vc_ueTai := vc_recvNGAP_PDU.initiatingMessage.value_.InitialUEMessage.protocolIEs[v_idx].value_.userLocationInformation.userLocationInformationNR.tAI;
        vc_ueTaiKnown := true;
        log("f_get_ue_tai: TAI of the UE: PLMN ", vc_ueTai.pLMNIdentity, ", TAC ", vc_ueTai.tAC);
        if ((vc_ueTai.pLMNIdentity != fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC)) or (vc_ueTai.tAC != PX_TACode)) {
            log("f_get_ue_tai: INFO: the TAI of the UE differs from the PIXITs (PLMN ", fl_NasNN_MCC2PlmnId(PX_NAS_MCC, PX_NAS_MNC),
                ", PX_TACode ", PX_TACode, "): the TAI of the UE is used");
        }
    } // End of function f_get_ue_tai

    /**
     * @brief  TAI of the UE, for the TAI list of the REGISTRATION ACCEPT (test system = AMF).
     * @details The TAI the gNB reported for the UE (vc_ueTai, see f_get_ue_tai), as a real AMF does; otherwise the PIXITs
     *          PX_NAS_MCC/PX_NAS_MNC and PX_TACode. With the AMF as IUT, the test system plays the gNB and these PIXITs
     *          are the TAI it announces (m_tAI).
     * @return The TAI.
     */
    function f_ue_tai() runs on NGNASComponent return TAI {
        if (vc_ueTaiKnown) {
            return vc_ueTai;
        }
        return valueof(m_tAI);
    } // End of function f_ue_tai

    /**
     * @brief  Await the REGISTRATION REQUEST of the UE, in an INITIAL UE MESSAGE (test system = AMF).
     * @details The INITIAL UE MESSAGE is matched without the UE context request IE when
@@ -367,6 +404,9 @@ module LibNGAP_Functions {
            // Save message in global variable for later use
            vc_registration_request := vc_recvNgNasUl_Msg.registration_Request;

            // TAI of the UE, as reported by the gNB, for the TAI list of the REGISTRATION ACCEPT (f_ue_tai)
            f_get_ue_tai();

            // The ngKSI allocated in the Authentication Request must differ from the one of the security
            // context the UE already holds, if any (TS 24.501 clause 5.4.1.3.2); otherwise the UE rejects
            // the authentication with cause #71 "ngKSI already in use". '111'B means the UE holds no key
@@ -1348,13 +1388,15 @@ module LibNGAP_Functions {
     * @brief  Send the INITIAL CONTEXT SETUP REQUEST carrying the REGISTRATION ACCEPT, and await the RESPONSE (test system = AMF).
     * @details The REGISTRATION ACCEPT assigns a 5G-GUTI (PX_AMF_REGION_ID, PX_AMF_SET_ID,
     *          PX_AMF_POINTER, px_TMSI_Def), whichever identity the UE registered with: a SUCI cannot be
     *          put in this IE. It also carries the TAI list (PX_TACode), the allowed NSSAI (SST 1) and
     *          put in this IE. It also carries the TAI list (the TAI of the UE, f_ue_tai), the allowed NSSAI (SST 1) and
     *          T3512, and is integrity protected and ciphered (TS 24.501 clause 9.3.1).
     *          K_gNB is derived from K_AMF and the uplink NAS COUNT of the SECURITY MODE COMPLETE
     *          (TS 33.501 Annex A.9). The request is kept in vc_initialContextSetupRequest.
     */
    function f_send_initial_context_setup_request_await_initial_context_setup_resonse() runs on NGNASComponent {
        log(">>> f_send_initial_context_setup_request_await_initial_context_setup_resonse");
        // Registration area: the tracking area the UE registered in, as a real AMF does (TS 24.501 clause 5.5.1.2.4)
        var TAI v_tai := f_ue_tai();

        // Send InitialContextSetupRequest
        // 1. Build the NAS message for Registration Accept
@@ -1403,13 +1445,7 @@ module LibNGAP_Functions {
                                                                                                                                                                                                        { 
                                                                                                                                                                                                            m_NG_Type2Element(
                                                                                                                                                                                                                              {
                                                                                                                                                                                                                                mw_ng_partial_tai(
                                                                                                                                                                                                                                                  fl_NasNN_MCC2PlmnId(
                                                                                                                                                                                                                                                        PX_NAS_MCC, 
                                                                                                                                                                                                                                                        PX_NAS_MNC
                                                                                                                                                                                                                                                  ),
                                                                                                                                                                                                                                                  PX_TACode
                                                                                                                                                                                                                                                  )
                                                                                                                                                                                                                                mw_ng_partial_tai(v_tai.pLMNIdentity, v_tai.tAC)
                                                                                                                                                                                                                              }
                                                                                                                                                                                                            )
                                                                                                                                                                                                        }
+3 −1
Changes for ttcn/LibNGAP/lib_system/LibNGAP_Interface.ttcn: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -85,7 +85,9 @@ module LibNGAP_Interface {

            var NGAP_PDU vc_sendNGAP_PDU ;
            var NGAP_PDU vc_recvNGAP_PDU ;
            var boolean vc_ueContextReleased := false; // true once the UE context is released (UE CONTEXT RELEASE COMPLETE received), false again once a new one is set up (INITIAL CONTEXT SETUP RESPONSE received)
            var boolean vc_ueContextReleased := false;
            var TAI vc_ueTai;                     // TAI of the UE, from the User Location Information of its INITIAL UE MESSAGE (f_await_registration_request)
            var boolean vc_ueTaiKnown := false;   // true once vc_ueTai is set // true once the UE context is released (UE CONTEXT RELEASE COMPLETE received), false again once a new one is set up (INITIAL CONTEXT SETUP RESPONSE received)
            var NasCount_Type vc_previous_nas_count_ul;
            var NasCount_Type vc_previous_nas_count_dl;
            var NG_REGISTRATION_REQUEST vc_registration_request;
Loading