Skip to content
LibItsMgt_Functions.ttcn3 11.5 KiB
Newer Older
garciay's avatar
garciay committed
/**
 *  @author     ETSI / STF422_EETS
 *  @version    $URL:$
 *              $Id:$
garciay's avatar
garciay committed
 *  @desc       ITS station management (ISO 24102-3) functions
garciay's avatar
garciay committed
 */
module LibItsMgt_Functions {
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues {
        const 
            c_uInt8Max;
    };
    import from LibCommon_Sync {
        function
            f_selfOrClientSyncAndVerdict, f_selfOrClientSyncAndVerdictPreamble
    };
    import from LibCommon_VerdictControl all;
    
    // LibIts
    import from CALMiitsscu language "ASN.1:1997" { 
        type 
            PduCounter 
    }; 
    import from CALMllsap language "ASN.1:1997" {
        type 
            MedType, CIaClass, CIclass 
    }; 
garciay's avatar
garciay committed
    import from CALMmanagement language "ASN.1:1997" {
        type 
            ITS_scuId
    };
    import from CALMmsap language "ASN.1:1997" {
        type 
            CommandRef, 
            MN_Request_request, FWTupdate, 
            MF_Request_request 
garciay's avatar
garciay committed
    };
//    import from CALMfsap language "ASN.1:1997" {
//        type
//            GCregServer, GCregClient, GCderegClient, GCctxTxCmd, CTXrxNot
//    };
garciay's avatar
garciay committed
    import from LibItsMgt_Templates all;
    import from LibItsMgt_Pixits all;
reinaortega's avatar
reinaortega committed
    import from LibItsCalm_Interface {
garciay's avatar
garciay committed
        type 
            ItsMgt, 
            MgtMnSapCommandReq 
    group functions {
        
        /**
         * @desc    Triggers a request command event in the test system adaptation.
         * @param   p_requestRequest The remote commad to trigger
         * @return  FncRetCode
         */
            in template (value) MF_Request_request p_requestRequest
        ) runs on ItsMgt return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            mgtMfSapPort.send(m_mgtMfSapRequestReq(p_requestRequest));
        /**
         * @desc    Triggers a request command event in the test system adaptation.
         * @param   p_requestRequest The remote commad to trigger
         * @return  FncRetCode
         */
        function f_mgtMnTriggerRequest(
            in template (value) MN_Request_request p_requestRequest
        ) runs on ItsMgt return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            mgtMnSapPort.send(m_mgtMnSapRequestReq(p_requestRequest));
            
            return v_ret;
        }
        
    } // End of group functions
    
garciay's avatar
garciay committed
    group mgtAltsteps {
        
        group mfSap {
            
            /**
             * @desc The base default.
             * @see ISO/CD 24102-3 Clause 8.2
garciay's avatar
garciay committed
             */
            altstep a_mgtMfSapPortDefault() runs on ItsMgt {
                [] mgtMfSapPort.receive(mw_mgtMfSapCommandReq(mw_mfCommandRequest_any)) { // Receive any MF-COMMAND.request message
                    log("*** a_mgtMfSapPortDefault: INFO: MF-SAP service primitive received in default ***");
garciay's avatar
garciay committed
                    repeat;
                }
                [] mgtMfSapPort.receive(mw_mgtMfSapRequestReq(mw_mfRequestRequest_any)) { // Receive any MF-COMMAND.request message
                    log("*** a_mgtMfSapPortDefault: INFO: MF-SAP service primitive received in default ***");
                    repeat;
                }
                // FIXME Add support of response to CommandRequest & RequestRequest
//                [] mgtMfSapPort.receive(mw_mgtMfSapCommandInd(mw_mfCommandRequest_any)) { // Receive any MF-COMMAND.request message
//                    log("*** a_mgtMfSapPortDefault: INFO: MF-SAP service primitive received in default ***");
garciay's avatar
garciay committed
//                    repeat;
//                }
                [] mgtMfSapPort.receive(mw_mgtMfSapCommandConfirm(mdw_mfCommandConfirm(0))) { // Receive any MF-REQUEST.confirm message with success status
                    log("*** a_mgtMfSapPortDefault: INFO: MF-SAP service primitive received in default ***");
garciay's avatar
garciay committed
                    repeat;
                }
                [] mgtMfSapPort.receive(mw_mgtMfSapCommandConfirm(mdw_mfCommandConfirm(?))) { // Receive any MF-REQUEST.confirm message with error status
                    log("*** a_mgtMfSapPortDefault: INFO: MF-SAP/MF-COMMAND.Confirm error status ***");
garciay's avatar
garciay committed
                    repeat;
                }
                [] mgtMfSapPort.receive(mw_mgtMfSapRequestConfirm(mw_mfRequestConfirm(0))) { // Receive any MF-REQUEST.confirm message with success status
                    log("*** a_mgtMfSapPortDefault: INFO: MF-SAP service primitive received in default ***");
                    repeat;
                }
                [] mgtMfSapPort.receive(mw_mgtMfSapRequestConfirm(mw_mfRequestConfirm(?))) { // Receive any MF-REQUEST.confirm message with error status
                    f_selfOrClientSyncAndVerdict("error", e_error);
                    log("*** a_mgtMfSapPortDefault: ERROR: Received MF-SAP/MF-REQUEST.Confirm error status ***");
                [] mgtMfSapPort.receive { // Receive unknown message
garciay's avatar
garciay committed
                    f_selfOrClientSyncAndVerdict("error", e_error);
                    log("*** a_mgtMfSapPortDefault: ERROR: Event received on MgtMfSapPort port in default ***");
garciay's avatar
garciay committed
                }
            } // End of altstep a_mgtMfSapPortDefault
garciay's avatar
garciay committed
            
        } // End of group mfSap
        
        group mnSap {
            
            /**
             * @desc The base default.
             * @see ISO/CD 24102-3 Clause 8.2
garciay's avatar
garciay committed
             */
            altstep a_mgtMnSapPortDefault() runs on ItsMgt {
                [] mgtMnSapPort.receive(mw_mgtMnSapCommandConfirm(mdw_mnCommandConfirm_any)) { // Receive any MF-COMMAND.confirm message
                    log("*** a_mgtMnSapPortDefault: INFO: MN-SAP service primitive MF-COMMAND.confirm received in default ***");
garciay's avatar
garciay committed
                    repeat;
                }
                [] mgtMnSapPort.receive(mw_mgtMnSapRequestConfirm(mw_mnRequestConfirm_any)) { // Receive any MF-REQUEST.confirm message
                    log("*** a_mgtMnSapPortDefault: INFO: MN-SAP service primitive MF-REQUEST.confirm received in default ***");
garciay's avatar
garciay committed
                    repeat;
                }
                [] mgtMnSapPort.receive(mw_mgtMnSapRequestReq(mw_mnRequestRequest_any)) { // Receive any MF-REQUEST.request message
                    log("*** a_mgtMnSapPortDefault: INFO: MN-SAP service primitive MF-REQUEST.request received in default ***");
garciay's avatar
garciay committed
                    repeat;
                }
                [] mgtMnSapPort.receive { // Receive unknown message
                    log("*** a_mgtMnSapPortDefault: ERROR: event received on MgtMnSapPort port in default ***");
garciay's avatar
garciay committed
                    f_selfOrClientSyncAndVerdict("error", e_error);
                }
            } // End of altstep a_mgtMnSapPortDefault
             * @desc    Wait for MN_COMMAND/FWTupdate message
garciay's avatar
garciay committed
             * @verdict Unchanged
             * @see     ISO/WD 24102-3 - Clause D.2.4 FWTupdate
garciay's avatar
garciay committed
             */
            altstep a_mgtSapAwaitFWTupdate() runs on ItsMgt { 
                var MgtMnSapCommandReq v_fWTupdate;
                [] mgtMnSapPort.receive(mw_mgtMnSapCommandReq(mw_fWTUpdateCommandReq)) -> value v_fWTupdate {
                    log("*** a_mgtSapAwaitFWTupdate: INFO: MN-SAP FWTupdate service primitive received: vc_noFntpFwtEntry=" & int2str(vc_noFntpFwtEntry) & " ***");
garciay's avatar
garciay committed
                }
            } // End of altstep a_mgtSapAwaitFWTupdate
            
            /**
             * @desc    Wait for a notification of creation of an entry in a forwarding table.
             * @see     ISO/WD 24102-3 Clause E.2.2 FWTsetNot
garciay's avatar
garciay committed
             * @verdict Unchanged
             */
            altstep a_mgtAwaitFWTsetNot() runs on ItsMgt {
                
                [] mgtMnSapPort.receive(mw_mgtMnSapRequestReq(mdw_fWTSetNotRequestReq)) {
                    log("*** a_mgtAwaitFWTsetNot: INFO: MN-SAP FWTupdateNot service primitive received ***");
garciay's avatar
garciay committed
                }
            } // End of altstep a_mgtAwaitFWTsetNot
            
            /**
             * @desc    Wait for creation of an entry in a forwarding table.
             * @see     ISO/WD 24102-4 Clause D.2.3 FWTset
             * @verdict Unchanged
             */
            altstep a_mgtAwaitFWTset() runs on ItsMgt {
                
                [] mgtMnSapPort.receive(mw_mgtMnSapCommandReq(mw_fWTSetCommandReq)) {
                    log("*** a_mgtAwaitFWTset: INFO: MN-SAP FWTupdateNot service primitive received ***");
                }
            } // End of altstep a_mgtAwaitFWTset
garciay's avatar
garciay committed
            
        } // End of group mnSap
        
    } // End of group mgtAltsteps
    
    
    group preambule {
        
    } // End of group preambule
    
    group testerFunctions {
        
        /**
         * @desc    Increments the pdu counter and returns the new value
         * @return  The new pdu counter value
         * 
         * @see ISO/WD 24102-4 - Clause 6.2.1
garciay's avatar
garciay committed
         */
        function f_getNextPduCounter() runs on ItsMgt return PduCounter {
            vc_pduCounter := (vc_pduCounter + 2) mod (c_uInt8Max - 1); // ISO/WD 24102-4 - Clause 6.2.1: modulus 254
            return vc_pduCounter;
        } // End of function f_getNextPduCounter
        
        /**
         * @desc    Increments the commandRef value and returns it
         * @return  The new commandRef value
         */
        function f_getNextCommandRef() runs on ItsMgt return CommandRef {
            vc_commandRef := (vc_commandRef + 1) mod (c_uInt8Max + 1);
            return vc_commandRef;
        } // End of function f_getNextCommandRef
        
    } // End of group testerFunctions
    
    group iutFunctions {
        
         * @desc    Get the ITS-SCU-ID of the source ITS-SCU which produces the request
         * @return  The ITS-SCU-ID of the source ITS-SCU which produces the request
         * @see     PX_SRC_ITS_SCU_ID
         */
        function f_getIutSourceItsScuId() return ITS_scuId {
garciay's avatar
garciay committed
            return PX_SRC_ITS_SCU_ID;
        }
        
garciay's avatar
garciay committed
         * @desc    Get the Host ITS-SCU-ID
         * @return  The Host ITS-SCU-ID
         * @see     PX_DST_ITS_SCU_ID
         */
        function f_getIutDestItsScuId() return ITS_scuId {
garciay's avatar
garciay committed
            return PX_DST_ITS_SCU_ID;
        }
        
garciay's avatar
garciay committed
        /**
         * @desc    Get an other ITS-SCU-ID
         * @return  The other ITS-SCU-ID
         * @see     PX_OTHER_ITS_SCU_ID
         */
        function f_getIutOtherItsScuId() return ITS_scuId {
garciay's avatar
garciay committed
            return PX_OTHER_ITS_SCU_ID;
        }
        
garciay's avatar
garciay committed
         * @desc    Get the type of access technology (medium)
         * @return  The type of access technology (medium)
         * @see     PX_MED_TYPE
         */
        function f_getIutMedType() return MedType { 
            return PX_MED_TYPE; 
        }
        
        /**
garciay's avatar
garciay committed
         * @desc    Get the CI access class
         * @return  The CI access class
         * @see     PX_CIACLASS
         */
        function f_getIutCIaClass() return CIaClass { 
            return PX_CIACLASS; 
        }
        
        /**
garciay's avatar
garciay committed
         * @desc    Get the CI access class
         * @return  The CI access class
         * @see     PX_CICLASS
         */
        function f_getIutCIClass() return CIclass { 
            return PX_CICLASS; 
        }
        
garciay's avatar
garciay committed
    } // End of group iutFunctions
    
} // End of module LibItsMgt_Functions