/** * @author ETSI / STF405 * @version $URL$ * $Id$ * @desc Module containing functions for DENM * */ module LibItsDenm_Functions { // LibCommon import from LibCommon_Sync all; import from LibCommon_VerdictControl all; // LibIts import from LibIts_TestSystem all; import from LibIts_Interface all; import from LibItsCommon_Functions all; import from LibItsDenm_TypesAndValues all; import from LibItsDenm_Templates all; import from LibItsDenm_Pics all; import from CAM_PDU_Descriptions language "ASN.1:1997" all; import from DENM_PDU_Descriptions language "ASN.1:1997" all; // LibCommon import from LibCommon_VerdictControl all; group denmConfigurationFunctions { /** * @desc Setups default configuration */ function f_cfUp() runs on ItsFa { map(self:utPort, system:utPort); map(self:denmPort, system:denmPort); f_connect4SelfOrClientSync(); } // end f_cfUp /** * @desc Deletes default configuration */ function f_cfDown() runs on ItsFa { unmap(self:utPort, system:utPort); unmap(self:camPort, system:camPort); f_disconnect4SelfOrClientSync(); } // end f_cfDown } //end denmConfigurationFunctions group altsteps { /** * @desc The base default. */ altstep a_default() runs on ItsFa { [] denmPort.receive { log("*** a_default: ERROR: Received an unexpected message ***"); f_selfOrClientSyncAndVerdict("error", e_error); } [] tc_wait.timeout { log("*** a_default: INCONC: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***"); f_selfOrClientSyncAndVerdict("error", e_timeout); } [] tc_ac.timeout { log("*** a_default: INCONC: Timeout while awaiting the reception of a message ***"); f_selfOrClientSyncAndVerdict("error", e_timeout); } [] a_shutdown() { f_poDefault(); f_cfDown(); log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***"); stop; } } /** * @desc Default handling the cancellation of an event. * @param p_trigger Indicates if the cancellation have to be raised by the test system(e_ets) * or at the application layer of the IUT(e_iut). * @param p_event The event to cancel. */ altstep a_cancelEvent(in template (value) Trigger p_trigger, in template (value) Situation p_event) runs on ItsFa { [] a_shutdown() { f_poCancelEvent(p_trigger, p_event); f_cfDown(); log("*** a_cancelEvent: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***"); stop; } } } // end group altsteps group preambles { /** * @desc The default preamble. */ function f_prDefault() runs on ItsFa { vc_default := activate(a_default()); } /** * @desc Brings the IUT into an initial state. * @return */ function f_prInitialState() runs on ItsFa return FncRetCode { var FncRetCode v_ret := e_success; f_prDefault(); f_utInitializeIut(m_denmInitialize); return v_ret; } } // end group preambles group postambles { /** * @desc The default postamble. */ function f_poDefault() runs on ItsFa { var FncRetCode v_ret := e_success; //empty } /** * @desc Postamble including cancellation of an event. * @param p_trigger Indicates if the cancellation have to be raised by the test system(e_ets) * or at the application layer of the IUT(e_iut). * @param p_event The event to cancel. */ function f_poCancelEvent(template (value) Trigger p_trigger, template (value) Situation p_event) runs on ItsFa { var FncRetCode v_ret := e_success; if (valueof(p_trigger) == e_ets) { f_sendDenMessage( m_denmReq( m_denmPdu( m_denmWithCause(c_dataVersionCancellation, p_event, m_eventPosition(f_getTsCurrentPosition()), f_getTsStationId()) ) ) ); } else { f_utTriggerEvent(m_utEventCancellation(p_event, c_dataVersionCancellation)); } f_poDefault(); } } // end group postambles group sendFunctions { /** * @desc Sends a DEN message * @param p_sendMsg The DEN message to send. */ function f_sendDenMessage(template (value) DenmReq p_sendMsg) runs on ItsFa { p_sendMsg.msgOut.denm.management.actionID.sequenceNo := vc_sequenceNo; denmPort.send(p_sendMsg); } } // end sendFunctions group receiveFunctions { /** * @desc Awaits a DEN message * @param p_rcvMsg The expected message to be received. */ function f_awaitDenMessage(template (present) DenmInd p_rcvMsg) runs on ItsFa { var DenmInd v_denmInd; f_awaitDenMessageOut(p_rcvMsg, v_denmInd); } /** * @desc Awaits a DEN message * @param p_rcvMsg The expected message to be received. * @param p_rcvdMsg The received message - OUT. * @return */ function f_awaitDenMessageOut(in template (present) DenmInd p_rcvMsg, out DenmInd p_rcvdMsg) runs on ItsFa { tc_ac.start; alt { [] denmPort.receive(p_rcvMsg) -> value p_rcvdMsg { tc_ac.stop; } [] tc_ac.timeout { log("*** f_awaitDenMessageOut: INFO: Timeout while awaiting the reception of a message ***"); f_selfOrClientSyncAndVerdict("error", e_timeout); } } } } // end receiveFunctions group getFunctions { group iutGetFunctions { /** * @desc Gets IUT's default event duration * @return */ function f_getIutDefaultEventDuration() return TimeStamp { return PICS_DEFAULT_EXPIRY_TIME; } } // end iutGetFunctions } // end group getFunctions } // end LibItsDenm_Functions