OneM2M_Testcases_CSE_Release_1.ttcn 478 KB
Newer Older
1 2 3 4 5 6 7
/**
 *  Copyright Notification
 *  No part of this document may be reproduced, in an electronic retrieval system or otherwise, except as authorized by written permission.
 *  The copyright and the foregoing restriction extend to reproduction in all media.
 *  © 2016, oneM2M Partners Type 1 (ARIB, ATIS, CCSA, ETSI, TIA, TSDSI, TTA, TTC).
 *  All rights reserved.
 *  
8
 *  @author     oneM2M/ETSI
9 10 11
 *  @desc       Module containing test cases for oneM2M
 *
 */
12
module OneM2M_Testcases_CSE_Release_1 {
13 14 15 16 17 18

	import from OneM2M_TestSystem all;
	import from OneM2M_Templates all;
	import from OneM2M_Types all;//{type XSD.ID};
	import from OneM2M_TypesAndValues all;
	import from OneM2M_Pixits all;
19
	import from LibCommon_Time all;
20
	import from OneM2M_Pics all;
21
	import from OneM2M_Functions all;
22
	import from OneM2M_PermutationFunctions all;
23 24
	import from XSD all;
	
25
	
26 27 28
	//Demos used for validation purposes
	group oneM2M_demos {
	
29
		group helpingTestCases {//These are not part of the test suite, just for verification purposes
30
			
31 32 33 34 35 36 37 38 39 40
			testcase TC_DELETE_RESOURCES() runs on Tester system CseSystem {
				// Local variables
				                        
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
	            
				v_ae1.start(f_DELETE_RESOURCES());
				v_ae1.done;
			}
			
			function f_DELETE_RESOURCES() runs on AeSimu system CseSystem {
41 42 43
				
				timer t_ac := 5.0;
				var integer i; 
44 45
				var XSD.ID v_resourceAddress;
				var RequestPrimitive v_request;
46 47 48
				map(self:mcaPort, system:mcaPort); 
					
				for (i:=0; i<lengthof(PX_RESOURCES_TO_BE_DELETED); i:= i+1) {  
49 50 51
					
					v_resourceAddress := f_getResourceAddress() & "/" & PX_RESOURCES_TO_BE_DELETED[i]; 
						
52 53
					v_request := valueof(m_delete(v_resourceAddress, PX_SUPER_AE_ID));
					    
54
					f_send(e_mca_port, m_request(v_request));
55
					
56 57
					t_ac.start;
					alt {
58
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
59
							t_ac.stop;
60
							log(__SCOPE__ & ":Resource deleted");
61
							//setverdict(pass);
62
						}
63
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
64
							t_ac.stop;
65
							log(__SCOPE__ & ":Error while deleting resource");
66
							//setverdict(fail);
67 68 69
						}
						[] mcaPort.receive {
							t_ac.stop;
70
							log(__SCOPE__ & ":Unexpected message received");
71
							//setverdict(inconc);
72 73
						}
						[] t_ac.timeout {
74
							log(__SCOPE__ & ":No answer while deleting resource");
75
							//setverdict(inconc);
76 77 78 79 80 81 82 83
						}	
					}	
				}
			
				unmap(self:mcaPort, system:mcaPort); 
				stop;
			}	
		
84
		}//end group helpingTestCases
85 86 87 88 89
	
	}//end group oneM2M_demos
	
	group CSE {
		
90
		group General_Capability {
91 92 93 94 95 96 97 98
			
			group Create {
				group g_CSE_GEN_CRE_001 {

					/**
					 * @desc Check that the IUT accepts the creation of a  resource using unstructured resource identifier
					 * 
					 */
99
					testcase TC_CSE_GEN_CRE_001_CSR() runs on Tester system CseSystem {
100 101
						// Local variables
						                        
102 103 104 105
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_001(e_cseRelative));
						v_ae1.done;
106
					}
107

108
					testcase TC_CSE_GEN_CRE_001_SPR() runs on Tester system CseSystem {
109 110
						// Local variables
						
111 112 113 114
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;

						v_ae1.start(f_CSE_GEN_CRE_001(e_spRelative));
						v_ae1.done;
115
					}
116
					
117
					testcase TC_CSE_GEN_CRE_001_ABS() runs on Tester system CseSystem {
118
						// Local variables
119 120 121 122
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_001(e_absolute));
						v_ae1.done;
123
					}				
124 125 126 127
				
				} // end of group g_CSE_GEN_CRE_001
				
				group g_CSE_GEN_CRE_002 {
128

129 130 131 132
					/**
					 * @desc Check that the IUT accepts the creation of a  resource using structured resource identifier
					 * 
					 */
133
					testcase TC_CSE_GEN_CRE_002_CSR() runs on Tester system CseSystem {
134 135
						// Local variables
						                        
136 137 138 139
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_cseRelative));
						v_ae1.done;
140
					}
141

142
					testcase TC_CSE_GEN_CRE_002_SPR() runs on Tester system CseSystem {
143 144
						// Local variables
						
145 146 147 148
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_spRelative));
						v_ae1.done;
149
					}
150
					
151
					testcase TC_CSE_GEN_CRE_002_ABS() runs on Tester system CseSystem {
152 153
						// Local variables
							
154 155 156 157
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_absolute));
						v_ae1.done;
158
					}
159
				
160
				} // end of group g_CSE_GEN_CRE_002
161
				
162 163 164 165 166 167 168 169 170
			} // end of group Create
			
			group Retrieve {
				group g_CSE_GEN_RET_001 {

					/**
					 * @desc Check that the IUT accepts the retrieval of a <container>  resource using unstructured resource identifier
					 * 
					 */
171
					testcase TC_CSE_GEN_RET_001_CSR() runs on Tester system CseSystem {
172 173
						// Local variables
						                        
174 175 176 177
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_cseRelative));
						v_ae1.done;
178
					}
179

180
					testcase TC_CSE_GEN_RET_001_SPR() runs on Tester system CseSystem {
181 182
						// Local variables
						
183 184 185 186
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_spRelative));
						v_ae1.done;
187
					}
188
					
189
					testcase TC_CSE_GEN_RET_001_ABS() runs on Tester system CseSystem {
190
						// Local variables
191 192 193 194
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_absolute));
						v_ae1.done;
195 196
					}
								
197
				
198 199 200 201 202 203 204 205
				} // end of group g_CSE_GEN_RET_001
				
				group g_CSE_GEN_RET_002 {

					/**
					 * @desc Check that the IUT accepts the retrieval of a <container>  resource using structured resource identifier
					 * 
					 */
206
					testcase TC_CSE_GEN_RET_002_CSR() runs on Tester system CseSystem {
207
						// Local variables
208 209 210 211
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_cseRelative));
						v_ae1.done;
212
					}
213

214
					testcase TC_CSE_GEN_RET_002_SPR() runs on Tester system CseSystem {
215 216
						// Local variables
						
217 218 219 220
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_spRelative));
						v_ae1.done;
221
					}
222
					
223
					testcase TC_CSE_GEN_RET_002_ABS() runs on Tester system CseSystem {
224 225
						// Local variables
							
226 227 228 229
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_absolute));
						v_ae1.done;
230 231
					}
								
232 233 234
				} // end of group g_CSE_GEN_RET_002
				
			} // end of group Retrieve
235
			
236 237
			group Update {
				group g_CSE_GEN_UPD_001 {
238

239 240 241 242
					/**
					 * @desc Check that the IUT accepts the update of a <container>  resource using unstructured resource identifier
					 * 
					 */
243
					testcase TC_CSE_GEN_UPD_001_CSR() runs on Tester system CseSystem {
244
						// Local variables
245 246 247 248
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_cseRelative));
						v_ae1.done;
249
					}
250

251
					testcase TC_CSE_GEN_UPD_001_SPR() runs on Tester system CseSystem {
252
						// Local variables
253 254 255 256
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_spRelative));
						v_ae1.done;
257
					}
258
					
259
					testcase TC_CSE_GEN_UPD_001_ABS() runs on Tester system CseSystem {
260 261
						// Local variables
							
262 263 264 265
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_absolute));
						v_ae1.done;
266 267
					}
								
268 269 270 271 272 273 274 275
				} // end of group g_CSE_GEN_UPD_001
				
				group g_CSE_GEN_UPD_002 {

					/**
					 * @desc Check that the IUT accepts the update of a <container>  resource using structured resource identifier
					 * 
					 */
276
					testcase TC_CSE_GEN_UPD_002_CSR() runs on Tester system CseSystem {
277 278
						// Local variables
						                        
279 280 281 282
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_cseRelative));
						v_ae1.done;
283 284
					}

285
					testcase TC_CSE_GEN_UPD_002_SPR() runs on Tester system CseSystem {
286 287
						// Local variables
						
288
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
289
						
290 291
						v_ae1.start(f_CSE_GEN_UPD_002(e_spRelative));
						v_ae1.done;
292
					}
293
					
294
					testcase TC_CSE_GEN_UPD_002_ABS() runs on Tester system CseSystem {
295
						// Local variables
296
							
297 298 299 300
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_absolute));
						v_ae1.done;
301
					}
302 303 304 305
								
				} // end of group g_CSE_GEN_UPD_002
				
			} // end of group Update
306
			
307 308
			group Delete {
				group g_CSE_GEN_DEL_001 {
309

310 311 312 313
					/**
					 * @desc Check that the IUT accepts the deletion of a <container>  resource using unstructured resource identifier
					 *  
					 */
314
					testcase TC_CSE_GEN_DEL_001_CSR() runs on Tester system CseSystem {
315 316
						// Local variables
						                        
317 318 319 320
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_cseRelative));
						v_ae1.done;
321 322
					}

323
					testcase TC_CSE_GEN_DEL_001_SPR() runs on Tester system CseSystem {
324 325
						// Local variables
						
326 327 328 329
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_spRelative));
						v_ae1.done;
330
					}
331
					
332
					testcase TC_CSE_GEN_DEL_001_ABS() runs on Tester system CseSystem {
333 334
						// Local variables
							
335 336 337 338
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_absolute));
						v_ae1.done;
339 340 341 342 343 344 345 346 347 348
					}
								
				} // end of group g_CSE_GEN_DEL_001
				
				group g_CSE_GEN_DEL_002 {

					/**
					 * @desc Check that the IUT accepts the deletion of a <container>  resource using structured resource identifier
					 * 
					 */
349
					testcase TC_CSE_GEN_DEL_002_CSR() runs on Tester system CseSystem {
350 351
						// Local variables
						                        
352 353 354 355
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_cseRelative));
						v_ae1.done;
356 357
					}

358
					testcase TC_CSE_GEN_DEL_002_SPR() runs on Tester system CseSystem {
359
						// Local variables
360
						
361 362 363 364
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_spRelative));
						v_ae1.done;
365
					}
366
					
367
					testcase TC_CSE_GEN_DEL_002_ABS() runs on Tester system CseSystem {
368 369
						// Local variables
							
370 371 372 373
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_absolute));
						v_ae1.done;
374 375 376 377 378 379
					}
								
				} // end of group g_CSE_GEN_DEL_002
				
			} // end of group Delete
		
380
		} // end of group General_Capability
381 382 383 384 385 386
		
		group Registration {
			
			group Create{
				
				/**
387
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned SP_RELATIVE_ AE_ID.  
388 389
				 * 
				 */
390
				group g_CSE_REG_CRE_001 {
391
					
392
					testcase TC_CSE_REG_CRE_001_CAE() runs on Tester system CseSystem {
393
					
394 395 396 397 398 399
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						v_ae1.start(f_CSE_REG_CRE_001(PX_ALLOWED_C_AE_IDS[0]));
			  	  		v_ae1.done;
			  	  		
					}
400
					
401 402 403 404 405 406 407 408
					testcase TC_CSE_REG_CRE_001_SAE() runs on Tester system CseSystem {
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						v_ae1.start(f_CSE_REG_CRE_001(PX_ALLOWED_S_AE_IDS[0]));
			  	  		v_ae1.done;
			  	  		
					}
409
					
410
				}//end group g_CSE_REG_CRE_001 
411

412
				/**
413
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned AE_ID_STEM of AE-ID-Stem format.
414 415
				 * 
				 */
416 417 418
				group g_CSE_REG_CRE_002 {

					testcase TC_CSE_REG_CRE_002_CAE() runs on Tester system CseSystem {
419
						
420 421 422 423 424 425
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
							
						v_ae1.start(f_CSE_REG_CRE_002(PX_ALLOWED_C_AE_IDS[0]));
				  	  	v_ae1.done;
				  	  		
					}
426
						
427 428 429 430 431 432 433 434 435 436
					testcase TC_CSE_REG_CRE_002_SAE() runs on Tester system CseSystem {
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
							
						v_ae1.start(f_CSE_REG_CRE_002(PX_ALLOWED_S_AE_IDS[0]));
				  	  	v_ae1.done;
				  	  		
					}

				}//end group g_CSE_REG_CRE_002 
437 438

				/**
439
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned S-AE-ID-STEM. 
440 441
				 */
				
442 443 444 445 446
				testcase TC_CSE_REG_CRE_003() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						
					v_cse1.start(f_CSE_REG_CRE_003());
447
			  	  	v_cse1.done;
448 449 450
			  	  		
				}
					
451
				function f_CSE_REG_CRE_003() runs on CseSimu system CseSystem {
452
					
453 454 455
					//Local variables
					var MsgIn v_request;
					var template RequestPrimitive v_requestPrimitive;
456
					
457
					//Test control
458 459 460 461
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
462
					
463 464 465
					// Test component configuration
					f_cf02UpCseSimuMaster(int1);
		  	  	
466
					//Preamble
467 468 469
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
		
					//Test Body
470
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_TS_AE1.appId, -, PX_ALLOWED_S_AE_IDS[0])));
471
					
472
					v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/" & PX_ALLOWED_S_AE_IDS[0], -, -, PX_CSE_ID & "/" & PX_ALLOWED_S_AE_IDS[0]);
473 474 475 476 477
											
					tc_ac.start;
					alt{
						[] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request {
							tc_ac.stop;
478
							setverdict(pass, __SCOPE__ & ": AEAnnc creation received.");
479 480 481 482
							f_cse_sendResponse_cseSimu(v_request);
						}
						[] mccPortIn.receive(mw_request(mw_createAEAnnc())) -> value v_request {
							tc_ac.stop;
483 484 485 486 487 488
							setverdict(fail, __SCOPE__ & ": AEAnnc creation received but wrong parameters");
							f_cse_sendResponse_cseSimu(v_request);
						}
						[] mccPortIn.receive(mw_request(?)) -> value v_request {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Other operation received");
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503
							f_cse_sendResponse_cseSimu(v_request);
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}
					
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
									
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
					
					// Tear down
					f_cf02DownCseSimuMaster();
						
504
				}
505 506 507 508 509
		  	  	
				/**
				 * @desc Check that the IUT rejects an AE registration (allowed App-ID, not allowed C-AE-ID-STEM provided by AE) 
				 * 
				 */
510 511
				testcase TC_CSE_REG_CRE_004() runs on Tester system CseSystem {
					
512
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
513 514 515 516 517 518 519
						
					v_ae1.start(f_CSE_REG_CRE_004());
			  	  	
					v_ae1.done;
			  	  		
				}
					
520
				function f_CSE_REG_CRE_004() runs on AeSimu system CseSystem {
521
		  	  	
522
					var MsgIn v_response;
523
					var RequestPrimitive v_request;
524 525
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
526
					var universal charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AE-ID is not allowed to register: " & PX_NOT_ALLOWED_C_AE_IDS[0];
527 528
					
					//Test control
529
	                
530
					// Test component configuration
531
					f_cf01Up();
532
		  	  	
533
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
534
					//vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
535
					//TODO: create serviceSubscribedProfile, Node, and serviceSubscribedAppRule
536
					//v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile({"C*"}); //c_CRUDNDi);
537
					action(v_action);
538
					f_sleepIgnoreDef(PX_TCONFIG_IUT);
539
					
540
					//Test Body	
541
					//v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));				
542
	    											
543
					v_request := f_getCreateRequestPrimitive(int2, m_createAe(PX_TS_AE1.appId, omit, PX_NOT_ALLOWED_C_AE_IDS[0]), -1);
544
			
545
					f_send(e_mca_port, m_request(v_request));
546 547
					tc_ac.start;
					alt {
548
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4107))) {
549
							tc_ac.stop;
550
							setverdict(pass, __SCOPE__ & ": AE creation rejected.");
551
						}
552
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response{
553
							tc_ac.stop;
554
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
555
						}
556 557 558 559 560 561
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error, creating AE with not allowed AE-ID ");
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
						}
562
						[] tc_ac.timeout {
563
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
564
						}
565
					}
566
									
567
					// Postamble
568
					f_cse_postamble_deleteResources();
569
						
570
					// Tear down
571
					f_cf01Down();
572 573
						
				}
574 575 576 577 578
		  	  	
				/**
				 * @desc Check that the IUT accepts an AE registration (allowed App-ID, S-AE-ID-STEM not provided by AE) 
				 * 
				 */
579 580 581 582 583
				testcase TC_CSE_REG_CRE_005() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						
					v_cse1.start(f_CSE_REG_CRE_005());
584
			  	  	v_cse1.done;
585 586 587
			  	  		
				}
					
588
				function f_CSE_REG_CRE_005() runs on CseSimu system CseSystem {
589
		  	  	
590
		  	  		//Local variables
591 592
		  	  		var MsgIn v_request;
					var template RequestPrimitive v_requestPrimitive;
593 594
					const  charstring v_cseId := PX_CSE_ID;
					template XSD.AnyURI v_link := pattern "{v_cseId}/S";
595 596
					
					//Test control
597 598 599 600
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
601
	                
602
					// Test component configuration
603
					f_cf02UpCseSimuMaster(int1);
604
		  	  	
605
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
606
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
607 608
		
					//Test Body
609
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_TS_AE1.appId, -, "S")));
610
					
611
					v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/S", -, -, v_link);
612
					v_requestPrimitive.primitiveContent.aEAnnc.app_ID := PX_TS_AE1.appId;
613
	    									
614 615
					tc_ac.start;
					alt{
616
						[] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request {
617 618
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
619
							f_cse_sendResponse_cseSimu(v_request);
620
						}
621
						[] mccPortIn.receive(mw_request(mw_createAEAnnc())) -> value v_request {
622
							tc_ac.stop;
623
							setverdict(fail, __SCOPE__ & ": AE creation redirected but wrong parameters");
624
							f_cse_sendResponse_cseSimu(v_request);
625
						}
626 627 628 629
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}
630 631
					
					vc_ae1.done;
632
									
633
					// Postamble
634
					f_cse_postamble_deleteResourcesCSE();
635 636
					
					// Tear down
637
					f_cf02DownCseSimuMaster();
638 639
						
				}
640 641 642 643 644
				
				/**
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided character ‘S’ in AE_ID_Stem ask for a SP_relative_AE_ID 
				 * 
				 */
645 646 647 648 649 650 651 652 653 654
				testcase TC_CSE_REG_CRE_006() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
							
					v_cse1.start(f_CSE_REG_CRE_006());
				  	  	
					v_cse1.done;
				  	  		
				}
						
655
				function f_CSE_REG_CRE_006() runs on CseSimu system CseSystem {
656

657 658
					var MsgIn v_request;
					var template RequestPrimitive v_requestPrimitive;
659
					var integer v_cseBaseIndex := -1;
660 661
					const  charstring v_cseId := PX_CSE_ID;
					template XSD.AnyURI v_link := pattern "{v_cseId}/?*";
662 663 664 665 666 667 668 669
	
					//Test control
					if(not(PICS_MN_CSE or PICS_ASN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE or ASN-CSE to run this test case");
						stop;
					}
    
					// Test component configuration
670
					f_cf02UpCseSimuMaster(int1);
671

672
					//Preamble
673 674 675
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
					
					//Test Body
676
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_TS_AE1.appId, -, "S")));
677 678 679
					
					v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/S", -, -, v_link);
					
680 681 682
					tc_ac.start;

					alt {
683
						[] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request {
684 685
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
686 687 688 689 690 691
							f_cse_sendResponse_cseSimu(v_request);
						}
						[] mccPortIn.receive(mw_request(mw_createAEAnnc())) -> value v_request {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": AE creation redirected but wrong parameters");
							f_cse_sendResponse_cseSimu(v_request);
692 693 694 695 696 697
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
					
698 699
					vc_ae1.done;
					
700 701 702 703 704 705 706 707 708 709 710 711
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
	
					// Tear down
					f_cf02DownCseSimuMaster();
		
				}	// end of TC_CSE_REG_CRE_006
				
				/**
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided character ‘S’ in AE_ID_Stem ask for a SP_relative_AE_ID 
				 * 
				 */
712 713 714 715 716 717 718 719 720 721
				testcase TC_CSE_REG_CRE_007() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
					v_ae1.start(f_CSE_REG_CRE_007());
			  	  	
					v_ae1.done;
			  	  		
				}
					
722
				function f_CSE_REG_CRE_007() runs on AeSimu system CseSystem {
723 724

					var MsgIn v_response;
725
					var template RequestPrimitive v_requestPrimitive;
726
					var integer v_aeIndex := -1;
727 728 729
					var integer v_aeAnncIndex := -1;
					const  charstring v_cseId := PX_CSE_ID;
					template XSD.AnyURI v_link := pattern "{v_cseId}/?*";
730 731 732 733 734 735 736 737
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
					
					// Test component configuration
738
					f_cf02Up(int1);
739
					
740
					//Preamble
741 742
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
					vc_cse1.done;
743
			
744
					v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/S", -, -, v_link);
745
					
746 747
					vc_cse1.start(f_cse_announcementProcedure_createHandler(v_requestPrimitive));
					
748
					f_send(e_mca_port, m_request(f_getCreateRequestPrimitive(int2, m_createAe(PX_TS_AE1.appId, omit, "S"),-1)));
749 750 751 752
					
					//Test Body
					tc_ac.start;
					alt {
753
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
754
							tc_ac.stop;
755
							
756 757 758 759 760
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
761 762 763 764 765 766 767 768 769 770 771 772 773 774
					
					vc_cse1.done;
					
					v_aeAnncIndex := f_getLatestLocalResource(vc_cse1);
					//continue to test the content
				 	if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){
						if (v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID == vc_resourcesList[v_aeAnncIndex].resource.aEAnnc.aE_ID){
							setverdict(pass, __SCOPE__ & ": AE-ID correctly set to AE-ID provided by IN-CSE");
						}else{
							setverdict(fail, __SCOPE__ & ": AE-ID not set correctly");
						}
				  	}else{
						setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist");
				  	}	
775 776 777 778 779 780 781
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf02Down();

				}	// end of TC_CSE_REG_CRE_007
782

783 784 785 786
				/**
				 * @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), transfer request to the IN-CSE 
				 * 
				 */
787 788 789 790 791 792 793 794 795 796
				testcase TC_CSE_REG_CRE_008() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
							
					v_cse1.start(f_CSE_REG_CRE_008());
				  	  	
					v_cse1.done;
				  	  		
				}
						
797
				function f_CSE_REG_CRE_008() runs on CseSimu system CseSystem {
798
		  	  	
799
					var RequestPrimitive v_request;
800
					var template RequestPrimitive v_updateAeAnnc := mw_updateAEAnnc;
801
					var integer v_cseBaseIndex := -1;
802 803 804
					var integer v_aeIndex := -1;
					var integer v_aeIndex_ae1 := -1;
					var integer v_aeAnncIndex := -1;
805
					var ResourceType v_resourceType := int2;
806 807 808 809 810 811
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
812
	                
813
					// Test component configuration
814
					f_cf02UpCseSimuMaster(int1);
815
		  	  	
816
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
817
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
818
					
819
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_TS_AE1.appId, omit, "S")));
820
					
821 822
					v_aeAnncIndex := f_cse_announcementProcedure_createHandler(-, -, -);
					
823
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
824
					
825 826 827 828 829 830
					v_aeIndex_ae1 := f_getLatestResourceIndex(vc_ae1);
					
					v_aeIndex := f_getLatestResource(vc_ae1);
					
					vc_ae1.start(f_cse_deleteResource(v_aeIndex_ae1));
					
831 832
					v_updateAeAnnc.primitiveContent.aEAnnc.link := "INACTIVE";
					f_cse_announcementProcedure_updateHandler(v_updateAeAnnc, -, v_aeAnncIndex);
833 834
					
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
835
					
836
					//Test Body
837
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_TS_AE1.appId, omit, vc_resourcesList[v_aeIndex].resource.aE.aE_ID)));
838
											
839
					tc_ac.start;
840
	
841
					alt {
842
						[] mccPortIn.receive(mw_request(mw_updateAEAnnc)) -> value vc_request {
843
							tc_ac.stop;
844 845
							setverdict(pass, __SCOPE__ & ": AE Announced UPDATE received");
							f_processUpdateRequestPrimitive(vc_request.primitive.requestPrimitive);
846
							f_send(e_mcc_in_port, m_response(vc_response.primitive.responsePrimitive));
847
						}