Newer
Older
* @desc Module containing functions for DENM
*
*/
// 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 CAM_PDU_Descriptions language "ASN.1:1997" all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
/**
* @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
/**
* @desc Create Facility component and connects DENM port
* @remark Only used when ItsFa is a PTC
* @param p_ptcDenm returned Facility component variable
*/
function f_ptcDenmUp(out ItsFa p_ptcDenm) {
// Create Facility component
p_ptcDenm := ItsFa.create("DENM Tester");
// map ports
map(p_ptcDenm:denmPort, system:denmPort);
map(p_ptcDenm:utPort, system:utPort);
} // end f_ptcDenmUp
/**
* @desc Wait for component to finish and unmap DENM ports
* @remark Only used when ItsFa is a PTC
* @param p_camPtc Facility component variable
*/
function f_ptcDenmDown(in ItsFa p_ptcDenm) runs on ItsMtc {
tc_guard.start;
alt {
[] p_ptcDenm.done {
tc_guard.stop;
}
[] tc_guard.timeout {
f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_ptcDenmDown: Timeout while waiting for component ***");
}
unmap(p_ptcDenm:denmPort);
unmap(p_ptcDenm:utPort);
} // end f_ptcDenmDown
group altsteps {
/**
* @desc The base default.
*/
altstep a_default() runs on ItsFa {
[] denmPort.receive {
f_selfOrClientSyncAndVerdict("error", e_error, "*** a_default: Received an unexpected message ***");
f_selfOrClientSyncAndVerdict("error", e_timeout, "*** a_default: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
f_selfOrClientSyncAndVerdict("error", e_timeout, "*** a_default: Timeout while awaiting the reception of a message ***");
}
}
} // 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_setVerdictPreOrPostamble(v_ret);
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
f_setVerdictPreOrPostamble(v_ret);
}
/**
* @desc Postamble including cancellation of an event.
berge
committed
* @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).
*/
function f_poCancelEvent(template (value) Trigger p_trigger, template (value) Situation p_event) runs on ItsFa {
var FncRetCode v_ret := e_success;
m_denmWithCause(c_dataVersionCancellation, p_event, m_eventPosition(f_getTsCurrentPosition()), f_getTsStationId())
v_ret := f_utTriggerEvent(m_utEventCancellation(p_event, c_dataVersionCancellation));
}
f_setVerdictPreOrPostamble(v_ret);
f_poDefault();
}
} // end group postambles
group upperTester {
/**
* @desc Requests to bring the IUT in an initial state
*/
utPort.send(UtDenmInitialize:{});
tc_ac.start;
alt {
[] utPort.receive(UtDenmResult:true) {
log("*** f_utInitializeIut: PASS: IUT initialized ***");
f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utInitializeIut: IUT could not be initialized ***");
f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_utInitializeIut: IUT could not be initialized in time ***");
* @desc Triggers event from the application layer
* @param p_event The event to trigger.
function f_utTriggerEvent(template (value) UtDenmEvent p_event) runs on ItsFa return FncRetCode {
var template (value) UtDenmTrigger v_utMsg := { p_event };
* @desc Checks that the event was indicated at the application layer
* @param p_event The event to check.
function f_utCheckEvent(template (value) UtDenmEvent p_event) runs on ItsFa return FncRetCode {
var template (value) UtDenmCheck v_utMsg := { p_event };
utPort.send(v_utMsg);
tc_ac.start;
alt {
[] utPort.receive(UtDenmResult:true) {
setverdict (pass, "*** f_utCheckEvent: Event correctly indicated at application layer ***");
v_ret := e_success;
}
[] utPort.receive {
setverdict (fail, "*** f_utCheckEvent: Event not correctly indicated at application layer ***");
v_ret := e_error;
}
[] tc_ac.timeout {
setverdict (inconc, "*** f_utCheckEvent: Timeout while waiting for event check result ***");
v_ret := e_timeout;
}
}
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 return FncRetCode {
return 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 return FncRetCode {
log("*** f_awaitDenMessageOut: INFO: Timeout while awaiting the reception of a message ***");
}
return v_ret;
}
} // end receiveFunctions
group getFunctions {
* @return
*/
function f_getIutDefaultEventDuration() return TimeStamp {