Commit 62c5f0fa authored by Yann Garcia's avatar Yann Garcia
Browse files

Review TC_5GNAS_AMF_AUT_REQ_03

parent 1738e681
Loading
Loading
Loading
Loading
+3 −2
Changes for etc/Ats_NG_NAS/Ats_NG_NAS_AMF_open5gs.cfg_: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ LibNGAP_Pixits.PX_OPEN5GS_BINARY_FILE := "/home/yann/dev/open5gs/build/tests/app

# open5gs AMF: T3522 is 3 s (TS 24.501 default 6 s), TC_5GNAS_AMF_DRG_REQ_02
Lib_NG_NAS_Pixits.PX_T3522                           := 3.0
Lib_NG_NAS_Pixits.PX_T3560                           := 6.0 # open5gs AMF: T3560 is 6 s, 4 retransmissions (TC_5GNAS_AMF_AUT_REQ_03)
# HTTP upper tester (upper_tester_http, config/open5gs.toml): python3.13 -m upper_tester_http --config upper_tester_http/config/open5gs.toml
# The network-initiated de-registrations of TC_5GNAS_AMF_DRG_REQ_01/02/03 (the UDM notifies the AMF)
LibUpperTesterHttp_Pics.PICS_USE_UT_HTTP             := true
@@ -167,11 +168,11 @@ system.utHttpPort.params := "HTTP/TCP(server=127.0.0.1,port=12200,use_ssl=0,debu
#AtsImsIot_TestControl.control

# Verify that the IUT sends an AUTHENTICATION_REQUEST message upon receipt of an initial REGISTRATION_REQUEST containing a SUCI, when no active 5G NAS security context exists
NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_01
#NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_01
# Verify that the IUT sends an AUTHENTICATION_REJECT message upon receipt of an AUTHENTICATION_RESPONSE containing an invalid authentication response value, when the UE was identified with SUCI in the initial NAS message
#NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_02
# Verify that the IUT stops re-sending an AUTHENTICATION_REQUEST message if no AUTHENTICATION_RESPONSE message is received on the fifth expire of timer T3560
#NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_03
NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_03
# Verify that the IUT sends an IDENTITY_REQUEST message correctly upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #20 - MAC failure
#NG_NAS_TestCases.TC_5GNAS_AMF_AUT_REQ_04
# Verify that the IUT sends a new AUTHENTICATION_REQUEST message with new ngKSI value to re-initiate the 5G AKA based primary authentication upon receipt of an AUTHENTICATION_FAILURE message indicating a 5GMM cause value #71 - ngKSI already in use
+1 −0
Changes for test_purposes/NGNAS_Common.tdltx: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ Package NGNAS_Common {
	PIXIT NgapMessage PX_SD_Rejected
	PIXIT NgapMessage PX_DRG_TWAIT
	PIXIT NgapMessage PX_T3522
	PIXIT NgapMessage PX_T3560
	PIXIT NgapMessage PX_T3550
	PIXIT NgapMessage PX_SCHEME_OUTPUT
   
+7 −5
Changes for test_purposes/TP_AMF_NGNAS.tdltx: 7 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -134,14 +134,15 @@ Package TP_AMF_NGNAS {
            
            Configuration: CF_AMF_N2N1
            
            PICS: PICS_NAS_A4_1_2
            
            Initial conditions
            with {
                the UE entity isNotRegisteredToAMF
                and (.) at time point start_initial_T3560 : event AUTHENTICATION_REQUEST occurs
                and (!) 6s after @start_initial_T3560 : event AUTHENTICATION_REQUEST occurs
                and (!) 12s after @start_initial_T3560 : event AUTHENTICATION_REQUEST occurs
                and (!) 18s after @start_initial_T3560 : event AUTHENTICATION_REQUEST occurs
                and (!) PX_T3560 after @start_initial_T3560 : event AUTHENTICATION_REQUEST occurs
                and (!) 2 * PX_T3560 after @start_initial_T3560 : event AUTHENTICATION_REQUEST occurs
                and (!) 3 * PX_T3560 after @start_initial_T3560 : event AUTHENTICATION_REQUEST occurs
            }
            Expected behaviour
                ensure that {
@@ -149,8 +150,9 @@ Package TP_AMF_NGNAS {
                        (.) at time point start_trigger_T3560 : event AUTHENTICATION_REQUEST occurs 
                    }
                    then {
                        (!) 6s after @start_trigger_T3560 : the IUT entity aborts an AUTHENTICATION_REQUEST procedure
                        //(Note 1: "It is not expected to receive another AUTHENTICATION message on the N2N1 interface.")
                        (!) PX_T3560 after @start_trigger_T3560 : the IUT entity aborts an AUTHENTICATION_REQUEST procedure
                        //(Note 1: "No further AUTHENTICATION_REQUEST message is expected on the N2N1 interface. The IUT may end the procedure with an AUTHENTICATION_REJECT and/or release the UE context.")
                        //(Note 2: PX_T3560 is the value of T3560, 6s by default, ETSI TS 124 501 Table 10.2.2.)
                    }
                }
            } // end TP_5GNAS_AMF_AUT_REQ_03
+57 −0
Changes for ttcn/Ats_NG_NAS/NG_NAS_Steps.ttcn: 57 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -126,6 +126,63 @@ module NG_NAS_Steps {
            }
        } // End of function f_NG_NAS_amf_UE_Authentication

        /**
         * @desc   Await an AUTHENTICATION REQUEST of the AMF (plain, RAND and AUTN present) for the UE (vc_RAN_UE_ID), within
         *         p_max seconds and not before p_min seconds (T3560 retransmission). vc_AMF_UE_ID is taken from it.
         *         Any other message is left to a_defaultNGAP.
         * @param  p_min     Earliest reception time, in seconds
         * @param  p_max     Latest reception time, in seconds
         * @param  p_message The AUTHENTICATION REQUEST received
         * @return true if it was received in the window
         */
        function f_NG_NAS_amf_await_AuthenticationRequest(
                                                          in float p_min,
                                                          in float p_max,
                                                          out NG_NAS_DL_Message_Type p_message
                                                          ) runs on aMF_NGNAS_NGAPComponent return boolean {
            var NGAP_PDU v_PDU;
            var float v_elapsed;
            timer t_window := p_max;

            t_window.start;
            alt {
                [] N2_gNBaMF_P.receive(
                                       mw_ngap_initMsg(
                                                       mw_n2_DownlinkNASTransport(
                                                                                  ?,
                                                                                  vc_RAN_UE_ID,
                                                                                  ?
                                       ))) -> value v_PDU {
                    v_elapsed := t_window.read;
                    t_window.stop;
                    f_NGAPPDU_Get(v_PDU);
                    f_NASPDU_Get(vc_recvNGAP_PDU);
                    if (not f_Check_5GAKA_NAS_DL_Message(
                                                         vc_recvNAS_PDU,
                                                         mw_NG_AUTHENTICATION_REQUEST(?, ?, mw_GMM_AuthRAND, mw_GSM_AUTN),
                                                         vc_ng_nas_security_params_type,
                                                         vc_previous_nas_count_dl,
                                                         p_message,
                                                         vc_inner_message
                                                         )) {
                        log("f_NG_NAS_amf_await_AuthenticationRequest: AUTHENTICATION REQUEST expected");
                        return false;
                    }
                    vc_AMF_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID;
                    log("f_NG_NAS_amf_await_AuthenticationRequest: received after ", v_elapsed, " s (window [", p_min, ", ", p_max, "])");
                    if (v_elapsed < p_min) {
                        log("f_NG_NAS_amf_await_AuthenticationRequest: received too early");
                        return false;
                    }
                }
                [] t_window.timeout {
                    log("f_NG_NAS_amf_await_AuthenticationRequest: no AUTHENTICATION REQUEST within ", p_max, " s");
                    return false;
                }
            }
            return true;
        } // End of function f_NG_NAS_amf_await_AuthenticationRequest

        /**
         * @desc   Trigger of TC_5GNAS_AMF_AUT_REQ_02: AUTHENTICATION RESPONSE with a wrong RES* (offline: read from the
         *         capture). The AUTHENTICATION REQUEST was received before (f_await_authentication_request).
+63 −61
Changes for ttcn/Ats_NG_NAS/NG_NAS_TCFunctions.ttcn: 63 added lines, 61 removed lines.
Original line number Diff line number Diff line
@@ -191,98 +191,100 @@ module NG_NAS_TCFunctions {
    
                /**
                 * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_03
                 * @see  TP_5GNAS_AMF_AUT_REQ_03: the AUTHENTICATION REQUEST is never answered. The IUT retransmits it on each
                 *       expiry of T3560 (PX_T3560) four times, then aborts the procedure on the fifth expiry: no further
                 *       AUTHENTICATION REQUEST. An AUTHENTICATION REJECT or a release of the UE context are accepted as the abort.
                 */
                function f_TC_5GNAS_AMF_AUT_REQ_03() runs on aMF_NGNAS_NGAPComponent {
                    // Local variables
                    var NG_NAS_DL_Message_Type v_first;
                    var NG_NAS_DL_Message_Type v_message;
                    var NGAP_PDU v_PDU;
                    var float v_start_time_ms;
                    var float v_max_wait_time_ms := 6.0 * 1000.0 * int2float(PX_TIMER_T3560); // Set a maximum wait time of 6 seconds for the test body to prevent infinite waiting in case of failure
                    var boolean v_released := false;
                    var float v_min := PX_T3560 - PX_T3560_TOLERANCE;
                    var float v_max := PX_T3560 + PX_T3560_TOLERANCE;
                    timer t_observation := PX_T3560 + PX_T3560_TOLERANCE + 1.0;

                    // Preamble
                    // Preamble: NG SETUP, initial REGISTRATION REQUEST, AUTHENTICATION REQUEST and its first three
                    // retransmissions (time points 0, T3560, 2 x T3560 and 3 x T3560 of the TP), none answered
                    f_NGNAS_amf_init();
                    f_NG_NAS_amf_UE_Register();
                    if (not f_NG_NAS_amf_await_AuthenticationRequest(0.0, PX_TNOAC, v_first)) {
                        setverdict(inconc, "*** " & __SCOPE__ & ": INCONC: no AUTHENTICATION REQUEST ***");
                    }
                    for (var integer i := 1; (i <= 3) and (f_getVerdict() == e_success); i := i + 1) {
                        if (not f_NG_NAS_amf_await_AuthenticationRequest(v_min, v_max, v_message)) {
                            setverdict(fail, "*** " & __SCOPE__ & ": FAIL: retransmission " & int2str(i) & " of the AUTHENTICATION REQUEST not received T3560 after the previous one ***");
                        } else if (v_message != v_first) {
                            setverdict(fail, "*** " & __SCOPE__ & ": FAIL: retransmission " & int2str(i) & " differs from the AUTHENTICATION REQUEST (ngKSI, ABBA, RAND or AUTN) ***");
                        }
                    }
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    // Test Body
                    tc_noac.start;
                    v_start_time_ms := int2float(f_getCurrentTimeUtc());
                    // When: the fourth retransmission (fifth AUTHENTICATION REQUEST), 4 x T3560 after the first one
                    if (not f_NG_NAS_amf_await_AuthenticationRequest(v_min, v_max, v_message)) {
                        setverdict(fail, "*** " & __SCOPE__ & ": FAIL: fourth retransmission of the AUTHENTICATION REQUEST not received T3560 after the previous one ***");
                    } else if (v_message != v_first) {
                        setverdict(fail, "*** " & __SCOPE__ & ": FAIL: fourth retransmission differs from the AUTHENTICATION REQUEST ***");
                    } else {
                        // Then: on the fifth expiry of T3560 the procedure is aborted, no further AUTHENTICATION REQUEST
                        t_observation.start;
                        alt {
                            [] N2_gNBaMF_P.receive(
                                                   mw_ngap_initMsg(
                                                                   mw_n2_DownlinkNASTransport(
                                                                                              ?,
                                                                                              vc_RAN_UE_ID,
                                                                                          ? // AuthorizationRequest
                                                                                              ?
                                                   ))) -> value v_PDU {
                            tc_noac.stop;

                            f_NGAPPDU_Get(v_PDU)
                                f_NGAPPDU_Get(v_PDU);
                                f_NASPDU_Get(vc_recvNGAP_PDU);
                            var NG_NAS_DL_Message_Type v_message;
                            if (f_Check_5GAKA_NAS_DL_Message(
                                                             vc_recvNAS_PDU, 
                                                             mw_NG_AUTHENTICATION_REQUEST, 
                                                             vc_ng_nas_security_params_type, 
                                                             vc_previous_nas_count_dl, 
                                                             v_message,
                                                             vc_inner_message
                                                             ) == true) {
                                // Do not reply to trigger T3560 expiry at AMF and verify that no unexpected messages are received after timer expiry
                                if ((int2float(f_getCurrentTimeUtc()) - v_start_time_ms) < v_max_wait_time_ms) {
                                    tc_noac.start;
                                if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, mw_NG_AUTHENTICATION_REQUEST, vc_ng_nas_security_params_type, vc_previous_nas_count_dl, v_message, vc_inner_message)) {
                                    t_observation.stop;
                                    setverdict(fail, "*** " & __SCOPE__ & ": FAIL: AUTHENTICATION REQUEST sent again after the fifth expiry of T3560 ***");
                                } else if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, mw_NG_AUTHENTICATION_REJECT, vc_ng_nas_security_params_type, vc_previous_nas_count_dl, v_message, vc_inner_message)) {
                                    log("*** " & __SCOPE__ & ": INFO: the IUT ends the procedure with an AUTHENTICATION REJECT after ", t_observation.read, " s ***");
                                    repeat;
                                } else {
                                    log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST after T3560 timer expiry ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                    log("*** " & __SCOPE__ & ": INFO: other DOWNLINK NAS TRANSPORT received, ignored ***");
                                    repeat;
                                }
                            }
                            [not v_released] N2_gNBaMF_P.receive(mw_ngap_initMsg_anyProcedure(id_UEContextRelease)) -> value v_PDU {
                                // Received here, before the synchronisation where a_defaultNGAP would discard it
                                f_NGAPPDU_Get(v_PDU);
                                v_released := true;
                                log("*** " & __SCOPE__ & ": INFO: the IUT releases the UE context after ", t_observation.read, " s ***");
                                repeat;
                            }
                        [] N2_gNBaMF_P.receive(
                                               mw_ngap_initMsg(
                                                               mw_n2_DownlinkNASTransport(
                                                                                          ?,
                                                                                          vc_RAN_UE_ID,
                                                                                          ? // AuthorizationRequest
                                                ))) -> value v_PDU {
                            tc_noac.stop;

                            f_NGAPPDU_Get(v_PDU)
                            f_NASPDU_Get(vc_recvNGAP_PDU);
                            var NG_NAS_DL_Message_Type v_message;
                            if (f_Check_5GAKA_NAS_DL_Message(
                                                             vc_recvNAS_PDU, 
                                                             mw_NG_AUTHENTICATION_REJECT, 
                                                             vc_ng_nas_security_params_type, 
                                                             vc_previous_nas_count_dl, 
                                                             v_message,
                                                             vc_inner_message
                                                             ) == true) {
                                // Do not reply to trigger T3560 expiry at AMF and verify that no unexpected messages are received after timer expiry
                                if ((int2float(f_getCurrentTimeUtc()) - v_start_time_ms) < v_max_wait_time_ms) {
                                    log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REJECT before T3560 timer expiration ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                } else {
                            [] t_observation.timeout {
                                log("*** " & __SCOPE__ & ": PASS: no AUTHENTICATION REQUEST after the fifth expiry of T3560 ***");
                                setverdict(pass);
                                    log("*** " & __SCOPE__ & ": PASS: T3560 timer expired and no unexpected messages received. ***");
                                }
                            }
                        }
                        [] N2_gNBaMF_P.receive {
                            tc_noac.stop;
                            setverdict(inconc);
                            log("*** " & __SCOPE__ & ": INCONC: Unexpected message recieved. ***");
                    }
                        [] tc_noac.timeout {
                            if ((int2float(f_getCurrentTimeUtc()) - v_start_time_ms) < v_max_wait_time_ms) {
                                setverdict(inconc);
                                log("*** " & __SCOPE__ & ": FAIL: T3560 shall be expired. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                    // Postamble: release of the UE context
                    if (v_released) {
                        if (PICS_OFFLINE_MODE) {
                            f_recv_NGAP_PDU(mw_ngap_succMsg_anyProcedure(id_UEContextRelease));
                        } else {
                            f_send_NGAP_PDU(
                                            m_ngap_succMsg(
                                                           f_m_n2_UEContextReleaseComplete(
                                                                                           vc_AMF_UE_ID,
                                                                                           vc_RAN_UE_ID
                                            )));
                        }
                    } else if (PICS_OFFLINE_MODE) {
                        f_await_ue_context_release_request_await_ue_context_release_response(m_cause_nas(normal_release));
                    } else {
                        f_send_ue_context_release_request_await_ue_context_release_response(m_cause_nas(normal_release));
                    }
                    } // End of 'alt'statement

                    // Postamble
                    f_postamble_NGAP_AMF();
                    f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
Loading