Newer
Older
* @author ETSI / STF405
* @version $URL$
* $Id$
* @desc Module containing common functions for ITS
// LibCommon
import from LibCommon_Sync all;
import from LibCommon_VerdictControl all;
// LibIts
import from LibIts_TestSystem all;
import from LibIts_Interface all;
import from LibItsCam_Templates all;
import from LibItsCam_Pixits all;
import from LibItsCommon_Functions all;
import from CAM_PDU_Descriptions language "ASN.1:1997" all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
group camConfigurationFunctions {
/**
* @desc Setups default configuration
*/
map(self:utPort, system:utPort);
map(self:camPort, system:camPort);
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 of camConfigurationFunctions
/**
* @desc basic default behaviour handling
*/
[] camPort.receive(mw_camInd ( mw_camMsg_any )){
f_selfOrClientSyncAndVerdict("error", e_error, "*** a_basicDefault: CAM message received in default ***");
f_selfOrClientSyncAndVerdict("error", e_error, "*** a_basicDefault: event received on CAM port in default ***");
f_selfOrClientSyncAndVerdict("error", e_timeout, "*** a_basicDefault: a timer expired in default ***");
[] a_shutdown() {
f_poDefault();
f_cfDown();
log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
stop;
}
}//end altstep a_basicDefault
} // end of defaults
/**
* @desc Initialize the IUT
* @remark No specific actions specified in the base standard
*/
function f_prInitialState() runs on ItsFa {
* @desc The default postamble.
*/
function f_poDefault() runs on ItsNt {
//empty
}
} // end group postambles
group otherFunctions {
/** @desc function to generate a random bitstring value
* corresponding to 1 bit position set to 1 (eg '00010000', '01000000', ...)
* @see f_random
* @param p_length bitstring length - max 15
* @return bitstring
*
*/
function f_bitPositionRandom( in integer p_length )
return bitstring {
//Variables
var bitstring v_random := '00000000'B;
v_random := '000000000000001'B << f_random (0, p_length);
log("*** f_bitPositionRandom: INFO: OK - random value = " & bit2str(v_random) & " ***");
return v_random;
} // end function f_bitPositionRandom
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
// group upperTester {
//
// /**
// * @desc Requests to bring the IUT in an initial state
// */
// function f_utInitializeIut() runs on ItsFa {
//
// utPort.send(UtCamInitialize:{});
// tc_wait.start;
// alt {
// [] utPort.receive(UtCamResult:true) {
// tc_wait.stop;
// log("*** f_utInitializeIut: IUT initialized ***");
// }
// [] utPort.receive {
// tc_wait.stop;
// f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utInitializeIut: IUT could not be initialized ***");
// }
// [] tc_wait.timeout {
// 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) UtCamEvent p_event) runs on ItsFa return FncRetCode {
// var FncRetCode v_ret := e_success;
// var template (value) UtCamTrigger v_utMsg := { p_event };
//
// utPort.send(v_utMsg);
//
// return v_ret;
// }
//
// /**
// * @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) CamPdu p_event, boolean p_discard := false) runs on ItsFa {
// var template (value) UtCamCheck v_utMsg := { p_event };
//
// utPort.send(v_utMsg);
// tc_wait.start;
// alt {
// [] utPort.receive(UtCamResult:true) {
// tc_wait.stop;
// if (p_discard == false) {
// log("*** f_utCheckEvent: Event correctly indicated at application layer ***");
// }
// else {
// f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utCheckEvent: Event indicated at application layer where it should be discarded ***");
// }
// }
// [] utPort.receive {
// tc_wait.stop;
// if (p_discard == false) {
// f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utCheckEvent: Event not correctly indicated at application layer ***");
// }
// else {
// log("*** f_utCheckEvent: Another event indicated at application layer, repeating check ***");
// repeat;
// }
// }
// [] tc_wait.timeout {
// if (p_discard == false) {
// f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_utCheckEvent: Timeout while waiting for event check result ***");
// }
// else {
// log("*** f_utCheckEvent: Event not indicated at application layer ***");
// }
// }
// }
// }
//
// } // end group upperTester
//
* @see PX_PTLINE_COURSE, PX_PTLINE_REF, PX_PTLINE_ROUTE
*/
var PTLineDescription v_ptLineDescription := {"", "", ""};
v_ptLineDescription := {PX_PTLINE_COURSE, PX_PTLINE_REF, PX_PTLINE_ROUTE};
} // end function f_getIutPtLineDescription
} // end getIutFunctions
* @desc Gets tester's station characteristics
* @return Station characteristics
* @see PX_TESTER_IS_MOBILE, PX_TESTER_IS_PRIVATE, PX_TESTER_IS_PHYSICAL_RELEVANT
return CoopAwareness.stationCharacteristics {
var CoopAwareness.stationCharacteristics v_stationCharacteristics := { true, true, true };
v_stationCharacteristics := {PX_TESTER_IS_MOBILE, PX_TESTER_IS_PRIVATE, PX_TESTER_IS_PHYSICAL_RELEVANT};
return v_stationCharacteristics ;