LibItsFsap_Functions.ttcn3 15.8 KB
Newer Older
garciay's avatar
garciay committed
1
2
/**
 *  @author     ETSI / STF422_EETS
filatov's avatar
filatov committed
3
4
 *  @version    $URL$
 *              $Id$
garciay's avatar
garciay committed
5
6
7
 *  @desc       Fast service advertisement protocol (ISO 24102-5) functions
 */
module LibItsFsap_Functions {
garciay's avatar
garciay committed
8
    
garciay's avatar
garciay committed
9
10
11
12
13
14
    // Libcommon
    import from LibCommon_Sync all;
    import from LibCommon_Time {
        function f_sleepIgnoreDef
    };
    
garciay's avatar
garciay committed
15
    // LibIts
16
17
18
    import from CITSapplMgmtApplReg language "ASN.1:1997" {
        type ITSaid 
    };
19
20
21
    import from CALMllsap language "ASN.1:1997" { 
        type EUI64 
    }; 
garciay's avatar
garciay committed
22
23
    import from CALMmanagement language "ASN.1:1997" {
        type
24
25
            ITS_scuId, StationID, 
            ApplicationID 
garciay's avatar
garciay committed
26
    };
27
28
29
30
    import from CALMiitsscu language "ASN.1:1997" {
        type 
            ITS_SCUtype 
    };
garciay's avatar
garciay committed
31
32
    import from CALMfsap language "ASN.1:1997" {
        type
33
            GCschedule, ServiceDataReg, ServiceList 
garciay's avatar
garciay committed
34
35
36
37
38
39
40
    };
    import from CALMmsap language "ASN.1:1997" {
        type CommandRef
    };
    import from LibItsMgt_Templates all;
    import from LibItsMgt_Functions all;
    import from LibItsFsap_TypesAndValues all;
garciay's avatar
garciay committed
41
    import from LibItsFsap_Templates all;
garciay's avatar
garciay committed
42
    import from LibItsFsap_Pixits all;
garciay's avatar
garciay committed
43
    import from LibItsFsap_Pics all;
garciay's avatar
garciay committed
44
45
46
    import from LibItsIicp_Functions {
        altstep a_iicpDefault
    };
garciay's avatar
garciay committed
47
    import from LibItsFntp_Templates all;
reinaortega's avatar
reinaortega committed
48
    import from LibItsCalm_Interface all; 
garciay's avatar
garciay committed
49
50
51
52
53
    
    group fsapConfigurationFunctions {
        
        /**
         * @desc This configuration features:
garciay's avatar
garciay committed
54
         * <li>Host and Router are combined (see ISO/WD 29281-2 - Figure 1 - Implementation architecture I)</li>
garciay's avatar
garciay committed
55
         * <li>MGT1 IISC Port (IISC/LAN) is not used</li>
garciay's avatar
garciay committed
56
         */
57
        function f_cf01Up() runs on ItsMgt {
garciay's avatar
garciay committed
58
            
59
60
61
62
63
64
            // Sanity check
            if (PICS_ITS_S_INW) {
                log("*** f_cf01Up: ERROR: PICS_ITS_S_INW shall not be required for executing the TC ***");
                stop;
            }
            
garciay's avatar
garciay committed
65
66
67
            // Map
            map(self:acPort, system:acPort);
            map(self:utPort, system:utPort);
68
            map(self:mgtMfSapPort, system:mgtMfSapPort);
garciay's avatar
garciay committed
69
70
            
            // Connect
garciay's avatar
garciay committed
71
            f_connect4SelfOrClientSync(); 
garciay's avatar
garciay committed
72
73
            
            // Set processing on shutdown
74
            activate(a_cf01Down());
garciay's avatar
garciay committed
75
76
            
            // Initialize the component
77
            f_initialiseComponent("cf01Up");
garciay's avatar
garciay committed
78
79
80
81
82
83

            // Initialze the IUT
            f_initialState();
            
        } // End of function f_cf01Up
        
84
85
86
        /**
         * @desc This configuration features:
         * <li>Host and Router are separated (see ISO/WD 29281-2 - Figure 3 - Implementation architecture II & III)</li>
garciay's avatar
garciay committed
87
         * <li>MGT1 IISC Port (IISC/LAN) is used if specified</li>
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
         */
        function f_cf02Up() runs on ItsMgt {
            
            // Sanity check
            if (not(PICS_ITS_S_INW)) {
                log("*** f_cf02Up: ERROR: PICS_ITS_S_INW required for executing the TC ***");
                stop;
            }
            
            vc_commandRef := 0;
            vc_pduCounter := 0;
            
            // Map
            map(self:acPort, system:acPort);
            map(self:utPort, system:utPort);
103
            map(self:mgtMfSapPort, system:mgtMfSapPort);
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
            map(self:iicpPort, system:iicpPort);
            
            // Connect
            f_connect4SelfOrClientSync();
            
            // Set processing on shutdown
            activate(a_cf02Down());
            
            // Initialize the component
            f_initialiseComponent("cf02Up");

            // Initialze the IUT
            f_initialState();
            
        } // End of function f_cf02Up
        
garciay's avatar
garciay committed
120
121
122
        /**
         * @desc    Deletes configuration cf01
         */
123
        function f_cf01Down() runs on ItsMgt {
garciay's avatar
garciay committed
124
125
126
127
128
129
            
            deactivate;
            
            // Unmap
            unmap(self:acPort, system:acPort);
            unmap(self:utPort, system:utPort);
130
            unmap(self:mgtMfSapPort, system:mgtMfSapPort);
garciay's avatar
garciay committed
131
132
133
134
            
            // Disconnect
            f_disconnect4SelfOrClientSync();
            
garciay's avatar
garciay committed
135
        } // End of f_cf01Down
garciay's avatar
garciay committed
136
        
137
138
139
140
141
142
143
144
145
146
        /**
         * @desc Deletes configuration cf02
         */
        function f_cf02Down() runs on ItsMgt {
            
            deactivate;
            
            // Unmap
            unmap(self:acPort, system:acPort);
            unmap(self:utPort, system:utPort);
147
            unmap(self:mgtMfSapPort, system:mgtMfSapPort);
148
149
150
151
152
153
154
            unmap(self:iicpPort, system:iicpPort);
            
            // Disconnect
            f_disconnect4SelfOrClientSync();
            
        } // End of f_cf02Down
        
garciay's avatar
garciay committed
155
156
157
        /**
         * @desc    Behavior function for initializing component's variables and tables
         * @param   p_componentName Name of the component
garciay's avatar
garciay committed
158
         * @param   p_iicpMGM Set to true if IISC port shall be used
garciay's avatar
garciay committed
159
         */
160
        function f_initialiseComponent(in charstring p_componentName) runs on ItsMgt {
garciay's avatar
garciay committed
161
162
163
164
            
            // Initialize variables
            
            // Set defaults
165
            activate(a_mgtMfSapPortDefault()); // Default for MGT module / MF-SAP port
garciay's avatar
garciay committed
166
            activate(a_fsapDefault()); 
garciay's avatar
garciay committed
167
168
169
            if (p_componentName == "cf02Up") {
                activate(a_iicpDefault());
            }
garciay's avatar
garciay committed
170
171
172
173
174
175
176
177
178
        } // end f_initialiseComponent
        
    } // End of group fsapConfigurationFunctions
    
    group preambles {
        
        /**
         * @desc Brings the IUT into an initial state.
         */
garciay's avatar
garciay committed
179
        function f_initialState() runs on ItsMgt {
garciay's avatar
garciay committed
180
            f_utInitializeIut(m_fsapInitialize);
garciay's avatar
garciay committed
181
            f_sleepIgnoreDef(PX_WAIT_FOR_IUT_READY); // Wait until the IUT is in a stable situation (beaconing...)
garciay's avatar
garciay committed
182
183
184
185
186
187
188
189
190
191
        } // End of function f_initialState
        
    } // End of group preambles
    
    group postambles {
        
        /**
         * @desc The default postamble.
         */
        function f_poDefault() runs on ItsMgt {
garciay's avatar
garciay committed
192
193
            // Nothing to do
        } // End of function f_poDefault
garciay's avatar
garciay committed
194
195
196
197
198
199
200
201
202
        
    } // End of group postambles
    
    group adapterControl {
        
        /**
         * @desc    Triggers event in the test system adaptation via NF-SAP interface.
         * @param   p_event The event to trigger
         */
garciay's avatar
garciay committed
203
204
205
//        function f_acTriggerEvent(template (value) AcFsapPrimitive p_event) runs on ItsAdapterComponent {
//            acPort.send(p_event);
//        }
garciay's avatar
garciay committed
206
207
208
209
210
211
212
213
214
215
        
    } // End of group adapterControl
    
    group testerFunctions {
        
    } // End of group testerFunctions
    
    group iutFunctions {
        
        /**
216
217
         * @desc    Get the local identifier of the VCI for broadcast on ITS-S host
         * @return  The local identifier of the VCI for broadcast on ITS-S host
218
         * @see     PX_WL_REMOTE_CIID_BC
219
         * @verdict Unchanged
garciay's avatar
garciay committed
220
         */
reinaortega's avatar
reinaortega committed
221
        function f_getIutSrcRemoteCiId() return EUI64 {
222
            return PX_SRC_REMOTE_CIID;
garciay's avatar
garciay committed
223
224
        }
        
225
        /**
226
227
         * @desc    Get the identifier of a VCI on ITS-S host/router only 
         * @return  The identifier of a different VCI on ITS-S host/router only 
228
         * @see     PX_WL_LOCAL_CIID
229
         * @verdict Unchanged
230
         */
reinaortega's avatar
reinaortega committed
231
        function f_getIutSrcLocalCiId() return EUI64 {
232
            return PX_WL_LOCAL_CIID;
233
        }
garciay's avatar
garciay committed
234
        
garciay's avatar
garciay committed
235
        /**
236
         * @desc    Gets the SAM retransmit timer.
garciay's avatar
garciay committed
237
         * @return  SAM retransmit timer 
238
         * @see     PICS_SAM_RETRANSMIT_TIMER
garciay's avatar
garciay committed
239
         */
240
        function f_getIutSamRetransmitTimer() return float {
241
            return int2float(PICS_SAM_RETRANSMIT_TIMER) / 1000.0; 
garciay's avatar
garciay committed
242
243
244
245
246
        }
        
        /**
         * @desc    Gets the maximum SAM jitter.
         * @return  Maximum SAM jitter
247
         * @see     PICS_SAM_RETRANSMIT_TIMER
garciay's avatar
garciay committed
248
         */
249
        function f_getIutSamMaxJitter() return float {
250
            return int2float(PICS_SAM_RETRANSMIT_TIMER) / 1000.0; 
garciay's avatar
garciay committed
251
252
253
        }
        
        /**
254
         * @desc    Get the ITS application object ID (ITS-AID) for GCregServer MF-REQUEST 
255
256
         * @return  The ITS application object ID (ITS-AID)
         * @see     PX_APPLICATION_ID
garciay's avatar
garciay committed
257
         */
reinaortega's avatar
reinaortega committed
258
        function f_getIutApplicationId() return ApplicationID {
garciay's avatar
garciay committed
259
260
261
            return PX_APPLICATION_ID;
        }
        
262
        /**
263
264
265
266
         * @desc    Get the ITS application object ID (ITS-AID) for GCregClient MF-REQUEST 
         * @return  The ITS application object ID (ITS-AID)
         * @see     PX_CLIENT_APPLICATION_ID
         */
reinaortega's avatar
reinaortega committed
267
        function f_getIutClientApplicationId() return ApplicationID {
268
269
270
271
272
273
274
275
            return PX_CLIENT_APPLICATION_ID;
        }
        
        /**
         * @desc    Get the globally unique ITS-AID of the ITS-S application 
         * @return  The globally unique ITS-AID of the ITS-S application
         * @see     PX_ITS_AID
         */
reinaortega's avatar
reinaortega committed
276
        function f_getIutServiceId() return ITSaid {
277
278
279
280
281
            return PX_ITS_AID;
        }
        
        /**
         * @desc    Get the server identifier value
garciay's avatar
garciay committed
282
         * @return  The client identifier value
283
284
         * @see     PX_SERVER_ID
         */
reinaortega's avatar
reinaortega committed
285
        function f_getIutServerId() return StationID {
286
287
288
289
290
291
            return PX_SERVER_ID;
        }
        
        /**
         * @desc    Get the service client ITS station value
         * @return  The service client ITS station value
garciay's avatar
garciay committed
292
         * @see     PX_CLIENT_ID
293
         */
reinaortega's avatar
reinaortega committed
294
        function f_getIutClientId() return StationID {
295
296
297
            return PX_CLIENT_ID;
        }
        
garciay's avatar
garciay committed
298
        /**
garciay's avatar
garciay committed
299
300
301
         * @desc    Get the scheduling information with a specific access technology
         * @return  The scheduling information
         * @see     PX_GSCHED_ACCESS_TECH_NONIP
garciay's avatar
garciay committed
302
         */
reinaortega's avatar
reinaortega committed
303
        function f_getIutGcScheduleWithAccessTechAndNonIp() return GCschedule {
garciay's avatar
garciay committed
304
305
306
            return { PX_GSCHED_ACCESS_TECH_NONIP };
        }
        
garciay's avatar
garciay committed
307
308
309
310
311
        /**
         * @desc    Get the scheduling information with an unknown access technology
         * @return  The scheduling information
         * @see     PX_GSCHED_ACCESS_UNKNOWN_TECH_NONIP
         */
reinaortega's avatar
reinaortega committed
312
        function f_getIutGCscheduleWithUnknownAccessTechAndNonIp() return GCschedule {
313
314
315
316
            return { PX_GSCHED_ACCESS_UNKNOWN_TECH_NONIP };
        }
        
                
garciay's avatar
garciay committed
317
        /**
garciay's avatar
garciay committed
318
319
320
         * @desc    Get the scheduling information with no access technology
         * @return  The scheduling information
         * @see     PX_GSCHED_NONIP
garciay's avatar
garciay committed
321
         */
reinaortega's avatar
reinaortega committed
322
        function f_getIutGCscheduleWithNonIp() return GCschedule {
323
324
325
326
            return { PX_GSCHED_NONIP };
        }
        
        /**
garciay's avatar
garciay committed
327
328
329
         * @desc    Get advertisement details with no session phase
         * @return  The advertisement details
         * @see     PX_SERVICE_DATA_REG_WITH_NO_SESSION_PHASE
330
331
332
333
334
335
         */
        function f_getIutServiceDataRegWithNoSession() return ServiceDataReg {
            return PX_SERVICE_DATA_REG_WITH_NO_SESSION_PHASE;
        }
        
        /**
garciay's avatar
garciay committed
336
337
338
         * @desc    Get advertisement details with a specific access technology and with request to change communication channel for session phase
         * @return  The advertisement details
         * @see     PX_SERVICE_DATA_REG_WITH_SESSION_PHASE_AND_CHANNEL_CHANGE
garciay's avatar
garciay committed
339
340
         */
        function f_getIutServiceDataRegWithNoSessionAndChannelChange() return ServiceDataReg {
garciay's avatar
garciay committed
341
            return PX_SERVICE_DATA_REG_WITH_SESSION_PHASE_AND_CHANNEL_CHANGE;
garciay's avatar
garciay committed
342
343
344
        }
        
        /**
garciay's avatar
garciay committed
345
346
347
         * @desc    Get advertisement details without request to change communication channel for session phase and without request to change communication channel for session phase
         * @return  The advertisement details
         * @see     PX_SERVICE_DATA_REG_WITH_SESSION_PHASE
348
349
350
         */
        function f_getIutServiceDataRegWithSession() return ServiceDataReg {
            return PX_SERVICE_DATA_REG_WITH_SESSION_PHASE;
garciay's avatar
garciay committed
351
        }
352
353
        
        /**
garciay's avatar
garciay committed
354
355
         * @desc    Get non-IP information on services offered, with no session phase and no channel change requested
         * @return  The non-IP information on services offered
356
357
         * @see     PX_NO_IP_SERVICE_WITH_NO_SESSION_AND_NO_CHANGE_CHANNEL
         */
garciay's avatar
garciay committed
358
        function f_getIutServicelistWithNoSessionAndNoChannelChange() return ServiceList { 
359
360
361
362
            return { PX_NO_IP_SERVICE_WITH_NO_SESSION_AND_NO_CHANGE_CHANNEL };
        }
        
        /**
garciay's avatar
garciay committed
363
364
         * @desc    Get non-IP information on services offered, with session phase and no channel change requested
         * @return  The non-IP information on services offered
365
366
367
368
369
370
371
         * @see     PX_NO_IP_SERVICE_WITH_SESSION_AND_NO_CHANGE_CHANNEL
         */
        function f_getIutServicelistWithSessionAndNoChangeChannel() return ServiceList { 
            return { PX_NO_IP_SERVICE_WITH_SESSION_AND_NO_CHANGE_CHANNEL };
        }
        
        /**
garciay's avatar
garciay committed
372
373
         * @desc    Get non-IP information on services offered, with no session phase and channel change requested
         * @return  The non-IP information on services offered
garciay's avatar
garciay committed
374
         * @see     PX_NO_IP_SERVICE_WITH_SESSION_AND_CHANNEL_CHANGE
375
376
         */
        function f_getIutServicelistWithSessionAndChangeChannel() return ServiceList { 
garciay's avatar
garciay committed
377
            return { PX_NO_IP_SERVICE_WITH_SESSION_AND_CHANNEL_CHANGE };
378
379
380
        }
        
        /**
garciay's avatar
garciay committed
381
382
         * @desc    Get non-IP information on an unknown services offered, with session phase and no channel change requested
         * @return  The non-IP information on services offered
383
384
         * @see     PX_NO_IP_SERVICE_WITH_UNKNOWN_SERVICE_ID
         */
reinaortega's avatar
reinaortega committed
385
        function f_getIutServicelistWithUnknownServiceId() return ServiceList { 
386
387
388
389
            return { PX_NO_IP_SERVICE_WITH_UNKNOWN_SERVICE_ID };
        }
        
        /**
garciay's avatar
garciay committed
390
391
         * @desc    Get non-IP information on services offered, with session phase and channel change requested on an unknown channel
         * @return  The non-IP information on services offered
392
393
394
395
396
         * @see     PX_NO_IP_SERVICE_WITH_UNKNOWN_CHANNEL
         */
        function f_getIutServicelistWithUnknownChannel() return ServiceList { 
            return { PX_NO_IP_SERVICE_WITH_UNKNOWN_CHANNEL };
        }
garciay's avatar
garciay committed
397
        
garciay's avatar
garciay committed
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
    } // End of group iutFunctions
    
    group fsapAltsteps {
        
        /**
         * @desc The base default.
         */
        altstep a_fsapDefault() runs on ItsMgt {
            [] tc_wait.timeout {
                log("*** a_fsapDefault: ERROR: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] tc_ac.timeout {
                log("*** a_fsapDefault: ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] any timer.timeout {
                log("*** a_fsapDefault: INCONC: An unknown timer has expired in default ***"); 
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] a_shutdown() {
                f_poDefault();
                log("*** a_fsapDefault: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                if(self == mtc) {
422
                    f_cf01Down();
garciay's avatar
garciay committed
423
424
425
426
427
428
429
430
                }
                stop;
            }
        } // End of altstep a_fsapDefault()
        
        /**
         * @desc Default handling cf01 de-initialisation.
         */
431
        altstep a_cf01Down() runs on ItsMgt {
garciay's avatar
garciay committed
432
433
            [] a_shutdown() {
                f_poDefault();
434
                f_cf01Down();
garciay's avatar
garciay committed
435
436
437
438
439
                log("*** a_cf01Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;
            }
        } // End of altstep a_cf01Down()
        
440
441
442
443
444
445
446
447
448
449
450
451
        /**
         * @desc Default handling cf02 de-initialisation.
         */
        altstep a_cf02Down() runs on ItsMgt {
            [] a_shutdown() {
                f_poDefault();
                f_cf02Down();
                log("*** a_cf02Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;
            }
        } // End of altstep a_cf02Down()
        
garciay's avatar
garciay committed
452
453
454
    } // End of group fsapAltsteps
    
} // End of module LibItsFsap_Functions