Newer
Older
/**
* @author ETSI / STF405
* @version $URL$
* $Id$
* @desc Module containing functions for basic Transport Protocol
*
*/
// LibCommon
import from LibCommon_Sync all;
import from LibItsCommon_Functions all;
import from LibItsBtp_TestSystem all;
import from LibItsBtp_TypesAndValues all;
import from LibItsBtp_Templates all;
import from LibItsBtp_Pixits all;
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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 {
utPort.send(p_init);
tc_wait.start;
alt {
[] utPort.receive(UtResult: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);
}
[else] { // Shortcut defaults
repeat;
}
}
}
/**
* @desc Triggers event from the application layer
* @param p_event The event to trigger.
*/
function f_utTriggerEvent(template (value) UtEvent p_event) runs on ItsBtp {
var template (value) UtTrigger v_utMsg := { p_event };
utPort.send(v_utMsg);
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
}
[] utPort.receive {
tc_wait.stop;
}
[] tc_wait.timeout {
}
[else] { // Shortcut defaults
repeat;
}
}
}
/**
* @desc Checks that the event was indicated at the application layer
* @param p_event The event to check.
* @param p_discard The event should not appear. Default value: FALSE.
*/
function f_utCheckEvent(template (value) UtEvent p_event, boolean p_discard) runs on ItsBtp {
var template (value) UtCheck v_utMsg := { p_event };
utPort.send(v_utMsg);
tc_wait.start;
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
if (p_discard == false) {
log("*** f_utCheckEvent: INFO: Event correctly indicated at application layer ***");
}
else {
log("*** f_utCheckEvent: ERROR: Event indicated at application layer where it should be discarded ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
}
[] utPort.receive(UtResult:false) {
tc_wait.stop;
if (p_discard == false) {
log("*** f_utCheckEvent: ERROR: Event not correctly indicated at application layer ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
else {
log("*** f_utCheckEvent: INFO: Event not indicated at application layer***");
}
}
[] tc_wait.timeout {
log("*** f_utCheckEvent: ERROR: Timeout while waiting for event check result ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[else] { // Shortcut defaults
repeat;
}
}
}
} // End of group utFunctions
group configurationFunctions {
/**
* @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;
}
}
} //end btpAltsteps
group postambles {
/**
* @desc The default postamble.
*/
group getFunctions {
/**
* @desc Gets the BTP source port of the IUT.
*/
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