Newer
Older
garciay
committed
/**
* @author ETSI / STF422_EETS
garciay
committed
* @desc Inter-ITS-SCU communications (ISO 24102-4) functions
*/
module LibItsIicp_Functions {
// LibCommon
import from LibCommon_Sync all;
import from LibCommon_Time {
function f_sleep, f_sleepIgnoreDef
garciay
committed
import from LibCommon_BasicTypesAndValues {
const
c_uInt8Max;
};
import from LibCommon_Sync {
function
f_selfOrClientSyncAndVerdict, f_selfOrClientSyncAndVerdictPreamble
};
import from LibCommon_VerdictControl all;
// LibIts
};
import from CALMmsap language "ASN.1:1997" {
type
MF_Request_confirm,
WakeUp, RegReq, StateCInotify,
LDMregister
garciay
committed
import from CALMmanagement language "ASN.1:1997" {
type
garciay
committed
};
import from CALMiitsscu language "ASN.1:1997" {
type
IIC_Request, IIC_Response,
garciay
committed
};
import from CALMfntp language "ASN.1:1997" {
type SetNotFNTP, DeleteFNTP
};
type IParamNoList, IParamList
};
import from LibItsMgt_Functions {
function
f_getIutSourceItsScuId, f_getIutDestItsScuId,
f_getNextPduCounter
garciay
committed
import from LibItsIicp_Templates all;
import from LibItsIicp_Pics {
modulepar PICS_ITS_MGT_NOT
};
garciay
committed
import from LibItsIicp_Pixits all;
garciay
committed
type
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
UtInitialize, CfInitialize, CfEventInd,
UtResult, CfResult,
ItsCalm
};
/**
* @desc Upper tester functions
*/
group utFunctions {
/**
* @desc Requests to bring the IUT in an initial state
* @param p_utInitialize The initialisation to trigger.
* @verdict Unchanged on success, fail on error and inconc otherwise
*/
function f_utIicpInitializeIut(template (value) UtInitialize p_utInitialize) runs on ItsCalm {
utPort.send(p_utInitialize);
tc_wait.start;
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
log("*** f_utIicpInitializeIut: INFO: IUT initialized ***");
}
[] utPort.receive {
tc_wait.stop;
log("*** f_utIicpInitializeIut: INFO: IUT could not be initialized ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] tc_wait.timeout {
log("*** f_utIicpInitializeIut: INFO: IUT could not be initialized in time ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[else] { // Shortcut defaults
//f_sleep(0.050); // 50 ms
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
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
repeat;
}
} // End of 'alt' statement
} // End of function f_utIicpInitializeIut
/**
* @desc Send a NFsapPrimitivesDown primitive and wait for the NFsapPrimitivesUp confirm response
* @param p_utIicpEvent The NFsapPrimitivesDown request
* @param p_utIicpEventInd The NFsapPrimitivesDown response
* @param p_discard Set to true if responses shall be discard, otherwise the function failed
* @param p_result The response value
* @verdict Unchanged on success, fail on error and inconc otherwise
*/
function f_utIicpEventResponse(
in template (value) UtIicpEvent p_utIicpEvent,
in template (present) UtIicpEventInd p_utIicpEventInd,
in boolean p_discard,
out UtIicpEventInd p_result)
runs on ItsCalm {
// log("*** f_utIicpEventResponse: INFO: Send message: ", p_commandReq, " ***");
utPort.send(p_utIicpEvent);
// log("*** f_utIicpEventResponse: INFO: Expected UtCommandConfirm: ", p_commandConf, " ***");
tc_wait.start;
alt {
[] utPort.receive(p_utIicpEventInd) -> value p_result {
// log("*** f_utIicpEventResponse: INFO: Receive expected confirm: message ***");
tc_wait.stop;
}
[] utPort.receive(UtIicpEventInd:? ) -> value p_result {
if (p_discard == false) {
tc_wait.stop;
log("*** f_utIicpEventResponse: ERROR: Event not correctly indicated at application layer ***", p_result);
f_selfOrClientSyncAndVerdict("fail", e_error);
}
else {
log("*** f_utIicpEventResponse: INFO: Another event indicated at application layer, repeating check ***");
repeat;
}
}
[] tc_wait.timeout {
if (p_discard == false) {
log("*** f_utIicpEventResponse: ERROR: Timeout while waiting for event check result ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
else {
log("*** f_utIicpEventResponse: INFO: Event not indicated at application layer ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
}
} // End of 'alt' statement
} // End of function f_utIicpEventResponse
/**
* @desc Send a NFsapPrimitivesDown primitive and do not wait for the NFsapPrimitivesDown confirm response
* @param p_utIicpEvent The NFsapPrimitivesDown primitive
* @verdict Unchanged on success, fail otherwise
*/
function f_utIicpEvent(
in template (value) UtIicpEvent p_utIicpEvent
) runs on ItsCalm {
utPort.send(p_utIicpEvent);
} // End of function f_utIicpEvent
} // End of group utFunctions
/**
* @desc Test trigger function
*/
group whenFunctions {
/**
* @desc Send a IIC-Request primitive
* @param p_IIC_Request The IIC-Request primitive
* @verdict Unchanged on success, fail otherwise
*/
function f_iicpEvent_IIC_Request(
in template (value) IIC_Request p_IIC_Request
) runs on ItsCalm {
iicpPort.send(
m_iicpReq(
p_IIC_Request
));
} // End of function f_iicpEvent_IIC_Request
/**
* @desc Send a IIC-Request primitive
* @param p_IIC_Request The IIC-Request primitive
* @verdict Unchanged on success, fail otherwise
*/
function f_iicpEvent_IIC_Response(
in template (value) IIC_Response p_IIC_Response
) runs on ItsCalm {
iicpPort.send(
m_iicpResp(
p_IIC_Response
));
} // End of function f_iicpEvent_IIC_Response
} // End of group whenFunctions
garciay
committed
garciay
committed
group iicpConfigurationFunctions {
/**
* @desc This configuration features:
* <li>Host and Router are combined (see ISO/WD 29281-2 - Figure 1 - Implementation architecture I)</li>
* <li>MGT1 IISC Port (IISC/LAN) is used if specified</li>
*/
garciay
committed
// Map
map(self:utPort, system:utPort);
garciay
committed
map(self:iicpPort, system:iicpPort);
garciay
committed
// Connect
f_connect4SelfOrClientSync();
// Set processing on shutdown
activate(a_cf01Down());
// Initialize the component
f_initialiseComponent("cf01Up");
// Initialze the IUT
f_initialState();
} // End of function f_cf01Up
/**
* @desc Deletes configuration cf01
*/
garciay
committed
deactivate;
// Unmap
unmap(self:utPort, system:utPort);
garciay
committed
unmap(self:iicpPort, system:iicpPort);
garciay
committed
// Disconnect
f_disconnect4SelfOrClientSync();
} // End of f_cf01Down
/**
* @desc Behavior function for initializing component's variables and tables
* @param p_componentName Name of the component
* @param p_iicpMGM Set to true if IISC port shall be used
*/
function f_initialiseComponent(in charstring p_componentName) runs on ItsCalm {
garciay
committed
// Initialize variables
// Set defaults
activate(a_iicpDefault());
} // end f_initialiseComponent
} // End of group iicpConfigurationFunctions
group functions {
} // End of group functions
garciay
committed
/**
* @desc Triggers a request command event in the test system adaptation.
* @param p_rCmd The remote commad to trigger
* @return FncRetCode
*/
function f_sendAliveMessage(
in ITS_scuId p_scuIdSource,
in ITS_scuId p_scuIdDest,
in template (value) ITS_SCUalive p_scuAlive
) runs on ItsCalm {
iicpPort.send(
m_iicpReq(
m_iicRequest(
p_scuIdSource, // The ITS SCU-ID of the sender
p_scuIdDest,
f_getNextPduCounter(),
m_pduRequest_scuAlive(
p_scuAlive
)
)
)
);
} // End of function f_sendAliveMessage
garciay
committed
group iicpAltsteps {
/**
* @desc Trap for not processed IICP message.
* @verdict Set to fail on unknown message
*/
altstep a_iicpDefault() runs on ItsCalm {
[] iicpPort.receive(
mw_iicpIndReq(
mdw_iicRequestTx_scuAlive(
?,
65535,
mw_scuAlive(
?,
?
)))) {
log("*** a_iicpDefault: INFO: Broadcasted Alive message, skip it and repeat ***");
repeat;
}
[] iicpPort.receive(mw_iicpIndReq(mw_iicpRequest_any)) { // Receive any IIC-Request message
log("*** a_iicpDefault: INFO: Remote IIC-Request command service primitive received in default ***");
repeat;
}
[] iicpPort.receive(mw_iicpIndResp(mw_iicpResponse_any)) { // Receive any IIC-Response message
garciay
committed
log("*** a_iicpDefault: INFO: Remote IIC-Response command service primitive received in default ***");
repeat;
}
garciay
committed
[] iicpPort.receive { // Receive unknown message
log("*** a_iicpDefault: ERROR: event received on IICP port in default ***");
garciay
committed
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] tc_wait.timeout {
log("*** a_iicpDefault: ERROR: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[] tc_ac.timeout {
log("*** a_iicpDefault: ERROR: Timeout while awaiting the reception of a message ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[] any timer.timeout {
log("*** a_iicpDefault: INCONC: An unknown timer has expired in default ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[] a_shutdown() {
f_poDefault();
log("*** a_iicpDefault: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
if(self == mtc) {
f_cf01Down();
}
stop;
}
} // End of altstep a_iicpDefault
/**
* @desc Default handling cf01 de-initialisation.
*/
garciay
committed
[] a_shutdown() {
f_poDefault();
f_cf01Down();
log("*** a_cf01Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
stop;
}
} // End of altstep a_cf01Down()
} // End of group iicpAltsteps
garciay
committed
/**
* @desc Brings the IUT into an initial state.
*/
function f_initialState() runs on ItsCalm {
if (PICS_ITS_MGT_NOT == true) {
f_utIicpInitializeIut(m_utIicpInitialize_with_management);
} else {
f_utIicpInitializeIut(m_utIicpInitialize_without_management);
}
// f_cfIicpInitialize(m_cfIicpInitialize);
garciay
committed
f_sleepIgnoreDef(PX_WAIT_FOR_IUT_READY); // Wait until the IUT is in a stable situation (beaconing...)
cfPort.clear; // Because TestConfigIICP should trigger management port deletion message
garciay
committed
} // End of function f_initialState
garciay
committed
group postambles {
/**
* @desc The default postamble.
*/
garciay
committed
// Nothing to do
} // End of function f_poDefault
} // End of group postambles
group adapterControl {
} // End of group adapterControl
group testerFunctions {
/**
* @desc matches a record of values if, and only if, the record of values contains at least all of the elements defined within the SuperSet, and may contain more.
* @param p_vciInfoRes Received datas to be checked
* @param p_baseTemplate Template to be matched
* @return true on matching, false otherwise
* @verdict Unchanged
* @see ETSI ES 201 873-1 V4.3.1 (2011-06)
*/
function f_superset_VCI_Info(in VCI_info_res p_vciInfoRes, in template (present) VCI_Info p_baseTemplate) return boolean {
for (v_counter := 0; v_counter < lengthof(p_vciInfoRes); v_counter := v_counter + 1) {
if (match(p_vciInfoRes[v_counter], p_baseTemplate)) {
return true;
}
} // End of 'for' statement
return false;
}
/**
* @desc matches a record of values if, and only if, the record of values contains at least all of the elements defined within the SuperSet, and may contain more.
* @param p_vciInfoRes Received datas to be checked
* @param p_baseTemplate Template to be matched
* @return true on matching, false otherwise
* @verdict Unchanged
* @see ETSI ES 201 873-1 V4.3.1 (2011-06)
*/
function f_superset_VCI_Update(in VCI_update_req p_vciUpdate, in template (present) VCI_Info p_baseTemplate) return boolean {
for (v_counter := 0; v_counter < lengthof(p_vciUpdate); v_counter := v_counter + 1) {
if (match(p_vciUpdate[v_counter], p_baseTemplate)) {
return true;
}
} // End of 'for' statement
return false;
}
garciay
committed
} // End of group testerFunctions
group iutFunctions {
/**
* @desc Get the active VCI link identifier
* @return The active VCI link identifier
* @see PX_ACTIVE_VCI_LINK_ID
*/
function f_getIutCiLinkId() return Link_ID {
garciay
committed
/**
* @desc Gets the Local/source ITS scuID
* @return The Local/source ITS scuID
* @see PX_LOCAL_ITS_SCU_ID
* @see ISO/WD 24102-4 - Table 2 — ITS-SCU-ID value assignment
*/
function f_getIutLocalItsScuId() return ITS_scuId {
garciay
committed
return PX_LOCAL_ITS_SCU_ID;
}
/**
* @desc Get the type of ITS-SCU in the "Data" element
* @return The type of ITS-SCU in the "Data" element
garciay
committed
* @see PX_SRC_ITS_SCU_TYPE
*/
function f_getIutSourceItsScuType() return ITS_SCUtype {
garciay
committed
return PX_SRC_ITS_SCU_TYPE;
}
/**
garciay
committed
* @return The type ITS scuID
* @see PX_LOCAL_ITS_TYPE
* @see ISO/WD 24102-4 - Table 2 — ITS-SCU-ID value assignment
*/
function f_getIutLocalItsType() return ITS_SCUtype {
garciay
committed
return PX_LOCAL_ITS_TYPE;
}
/**
* @desc Gets the Alive timer
* @return The Alive timer
* @see PX_TALIVE
*/
/**
* @desc Gets the Talive retransmit timer.
* @return Talive retransmit timer
* @see PX_TALIVE
*/
function f_getIutTaliveRetransmitTimer() return float {
return 0.9 * int2float(PX_TALIVE); // 90%;
}
/**
* @desc Gets the maximum Talive jitter.
* @return Maximum Talive jitter
* @see PICS_SAM_RETRANSMIT_TIMER
*/
function f_getIutTaliveMaxJitter() return float {
return 1.1 * int2float(PX_TALIVE); // 110%;
}
* @desc Get the MI-Command value used for remote command
* @return The MI-Command value used for remote command
* @desc Get the MI-Request value used for remote command
* @return The MI-Request value used for remote command
* @see PX_MI_RCMD_REGTYPE
*/
return PX_MI_RCMD_REGTYPE;
}
/**
* @desc Get the Link_ID value used for remote command
* @return The MI-Request value used for remote command
* @see PX_MI_RCMD_REGTYPE
*/
function f_getIutRemoteCmdForMiRequestLinkID() return Link_ID {
return PX_MI_RCMD_LINKID;
}
/**
* @desc Get the MM-Command value used for remote command
* @return The MM-Command value used for remote command
function f_getIutRemoteCmdForMnCommand() return DeleteFNTP {
return PX_MN_RCMD_FWTDELETEFNTP;
* @desc Get the MM-Request value used for remote command
* @return The MN-Request value used for remote command
* @see PX_MN_RCMD_FWYSETNOTIFY
*/
function f_getIutRemoteCmdForMnRequest() return SetNotFNTP {
return PX_MN_RCMD_FWYSETNOTIFY;
}
/**
* @desc Get the MF-Command value used for remote command
* @return The MF-Command value used for remote command
function f_getIutRemoteCmdForMfCommand() return StateCInotify {
* @desc Get the MF-Request value used for remote command
* @return The MF-Request value used for remote command
* @see PX_MF_RCMD_LDM_REGISTER
*/
function f_getIutRemoteCmdForMfRequest() return LDMregister {
return PX_MF_RCMD_LDM_REGISTER;
}
/**
* @desc Get the List of reference number of parameter to be monitored
* @return The List of reference number of parameter to be monitored
function f_getIutIparamNoList() return IParamNoList {
* @desc Get the list of error status for each parameter to be monitored
* @return The list of error status for each parameter to be monitored
function f_getIutIparamList() return IParamList {
* @desc Get the list of error status for each parameter to be monitored
* @return The list of error status for each parameter to be monitored
/**
* @desc Get a IIC-Response value
* @return The IIC-Response value
* @see PX_IIC_RESPONSE
*/
function f_getIutIicResponse() return MF_Request_confirm {
return PX_IIC_RESPONSE;
}
garciay
committed
} // End of group iutFunctions
} // End of module LibItsIicp_Functions