Commit 3be1c84f authored by Yann Garcia's avatar Yann Garcia
Browse files

Validate TC_NGAP_AMF_CMP_01 offline

parent b0060164
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@
		},
		{
			"path": "../../frameworks/CryptoMobile/CryptoMobile"
		},
		{
			"path": "../open5gs"
		}
	],
	"settings": {
+17 −4
Original line number Diff line number Diff line
@@ -12,8 +12,13 @@
module NGAP_Steps {

    // LibNGAP
    import from NGAP_CommonDataTypes language "ASN.1:1997" all;
    import from NGAP_PDU_Descriptions language "ASN.1:1997" all;
    import from NGAP_IEs language "ASN.1:1997" all;

    import from LibNGAP_Steps  all;
    import from LibNGAP_Interface all;
    import from LibNGAP_Templates all;
    import from LibNGAP_Functions all;
    import from LibNGAP_Pixits all;

@@ -133,8 +138,12 @@ module NGAP_Steps {
        /**
         * @desc
         */
        function f_postamble_NGAP_gNB() runs on NGAPComponent {
            f_postambleNGAP_gNB();
        function f_postamble_NGAP_gNB(
                                      in template (value) Cause p_Cause := m_cause_nas(authentication_failure)
                                      ) runs on NGAPComponent {
            if (not(PICS_OFFLINE_MODE)) {
                f_postambleNGAP_gNB(p_Cause);
            }

            //Deactivate defaults
            deactivate;
@@ -143,8 +152,12 @@ module NGAP_Steps {
        /**
         * @desc
         */
        function f_postamble_NGAP_gNB2() runs on NGAPComponent {
            f_postambleNGAP_gNB();
        function f_postamble_NGAP_gNB2(
                                      in template (value) Cause p_Cause := m_cause_nas(authentication_failure)
                                      ) runs on NGAPComponent {
            if (not(PICS_OFFLINE_MODE)) {
                f_postambleNGAP_gNB(p_Cause);
            }

            // Deactivate defaults
            deactivate;
+25 −21
Original line number Diff line number Diff line
@@ -14,10 +14,10 @@ module LibNGAP_Functions {
    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;
    import from LibNGAP_Pixits all;

    // Lib_NG_NAS_Templates
    import from Lib_NG_NAS_Templates all;
@@ -181,7 +181,6 @@ module LibNGAP_Functions {
        log(">>> f_send_registration_request");

        // Send request for REGISTRATION_REQUEST
        // Compute NAS message
        var NG_NAS_UL_Message_Type v_nas_message := valueof(
                                                            m_NG_REGISTRATION_REQUEST(
                                                                                      cs_RegistrationType(tsc_NG_RegistrationInitial, '1'B),
@@ -216,9 +215,13 @@ module LibNGAP_Functions {
                        mw_ngap_initMsg(
                                        mw_n2_initialUeMessage
                        ));
        f_NASPDU_Get(vc_recvNGAP_PDU)
        f_NASPDU_Get(vc_recvNGAP_PDU);
        if (match(vc_recvNgNasUl_Msg, mw_NG_REGISTRATION_REQUEST)) {
            log("Received NG_REGISTRATION_REQUEST NAS message");

            // Extract ID-RAN-UE-NGAP-ID
            vc_RAN_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.InitialUEMessage.protocolIEs[0].value_.rAN_UE_NGAP_ID;
            log("vc_RAN_UE_ID: ", vc_RAN_UE_ID);   
        } else {
            log("*** " & __SCOPE__ & ": FAIL: Unexpected NAS message ***");
            setverdict(fail, "*** " & __SCOPE__ & ": FAIL: Unexpected NAS message ***");
@@ -328,7 +331,7 @@ module LibNGAP_Functions {
                        mw_ngap_initMsg(
                                        mw_n2_DownlinkNASTransport(
                                                                   PX_AMF_UE_NGAP_ID,
                                                                   PX_RAN_UE_NGAP_ID,
                                                                   vc_RAN_UE_ID,
                                                                   ? // AuthorizationRequest
                        )));
        f_NASPDU_Get(vc_recvNGAP_PDU);
@@ -347,7 +350,7 @@ module LibNGAP_Functions {
        }
        log("v_dl_message: ", v_dl_message);

        // Extract ID-RAN-UE-NGAP-ID
        // Extract ID-AMF-UE-NGAP-ID
        vc_AMF_UE_ID := vc_recvNGAP_PDU.initiatingMessage.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID;
        log("vc_AMF_UE_ID: ", vc_AMF_UE_ID);   

@@ -362,7 +365,7 @@ module LibNGAP_Functions {
                        mw_ngap_initMsg(
                                        mw_n2_UplinkNASTransport(
                                                                 vc_AMF_UE_ID,
                                                                 PX_RAN_UE_NGAP_ID
                                                                 vc_RAN_UE_ID
                        )));
        f_NASPDU_Get(vc_recvNGAP_PDU);
        if (f_Check_5GAKA_NAS_UL_Message(
@@ -401,7 +404,7 @@ module LibNGAP_Functions {
                        mw_ngap_initMsg(
                                        mw_n2_DownlinkNASTransport(
                                                                   vc_AMF_UE_ID,
                                                                   PX_RAN_UE_NGAP_ID,
                                                                   vc_RAN_UE_ID,
                                                                   ? // SecurityModeCommand
                        )));
        f_NASPDU_Get(vc_recvNGAP_PDU);
@@ -435,7 +438,7 @@ module LibNGAP_Functions {
                        m_ngap_initMsg(
                                        m_n2_UplinkNASTransport(
                                                                vc_AMF_UE_ID,
                                                                PX_RAN_UE_NGAP_ID,
                                                                vc_RAN_UE_ID,
                                                                vc_sendNAS_PDU,
                                                                m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                                                        m_userLocationInformationNR(
@@ -454,7 +457,7 @@ module LibNGAP_Functions {
                        mw_ngap_initMsg(
                                        mw_n2_DownlinkNASTransport(
                                                                   vc_AMF_UE_ID,
                                                                   PX_RAN_UE_NGAP_ID,
                                                                   vc_RAN_UE_ID,
                                                                   ? // SecurityModeCommand
                        )));
        f_NASPDU_Get(vc_recvNGAP_PDU);
@@ -470,15 +473,15 @@ module LibNGAP_Functions {

        // Await response for SECURITY_MODE_COMPLETE
        f_recv_NGAP_PDU(
                        m_ngap_initMsg(
                                        m_n2_UplinkNASTransport(
                        mw_ngap_initMsg(
                                        mw_n2_UplinkNASTransport(
                                                                vc_AMF_UE_ID,
                                                                PX_RAN_UE_NGAP_ID,
                                                                vc_sendNAS_PDU,
                                                                m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                                                        m_userLocationInformationNR(
                                                                                                                                                    m_nR_CGI,
                                                                                                                                                    m_tAI
                                                                vc_RAN_UE_ID,
                                                                ?,
                                                                mw_uPTransportLayerInformation_userLocationInformationNR(
                                                                                                                         mw_userLocationInformationNR(
                                                                                                                                                      mw_nR_CGI,
                                                                                                                                                      mw_tAI
                        )))));
        f_NASPDU_Get(vc_recvNGAP_PDU);
        if (f_Check_5GAKA_NAS_UL_Message(
@@ -503,7 +506,7 @@ module LibNGAP_Functions {
                        mw_ngap_initMsg(
                                        mw_n2_InitialContextSetupRequest/*_withPDUSessionList*/(
                                                                                                vc_AMF_UE_ID,
                                                                                                PX_RAN_UE_NGAP_ID,
                                                                                                vc_RAN_UE_ID,
                                                                                                mw_gUAMI
                                                                                                (
                                                                                                    PX_PLMN_IDENTITY,
@@ -546,7 +549,7 @@ module LibNGAP_Functions {
                        mw_ngap_initMsg(
                                        mw_n2_InitialContextSetupRequest/*_withPDUSessionList*/(
                                                                                                vc_AMF_UE_ID,
                                                                                                PX_RAN_UE_NGAP_ID,
                                                                                                vc_RAN_UE_ID,
                                                                                                mw_gUAMI
                                                                                                (
                                                                                                    PX_PLMN_IDENTITY,
@@ -658,7 +661,7 @@ module LibNGAP_Functions {
                        m_ngap_initMsg(
                                        m_n2_UplinkNASTransport(
                                                                vc_AMF_UE_ID,
                                                                PX_RAN_UE_NGAP_ID,
                                                                vc_RAN_UE_ID,
                                                                vc_sendNAS_PDU,
                                                                m_uPTransportLayerInformation_userLocationInformationNR(
                                                                                                                        m_userLocationInformationNR(
@@ -858,13 +861,14 @@ module LibNGAP_Functions {
    function f_send_ue_context_release_request_await_ue_context_release_response(
                                                                                 in template (value) Cause p_Cause
                                                                                 ) runs on NGAPComponent {
        log(">>> f_send_ue_context_release_request_await_ue_context_release_response");

        // Send UEContextReleaseRequest
        f_send_NGAP_PDU(
                        m_ngap_initMsg(
                                        m_n2_UEContextReleaseRequest(
                                                                     vc_AMF_UE_ID,
                                                                     PX_RAN_UE_NGAP_ID,
                                                                     vc_RAN_UE_ID,
                                                                     p_Cause
                        )));
        // Await UEContextReleaseComplete
+2 −1
Original line number Diff line number Diff line
@@ -71,7 +71,8 @@ module LibNGAP_Interface {

            // Init of values at component started
            // Note: generation of following MME and ENB UE IDs can be done randomly in init
            var integer vc_AMF_UE_ID         := 10;
            var integer vc_AMF_UE_ID         := PX_AMF_UE_NGAP_ID;
            var integer vc_RAN_UE_ID         := PX_RAN_UE_NGAP_ID;
            var integer vc_gNB_UE_ID         := 11;

            // General timers
+5 −3
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ module LibNGAP_Steps {
    import from LibNGAP_Interface all;
    import from LibNGAP_Pixits all;
    import from LibNGAP_Templates all;
    import from LibNGAP_Functions all;

    /**
     * @desc Common functions description
@@ -234,9 +235,10 @@ module LibNGAP_Steps {
             * @desc 
             * @verdict 
             */
            function f_postambleNGAP_gNB()
            runs on NGAPComponent {
                // Nothing to do
            function f_postambleNGAP_gNB(
                                         in template (value) Cause p_Cause
                                         ) runs on NGAPComponent {
                f_send_ue_context_release_request_await_ue_context_release_response(p_Cause);
            } // End of function f_postambleNGAP_gNB

            /**
Loading