/**
 *    @author   ETSI / TTF041
 *    @version  $URL$
 *              $Id$
 *    @desc     This module provides test functions for NG_NAS tests.
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
 *    @see      ETSI TS 
 */

module NG_NAS_TCFunctions {

    // LibCommon
    import from LibCommon_Sync all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Time all;

    // Lib_NG_NAS
    import from Lib_NG_NAS_Interface all;
    import from Lib_NG_NAS_Templates all;
    import from LIB_NG_NAS_Functions all;
    import from NAS_CommonTemplates all;

    // NG_NAS
    import from NG_NAS_TypeDefs all;
    import from NG_NAS_TestSystem all;
    import from NG_NAS_Templates all;
    import from NAS_CommonTypeDefs all;
    import from NG_NAS_Templates all;

    // Lib3GPP
    import from NG_NAS_MsgContainers  all;

    // LibNGAP
    import from NGAP_IEs language "ASN.1:2002" all;
    import from NGAP_Constants language "ASN.1:2002" all;
    import from NGAP_PDU_Descriptions language "ASN.1:2002" all;
    import from LibNGAP_Pixits all;
    import from LibNGAP_Templates all;
    import from LibNGAP_Interface all;
    import from LibNGAP_Steps all;

    // LibFramwork
    import from LibHelpers_Functions all;

    // NGAP_Ats
    import from NGAP_Pixits all;
    import from NGAP_Steps all;
    import from Lib_NG_NAS_Pixits all;

    // interface at AMF
    group TP_AMF_NGAP {

        group /*5_4_*/fiveGMM_Common_Procedures {

            group /*5_4_1_*/fiveGMM_Common_ProceduresPrimary_authentication_and_key_agreement_procedure {

                /**
                 * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_01
                 */
                function f_TC_5GNAS_AMF_AUT_REQ_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                    // Local variables

                    // Preamble
                    f_NGAP_gnb_init();
                    f_send_NGSetupRequest_await_NGSetupRespone();
                    f_send_NasRegistrationRequest();
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    // Body
                    f_recv_NGAP_PDU(
                                    mw_ngap_initMsg(
                                                    mw_n2_DownlinkNASTransport(
                                                                               PX_AMF_UE_NGAP_ID,
                                                                               PX_RAN_UE_NGAP_ID,
                                                                               ? // AuthorizationRequest
                    )));
                    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(
                                                                                  '111'B,
                                                                                  -,
                                                                                  ?, // Authentication_parameter_RAND
                                                                                  ?  // Authentication_parameter_AUTN
                                                                                  ),
                                                     v_message
                                                     ) == false) {
                        setverdict(fail);
                        log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST ***");
                    }
                    f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                    // Postamble
                    // Terminate call with rejection
                    f_terminate_NasRegistrationRequest_with_reject();
                    //TODO: f_postamble_NGAP_gNB();
                    f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                } // End of function f_TC_5GNAS_AMF_AUT_REQ_01
    
                /**
                 * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_02
                 */
                function f_TC_5GNAS_AMF_AUT_REQ_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                    // Local variables

                    // Preamble
                    f_NGAP_gnb_init();
                    f_send_NGSetupRequest_await_NGSetupRespone();
                    f_send_NasRegistrationRequest();
                    f_await_NasAuthorizationRequest_send_NasAuthorizationResponse();
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    // Body
                    f_recv_NGAP_PDU(
                                    mw_ngap_initMsg(
                                                    mw_n2_DownlinkNASTransport(
                                                                               PX_AMF_UE_NGAP_ID,
                                                                               PX_RAN_UE_NGAP_ID,
                                                                               ? // SecurityModeCommand
                    )));
                    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_SECURITY_MODE_COMMAND, v_message) == false) {
                        setverdict(fail);
                        log("*** " & __SCOPE__ & ": FAIL: NG_SECURITY_MODE_COMMAND mismatch. ***");
                    }
                    f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                    // Postamble
                    // Terminate call with rejection
                    f_terminate_NasRegistrationRequest_with_reject();
                    //TODO: f_postamble_NGAP_gNB();
                    f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                } // End of function f_TC_5GNAS_AMF_AUT_REQ_02
    
                /**
                 * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_03
                 */
                function f_TC_5GNAS_AMF_AUT_REQ_03() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                    // Local variables
                    var NGAP_PDU v_PDU;
                    var integer v_start_time_ms;

                    // Preamble
                    f_NGAP_gnb_init();
                    f_send_NGSetupRequest_await_NGSetupRespone();
                    f_send_NasRegistrationRequest();
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    // Body
                    tc_noac.start;
                    v_start_time_ms := f_getCurrentTimeUtc(); // FSCOM: TTCN-3 timer are in seconds (ETSI ES 201 873-1 V4.16.1 (2024-10) Clause 12 Declaring timers)
                    alt {
                        [] N2_gNBaMF_P.receive {
                            // Skip message and check that timer T3560 has not expired (in milliseconds)
                            if ((f_getCurrentTimeUtc() - v_start_time_ms) < PX_TIMER_T3560) {
                                repeat;
                            } else {
                                tc_noac.stop;
                            }
                        }
                        [] tc_noac.timeout {
                            setverdict(fail);
                            log("*** " & __SCOPE__ & ": FAIL: T3560 shall be expired. ***");
                        }
                    } // End of 'alt'statement
                    N2_gNBaMF_P.clear; // Remove enqueued messages
                    tc_noac.start;
                    alt {
                        [] N2_gNBaMF_P.receive(
                                               mw_ngap_initMsg(
                                                               mw_n2_DownlinkNASTransport(
                                                                                          PX_AMF_UE_NGAP_ID,
                                                                                          PX_RAN_UE_NGAP_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_REQUEST, v_message) == true) {
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_AUTHENTICATION_REQUEST after T3560 timer expiry ***");
                            }
                        }
                        [] tc_noac.timeout {
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");
                        }
                    } // End of 'alt'statement

                    // Postamble
                    //TODO: f_postamble_NGAP_gNB();
                    f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                } // End of function f_TC_5GNAS_AMF_AUT_REQ_03
    
                /**
                 * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_04
                 */
                function f_TC_5GNAS_AMF_AUT_REQ_04() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                    // Local variables

                    // Preamble
                    f_NGAP_gnb_init();
                    f_send_NGSetupRequest_await_NGSetupRespone();
                    f_send_NasRegistrationRequest();
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    // Body
                    // Send error message
                    vt_NgNasUl_Msg := m_NG_AUTHENTICATION_FAILURE(
                                                                  m_GMM_GSM_Cause(
                                                                                  -,
                                                                                  int2bit(20, 8) // MAC failure
                                                                  ));
                    vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg)));
                    f_send_NGAP_PDU(
                                    m_ngap_initMsg(
                                                    m_n2_UplinkNASTransport(
                                                                            PX_AMF_UE_NGAP_ID,
                                                                            PX_RAN_UE_NGAP_ID,
                                                                            vc_sendNAS_PDU,
                                                                            m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                                                                    m_userLocationInformationNR(
                                                                                                                                                                m_nR_CGI,
                                                                                                                                                                m_tAI
                                    )))));
                    // Await response
                    f_recv_NGAP_PDU(
                                    mw_ngap_initMsg(
                                                    mw_n2_DownlinkNASTransport(
                                                                               PX_AMF_UE_NGAP_ID,
                                                                               PX_RAN_UE_NGAP_ID,
                                                                               ? // IdentityRequest
                    )));
                    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(
                                                                                  '111'B // Identity type
                                                                                  ),
                                                     v_message
                                                     ) == false) {
                        setverdict(fail);
                        log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_IDENTITY_REQUEST ***");
                    }
                    f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                    // Postamble
                    // Terminate call with rejection
                    f_terminate_NasRegistrationRequest_with_reject();
                    //TODO: f_postamble_NGAP_gNB();
                    f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                } // End of function f_TC_5GNAS_AMF_AUT_REQ_04
    
                /**
                 * @desc Testcase function for TC_5GNAS_AMF_AUT_REQ_05
                 */
                function f_TC_5GNAS_AMF_AUT_REQ_05() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                    // Local variables
                    var NG_NAS_DL_Message_Type v_NG_NAS_DL_Message_Type;
                    var NAS_KsiValue ngKSI;

                    // Preamble
                    f_NGAP_gnb_init();
                    f_send_NGSetupRequest_await_NGSetupRespone();
                    f_send_NasRegistrationRequest();
                    f_decode_5G_NAS_DL_Message(vc_recvNAS_PDU, v_NG_NAS_DL_Message_Type);
                    ngKSI := v_NG_NAS_DL_Message_Type.authentication_Request.ngNasKeySetId.nasKeySetId;
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    // Body
                    // Send error message
                    vt_NgNasUl_Msg := m_NG_AUTHENTICATION_FAILURE(
                                                                  m_GMM_GSM_Cause(
                                                                                  -,
                                                                                  int2bit(71, 8) // ngKSI already in use
                                                                  ));
                    vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg)));
                    f_send_NGAP_PDU(
                                    m_ngap_initMsg(
                                                    m_n2_UplinkNASTransport(
                                                                            PX_AMF_UE_NGAP_ID,
                                                                            PX_RAN_UE_NGAP_ID,
                                                                            vc_sendNAS_PDU,
                                                                            m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                                                                    m_userLocationInformationNR(
                                                                                                                                                                m_nR_CGI,
                                                                                                                                                                m_tAI
                                    )))));
                    // Await response
                    f_recv_NGAP_PDU(
                                    mw_ngap_initMsg(
                                                    mw_n2_DownlinkNASTransport(
                                                                               PX_AMF_UE_NGAP_ID,
                                                                               PX_RAN_UE_NGAP_ID,
                                                                               ?
                    )));
                    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(
                                                                                  complement(ngKSI)
                                                                                  ),
                                                     v_message) == false) {
                        setverdict(fail);
                        log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_IDENTITY_REQUEST ***");
                    }
                    f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                    // Postamble
                    // Terminate call with rejection
                    f_terminate_NasRegistrationRequest_with_reject();
                    //TODO: f_postamble_NGAP_gNB();
                    f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                } // End of function f_TC_5GNAS_AMF_AUT_REQ_05
    
                /**
                 * @desc Testcase function for TC_5GNAS_AMF_AUT_ABN_01
                 */
                function f_TC_5GNAS_AMF_AUT_ABN_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                    // Local variables

                    // Preamble
                    f_NGAP_gnb_init();
                    f_send_NGSetupRequest_await_NGSetupRespone();
                    f_send_NasRegistrationRequest();
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    // Body
                    // Send error message
                    vt_NgNasUl_Msg := m_NG_AUTHENTICATION_FAILURE(
                                                                  m_GMM_GSM_Cause(
                                                                                  -,
                                                                                  int2bit(26, 8) // Non-5G authentication unacceptable
                                                                  ));
                    vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg)));
                    f_send_NGAP_PDU(
                                    m_ngap_initMsg(
                                                    m_n2_UplinkNASTransport(
                                                                            PX_AMF_UE_NGAP_ID,
                                                                            PX_RAN_UE_NGAP_ID,
                                                                            vc_sendNAS_PDU,
                                                                            m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                                                                    m_userLocationInformationNR(
                                                                                                                                                                m_nR_CGI,
                                                                                                                                                                m_tAI
                                    )))));
                    // Await IdentityRequest
                    f_recv_NGAP_PDU(
                                    mw_ngap_initMsg(
                                                    mw_n2_DownlinkNASTransport(
                                                                               PX_AMF_UE_NGAP_ID,
                                                                               PX_RAN_UE_NGAP_ID,
                                                                               ? // IdentityRequest
                    )));
                    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_IDENTITY_REQUEST(
                                                                            // TODO
                                                                            ),
                                                     v_message
                                                     ) == false) {
                        setverdict(fail);
                        log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_IDENTITY_REQUEST ***");
                    }
                    f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                    // Postamble
                    // Terminate call with rejection
                    f_terminate_NasRegistrationRequest_with_reject();
                    //TODO: f_postamble_NGAP_gNB();
                    f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                } // End of function f_TC_5GNAS_AMF_AUT_ABN_01
    
            } // End of group /*5_4_1_*/fiveGMM_Common_ProceduresPrimary_authentication_and_key_agreement_procedure

            group /*5_4_2_*/Security_mode_control_procedure {

                /**
                 * @desc Testcase function for TC_NGNAS_AMF_AUT_SEQ_01
                 */
                function f_TC_NGNAS_AMF_AUT_SEQ_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                    // Local variables

                    // Preamble
                    f_NGAP_gnb_init();
                    f_send_NGSetupRequest_await_NGSetupRespone();
                    f_await_NasAuthorizationRequest_send_NasAuthorizationResponse();
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    // Body
                    // Await SecurityModeCommand
                    f_recv_NGAP_PDU(
                                    mw_ngap_initMsg(
                                                    mw_n2_DownlinkNASTransport(
                                                                               PX_AMF_UE_NGAP_ID,
                                                                               PX_RAN_UE_NGAP_ID,
                                                                               ? // Security mode command
                    )));
                    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_SECURITY_MODE_COMMAND,
                                                     v_message
                                                     ) == false) {
                        setverdict(fail);
                        log("*** " & __SCOPE__ & ": FAIL: Unexpected NG_SECURITY_MODE_COMMAND ***");
                    }
                    f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                    // Postamble
                    // Terminate call with rejection
                    f_terminate_NasRegistrationRequest_with_reject();
                    //TODO: f_postamble_NGAP_gNB();
                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                } // End of function f_TC_NGNAS_AMF_AUT_SEQ_01
    
                /**
                * @desc Testcase function for TC_5GNAS_AMF_SEC_ACC_01
                */
                function f_TC_5GNAS_AMF_SEC_ACC_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                    // Local variables

                    // Preamble
                    f_NGAP_gnb_init();
                    f_NGAP_gnb_init();
                    f_send_NGSetupRequest_await_NGSetupRespone();
                    f_await_NasAuthorizationRequest_send_NasAuthorizationResponse();
                    f_await_NasSecurityModeCommand_send_NasSecurityModeComplete();
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    // Body
                    // Await next command (InitialContextSetupRequest) with NAS encrypted payload
                    f_recv_NGAP_PDU(
                                    mw_ngap_initMsg(
                                                    mw_n2_InitialContextSetupRequest_withPDUSessionList(
                                                                                                        PX_AMF_UE_NGAP_ID,
                                                                                                        PX_RAN_UE_NGAP_ID,
                                                                                                        ? // Security mode command
                    )));
                    f_NASPDU_Get(vc_recvNGAP_PDU);
                    if (f_Check_5GAKA_NAS_UL_Message_is_encrypted(vc_recvNAS_PDU) == false) {
                        setverdict(fail);
                        log("*** " & __SCOPE__ & ": FAIL: Message is not encrypted ***");
                    }
                    // FIXME FSCOM Add NAS_PDU message check
                    f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                    // Postamble
                    // Terminate call with rejection
                    f_terminate_NasRegistrationRequest_with_reject();
                    //TODO: f_postamble_NGAP_gNB();
                    f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                } // End of function f_TC_5GNAS_AMF_SEC_ACC_01

                /**
                * @desc Testcase function for TC_5GNAS_AMF_SEC_REJ_01
                */
                function f_TC_5GNAS_AMF_SEC_REJ_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                    // Local variables

                    // Preamble
                    f_NGAP_gnb_init();
                    f_NGAP_gnb_init();
                    f_send_NGSetupRequest_await_NGSetupRespone();
                    f_await_NasAuthorizationRequest_send_NasAuthorizationResponse();
                    f_await_NasSecurityModeCommand();
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    // Body
                    // Send SecurityModeComplete
                    vt_NgNasUl_Msg := m_NG_SECURITY_MODE_REJECT(
                                                                m_GMM_GSM_Cause(
                                                                                -,
                                                                                '00100011'B // FIXME Create const NAS_CauseValue_Type tsc_EmmCause_UESecurityCapabilitiesMismatch;

                                                                ));
                    vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg)));
                    f_send_NGAP_PDU(
                                    m_ngap_initMsg(
                                                    m_n2_UplinkNASTransport(
                                                                            PX_AMF_UE_NGAP_ID,
                                                                            PX_RAN_UE_NGAP_ID, 
                                                                            vc_sendNAS_PDU,
                                                                            m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                                                                    m_userLocationInformationNR(
                                                                                                                                                                m_nR_CGI,
                                                                                                                                                                m_tAI
                                    )))));
                    // FIXME FSCOM How to check the IUT entity sends a DOWNLINK_NAS_TRANSPORT containing to the GNB entity
                    f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                    // Postamble
                    //TODO: f_postamble_NGAP_gNB();
                    f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                } // End of function f_TC_5GNAS_AMF_SEC_REJ_01

            } // End of group /*5_4_2_*/Security_mode_control_procedure

            group /*5_4_5_*/NAS_transport_procedure {

            /**
             * @desc Testcase function for TC_5GNAS_AMF_DLN_ACC_01
             */
            function f_TC_5GNAS_AMF_DLN_ACC_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_send_NGSetupRequest_await_NGSetupRespone();
                f_await_NasAuthorizationRequest_send_NasAuthorizationResponse();
                f_await_NasSecurityModeCommand_send_NasSecurityModeComplete();
                f_await_NGInitialContextSetupRequest_send_NGInitialContextSetupRespone();
                f_send_NGUERadioCApabilityInfoIndication();
                f_await_registration_accept();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                vt_NgNasUl_Msg := m_NG_PDU_SESSION_ESTABLISHMENT_REQUEST(
                                                                         cs_NG_PDU_SessionId,
                                                                         tsc_PTI_1
                                                                         );
                vc_sendNAS_PDU := bit2oct(encvalue(valueof(vt_NgNasUl_Msg)));
                f_send_NGAP_PDU(
                                m_ngap_initMsg(
                                                m_n2_UplinkNASTransport(
                                                                        PX_AMF_UE_NGAP_ID,
                                                                        PX_RAN_UE_NGAP_ID, 
                                                                        vc_sendNAS_PDU,
                                                                        m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                                                                m_userLocationInformationNR(
                                                                                                                                                            m_nR_CGI,
                                                                                                                                                            m_tAI
                                )))));
                // Await PDU SESSION ESTABLISHMENT ACCEPT with NAS encrypted payload
                f_recv_NGAP_PDU(
                                    mw_ngap_initMsg(
                                                    mw_n2_DownlinkNASTransport(
                                                                            PX_AMF_UE_NGAP_ID,
                                                                            PX_RAN_UE_NGAP_ID,
                                                                            ? // PDU SESSION ESTABLISHMENT ACCEPT
                    )));
                    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_PDU_SESSION_ESTABLISHMENT_ACCEPT,
                                                    v_message
                                                    ) == false) {
                        setverdict(fail);
                        return;
                    }

                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                // Postamble
                //TODO: f_postamble_NGAP_gNB();
                f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            } // End of function f_TC_5GNAS_AMF_DLN_ACC_01

            } // End of group /*5__4_5_*/NAS_transport_procedure

        } // End of group /*5_4_*/fiveGMM_Common_Procedures

        group /*5_5_1_2_*/Registration_Procedure_for_initial_registration {
            
            /**
             * @desc Testcase function for TC_5GNAS_AMF_REG_ACC_01
             */
            function f_TC_5GNAS_AMF_REG_ACC_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_send_NGSetupRequest_await_NGSetupRespone();
                f_await_NasAuthorizationRequest_send_NasAuthorizationResponse();
                f_await_NasSecurityModeCommand_send_NasSecurityModeComplete();
                f_send_NGUERadioCApabilityInfoIndication();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                vt_NgNasUl_Msg := 
                    m_NG_REGISTRATION_REQUEST(
                        {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType,
                        '111'B,//in template (value) NAS_KsiValue p_KeySetId,
                        '0'B,//in template (value) B1_Type p_Tsc,
                        m_NG_MobileIdentitySUCI('0000'B,'00f110214300014444330302'O)//in template (value) NG_MobileIdentity p_MobileId,  // 24.501 cl. 9.11.3.4
                        
                        /* in template (omit) NAS_KeySetIdentifier p_NonCurrentKSI := omit,
                        in template (omit) NG_GMM_Cap p_GMM_Cap := omit,
                        in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit,
                        in template (omit) NSSAI p_ReqNSSAI := omit,
                        in template (omit) NG_TrackingAreaId p_TAI := omit,
                        in template (omit) UE_NetworkCap p_UE_NetworkCap := omit,
                        in template (omit) ULDataStatus p_ULDataStatus := omit,
                        in template (omit) PDU_SessionStatus p_PDU_SessionStatus := omit,
                        in template (omit) MICO_Ind p_MICO_Ind := omit,
                        in template (omit) UE_Status p_UE_Status := omit,
                        in template (omit) NG_MobileIdentity p_AddGUTI := omit,
                        in template (omit) AllowedPDU_SessionStatus p_AllowedPDU_SessionStatus := omit,
                        in template (omit) UE_UsageSetting p_UE_UsageSetting := omit,
                        in template (omit) NG_DRXparameter p_DRXparam := omit,
                        in template (omit) EPS_MessageContainer p_EPSMsg := omit,
                        in template (omit) LADN_Ind p_LADN_Ind := omit,
                        in template (omit) PayloadContainerType p_ContainerType := omit, // @sic R5w190113 sic@
                        in template (omit) PayloadContainer p_Payload := omit,
                        in template (omit) NetworkSlicingInd p_NetworkSlicingInd := omit,
                        in template (omit) NG_UpdateType p_NG_UpdateType := omit,
                        in template (omit) MS_Clsmk2 p_MS_Clsmk2 := omit,
                        in template (omit) CodecList p_SupportedCodecs := omit,
                        in template (omit) EPS_BearerContextStatus p_EPS_BearerContextStatus := omit, // @sic R5s190543 sic@
                        in template (omit) NASMessageContainer p_Msg := omit,
                        in template (omit) ExtdDRXParams p_ExtdDRXParams := omit,
                        in template (omit) GPRS_Timer3 p_T3324 := omit,
                        in template (omit) UERadioCapId p_UERadioCapId := omit,
                        in template (omit) MappedNSSAI p_MappedNSSAI := omit,
                        in template (omit) AddInfoRequest p_AddInfoRequest := omit,
                        in template (omit) WUSAssistInfo p_WUSAssistInfo := omit,
                        in template (omit) N5GCInd p_N5GCInd := omit,
                        in template (omit) NB_N1ModeDRXParams p_NB_N1ModeDRXParams := omit,
                        in template (omit) UE_RequestType p_UeRequestType := omit,
                        in template (omit) NG_PagingRestriction p_PagingRestrict := omit,
                        in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit,
                        in template (omit) NID p_NId := omit,
                        in template (omit) PLMN_IdIE p_MSPLMNwDisasterCondition := omit,
                        in template (omit) PEIPS_AssistInfo p_RequestedPEIPS_AssistInfo := omit,
                        in template (omit) GPRS_Timer3 p_T3512 := omit */
                    )

                vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasUl_Msg ));
                f_send_NGAP_PDU(
                    m_ngap_initMsg(
                        m_n2_initialUeMessage(
                            -,
                            vc_sendNAS_PDU,
                            m_uPTransportLayerInformation_userLocationInformationNR(
                                m_userLocationInformationNR(
                                    m_nR_CGI,
                                    m_tAI
                            ))
                    ))
                );
                // Await request for REGISTRATION_ACCEPT
                f_recv_NGAP_PDU(
                                mw_ngap_initMsg(
                                                mw_n2_DownlinkNASTransport(
                                                                        PX_AMF_UE_NGAP_ID,
                                                                        PX_RAN_UE_NGAP_ID,
                                                                        ? // AuthorizationRequest
                )));
                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_REGISTRATION_ACCEPT(
                                                                          -,
                                                                          ?,
                                                                          mw_PLMN_List(
                                                                                       -, -, 
                                                                                       {
                                                                                        *,
                                                                                        PX_PLMN_IDENTITY,
                                                                                        *
                                                                                       }
                                                                          ),
                                                                          -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,
                                                                          ?
                                                                          ),
                                                v_message) == false) {
                    setverdict(fail);
                }
                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                // Postamble
                //TODO: f_postamble_NGAP_gNB();
                f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            } // End of function f_TC_5GNAS_AMF_REG_ACC_01

            /**
             * @desc Testcase function for TC_5GNAS_AMF_REG_ACC_02
             */
            function f_TC_5GNAS_AMF_REG_ACC_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_send_NGSetupRequest_await_NGSetupRespone();
                f_await_NasAuthorizationRequest_send_NasAuthorizationResponse();
                f_await_NasSecurityModeCommand_send_NasSecurityModeComplete();
                f_send_NGUERadioCApabilityInfoIndication();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                vt_NgNasUl_Msg := 
                    m_NG_REGISTRATION_REQUEST(
                        {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType,
                        '111'B,//in template (value) NAS_KsiValue p_KeySetId,
                        '0'B,//in template (value) B1_Type p_Tsc,
                        m_NG_MobileIdentitySUCI('0000'B,'00f110214300014444330302'O)//in template (value) NG_MobileIdentity p_MobileId,  // 24.501 cl. 9.11.3.4
                        
                        /* in template (omit) NAS_KeySetIdentifier p_NonCurrentKSI := omit,
                        in template (omit) NG_GMM_Cap p_GMM_Cap := omit,
                        in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit,
                        in template (omit) NSSAI p_ReqNSSAI := omit,
                        in template (omit) NG_TrackingAreaId p_TAI := omit,
                        in template (omit) UE_NetworkCap p_UE_NetworkCap := omit,
                        in template (omit) ULDataStatus p_ULDataStatus := omit,
                        in template (omit) PDU_SessionStatus p_PDU_SessionStatus := omit,
                        in template (omit) MICO_Ind p_MICO_Ind := omit,
                        in template (omit) UE_Status p_UE_Status := omit,
                        in template (omit) NG_MobileIdentity p_AddGUTI := omit,
                        in template (omit) AllowedPDU_SessionStatus p_AllowedPDU_SessionStatus := omit,
                        in template (omit) UE_UsageSetting p_UE_UsageSetting := omit,
                        in template (omit) NG_DRXparameter p_DRXparam := omit,
                        in template (omit) EPS_MessageContainer p_EPSMsg := omit,
                        in template (omit) LADN_Ind p_LADN_Ind := omit,
                        in template (omit) PayloadContainerType p_ContainerType := omit, // @sic R5w190113 sic@
                        in template (omit) PayloadContainer p_Payload := omit,
                        in template (omit) NetworkSlicingInd p_NetworkSlicingInd := omit,
                        in template (omit) NG_UpdateType p_NG_UpdateType := omit,
                        in template (omit) MS_Clsmk2 p_MS_Clsmk2 := omit,
                        in template (omit) CodecList p_SupportedCodecs := omit,
                        in template (omit) EPS_BearerContextStatus p_EPS_BearerContextStatus := omit, // @sic R5s190543 sic@
                        in template (omit) NASMessageContainer p_Msg := omit,
                        in template (omit) ExtdDRXParams p_ExtdDRXParams := omit,
                        in template (omit) GPRS_Timer3 p_T3324 := omit,
                        in template (omit) UERadioCapId p_UERadioCapId := omit,
                        in template (omit) MappedNSSAI p_MappedNSSAI := omit,
                        in template (omit) AddInfoRequest p_AddInfoRequest := omit,
                        in template (omit) WUSAssistInfo p_WUSAssistInfo := omit,
                        in template (omit) N5GCInd p_N5GCInd := omit,
                        in template (omit) NB_N1ModeDRXParams p_NB_N1ModeDRXParams := omit,
                        in template (omit) UE_RequestType p_UeRequestType := omit,
                        in template (omit) NG_PagingRestriction p_PagingRestrict := omit,
                        in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit,
                        in template (omit) NID p_NId := omit,
                        in template (omit) PLMN_IdIE p_MSPLMNwDisasterCondition := omit,
                        in template (omit) PEIPS_AssistInfo p_RequestedPEIPS_AssistInfo := omit,
                        in template (omit) GPRS_Timer3 p_T3512 := omit */
                    )

                vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasUl_Msg ));
                f_send_NGAP_PDU(
                    m_ngap_initMsg(
                        m_n2_initialUeMessage(
                            -,
                            vc_sendNAS_PDU,
                            m_uPTransportLayerInformation_userLocationInformationNR(
                                m_userLocationInformationNR(
                                    m_nR_CGI,
                                    m_tAI
                            ))
                    ))
                );
                // Await request for REGISTRATION_ACCEPT
                f_recv_NGAP_PDU(
                                mw_ngap_initMsg(
                                                mw_n2_DownlinkNASTransport(
                                                                        PX_AMF_UE_NGAP_ID,
                                                                        PX_RAN_UE_NGAP_ID,
                                                                        ? // AuthorizationRequest
                )));
                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_REGISTRATION_ACCEPT(
                                                                          cs_RegistrationResult('000'B,//B3_Type p_Result,
                                                                                                '0'B,//B1_Type p_SMS,
                                                                                                '0'B,//B1_Type p_EmergencyRegistered,
                                                                                                '0'B,//B1_Type p_NssaaPerformed,
                                                                                                '0'B),//B1_Type p_DisasterRoamingResult),//-,
                                                                          ?,
                                                                          mw_PLMN_List(
                                                                                       -, -, 
                                                                                       {
                                                                                        *,
                                                                                        PX_PLMN,
                                                                                        *
                                                                                       }
                                                                          ),
                                                                          ?/*TAIList*/,-,-,-,-,-,-,-,-,-,-,-,?/*GPRSTimer3512*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,
                                                                          ?
                                                                          ),
                                                v_message) == false) {
                    log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_ACCEPT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    setverdict(fail);
                }

                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                // Postamble
                //TODO: f_postamble_NGAP_gNB();
                f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            } // End of function f_TC_5GNAS_AMF_REG_ACC_02

            /**
             * @desc Testcase function for TC_5GNAS_AMF_REG_ACC_03
             */
            function f_TC_5GNAS_AMF_REG_ACC_03() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_send_NGSetupRequest_await_NGSetupRespone();
                f_await_NasAuthorizationRequest_send_NasAuthorizationResponse();
                f_await_NasSecurityModeCommand_send_NasSecurityModeComplete();
                f_send_NGUERadioCApabilityInfoIndication();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                vt_NgNasUl_Msg := 
                    m_NG_REGISTRATION_REQUEST(
                        {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType,
                        '111'B,//in template (value) NAS_KsiValue p_KeySetId,
                        '0'B,//in template (value) B1_Type p_Tsc,
                        m_NG_MobileIdentitySUCI('0000'B,'00f110214300014444330302'O)//in template (value) NG_MobileIdentity p_MobileId,  // 24.501 cl. 9.11.3.4
                        
                        /* in template (omit) NAS_KeySetIdentifier p_NonCurrentKSI := omit,
                        in template (omit) NG_GMM_Cap p_GMM_Cap := omit,
                        in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit,
                        in template (omit) NSSAI p_ReqNSSAI := omit,
                        in template (omit) NG_TrackingAreaId p_TAI := omit,
                        in template (omit) UE_NetworkCap p_UE_NetworkCap := omit,
                        in template (omit) ULDataStatus p_ULDataStatus := omit,
                        in template (omit) PDU_SessionStatus p_PDU_SessionStatus := omit,
                        in template (omit) MICO_Ind p_MICO_Ind := omit,
                        in template (omit) UE_Status p_UE_Status := omit,
                        in template (omit) NG_MobileIdentity p_AddGUTI := omit,
                        in template (omit) AllowedPDU_SessionStatus p_AllowedPDU_SessionStatus := omit,
                        in template (omit) UE_UsageSetting p_UE_UsageSetting := omit,
                        in template (omit) NG_DRXparameter p_DRXparam := omit,
                        in template (omit) EPS_MessageContainer p_EPSMsg := omit,
                        in template (omit) LADN_Ind p_LADN_Ind := omit,
                        in template (omit) PayloadContainerType p_ContainerType := omit, // @sic R5w190113 sic@
                        in template (omit) PayloadContainer p_Payload := omit,
                        in template (omit) NetworkSlicingInd p_NetworkSlicingInd := omit,
                        in template (omit) NG_UpdateType p_NG_UpdateType := omit,
                        in template (omit) MS_Clsmk2 p_MS_Clsmk2 := omit,
                        in template (omit) CodecList p_SupportedCodecs := omit,
                        in template (omit) EPS_BearerContextStatus p_EPS_BearerContextStatus := omit, // @sic R5s190543 sic@
                        in template (omit) NASMessageContainer p_Msg := omit,
                        in template (omit) ExtdDRXParams p_ExtdDRXParams := omit,
                        in template (omit) GPRS_Timer3 p_T3324 := omit,
                        in template (omit) UERadioCapId p_UERadioCapId := omit,
                        in template (omit) MappedNSSAI p_MappedNSSAI := omit,
                        in template (omit) AddInfoRequest p_AddInfoRequest := omit,
                        in template (omit) WUSAssistInfo p_WUSAssistInfo := omit,
                        in template (omit) N5GCInd p_N5GCInd := omit,
                        in template (omit) NB_N1ModeDRXParams p_NB_N1ModeDRXParams := omit,
                        in template (omit) UE_RequestType p_UeRequestType := omit,
                        in template (omit) NG_PagingRestriction p_PagingRestrict := omit,
                        in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit,
                        in template (omit) NID p_NId := omit,
                        in template (omit) PLMN_IdIE p_MSPLMNwDisasterCondition := omit,
                        in template (omit) PEIPS_AssistInfo p_RequestedPEIPS_AssistInfo := omit,
                        in template (omit) GPRS_Timer3 p_T3512 := omit */
                    )

                vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasUl_Msg ));
                f_send_NGAP_PDU(
                    m_ngap_initMsg(
                        m_n2_initialUeMessage(
                            -,
                            vc_sendNAS_PDU,
                            m_uPTransportLayerInformation_userLocationInformationNR(
                                m_userLocationInformationNR(
                                    m_nR_CGI,
                                    m_tAI
                            ))
                    ))
                );
                // Await request for REGISTRATION_ACCEPT
                f_recv_NGAP_PDU(
                                mw_ngap_initMsg(
                                                mw_n2_DownlinkNASTransport(
                                                                        PX_AMF_UE_NGAP_ID,
                                                                        PX_RAN_UE_NGAP_ID,
                                                                        ? // AuthorizationRequest
                )));
                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_REGISTRATION_ACCEPT(
                                                                          cs_RegistrationResult('000'B,//B3_Type p_Result,
                                                                                                '0'B,//B1_Type p_SMS,
                                                                                                '0'B,//B1_Type p_EmergencyRegistered,
                                                                                                '0'B,//B1_Type p_NssaaPerformed,
                                                                                                '0'B),//B1_Type p_DisasterRoamingResult),//-,
                                                                          ?,
                                                                          mw_PLMN_List(
                                                                                       -, -, 
                                                                                       {
                                                                                        *,
                                                                                        PX_PLMN,
                                                                                        *
                                                                                       }
                                                                          ),
                                                                          ?/*TAIList*/,-,-,-,-,-,-,-,-,-,-,-,?/*GPRSTimer3512*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,
                                                                          ?
                                                                          ),
                                                v_message) == false) {
                    log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_ACCEPT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    setverdict(fail);
                }


                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                // Postamble
                //TODO: f_postamble_NGAP_gNB();
                f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            } // End of function f_TC_5GNAS_AMF_REG_ACC_03

            /**
             * @desc Testcase function for TC_5GNAS_AMF_REG_ACC_04
             */
            function f_TC_5GNAS_AMF_REG_ACC_04() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_send_NGSetupRequest_await_NGSetupRespone();
                f_await_NasAuthorizationRequest_send_NasAuthorizationResponse();
                f_await_NasSecurityModeCommand_send_NasSecurityModeComplete();
                f_send_NGUERadioCApabilityInfoIndication();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                vt_NgNasUl_Msg := 
                    m_NG_REGISTRATION_REQUEST(
                        {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType,
                        '111'B,//in template (value) NAS_KsiValue p_KeySetId,
                        '0'B,//in template (value) B1_Type p_Tsc,
                        m_NG_MobileIdentitySUCI('0000'B,'00f110214300014444330302'O)//in template (value) NG_MobileIdentity p_MobileId,  // 24.501 cl. 9.11.3.4
                        
                        /* in template (omit) NAS_KeySetIdentifier p_NonCurrentKSI := omit,
                        in template (omit) NG_GMM_Cap p_GMM_Cap := omit,
                        in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit,
                        in template (omit) NSSAI p_ReqNSSAI := omit,
                        in template (omit) NG_TrackingAreaId p_TAI := omit,
                        in template (omit) UE_NetworkCap p_UE_NetworkCap := omit,
                        in template (omit) ULDataStatus p_ULDataStatus := omit,
                        in template (omit) PDU_SessionStatus p_PDU_SessionStatus := omit,
                        in template (omit) MICO_Ind p_MICO_Ind := omit,
                        in template (omit) UE_Status p_UE_Status := omit,
                        in template (omit) NG_MobileIdentity p_AddGUTI := omit,
                        in template (omit) AllowedPDU_SessionStatus p_AllowedPDU_SessionStatus := omit,
                        in template (omit) UE_UsageSetting p_UE_UsageSetting := omit,
                        in template (omit) NG_DRXparameter p_DRXparam := omit,
                        in template (omit) EPS_MessageContainer p_EPSMsg := omit,
                        in template (omit) LADN_Ind p_LADN_Ind := omit,
                        in template (omit) PayloadContainerType p_ContainerType := omit, // @sic R5w190113 sic@
                        in template (omit) PayloadContainer p_Payload := omit,
                        in template (omit) NetworkSlicingInd p_NetworkSlicingInd := omit,
                        in template (omit) NG_UpdateType p_NG_UpdateType := omit,
                        in template (omit) MS_Clsmk2 p_MS_Clsmk2 := omit,
                        in template (omit) CodecList p_SupportedCodecs := omit,
                        in template (omit) EPS_BearerContextStatus p_EPS_BearerContextStatus := omit, // @sic R5s190543 sic@
                        in template (omit) NASMessageContainer p_Msg := omit,
                        in template (omit) ExtdDRXParams p_ExtdDRXParams := omit,
                        in template (omit) GPRS_Timer3 p_T3324 := omit,
                        in template (omit) UERadioCapId p_UERadioCapId := omit,
                        in template (omit) MappedNSSAI p_MappedNSSAI := omit,
                        in template (omit) AddInfoRequest p_AddInfoRequest := omit,
                        in template (omit) WUSAssistInfo p_WUSAssistInfo := omit,
                        in template (omit) N5GCInd p_N5GCInd := omit,
                        in template (omit) NB_N1ModeDRXParams p_NB_N1ModeDRXParams := omit,
                        in template (omit) UE_RequestType p_UeRequestType := omit,
                        in template (omit) NG_PagingRestriction p_PagingRestrict := omit,
                        in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit,
                        in template (omit) NID p_NId := omit,
                        in template (omit) PLMN_IdIE p_MSPLMNwDisasterCondition := omit,
                        in template (omit) PEIPS_AssistInfo p_RequestedPEIPS_AssistInfo := omit,
                        in template (omit) GPRS_Timer3 p_T3512 := omit */
                    )

                vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasUl_Msg ));
                f_send_NGAP_PDU(
                    m_ngap_initMsg(
                        m_n2_initialUeMessage(
                            -,
                            vc_sendNAS_PDU,
                            m_uPTransportLayerInformation_userLocationInformationNR(
                                m_userLocationInformationNR(
                                    m_nR_CGI,
                                    m_tAI
                            ))
                    ))
                );
                // Await request for REGISTRATION_ACCEPT
                f_recv_NGAP_PDU(
                                mw_ngap_initMsg(
                                                mw_n2_DownlinkNASTransport(
                                                                        PX_AMF_UE_NGAP_ID,
                                                                        PX_RAN_UE_NGAP_ID,
                                                                        ? // AuthorizationRequest
                )));
                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_REGISTRATION_ACCEPT(
                                                                          -,
                                                                          ?,
                                                                          mw_PLMN_List(
                                                                                       -, -, 
                                                                                       {
                                                                                        *,
                                                                                        PX_PLMN,
                                                                                        *
                                                                                       }
                                                                          ),
                                                                          -,?/*AllowedNSSAI*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,
                                                                          ?
                                                                          ),
                                                v_message) == false) {
                    log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_ACCEPT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    setverdict(fail);
                }

                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                // Postamble
                //TODO: f_postamble_NGAP_gNB();
                f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            } // End of function f_TC_5GNAS_AMF_REG_ACC_04

            /**
             * @desc Testcase function for TC_5GNAS_AMF_REG_ACC_05
             */
            function f_TC_5GNAS_AMF_REG_ACC_05() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_send_NGSetupRequest_await_NGSetupRespone();
                f_await_NasAuthorizationRequest_send_NasAuthorizationResponse();
                f_await_NasSecurityModeCommand_send_NasSecurityModeComplete();
                f_send_NGUERadioCApabilityInfoIndication();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                vt_NgNasUl_Msg := 
                    m_NG_REGISTRATION_REQUEST(
                        {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType,
                        '111'B,//in template (value) NAS_KsiValue p_KeySetId,
                        '0'B,//in template (value) B1_Type p_Tsc,
                        m_NG_MobileIdentitySUCI('0000'B,'00f110214300014444330302'O)//in template (value) NG_MobileIdentity p_MobileId,  // 24.501 cl. 9.11.3.4
                        
                        /* in template (omit) NAS_KeySetIdentifier p_NonCurrentKSI := omit,
                        in template (omit) NG_GMM_Cap p_GMM_Cap := omit,
                        in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit,
                        in template (omit) NSSAI p_ReqNSSAI := omit,
                        in template (omit) NG_TrackingAreaId p_TAI := omit,
                        in template (omit) UE_NetworkCap p_UE_NetworkCap := omit,
                        in template (omit) ULDataStatus p_ULDataStatus := omit,
                        in template (omit) PDU_SessionStatus p_PDU_SessionStatus := omit,
                        in template (omit) MICO_Ind p_MICO_Ind := omit,
                        in template (omit) UE_Status p_UE_Status := omit,
                        in template (omit) NG_MobileIdentity p_AddGUTI := omit,
                        in template (omit) AllowedPDU_SessionStatus p_AllowedPDU_SessionStatus := omit,
                        in template (omit) UE_UsageSetting p_UE_UsageSetting := omit,
                        in template (omit) NG_DRXparameter p_DRXparam := omit,
                        in template (omit) EPS_MessageContainer p_EPSMsg := omit,
                        in template (omit) LADN_Ind p_LADN_Ind := omit,
                        in template (omit) PayloadContainerType p_ContainerType := omit, // @sic R5w190113 sic@
                        in template (omit) PayloadContainer p_Payload := omit,
                        in template (omit) NetworkSlicingInd p_NetworkSlicingInd := omit,
                        in template (omit) NG_UpdateType p_NG_UpdateType := omit,
                        in template (omit) MS_Clsmk2 p_MS_Clsmk2 := omit,
                        in template (omit) CodecList p_SupportedCodecs := omit,
                        in template (omit) EPS_BearerContextStatus p_EPS_BearerContextStatus := omit, // @sic R5s190543 sic@
                        in template (omit) NASMessageContainer p_Msg := omit,
                        in template (omit) ExtdDRXParams p_ExtdDRXParams := omit,
                        in template (omit) GPRS_Timer3 p_T3324 := omit,
                        in template (omit) UERadioCapId p_UERadioCapId := omit,
                        in template (omit) MappedNSSAI p_MappedNSSAI := omit,
                        in template (omit) AddInfoRequest p_AddInfoRequest := omit,
                        in template (omit) WUSAssistInfo p_WUSAssistInfo := omit,
                        in template (omit) N5GCInd p_N5GCInd := omit,
                        in template (omit) NB_N1ModeDRXParams p_NB_N1ModeDRXParams := omit,
                        in template (omit) UE_RequestType p_UeRequestType := omit,
                        in template (omit) NG_PagingRestriction p_PagingRestrict := omit,
                        in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit,
                        in template (omit) NID p_NId := omit,
                        in template (omit) PLMN_IdIE p_MSPLMNwDisasterCondition := omit,
                        in template (omit) PEIPS_AssistInfo p_RequestedPEIPS_AssistInfo := omit,
                        in template (omit) GPRS_Timer3 p_T3512 := omit */
                    )

                vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasUl_Msg ));
                f_send_NGAP_PDU(
                    m_ngap_initMsg(
                        m_n2_initialUeMessage(
                            -,
                            vc_sendNAS_PDU,
                            m_uPTransportLayerInformation_userLocationInformationNR(
                                m_userLocationInformationNR(
                                    m_nR_CGI,
                                    m_tAI
                            ))
                    ))
                );
                // Await request for REGISTRATION_ACCEPT
                f_recv_NGAP_PDU(
                                mw_ngap_initMsg(
                                                mw_n2_DownlinkNASTransport(
                                                                        PX_AMF_UE_NGAP_ID,
                                                                        PX_RAN_UE_NGAP_ID,
                                                                        ? // AuthorizationRequest
                )));
                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_REGISTRATION_ACCEPT(
                                                                          -,
                                                                          ?,
                                                                          mw_PLMN_List(
                                                                                       -, -, 
                                                                                       {
                                                                                        *,
                                                                                        PX_PLMN,
                                                                                        *
                                                                                       }
                                                                          ),
                                                                          -,-,?/*RejectedNSSAI*/,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,
                                                                          ?
                                                                          ),
                                                v_message) == false) {
                    log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_ACCEPT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    setverdict(fail);
                }

                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

                // Postamble
                //TODO: f_postamble_NGAP_gNB();
                f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            } // End of function f_TC_5GNAS_AMF_REG_ACC_05

            /**
             * @desc Testcase function for TP_5GNAS_AMF_REG_REJ_01
             */
            function f_TC_5GNAS_AMF_REG_REJ_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                vt_NgNasUl_Msg := 
                    m_NG_REGISTRATION_REQUEST(
                        {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType,
                        '111'B,//in template (value) NAS_KsiValue p_KeySetId,
                        '0'B,//in template (value) B1_Type p_Tsc,
                        m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT,PX_SUPI_DIGITS)//in template (value) NG_MobileIdentity p_MobileId,  // 24.501 cl. 9.11.3.4
                        
                        /* in template (omit) NAS_KeySetIdentifier p_NonCurrentKSI := omit,
                        in template (omit) NG_GMM_Cap p_GMM_Cap := omit,
                        in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit,
                        in template (omit) NSSAI p_ReqNSSAI := omit,
                        in template (omit) NG_TrackingAreaId p_TAI := omit,
                        in template (omit) UE_NetworkCap p_UE_NetworkCap := omit,
                        in template (omit) ULDataStatus p_ULDataStatus := omit,
                        in template (omit) PDU_SessionStatus p_PDU_SessionStatus := omit,
                        in template (omit) MICO_Ind p_MICO_Ind := omit,
                        in template (omit) UE_Status p_UE_Status := omit,
                        in template (omit) NG_MobileIdentity p_AddGUTI := omit,
                        in template (omit) AllowedPDU_SessionStatus p_AllowedPDU_SessionStatus := omit,
                        in template (omit) UE_UsageSetting p_UE_UsageSetting := omit,
                        in template (omit) NG_DRXparameter p_DRXparam := omit,
                        in template (omit) EPS_MessageContainer p_EPSMsg := omit,
                        in template (omit) LADN_Ind p_LADN_Ind := omit,
                        in template (omit) PayloadContainerType p_ContainerType := omit, // @sic R5w190113 sic@
                        in template (omit) PayloadContainer p_Payload := omit,
                        in template (omit) NetworkSlicingInd p_NetworkSlicingInd := omit,
                        in template (omit) NG_UpdateType p_NG_UpdateType := omit,
                        in template (omit) MS_Clsmk2 p_MS_Clsmk2 := omit,
                        in template (omit) CodecList p_SupportedCodecs := omit,
                        in template (omit) EPS_BearerContextStatus p_EPS_BearerContextStatus := omit, // @sic R5s190543 sic@
                        in template (omit) NASMessageContainer p_Msg := omit,
                        in template (omit) ExtdDRXParams p_ExtdDRXParams := omit,
                        in template (omit) GPRS_Timer3 p_T3324 := omit,
                        in template (omit) UERadioCapId p_UERadioCapId := omit,
                        in template (omit) MappedNSSAI p_MappedNSSAI := omit,
                        in template (omit) AddInfoRequest p_AddInfoRequest := omit,
                        in template (omit) WUSAssistInfo p_WUSAssistInfo := omit,
                        in template (omit) N5GCInd p_N5GCInd := omit,
                        in template (omit) NB_N1ModeDRXParams p_NB_N1ModeDRXParams := omit,
                        in template (omit) UE_RequestType p_UeRequestType := omit,
                        in template (omit) NG_PagingRestriction p_PagingRestrict := omit,
                        in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit,
                        in template (omit) NID p_NId := omit,
                        in template (omit) PLMN_IdIE p_MSPLMNwDisasterCondition := omit,
                        in template (omit) PEIPS_AssistInfo p_RequestedPEIPS_AssistInfo := omit,
                        in template (omit) GPRS_Timer3 p_T3512 := omit */
                    )

                vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasUl_Msg ));
                var bitstring s := encvalue( vt_NgNasUl_Msg );
                //int i := decvalue(encvalue( vt_NgNasUl_Msg),vt_NgNasUl_Msg);
                log(vt_NgNasUl_Msg);
                log(vc_sendNAS_PDU);
                var NG_NAS_UL_Message_Type rec;
                var integer i;
                i := decvalue(s,rec);
                log(i);
                log(rec);

                f_send_NGAP_PDU(
                    m_ngap_initMsg(
                        m_n2_initialUeMessage(
                            -,
                            vc_sendNAS_PDU,
                            m_uPTransportLayerInformation_userLocationInformationNR(
                                m_userLocationInformationNR(
                                    m_nR_CGI,
                                    m_tAI
                            ))
                    ))
                );

                f_recv_NGAP_PDU(
                    mw_ngap_initMsg(
                        mw_n2_DownlinkNASTransport(
                            PX_AMF_UE_NGAP_ID,
                            PX_RAN_UE_NGAP_ID,
                            ?//template (present) NAS_PDU p_nasPdu := ?
                    ))
                );

                f_NASPDU_Get(vc_recvNGAP_PDU);
                if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU,
                                                 mw_NG_REGISTRATION_REJECT(
                                                        cr_GMM_GSM_Cause(*,'00010110'B),//tsc_NR5GCCause_Congestion //template (present) GMM_GSM_Cause p_Cause := ?,
                                                        ?//template GPRS_Timer2 p_T3346 := *
                                                        /*template GPRS_Timer2 p_T3502 := *,
                                                        template EAP_Message p_EAP := *,
                                                        template RejectedNSSAI p_RejectedNSSAI := *,
                                                        template CAGInfoList p_CAGInfoList := *,
                                                        template ExtdRejectedNSSAI p_ExtdRejectedNSSAI := *,
                                                        template RegistrationWaitRange p_DisasterReturnWaitRange := *,
                                                        template ExtdCAGInfoList p_ExtdCAGInfoList := *,
                                                        template GPRS_Timer3 p_LowerBoundTimerValue := *,
                                                        template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *,
                                                        template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := **/
                                                 )) == false) {

                    log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_REJECT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }

                log(vc_recvNGAP_PDU);
                f_NASPDU_Get(vc_recvNGAP_PDU);
                s := oct2bit(vc_recvNAS_PDU);
                log(s);
                var NG_NAS_DL_Message_Type recdl;
                var integer ir;
                ir := decvalue(s,recdl);
                log(ir);
                log(recdl);

                 vt_NgNasDl_Msg := 
                    m_NG_REGISTRATION_REJECT(
                                                cs_GMM_GSM_Cause(omit,
                                                  '00001101'B/*;tsc_Cause_Roaming_NotAllowed*/)
                                                /*in template (omit) GPRS_Timer2 p_T3346 := omit,
                                                in template (omit) GPRS_Timer2 p_T3502 := omit,
                                                in template (omit) EAP_Message p_EAP := omit,
                                                in template (omit) RejectedNSSAI p_RejectedNSSAI := omit,
                                                in template (omit) CAGInfoList p_CAGInfoList := omit,
                                                in template (omit) ExtdRejectedNSSAI p_ExtdRejectedNSSAI := omit,
                                                in template (omit) RegistrationWaitRange p_DisasterReturnWaitRange := omit,
                                                in template (omit) ExtdCAGInfoList p_ExtdCAGInfoList := omit,
                                                in template (omit) GPRS_Timer3 p_LowerBoundTimerValue := omit,
                                                in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_Roaming := omit,
                                                in template (omit) NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := omit
                                        */);
                 vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasDl_Msg ));
                s := encvalue( vt_NgNasDl_Msg );
                //int i := decvalue(encvalue( vt_NgNasUl_Msg),vt_NgNasUl_Msg);
                log(vt_NgNasDl_Msg);
                log(vc_sendNAS_PDU);
                var NG_NAS_DL_Message_Type recdl1;
                
                i := decvalue(s,recdl1);
                log(i);
                log(recdl1);


                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

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

            } // End of function f_TC_5GNAS_AMF_REG_REJ_01

            /**
             * @desc Testcase function for TP_5GNAS_AMF_REG_REJ_02
             */
            function f_TC_5GNAS_AMF_REG_REJ_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                vt_NgNasUl_Msg := 
                    m_NG_REGISTRATION_REQUEST(
                            {'1'B,'001'B},//in template (value) RegistrationType p_RegistrationType,
                            '111'B,//in template (value) NAS_KsiValue p_KeySetId,
                            '0'B,//in template (value) B1_Type p_Tsc,
                            m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT,PX_SUPI_DIGITS),//in template (value) NG_MobileIdentity p_MobileId,
                            
                            omit, // in template (omit) NAS_KeySetIdentifier p_NonCurrentKSI := omit,
                            omit, // in template (omit) NG_GMM_Cap p_GMM_Cap := omit,
                            omit //in template (omit) NG_UE_SecurityCapability p_UESecurityCap := omit,
                            //in template (omit) NSSAI p_ReqNSSAI := omit,
                            /*in template (omit) NG_TrackingAreaId p_TAI := omit,
                            in template (omit) UE_NetworkCap p_UE_NetworkCap := omit,
                            in template (omit) ULDataStatus p_ULDataStatus := omit,
                            in template (omit) PDU_SessionStatus p_PDU_SessionStatus := omit,
                            in template (omit) MICO_Ind p_MICO_Ind := omit,
                            in template (omit) UE_Status p_UE_Status := omit,
                            in template (omit) NG_MobileIdentity p_AddGUTI := omit,
                            in template (omit) AllowedPDU_SessionStatus p_AllowedPDU_SessionStatus := omit,
                            in template (omit) UE_UsageSetting p_UE_UsageSetting := omit,
                            in template (omit) NG_DRXparameter p_DRXparam := omit,
                            in template (omit) EPS_MessageContainer p_EPSMsg := omit,
                            in template (omit) LADN_Ind p_LADN_Ind := omit,
                            in template (omit) PayloadContainerType p_ContainerType := omit, // @sic R5w190113 sic@
                            in template (omit) PayloadContainer p_Payload := omit,
                            in template (omit) NetworkSlicingInd p_NetworkSlicingInd := omit,
                            in template (omit) NG_UpdateType p_NG_UpdateType := omit,
                            in template (omit) MS_Clsmk2 p_MS_Clsmk2 := omit,
                            in template (omit) CodecList p_SupportedCodecs := omit,
                            in template (omit) EPS_BearerContextStatus p_EPS_BearerContextStatus := omit, // @sic R5s190543 sic@
                            in template (omit) NASMessageContainer p_Msg := omit,
                            in template (omit) ExtdDRXParams p_ExtdDRXParams := omit,
                            in template (omit) GPRS_Timer3 p_T3324 := omit,
                            in template (omit) UERadioCapId p_UERadioCapId := omit,
                            in template (omit) MappedNSSAI p_MappedNSSAI := omit,
                            in template (omit) AddInfoRequest p_AddInfoRequest := omit,
                            in template (omit) WUSAssistInfo p_WUSAssistInfo := omit,
                            in template (omit) N5GCInd p_N5GCInd := omit,
                            in template (omit) NB_N1ModeDRXParams p_NB_N1ModeDRXParams := omit,
                            in template (omit) UE_RequestType p_UeRequestType := omit,
                            in template (omit) NG_PagingRestriction p_PagingRestrict := omit,
                            in template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit,
                            in template (omit) NID p_NId := omit,
                            in template (omit) PLMN_IdIE p_MSPLMNwDisasterCondition := omit,
                            in template (omit) PEIPS_AssistInfo p_RequestedPEIPS_AssistInfo := omit,
                            in template (omit) GPRS_Timer3 p_T3512 := omit */
                    )

                //vc_sendNAS_PDU := bit2oct(encvalue( vt_NgNasUl_Msg ));
                f_send_NGAP_PDU(
                    m_ngap_initMsg(
                        m_n2_initialUeMessage(
                            -,
                            bit2oct(encvalue( vt_NgNasUl_Msg )),//vc_sendNAS_PDU
                            m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                    m_userLocationInformationNR(
                                                                                        m_nR_CGI,
                                                                                        m_tAI
                                                                                    ))
                    ))
                );

                f_recv_NGAP_PDU(
                    mw_ngap_initMsg(
                        mw_n2_DownlinkNASTransport(
                            PX_AMF_UE_NGAP_ID,
                            PX_RAN_UE_NGAP_ID,
                            ?//template (present) NAS_PDU p_nasPdu := ?
                    ))
                );

                f_NASPDU_Get(vc_recvNGAP_PDU);
                if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, 
                                                 mw_NG_REGISTRATION_REJECT(
                                                        cr_GMM_GSM_Cause(*,'00111110'B)//tsc_Cause_NoNetworkSlices_Available //template (present) GMM_GSM_Cause p_Cause := ?,
                                                        /*template GPRS_Timer2 p_T3346 := *
                                                        template GPRS_Timer2 p_T3502 := *,
                                                        template EAP_Message p_EAP := *,
                                                        template RejectedNSSAI p_RejectedNSSAI := *,
                                                        template CAGInfoList p_CAGInfoList := *,
                                                        template ExtdRejectedNSSAI p_ExtdRejectedNSSAI := *,
                                                        template RegistrationWaitRange p_DisasterReturnWaitRange := *,
                                                        template ExtdCAGInfoList p_ExtdCAGInfoList := *,
                                                        template GPRS_Timer3 p_LowerBoundTimerValue := *,
                                                        template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *,
                                                        template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := **/
                                                 )) == false) {

                    log("*** " & __SCOPE__ & ": FAIL: NG_REGISTRATION_REJECT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }

                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

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

            } // End of function f_TC_5GNAS_AMF_REG_REJ_02

        } // End of group /*5_5_1_2_*/Registration_Procedure_for_initial_registration

        group /*5_5_2_2_3*/UE_initiated_de_registration_procedure_completion {

            /**
             * @desc Testcase function for TC_5GNAS_AMF_DRG_ACC_01
             */
            function f_TC_5GNAS_AMF_DRG_ACC_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                vt_NgNasUl_Msg := 
                    m_NG_DEREGISTRATION_REQUEST_MO(
                        crs_DeregisterType ('0'B,//B1_Type p_SwitchOff,
                                            '0'B,//B1_Type p_ReReg,
                                            '01'B//B2_Type p_Access := '01'B),//in template (value) DeregisterType p_DeregisterType,
                        ),
                        cs_NAS_KeySetIdentifier_lv('111'B,'1'B),//in template (value) NAS_KeySetIdentifier p_KSI,
                        m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT,PX_SUPI_DIGITS)//in template (value) NG_MobileIdentity p_MobileId,                            
                    );
                 f_send_NGAP_PDU(
                    m_ngap_initMsg(
                        m_n2_initialUeMessage(
                            -,
                            bit2oct(encvalue( vt_NgNasUl_Msg )),//vc_sendNAS_PDU
                            m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                    m_userLocationInformationNR(
                                                                                        m_nR_CGI,
                                                                                        m_tAI
                                                                                    ))
                    ))
                );

                f_recv_NGAP_PDU(
                    mw_ngap_initMsg(
                        mw_n2_DownlinkNASTransport(
                            PX_AMF_UE_NGAP_ID,
                            PX_RAN_UE_NGAP_ID,
                            ?//template (present) NAS_PDU p_nasPdu := ?
                    ))
                );

                f_NASPDU_Get(vc_recvNGAP_PDU);
                if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, 
                                                 mw_NG_DEREGISTRATION_ACCEPT_MO
                                                 ) == false) {

                    log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_ACCEPT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }

                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

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

            } // End of function f_TC_5GNAS_AMF_DRG_ACC_01

            /**
             * @desc Testcase function for TC_5GNAS_AMF_DRG_ACC_02
             */
            function f_TC_5GNAS_AMF_DRG_ACC_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                vt_NgNasUl_Msg := 
                    m_NG_DEREGISTRATION_REQUEST_MO(
                        crs_DeregisterType ('1'B,//B1_Type p_SwitchOff,
                                            '0'B,//B1_Type p_ReReg,
                                            '01'B//B2_Type p_Access := '01'B),//in template (value) DeregisterType p_DeregisterType,
                        ),
                        cs_NAS_KeySetIdentifier_lv('111'B,'1'B),//in template (value) NAS_KeySetIdentifier p_KSI,
                        m_NG_MobileIdentitySUCI(PX_SUPI_FORMAT,PX_SUPI_DIGITS)//in template (value) NG_MobileIdentity p_MobileId,                            
                    );
                 f_send_NGAP_PDU(
                    m_ngap_initMsg(
                        m_n2_initialUeMessage(
                            -,
                            bit2oct(encvalue( vt_NgNasUl_Msg )),//vc_sendNAS_PDU
                            m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                    m_userLocationInformationNR(
                                                                                        m_nR_CGI,
                                                                                        m_tAI
                                                                                    ))
                    ))
                );

                f_recv_NGAP_PDU(
                    mw_ngap_initMsg(
                        mw_n2_DownlinkNASTransport(
                            PX_AMF_UE_NGAP_ID,
                            PX_RAN_UE_NGAP_ID,
                            ?//template (present) NAS_PDU p_nasPdu := ?
                    ))
                );

                f_NASPDU_Get(vc_recvNGAP_PDU);
                if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, 
                                                 mw_NG_DEREGISTRATION_ACCEPT_MO
                                                 ) == false) {

                    log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_ACCEPT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }

                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

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

            } // End of function f_TC_5GNAS_AMF_DRG_ACC_02

        } // End of group /*5_5_2_2_3*/UE_initiated_de_registration_procedure_completion

        group /*5_5_2_3_1*/Network_initiated_de_registration_procedure_initiation {

            /**
             * @desc Testcase function for TC_5GNAS_AMF_DRG_REQ_01
             */
            function f_TC_5GNAS_AMF_DRG_REQ_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                //USER REGISTRATION
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                f_recv_NGAP_PDU(
                    mw_ngap_initMsg(
                        mw_n2_DownlinkNASTransport(
                            PX_AMF_UE_NGAP_ID,
                            PX_RAN_UE_NGAP_ID,
                            ?//template (present) NAS_PDU p_nasPdu := ?
                    ))
                );

                f_NASPDU_Get(vc_recvNGAP_PDU);
                if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, 
                                                 mw_NG_DEREGISTRATION_REQUEST_MT(
                                                    crs_DeregisterType ('0'B,//B1_Type p_SwitchOff,
                                                                        '0'B,//B1_Type p_ReReg,
                                                                        '01'B//B2_Type p_Access := '01'B),//in template (value) DeregisterType p_DeregisterType,
                                                    )//template (present) DeregisterType p_Type := ?,
                                                    //template GMM_GSM_Cause p_Cause := *,
                                                    //template GPRS_Timer2 p_T3346 := *,
                                                    //template RejectedNSSAI p_RejectedNSSAI := *,
                                                    //template CAGInfoList p_CAGInfoList := *,
                                                    //template ExtdRejectedNSSAI p_ExtdRejectedNSSAI := *,
                                                    //template RegistrationWaitRange p_DisasterReturnWaitRange := *,
                                                    //template ExtdCAGInfoList p_ExtdCAGInfoList := *,
                                                    //template GPRS_Timer3 p_LowerBoundTimerValue := *,
                                                    //template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *,
                                                    //template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := *
                                                 )) == false) {

                    log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_REQUEST_MT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

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

            } // End of function f_TC_5GNAS_AMF_DRG_REQ_01

            /**
             * @desc Testcase function for TC_5GNAS_AMF_DRG_REQ_02
             */
            function f_TC_5GNAS_AMF_DRG_REQ_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                f_recv_NGAP_PDU(
                    mw_ngap_initMsg(
                        mw_n2_DownlinkNASTransport(
                            PX_AMF_UE_NGAP_ID,
                            PX_RAN_UE_NGAP_ID,
                            ?//template (present) NAS_PDU p_nasPdu := ?
                    ))
                );

                f_NASPDU_Get(vc_recvNGAP_PDU);
                if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, 
                                                 mw_NG_DEREGISTRATION_REQUEST_MT(
                                                    //template (present) DeregisterType p_Type := ?,
                                                    //template GMM_GSM_Cause p_Cause := *,
                                                    //template GPRS_Timer2 p_T3346 := *,
                                                    //template RejectedNSSAI p_RejectedNSSAI := *,
                                                    //template CAGInfoList p_CAGInfoList := *,
                                                    //template ExtdRejectedNSSAI p_ExtdRejectedNSSAI := *,
                                                    //template RegistrationWaitRange p_DisasterReturnWaitRange := *,
                                                    //template ExtdCAGInfoList p_ExtdCAGInfoList := *,
                                                    //template GPRS_Timer3 p_LowerBoundTimerValue := *,
                                                    //template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *,
                                                    //template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := *
                                                 )) == false) {

                    log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_REQUEST_MT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                //Not sent sesponse and again wait for deregistration_request
                f_recv_NGAP_PDU(
                    mw_ngap_initMsg(
                        mw_n2_DownlinkNASTransport(
                            PX_AMF_UE_NGAP_ID,
                            PX_RAN_UE_NGAP_ID,
                            ?//template (present) NAS_PDU p_nasPdu := ?
                    ))
                );

                f_NASPDU_Get(vc_recvNGAP_PDU);
                if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, 
                                                 mw_NG_DEREGISTRATION_REQUEST_MT(
                                                    crs_DeregisterType ('0'B,//B1_Type p_SwitchOff,
                                                                        '0'B,//B1_Type p_ReReg,
                                                                        '01'B//B2_Type p_Access := '01'B),//in template (value) DeregisterType p_DeregisterType,
                                                    )//template (present) DeregisterType p_Type := ?,
                                                    //template GMM_GSM_Cause p_Cause := *,
                                                    //template GPRS_Timer2 p_T3346 := *,
                                                    //template RejectedNSSAI p_RejectedNSSAI := *,
                                                    //template CAGInfoList p_CAGInfoList := *,
                                                    //template ExtdRejectedNSSAI p_ExtdRejectedNSSAI := *,
                                                    //template RegistrationWaitRange p_DisasterReturnWaitRange := *,
                                                    //template ExtdCAGInfoList p_ExtdCAGInfoList := *,
                                                    //template GPRS_Timer3 p_LowerBoundTimerValue := *,
                                                    //template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *,
                                                    //template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := *
                                                 )) == false) {

                    log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_REQUEST_MT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

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

            } // End of function f_TC_5GNAS_AMF_DRG_REQ_02

            /**
             * @desc Testcase function for TC_5GNAS_AMF_DRG_REQ_03
             */
            function f_TC_5GNAS_AMF_DRG_REQ_03() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
                // Local variables

                // Preamble
                f_NGAP_gnb_init();
                f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                // Body
                f_recv_NGAP_PDU(
                    mw_ngap_initMsg(
                        mw_n2_DownlinkNASTransport(
                            PX_AMF_UE_NGAP_ID,
                            PX_RAN_UE_NGAP_ID,
                            ?//template (present) NAS_PDU p_nasPdu := ?
                    ))
                );

                f_NASPDU_Get(vc_recvNGAP_PDU);
                if (f_Check_5GAKA_NAS_DL_Message(vc_recvNAS_PDU, 
                                                 mw_NG_DEREGISTRATION_REQUEST_MT(
                                                    crs_DeregisterType ('0'B,//B1_Type p_SwitchOff,
                                                                        '1'B,//B1_Type p_ReReg,
                                                                        '01'B//B2_Type p_Access := '01'B),//in template (value) DeregisterType p_DeregisterType,
                                                    )//template (present) DeregisterType p_Type := ?,
                                                    //template GMM_GSM_Cause p_Cause := *,
                                                    //template GPRS_Timer2 p_T3346 := *,
                                                    //template RejectedNSSAI p_RejectedNSSAI := *,
                                                    //template CAGInfoList p_CAGInfoList := *,
                                                    //template ExtdRejectedNSSAI p_ExtdRejectedNSSAI := *,
                                                    //template RegistrationWaitRange p_DisasterReturnWaitRange := *,
                                                    //template ExtdCAGInfoList p_ExtdCAGInfoList := *,
                                                    //template GPRS_Timer3 p_LowerBoundTimerValue := *,
                                                    //template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *,
                                                    //template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := *
                                                 )) == false) {

                    log("*** " & __SCOPE__ & ": FAIL: NG_DEREGISTRATION_REQUEST_MT mismatch. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
                log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

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

            } // End of function f_TC_5GNAS_AMF_DRG_REQ_03

        } // End of group /*5_5_2_3_1*/Network_initiated_de_registration_procedure_initiation










    } // End of group TP_AMF_NGAP

    group TC_AMF_NGAP {

        /**
         * @desc Testcase function for TC_5GAP_ICS_01
         */
        function f_TC_5GAP_ICS_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
            // Local variables

            // Preamble
            f_NGAP_gnb_init();
            f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

            // Body
            // TODO

            f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

            // Postamble
            //TODO: f_postamble_NGAP_gNB();
            f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
        } // End of function f_TC_5GAP_ICS_01

        /**
         * @desc Testcase function for TC_5GAP_ICS_02
         */
        function f_TC_5GAP_ICS_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
            // Local variables

            // Preamble
            f_NGAP_gnb_init();
            f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

            // Body
            // TODO

            f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

            // Postamble
            //TODO: f_postamble_NGAP_gNB();
            f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
        } // End of function f_TC_5GAP_ICS_02

        /**
         * @desc Testcase function for TC_5GAP_DNA_01
         */
        function f_TC_5GAP_DNA_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
            // Local variables

            // Preamble
            f_NGAP_gnb_init();
            f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

            // Body
            // TODO

            f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

            // Postamble
            //TODO: f_postamble_NGAP_gNB();
            f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
        } // End of function f_TC_5GAP_DNA_01

        /**
         * @desc Testcase function for TC_5GAP_DNA_02
         */
        function f_TC_5GAP_DNA_02() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
            // Local variables

            // Preamble
            f_NGAP_gnb_init();
            f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

            // Body
            // TODO

            f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

            // Postamble
            //TODO: f_postamble_NGAP_gNB();
            f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
        } // End of function f_TC_5GAP_DNA_02

        /**
         * @desc Testcase function for TC_5GAP_PDU_01
         */
        function f_TC_5GAP_PDU_01() runs on NGNASComponent /*gNB_NGNAS_NGAPComponent*/ {
            // Local variables

            // Preamble
            f_NGAP_gnb_init();
            f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

            // Body
            // TODO

            f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Testbody done. ***");

            // Postamble
            //TODO: f_postamble_NGAP_gNB();
            f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
        } // End of function f_TC_5GAP_PDU_01

    } // End of group TC_AMF_NGAP

} // End of module NG_NAS_TCFunctions
