Newer
Older
* @desc Module containing functions for DENM
*
*/
// LibIts
import from LibIts_TestSystem all;
import from LibIts_Interface 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 Create Facility component and connects DENM port
* @param p_ptcDenm returned Facility component variable
*/
// map ports
map(p_ptcDenm:denmPort, system:denmPort);
/**
* @desc Wait for component to finish and unmap DENM ports
function f_ptcDenmDown(in ItsFa p_ptcDenm) runs on ItsMtc {
tc_guard.start;
alt {
[] p_ptcDenm.done {
tc_guard.stop;
}
[] tc_guard.timeout {
log("*** f_ptcDenmDown: ERROR: Timeout while waiting for component ***");
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
118
119
120
121
122
123
124
125
126
127
128
129
130
group altsteps {
/**
* @desc The base default.
*/
altstep a_default() runs on ItsFa {
[] denmPort.receive {
setverdict (inconc, "Received an unexpected message");
//TODO shall stop be called here?
stop;
}
[] tc_wait.timeout {
setverdict (inconc, "Timeout while awaiting reaction of the IUT prior to Upper Tester action");
//TODO shall stop be called here?
stop;
}
[] tc_ac.timeout {
setverdict (inconc, "Timeout while awaiting the reception of a message");
//TODO shall stop be called here?
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();
//TODO raise action or send message via port
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.
* @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.
* @verdict
*/
function f_poCancelEvent(template (value) Trigger p_trigger, template (value) Situation p_event) runs on ItsFa {
var FncRetCode v_ret := e_success;
if (p_trigger == e_ets) {
m_denmPdu(
m_denmWithCause(c_dataVersionCancellation, p_event, f_getCurrentPosition(), f_getStationId())
)
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
)
);
}
else {
v_ret := f_triggerEventCancellation(p_event);
}
f_setVerdictPreOrPostamble(v_ret);
f_poDefault();
}
} // end group postambles
group eventFunctions {
//TODO check if type Situation is suitable
/**
* @desc Triggers event from the application layer
* @param p_event The event cause and subcause.
* @return
*/
function f_triggerEvent(template (value) Situation p_event) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
//TODO raise action or send message via port
return v_ret;
}
/**
* @desc Triggers cancellation event from the application layer
* @param p_event The event cause and subcause.
* @return
*/
function f_triggerEventCancellation(template (value) Situation p_event) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
var DataVersion v_dataVersion := c_dataVersionCancellation;
//TODO raise action or send message via port
return v_ret;
}
/**
* @desc Triggers event negation from the application layer
* @param p_event The event cause and subcause.
* @return
*/
function f_triggerEventNegation(template (value) Situation p_event) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
var DecentralizedEnvironmentalNotificationMessage.management.isNegation v_isNegation := true;
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
//TODO raise action or send message via port
return v_ret;
}
/**
* @desc Triggers event with additional TrafficFlowEffect information field included from the application layer
* @param p_event The event cause and subcause.
* @param p_tfe The Traffic Flow Effect.
* @return
*/
function f_triggerEventTrafficFlowEffect(
template (value) Situation p_event,
template (value) TrafficFlowEffect p_tfe
) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
//TODO raise action or send message via port
return v_ret;
}
/**
* @desc Triggers event with additional LinkedCause information field included from the application layer
* @param p_event The event cause and subcause.
* @param p_linkedCause The linked event.
* @return
*/
function f_triggerEventLinkedCause(
template (value) Situation p_event,
template (value) Situation p_linkedCause
) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
//TODO raise action or send message via port
return v_ret;
}
/**
* @desc Triggers event with expiration time information field included from the application layer
* @param p_event The event cause and subcause.
* @param p_expirationTime The expiration time.
* @return
*/
function f_triggerEventExpirationTime(
template (value) Situation p_event,
template (value) TimeStamp p_expirationTime
) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
//TODO raise action or send message via port
return v_ret;
}
/**
* @desc Triggers update of event's expiration time
* @param p_event The event cause and subcause.
* @param p_expirationTime The new expiration time.
* @return
*/
function f_triggerEventExpirationTimeUpdate(
template (value) Situation p_event,
template (value) TimeStamp p_expirationTime
) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
//TODO raise action or send message via port
return v_ret;
}
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
/**
* @desc Triggers event with additional Event Characteristics information field included from the application layer
* @param p_event The event cause and subcause.
* @param p_eventCharact The event characteristics.
* @return
*/
function f_triggerEventEventCharact(
template (value) Situation p_event,
template (value) DecentralizedSituation.eventCharact p_eventCharact
) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
//TODO raise action or send message via port
return v_ret;
}
//TODO check if type Situation is suitable
/**
* @desc Checks that the event was indicated the application layer
* @param p_event The event cause and subcause.
* @return
*/
function f_checkEvent(template (value) Situation p_event) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
//TODO raise action or send message via port
return v_ret;
}
/**
* @desc Checks that the event cancellation was indicated to the application layer
* @param p_event The event cause and subcause.
* @return
*/
function f_checkEventCancellation(template (value) Situation p_event) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
//TODO raise action or send message via port
return v_ret;
}
/**
* @desc Checks that the event negation was indicated to the application layer
* @param p_event The event cause and subcause.
* @return
*/
function f_checkEventNegation(template (present) Situation p_event) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
//TODO raise action or send message via port
return v_ret;
}
} // end group eventFunctions
group sendFunctions {
/**
* @desc Sends a DEN message
* @param p_sendMsg The DEN message to send.
* @return
*/
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.
* @return
*/
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 template (value) DenmInd p_rcvdMsg) runs on ItsFa return FncRetCode {
var FncRetCode v_ret := e_success;
tc_wait.start;
alt {
[] denmPort.receive(p_rcvMsg) -> value p_rcvdMsg {
tc_wait.stop;
v_ret := e_success;
}
}
return v_ret;
}
} // end receiveFunctions
group getFunctions {
group iutGetFunctions {
} // end iutGetFunctions
group testerGetFunctions {
/**
* @desc Gets the station identifier of IUT.
* @return
*/
function f_getIutDefaultEventDuration() return TimeStamp {
var TimeStamp v_iutDefaultEventDuration;
//TODO get the value from PIXIT or MIB
return v_iutDefaultEventDuration;
}
} // end testerGetFunctions
// TODO: Clean up
* @return
*/
function f_getStationId() return StationID {
var StationID v_stationId;
//TODO get the value from PIXIT or MIB
return v_stationId;
}
/**
* @desc Gets the position of the test system.
* @return
*/
function f_getCurrentPosition() return DecentralizedSituationLocation.eventPosition {
var DecentralizedSituationLocation.eventPosition v_eventPos;
//TODO get the value from PIXIT or ...
return v_eventPos;
}
/**
* @desc Gets the current time
* @return
*/
function f_getCurrentTime() return TimeStamp {
var TimeStamp v_timeStamp;