LibItsFsap_Functions.ttcn3 15.8 KB
Newer Older
garciay's avatar
garciay committed
/**
 *  @author     ETSI / STF422_EETS
 *  @version    $URL:$
 *              $Id:$
 *  @desc       Fast service advertisement protocol (ISO 24102-5) functions
 */
module LibItsFsap_Functions {
    
    // Libcommon
    import from LibCommon_Sync all;
    import from LibCommon_Time {
        function f_sleepIgnoreDef
    };
    
    // LibIts
    import from CITSapplMgmtApplReg language "ASN.1:1997" {
        type ITSaid 
    };
    import from CALMllsap language "ASN.1:1997" { 
        type EUI64 
    }; 
garciay's avatar
garciay committed
    import from CALMmanagement language "ASN.1:1997" {
        type
garciay's avatar
garciay committed
    };
    import from CALMiitsscu language "ASN.1:1997" {
        type 
            ITS_SCUtype 
    };
garciay's avatar
garciay committed
    import from CALMfsap language "ASN.1:1997" {
        type
            GCschedule, ServiceDataReg, ServiceList 
garciay's avatar
garciay committed
    };
    import from CALMmsap language "ASN.1:1997" {
        type CommandRef
    };
    import from LibItsMgt_Templates all;
    import from LibItsMgt_Functions all;
    import from LibItsFsap_TypesAndValues all;
    import from LibItsFsap_Templates all;
    import from LibItsFsap_Pixits all;
    import from LibItsFsap_Pics all;
    import from LibItsIicp_Functions {
        altstep a_iicpDefault
    };
garciay's avatar
garciay committed
    import from LibItsFntp_Templates all;
reinaortega's avatar
reinaortega committed
    import from LibItsCalm_Interface all; 
garciay's avatar
garciay committed
    
    group fsapConfigurationFunctions {
        
        /**
         * @desc This configuration features:
         * <li>Host and Router are combined (see ISO/WD 29281-2 - Figure 1 - Implementation architecture I)</li>
garciay's avatar
garciay committed
         * <li>MGT1 IISC Port (IISC/LAN) is used if specified</li>
         */
garciay's avatar
garciay committed
            
            // Sanity check
            if (PICS_ITS_S_INW) {
                log("*** f_cf01Up: ERROR: PICS_ITS_S_INW shall not be required for executing the TC ***");
                stop;
            }
            
garciay's avatar
garciay committed
            // Map
            map(self:acPort, system:acPort);
            map(self:utPort, system:utPort);
            map(self:mgtMFSapPort, system:mgtMFSapPort);
garciay's avatar
garciay committed
            
            // Connect
            f_connect4SelfOrClientSync(); 
garciay's avatar
garciay committed
            
            // Set processing on shutdown
garciay's avatar
garciay committed
            
            // Initialize the component
garciay's avatar
garciay committed

            // Initialze the IUT
            f_initialState();
            
        } // End of function f_cf01Up
        
        /**
         * @desc This configuration features:
         * <li>Host and Router are separated (see ISO/WD 29281-2 - Figure 3 - Implementation architecture II & III)</li>
         * <li>MGT1 IISC Port (IISC/LAN) is not used</li>
         */
        function f_cf02Up() runs on ItsMgt {
            
            // Sanity check
            if (not(PICS_ITS_S_INW)) {
                log("*** f_cf02Up: ERROR: PICS_ITS_S_INW required for executing the TC ***");
                stop;
            }
            
            vc_commandRef := 0;
            vc_pduCounter := 0;
            
            // Map
            map(self:acPort, system:acPort);
            map(self:utPort, system:utPort);
            map(self:mgtMNSapPort, system:mgtMNSapPort);
            map(self:iicpPort, system:iicpPort);
            
            // Connect
            f_connect4SelfOrClientSync();
            
            // Set processing on shutdown
            activate(a_cf02Down());
            
            // Initialize the component
            f_initialiseComponent("cf02Up");

            // Initialze the IUT
            f_initialState();
            
        } // End of function f_cf02Up
        
        /**
         * @desc    Deletes configuration cf01
         */
garciay's avatar
garciay committed
            
            deactivate;
            
            // Unmap
            unmap(self:acPort, system:acPort);
            unmap(self:utPort, system:utPort);
            unmap(self:mgtMFSapPort, system:mgtMFSapPort);
garciay's avatar
garciay committed
            
            // Disconnect
            f_disconnect4SelfOrClientSync();
            
        } // End of f_cf01Down
garciay's avatar
garciay committed
        
        /**
         * @desc Deletes configuration cf02
         */
        function f_cf02Down() runs on ItsMgt {
            
            deactivate;
            
            // Unmap
            unmap(self:acPort, system:acPort);
            unmap(self:utPort, system:utPort);
            unmap(self:mgtMFSapPort, system:mgtMFSapPort);
            unmap(self:iicpPort, system:iicpPort);
            
            // Disconnect
            f_disconnect4SelfOrClientSync();
            
        } // End of f_cf02Down
        
garciay's avatar
garciay committed
        /**
         * @desc    Behavior function for initializing component's variables and tables
         * @param   p_componentName Name of the component
         * @param   p_iicpMGM Set to true if IISC port shall be used
garciay's avatar
garciay committed
         */
        function f_initialiseComponent(in charstring p_componentName) runs on ItsMgt {
garciay's avatar
garciay committed
            
            // Initialize variables
            
            // Set defaults
            activate(a_mgtMFSapPortDefault()); // Default for MGT module / MF-SAP port
            activate(a_fsapDefault()); 
            if (p_componentName == "cf02Up") {
                activate(a_iicpDefault());
            }
garciay's avatar
garciay committed
        } // end f_initialiseComponent
        
    } // End of group fsapConfigurationFunctions
    
    group preambles {
        
        /**
         * @desc Brings the IUT into an initial state.
         */
        function f_initialState() {
            f_utInitializeIut(m_fsapInitialize);
            f_sleepIgnoreDef(PX_WAIT_FOR_IUT_READY); // Wait until the IUT is in a stable situation (beaconing...)
garciay's avatar
garciay committed
        } // End of function f_initialState
        
    } // End of group preambles
    
    group postambles {
        
        /**
         * @desc The default postamble.
         */
        function f_poDefault() runs on ItsMgt {
            // Nothing to do
        } // End of function f_poDefault
garciay's avatar
garciay committed
        
    } // End of group postambles
    
    group adapterControl {
        
        /**
         * @desc    Triggers event in the test system adaptation via NF-SAP interface.
         * @param   p_event The event to trigger
         */
//        function f_acTriggerEvent(template (value) AcFsapPrimitive p_event) runs on ItsAdapterComponent {
//            acPort.send(p_event);
//        }
garciay's avatar
garciay committed
        
    } // End of group adapterControl
    
    group testerFunctions {
        
    } // End of group testerFunctions
    
    group iutFunctions {
        
        /**
         * @desc    Get the local identifier of the VCI for broadcast on ITS-S host
         * @return  The local identifier of the VCI for broadcast on ITS-S host
         * @see     PX_SRC_REMOTE_CIID_BC
         * @verdict Unchanged
garciay's avatar
garciay committed
         */
        function f_getIutSrcRemoteCIID() return EUI64 {
            return PX_SRC_REMOTE_CIID;
         * @desc    Get the identifier of a VCI on ITS-S host/router only 
         * @return  The identifier of a different VCI on ITS-S host/router only 
         * @see     PX_SRC_LOCAL_CIID
         * @verdict Unchanged
        function f_getIutSrcLocalCIID() return EUI64 {
            return PX_SRC_LOCAL_CIID;
garciay's avatar
garciay committed
        
         * @return  SAM retransmit timer 
         */
        function f_getIutSAMRetransmitTimer() return float {
            return int2float(PICS_SAM_RETRANSMIT_TIMER) / 1000.0; 
        }
        
        /**
         * @desc    Gets the maximum SAM jitter.
         * @return  Maximum SAM jitter
         */
        function f_getIutSAMMaxJitter() return float {
            return int2float(PICS_SAM_RETRANSMIT_TIMER) / 1000.0; 
         * @desc    Get the ITS application object ID (ITS-AID) for GCregServer MF-REQUEST 
         * @return  The ITS application object ID (ITS-AID)
         * @see     PX_APPLICATION_ID
         */
        function f_getIutApplicationID() return ApplicationID {
            return PX_APPLICATION_ID;
        }
        
         * @desc    Get the ITS application object ID (ITS-AID) for GCregClient MF-REQUEST 
         * @return  The ITS application object ID (ITS-AID)
         * @see     PX_CLIENT_APPLICATION_ID
         */
        function f_getIutClientApplicationID() return ApplicationID {
            return PX_CLIENT_APPLICATION_ID;
        }
        
        /**
         * @desc    Get the globally unique ITS-AID of the ITS-S application 
         * @return  The globally unique ITS-AID of the ITS-S application
         * @see     PX_ITS_AID
         */
        function f_getIutServiceID() return ITSaid {
            return PX_ITS_AID;
        }
        
        /**
         * @desc    Get the server identifier value
         * @return  The client identifier value
         * @see     PX_SERVER_ID
         */
        function f_getIutServerID() return StationID {
            return PX_SERVER_ID;
        }
        
        /**
         * @desc    Get the service client ITS station value
         * @return  The service client ITS station value
         * @see     PX_CLIENT_ID
         */
        function f_getIutClientID() return StationID {
            return PX_CLIENT_ID;
        }
        
         * @desc    Get the scheduling information with a specific access technology
         * @return  The scheduling information
         * @see     PX_GSCHED_ACCESS_TECH_NONIP
         */
        function f_getIutGCscheduleWithAccessTechAndNonIP() return GCschedule {
            return { PX_GSCHED_ACCESS_TECH_NONIP };
        }
        
        /**
         * @desc    Get the scheduling information with an unknown access technology
         * @return  The scheduling information
         * @see     PX_GSCHED_ACCESS_UNKNOWN_TECH_NONIP
         */
        function f_getIutGCscheduleWithUnknownAccessTechAndNonIP() return GCschedule {
            return { PX_GSCHED_ACCESS_UNKNOWN_TECH_NONIP };
        }
        
                
         * @desc    Get the scheduling information with no access technology
         * @return  The scheduling information
         * @see     PX_GSCHED_NONIP
        function f_getIutGCscheduleWithNonIP() return GCschedule {
            return { PX_GSCHED_NONIP };
        }
        
        /**
         * @desc    Get advertisement details with no session phase
         * @return  The advertisement details
         * @see     PX_SERVICE_DATA_REG_WITH_NO_SESSION_PHASE
         */
        function f_getIutServiceDataRegWithNoSession() return ServiceDataReg {
            return PX_SERVICE_DATA_REG_WITH_NO_SESSION_PHASE;
        }
        
        /**
         * @desc    Get advertisement details with a specific access technology and with request to change communication channel for session phase
         * @return  The advertisement details
         * @see     PX_SERVICE_DATA_REG_WITH_SESSION_PHASE_AND_CHANNEL_CHANGE
         */
        function f_getIutServiceDataRegWithNoSessionAndChannelChange() return ServiceDataReg {
            return PX_SERVICE_DATA_REG_WITH_SESSION_PHASE_AND_CHANNEL_CHANGE;
         * @desc    Get advertisement details without request to change communication channel for session phase and without request to change communication channel for session phase
         * @return  The advertisement details
         * @see     PX_SERVICE_DATA_REG_WITH_SESSION_PHASE
         */
        function f_getIutServiceDataRegWithSession() return ServiceDataReg {
            return PX_SERVICE_DATA_REG_WITH_SESSION_PHASE;
garciay's avatar
garciay committed
         * @desc    Get non-IP information on services offered, with no session phase and no channel change requested
         * @return  The non-IP information on services offered
         * @see     PX_NO_IP_SERVICE_WITH_NO_SESSION_AND_NO_CHANGE_CHANNEL
         */
        function f_getIutServicelistWithNoSessionAndNoChannelChange() return ServiceList { 
            return { PX_NO_IP_SERVICE_WITH_NO_SESSION_AND_NO_CHANGE_CHANNEL };
        }
        
        /**
garciay's avatar
garciay committed
         * @desc    Get non-IP information on services offered, with session phase and no channel change requested
         * @return  The non-IP information on services offered
         * @see     PX_NO_IP_SERVICE_WITH_SESSION_AND_NO_CHANGE_CHANNEL
         */
        function f_getIutServicelistWithSessionAndNoChangeChannel() return ServiceList { 
            return { PX_NO_IP_SERVICE_WITH_SESSION_AND_NO_CHANGE_CHANNEL };
        }
        
        /**
garciay's avatar
garciay committed
         * @desc    Get non-IP information on services offered, with no session phase and channel change requested
         * @return  The non-IP information on services offered
         * @see     PX_NO_IP_SERVICE_WITH_SESSION_AND_CHANNEL_CHANGE
         */
        function f_getIutServicelistWithSessionAndChangeChannel() return ServiceList { 
            return { PX_NO_IP_SERVICE_WITH_SESSION_AND_CHANNEL_CHANGE };
garciay's avatar
garciay committed
         * @desc    Get non-IP information on an unknown services offered, with session phase and no channel change requested
         * @return  The non-IP information on services offered
         * @see     PX_NO_IP_SERVICE_WITH_UNKNOWN_SERVICE_ID
         */
        function f_getIutServicelistWithUnknownServiceID() return ServiceList { 
            return { PX_NO_IP_SERVICE_WITH_UNKNOWN_SERVICE_ID };
        }
        
        /**
garciay's avatar
garciay committed
         * @desc    Get non-IP information on services offered, with session phase and channel change requested on an unknown channel
         * @return  The non-IP information on services offered
         * @see     PX_NO_IP_SERVICE_WITH_UNKNOWN_CHANNEL
         */
        function f_getIutServicelistWithUnknownChannel() return ServiceList { 
            return { PX_NO_IP_SERVICE_WITH_UNKNOWN_CHANNEL };
        }
garciay's avatar
garciay committed
    } // End of group iutFunctions
    
    group fsapAltsteps {
        
        /**
         * @desc The base default.
         */
        altstep a_fsapDefault() runs on ItsMgt {
            [] tc_wait.timeout {
                log("*** a_fsapDefault: ERROR: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] tc_ac.timeout {
                log("*** a_fsapDefault: ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] any timer.timeout {
                log("*** a_fsapDefault: INCONC: An unknown timer has expired in default ***"); 
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] a_shutdown() {
                f_poDefault();
                log("*** a_fsapDefault: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                if(self == mtc) {
garciay's avatar
garciay committed
                }
                stop;
            }
        } // End of altstep a_fsapDefault()
        
        /**
         * @desc Default handling cf01 de-initialisation.
         */
garciay's avatar
garciay committed
            [] a_shutdown() {
                f_poDefault();
garciay's avatar
garciay committed
                log("*** a_cf01Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;
            }
        } // End of altstep a_cf01Down()
        
        /**
         * @desc Default handling cf02 de-initialisation.
         */
        altstep a_cf02Down() runs on ItsMgt {
            [] a_shutdown() {
                f_poDefault();
                f_cf02Down();
                log("*** a_cf02Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;
            }
        } // End of altstep a_cf02Down()
        
garciay's avatar
garciay committed
    } // End of group fsapAltsteps
    
} // End of module LibItsFsap_Functions