AtsMec_UEidentityAPI_TestCases.ttcn 25 KB
Newer Older
Yann Garcia's avatar
Yann Garcia committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
 *    @author   ETSI / STF569
 *    @version  $URL:$
 *              $ID:$
 *    @desc     This module provides the MEC test cases.
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
 *    @see      ETSI GS MEC 003, Draft ETSI GS MEC 013 V2.0.3 (2018-10)
 */
module AtsMec_UEidentityAPI_TestCases {
  
  // Libcommon
  import from LibCommon_Time all;
  import from LibCommon_VerdictControl all;
  import from LibCommon_Sync all;
  
  // LibHttp
  import from LibItsHttp_TypesAndValues all;
  import from LibItsHttp_Functions all;
  import from LibItsHttp_Templates all;
  import from LibItsHttp_JsonTemplates all;
  import from LibItsHttp_TestSystem all;
  
  // LibMec_UEidentityAPI
  import from UEidentityAPI_TypesAndValues all;
  import from UEidentityAPI_Templates all;
  import from UEidentityAPI_Pics all;
  import from UEidentityAPI_Pixits all;
  
  // LibMec
  import from LibMec_Functions all;
  import from LibMec_Pics all;
  import from LibMec_Pixits all;
  
  group me_app_role {
    
    /**
Yann Garcia's avatar
Yann Garcia committed
40
     * @desc Check that the IUT responds with a list for the location of User Equipments when queried by a MEC Application
Yann Garcia's avatar
Yann Garcia committed
41
42
43
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2
     */
    testcase TC_MEC_PLAT_MP1_UETAG_BV_001() runs on HttpComponent system HttpTestAdapter {
Yann Garcia's avatar
Yann Garcia committed
44
45
46
      // Local variables
      var HeaderLines v_headers;
      var HttpMessage v_response;
Yann Garcia's avatar
Yann Garcia committed
47
        
Yann Garcia's avatar
Yann Garcia committed
48
      // Test control
YannGarcia's avatar
YannGarcia committed
49
50
      if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***");
Yann Garcia's avatar
Yann Garcia committed
51
52
53
        setverdict(inconc);
        stop;
      }
Yann Garcia's avatar
Yann Garcia committed
54
        
Yann Garcia's avatar
Yann Garcia committed
55
56
      // Test component configuration
      f_cf_01_http_up();
Yann Garcia's avatar
Yann Garcia committed
57
        
Yann Garcia's avatar
Yann Garcia committed
58
      // Test adapter configuration
Yann Garcia's avatar
Yann Garcia committed
59
        
Yann Garcia's avatar
Yann Garcia committed
60
61
62
63
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
Yann Garcia's avatar
Yann Garcia committed
64
                                   m_http_request_get(
YannGarcia's avatar
YannGarcia committed
65
                                                      PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")),
Yann Garcia's avatar
Yann Garcia committed
66
67
                                                      v_headers
                                                      )
Yann Garcia's avatar
Yann Garcia committed
68
69
                                   )
                    );
Yann Garcia's avatar
Yann Garcia committed
70
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
Yann Garcia's avatar
Yann Garcia committed
71
      
Yann Garcia's avatar
Yann Garcia committed
72
73
74
75
76
77
78
79
80
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_ok(
                                                                 mw_http_message_body_json(
                                                                                           mw_body_json_ue_identity_tag_info(
                                                                                                                             mw_ue_identity_tag_info(
Yann Garcia's avatar
Yann Garcia committed
81
                                                                                                                                                     { *, mw_ue_identity_tag_item(PX_UE_IDENTITY_TAG), * }
Yann Garcia's avatar
Yann Garcia committed
82
83
84

                                                                                                                                                                                                                                                                                                          )))))) -> value v_response {
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a UeIdentityTag ***");
Yann Garcia's avatar
Yann Garcia committed
85
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
Yann Garcia's avatar
Yann Garcia committed
86
87
88
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
Yann Garcia's avatar
Yann Garcia committed
89
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
Yann Garcia's avatar
Yann Garcia committed
90
91
        }
      } // End of 'alt' statement
Yann Garcia's avatar
Yann Garcia committed
92
        
Yann Garcia's avatar
Yann Garcia committed
93
94
      // Postamble
      f_cf_01_http_down();
Yann Garcia's avatar
Yann Garcia committed
95
96
    } // End of testcase TC_MEC_PLAT_MP1_UETAG_BV_001
    
Yann Garcia's avatar
Yann Garcia committed
97
98
99
100
101
102
103
104
105
106
    /**
     * @desc Check that the IUT registers a tag (representing a UE) or a list of tags when commanded by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2
     */
    testcase TC_MEC_PLAT_MP1_UETAG_BV_002() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      var HttpMessage v_response;
      
      // Test control
YannGarcia's avatar
YannGarcia committed
107
108
      if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***");
Yann Garcia's avatar
Yann Garcia committed
109
110
111
112
113
114
115
116
117
118
119
120
121
122
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_post(
YannGarcia's avatar
YannGarcia committed
123
                                                       PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info",
Yann Garcia's avatar
Yann Garcia committed
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_ue_identity_tag_info(
                                                                                                                 m_ue_identity_tag_info(
                                                                                                                                        {
                                                                                                                                          m_ue_identity_tag_item(
                                                                                                                                                                 PX_UE_IDENTITY_TAG,
                                                                                                                                                                 REGISTERED
                                                                                                                                                                 )
                                                                                                                                          }
                                                                                                                                        )
                                                                                                                 )
                                                                                )
                                                       )
                                   )
                    );
Yann Garcia's avatar
Yann Garcia committed
140
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
Yann Garcia's avatar
Yann Garcia committed
141
142
143
144
145
146
147
148
149
150
151
152
153
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_ok(
                                                                 mw_http_message_body_json(
                                                                                           mw_body_json_ue_identity_tag_info(
                                                                                                                             mw_ue_identity_tag_info(
                                                                                                                                                     { *, mw_ue_identity_tag_item(PX_UE_IDENTITY_TAG, REGISTERED), * }
                                                                                                                                                     )))))) -> value v_response {
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a UeIdentityTag ***");
Yann Garcia's avatar
Yann Garcia committed
154
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
Yann Garcia's avatar
Yann Garcia committed
155
156
157
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
Yann Garcia's avatar
Yann Garcia committed
158
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
Yann Garcia's avatar
Yann Garcia committed
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
        }
      } // End of 'alt' statement
      
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TC_MEC_PLAT_MP1_UETAG_BV_002
    
    /**
     * @desc Check that the IUT deregisters a tag (representing a UE) or a list of tags when commanded by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2
     */
    testcase TC_MEC_PLAT_MP1_UETAG_BV_003() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      var HttpMessage v_response;
      
      // Test control
YannGarcia's avatar
YannGarcia committed
176
177
      if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***");
Yann Garcia's avatar
Yann Garcia committed
178
179
180
181
182
183
184
185
186
187
188
189
190
191
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_post(
YannGarcia's avatar
YannGarcia committed
192
                                                       PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info",
Yann Garcia's avatar
Yann Garcia committed
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_ue_identity_tag_info(
                                                                                                                 m_ue_identity_tag_info(
                                                                                                                                        {
                                                                                                                                          m_ue_identity_tag_item(
                                                                                                                                                                 PX_UE_IDENTITY_TAG,
                                                                                                                                                                 UNREGISTERED
                                                                                                                                                                 )
                                                                                                                                          }
                                                                                                                                        )
                                                                                                                 )
                                                                                )
                                                       )
                                   )
                    );
Yann Garcia's avatar
Yann Garcia committed
209
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
Yann Garcia's avatar
Yann Garcia committed
210
211
212
213
214
215
216
217
218
219
220
221
222
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_ok(
                                                                 mw_http_message_body_json(
                                                                                           mw_body_json_ue_identity_tag_info(
                                                                                                                             mw_ue_identity_tag_info(
                                                                                                                                                     { *, mw_ue_identity_tag_item(PX_UE_IDENTITY_TAG, UNREGISTERED), * }
                                                                                                                                                     )))))) -> value v_response {
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a UeIdentityTag ***");
Yann Garcia's avatar
Yann Garcia committed
223
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
Yann Garcia's avatar
Yann Garcia committed
224
225
226
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
Yann Garcia's avatar
Yann Garcia committed
227
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
Yann Garcia's avatar
Yann Garcia committed
228
229
230
231
232
233
234
        }
      } // End of 'alt' statement
      
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TC_MEC_PLAT_MP1_UETAG_BV_003
    
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
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
327
328
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
    /**
     * @desc Check that the IUT responds with ProblemDetails on information on an unknown UE Identity tag when queried by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2
     */
    testcase TC_MEC_PLAT_MP1_UETAG_BI_001() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      var HttpMessage v_response;
        
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
        
      // Test component configuration
      f_cf_01_http_up();
        
      // Test adapter configuration
        
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_get(
                                                      PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG_UNKNOWN, "UTF-8")),
                                                      v_headers
                                                      )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_404_not_found(
                                                                            mw_http_message_body_json(
                                                                                                      mw_body_json_ue_identity_problem_details(
                                                                                                                                               mw_problem_details(
                                                                                                                                                                  -, -, 404
                                                                                                                                                                  )))))) -> value v_response {
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
        
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TC_MEC_PLAT_MP1_UETAG_BI_001
    
    /**
     * @desc Check that the IUT responds with ProblemDetails on information an unknown Application Instance Identifier when queried by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2
     */
    testcase TC_MEC_PLAT_MP1_UETAG_BI_002() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      var HttpMessage v_response;
        
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
        
      // Test component configuration
      f_cf_01_http_up();
        
      // Test adapter configuration
        
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_get(
                                                      PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID_UNKNOWN, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")),
                                                      v_headers
                                                      )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_404_not_found(
                                                                            mw_http_message_body_json(
                                                                                                      mw_body_json_ue_identity_problem_details(
                                                                                                                                               mw_problem_details(
                                                                                                                                                                  -, -, 404
                                                                                                                                                                  )))))) -> value v_response {
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
        
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TC_MEC_PLAT_MP1_UETAG_BI_002
    
    /**
     * @desc Check that the IUT responds with ProblemDetails on information an invalid URI
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2
     */
    testcase TC_MEC_PLAT_MP1_UETAG_BI_003() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      var HttpMessage v_response;
        
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
        
      // Test component configuration
      f_cf_01_http_up();
        
      // Test adapter configuration
        
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_get(
                                                      PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_information?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")),
                                                      v_headers
                                                      )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_400_bad_request(
                                                                              mw_http_message_body_json(
                                                                                                        mw_body_json_ue_identity_problem_details(
                                                                                                                                                 mw_problem_details(
                                                                                                                                                                    -, -, 400
                                                                                                                                                                    )))))) -> value v_response {
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
        
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TC_MEC_PLAT_MP1_UETAG_BI_003
    
    /**
     * @desc Check that the IUT responds with ProblemDetails on information on not allowed request
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2
     */
    testcase TC_MEC_PLAT_MP1_UETAG_BI_004() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      var HttpMessage v_response;
        
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
        
      // Test component configuration
      f_cf_01_http_up();
        
      // Test adapter configuration
        
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_get(
                                                      PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(APP_INSTANCE_ID_WITH_RESTRICTED_ACCESS, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")),
                                                      v_headers
                                                      )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_403_forbidden(
                                                                            mw_http_message_body_json(
                                                                                                      mw_body_json_ue_identity_problem_details(
                                                                                                                                               mw_problem_details(
                                                                                                                                                                  -, -, 403
                                                                                                                                                                  )))))) -> value v_response {
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
        
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TC_MEC_PLAT_MP1_UETAG_BI_004
    
Yann Garcia's avatar
Yann Garcia committed
463
464
465
  } // End of group me_app_role 
  
} // End of module AtsMec_TestCases