Newer
Older
/**
* @author ETSI / STF405
* @version $URL$
* $Id$
* @desc Module containing functions for basic Transport Protocol
* @copyright ETSI Copyright Notification
* No part may be reproduced except as authorized by written permission.
* The copyright and the foregoing restriction extend to reproduction in all media.
* All rights reserved.
// LibCommon
import from LibCommon_Sync all;
import from LibCommon_Time all;
import from LibItsCommon_TypesAndValues all;
// LibItsBtp
import from LibItsBtp_TypesAndValues all;
import from LibItsBtp_Templates all;
import from LibItsBtp_Pixits all;
group utFuntions {
/**
* @desc Requests to bring the IUT in an initial state
* @param p_init The initialisation to trigger.
*/
function f_utInitializeIut(template (value) UtInitialize p_init) runs on ItsBtp {
//deactivate btpPort default alts
vc_btpDefaultActive := false;
[] utPort.receive(UtInitializeResult:true) {
tc_wait.stop;
log("*** f_utInitializeIut: INFO: IUT initialized ***");
}
[] utPort.receive {
tc_wait.stop;
log("*** f_utInitializeIut: INFO: IUT could not be initialized ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] tc_wait.timeout {
log("*** f_utInitializeIut: INFO: IUT could not be initialized in time ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
}
//activate btpPort default alts
vc_btpDefaultActive := true;
}
/**
* @desc Triggers event from the application layer
* @param p_event The event to trigger.
*/
function f_utTriggerEvent(template (value) UtBtpTrigger p_event) runs on ItsBtp {
//deactivate btpPort default alts
vc_btpDefaultActive := false;
utPort.send(p_event);
[] utPort.receive(UtBtpTriggerResult:true) {
tc_wait.stop;
}
[] utPort.receive {
tc_wait.stop;
}
[] tc_wait.timeout {
}
}
//activate btpPort default alts
vc_btpDefaultActive := true;
/**
* @desc Setups default configuration
map(self:utPort, system:utPort);
map(self:btpPort, system:btpPort);
f_connect4SelfOrClientSync();
} // end f_cfUp
/**
* @desc Deletes default configuration
unmap(self:utPort, system:utPort);
unmap(self:btpPort, system:btpPort);
f_disconnect4SelfOrClientSync();
} // end f_cfDown
} // end configurationFunctions
group btpAltsteps {
/**
* @desc The base default.
*/
log("*** a_default: ERROR: Received an unexpected message ***");
log("*** a_default: INCONC: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
f_selfOrClientSyncAndVerdict("error", e_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 The default for handling upper tester messages.
*/
altstep a_utDefault() runs on ItsBtp {
var UtBtpEventInd v_ind;
[vc_utDefaultActive] utPort.receive(UtBtpEventInd:?) -> value v_ind {
//store every upper tester indication received
vc_utEvents[lengthof(vc_utEvents)] := v_ind;
repeat;
}
log("*** " & testcasename() & ": INFO: Received unhandled/unknown UT message from IUT ***");
repeat;
}
}
activate(a_utDefault());
group postambles {
/**
* @desc The default postamble.
*/
group getFunctions {
/**
* @desc Gets the BTP source port of the IUT.
* @return BTP source port ID
*/
function f_getBtpSrcPort() return BtpPortId {
return PX_SOURCE_PORT;
}
/**
* @desc Gets the BTP destination port of the IUT.
*/
function f_getBtpDstPort() return BtpPortId {
return PX_DESTINATION_PORT;
}
/**
* @desc Gets a unknown BTP destination port of the IUT.
function f_getBtpUnknownDstPort() return BtpPortId {
return PX_UNKNOWN_DESTINATION_PORT;
}
/**
* @desc Gets the BTP destination port info of the IUT.
*/
function f_getBtpDstPortInfo() return BtpPortId {
return PX_DESTINATION_PORT_INFO;
}
/**
* @desc Gets the BTP payload to use.
*/
function f_getBtpPayload() return BtpPayload {
return PX_PAYLOAD;
}
} // end getFunctions