OneM2M_Testcases_CSE_Release_1.ttcn 469 KB
Newer Older
1 2 3 4 5 6 7 8
/**
 *  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.
 *  
 *  @author     ETSI
9 10
 *  @version    $URL: https://oldforge.etsi.org/svn/oneM2M/branches/Release1/ttcn/OneM2M_Testcases.ttcn $
 *              $Id: OneM2M_Testcases.ttcn 347 2017-08-11 08:48:20Z reinaortega $
11 12 13
 *  @desc       Module containing test cases for oneM2M
 *
 */
14
module OneM2M_Testcases_CSE_Release_1 {
15 16 17 18 19 20

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

					/**
					 * @desc Check that the IUT accepts the creation of a  resource using unstructured resource identifier
					 * 
					 */
92
					testcase TC_CSE_GEN_CRE_001_CSR() runs on Tester system CseSystem {
93 94
						// Local variables
						                        
95 96 97 98
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_001(e_cseRelative));
						v_ae1.done;
99
					}
100

101
					testcase TC_CSE_GEN_CRE_001_SPR() runs on Tester system CseSystem {
102 103
						// Local variables
						
104 105 106 107
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;

						v_ae1.start(f_CSE_GEN_CRE_001(e_spRelative));
						v_ae1.done;
108
					}
109
					
110
					testcase TC_CSE_GEN_CRE_001_ABS() runs on Tester system CseSystem {
111
						// Local variables
112 113 114 115
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_001(e_absolute));
						v_ae1.done;
116
					}				
117 118 119 120
				
				} // end of group g_CSE_GEN_CRE_001
				
				group g_CSE_GEN_CRE_002 {
121

122 123 124 125
					/**
					 * @desc Check that the IUT accepts the creation of a  resource using structured resource identifier
					 * 
					 */
126
					testcase TC_CSE_GEN_CRE_002_CSR() runs on Tester system CseSystem {
127 128
						// Local variables
						                        
129 130 131 132
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_cseRelative));
						v_ae1.done;
133
					}
134

135
					testcase TC_CSE_GEN_CRE_002_SPR() runs on Tester system CseSystem {
136 137
						// Local variables
						
138 139 140 141
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_spRelative));
						v_ae1.done;
142
					}
143
					
144
					testcase TC_CSE_GEN_CRE_002_ABS() runs on Tester system CseSystem {
145 146
						// Local variables
							
147 148 149 150
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_absolute));
						v_ae1.done;
151
					}
152
				
153
				} // end of group g_CSE_GEN_CRE_002
154
				
155 156 157 158 159 160 161 162 163
			} // 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
					 * 
					 */
164
					testcase TC_CSE_GEN_RET_001_CSR() runs on Tester system CseSystem {
165 166
						// Local variables
						                        
167 168 169 170
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_cseRelative));
						v_ae1.done;
171
					}
172

173
					testcase TC_CSE_GEN_RET_001_SPR() runs on Tester system CseSystem {
174 175
						// Local variables
						
176 177 178 179
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_spRelative));
						v_ae1.done;
180
					}
181
					
182
					testcase TC_CSE_GEN_RET_001_ABS() runs on Tester system CseSystem {
183
						// Local variables
184 185 186 187
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_absolute));
						v_ae1.done;
188 189
					}
								
190
				
191 192 193 194 195 196 197 198
				} // 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
					 * 
					 */
199
					testcase TC_CSE_GEN_RET_002_CSR() runs on Tester system CseSystem {
200
						// Local variables
201 202 203 204
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_cseRelative));
						v_ae1.done;
205
					}
206

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

232 233 234 235
					/**
					 * @desc Check that the IUT accepts the update of a <container>  resource using unstructured resource identifier
					 * 
					 */
236
					testcase TC_CSE_GEN_UPD_001_CSR() runs on Tester system CseSystem {
237
						// Local variables
238 239 240 241
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_cseRelative));
						v_ae1.done;
242
					}
243

244
					testcase TC_CSE_GEN_UPD_001_SPR() runs on Tester system CseSystem {
245
						// Local variables
246 247 248 249
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_spRelative));
						v_ae1.done;
250
					}
251
					
252
					testcase TC_CSE_GEN_UPD_001_ABS() runs on Tester system CseSystem {
253 254
						// Local variables
							
255 256 257 258
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_absolute));
						v_ae1.done;
259 260
					}
								
261 262 263 264 265 266 267 268
				} // 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
					 * 
					 */
269
					testcase TC_CSE_GEN_UPD_002_CSR() runs on Tester system CseSystem {
270 271
						// Local variables
						                        
272 273 274 275
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_cseRelative));
						v_ae1.done;
276 277
					}

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

303 304 305 306
					/**
					 * @desc Check that the IUT accepts the deletion of a <container>  resource using unstructured resource identifier
					 *  
					 */
307
					testcase TC_CSE_GEN_DEL_001_CSR() runs on Tester system CseSystem {
308 309
						// Local variables
						                        
310 311 312 313
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_cseRelative));
						v_ae1.done;
314 315
					}

316
					testcase TC_CSE_GEN_DEL_001_SPR() runs on Tester system CseSystem {
317 318
						// Local variables
						
319 320 321 322
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_spRelative));
						v_ae1.done;
323
					}
324
					
325
					testcase TC_CSE_GEN_DEL_001_ABS() runs on Tester system CseSystem {
326 327
						// Local variables
							
328 329 330 331
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_absolute));
						v_ae1.done;
332 333 334 335 336 337 338 339 340 341
					}
								
				} // 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
					 * 
					 */
342
					testcase TC_CSE_GEN_DEL_002_CSR() runs on Tester system CseSystem {
343 344
						// Local variables
						                        
345 346 347 348
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_cseRelative));
						v_ae1.done;
349 350
					}

351
					testcase TC_CSE_GEN_DEL_002_SPR() runs on Tester system CseSystem {
352
						// Local variables
353
						
354 355 356 357
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_spRelative));
						v_ae1.done;
358
					}
359
					
360
					testcase TC_CSE_GEN_DEL_002_ABS() runs on Tester system CseSystem {
361 362
						// Local variables
							
363 364 365 366
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_absolute));
						v_ae1.done;
367 368 369 370 371 372 373 374 375 376 377 378 379
					}
								
				} // end of group g_CSE_GEN_DEL_002
				
			} // end of group Delete
		
		} // end of group Generic
		
		group Registration {
			
			group Create{
				
				/**
380
				 * @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.  
381 382
				 * 
				 */
383 384 385 386 387 388 389 390 391 392 393
				testcase TC_CSE_REG_CRE_001() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					
					v_ae1.start(f_CSE_REG_CRE_001());
		  	  	
		  	  		v_ae1.done;
		  	  		
				}
				
				function f_CSE_REG_CRE_001() runs on AeSimu {
394
		  	  	
395
					var MsgIn v_response;
396
					var RequestPrimitive v_request;
397 398
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
399
					var universal charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AE-ID is allowed to register: " & PX_ALLOWED_C_AE_IDS[0];
400
					
401 402 403 404 405 406
					//Test control
					if(not(PICS_IN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case");
						stop;
					}
	                
407 408
					// Test component configuration
					f_cf01Up();
409 410
	                
					//Preamble
411
					action(v_action);
412
					f_sleepIgnoreDef(PX_TCONFIG_IUT);
413
					
414
					//Test Body
Miguel Angel Reina Ortega's avatar
Fix #37  
Miguel Angel Reina Ortega committed
415
					v_request := valueof(m_createAe(PX_APP_ID, omit, PX_CSE_ID & "/" & PX_ALLOWED_C_AE_IDS[0]));	
416
					
417
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
418
					
419
					mcaPort.send(m_request(v_request));
420
					
421 422
					tc_ac.start;
					alt {
423
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
424
							tc_ac.stop;
425 426 427
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							
428
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
429
						}
430
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
431
							tc_ac.stop;
432
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
433 434
						}
						[] tc_ac.timeout {
435
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
436 437
						}
					}	
438
									
439
					// Postamble
440 441 442 443
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
444 445
						
				}
446 447
		  	  	
				/**
448
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned AE_ID of AE-ID-Stem format.
449 450
				 * 
				 */
451 452 453 454 455 456 457 458 459 460 461
				testcase TC_CSE_REG_CRE_002() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
					v_ae1.start(f_CSE_REG_CRE_002());
			  	  	
					v_ae1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_002() runs on AeSimu {
462
		  	  	
463
					var MsgIn v_response;
464
					var RequestPrimitive v_request;
465 466
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
467 468
					
					//Test control
469
	                
470 471
					// Test component configuration
					f_cf01Up();
472
		  	  	
473
					//Preamble
474
					
475
					//Test Body
476
					v_request := valueof(m_createAe(PX_APP_ID, omit, PX_ALLOWED_C_AE_IDS[0]));				
477
	    									
478
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
479
	
480 481 482
					mcaPort.send(m_request(v_request));
					tc_ac.start;
					alt {
483
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
484
							tc_ac.stop;
485 486 487
							
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
488
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
489
						}
490
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
491
							tc_ac.stop;
492
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
493 494
						}
						[] tc_ac.timeout {
495
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
496 497
						}
					}	
498
									
499
					// Postamble
500 501 502 503
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
504
						
505
				}
506 507

				/**
508 509 510
				 * @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. 
				 */
				
511 512 513 514 515 516 517 518 519 520 521
				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());
			  	  	
					v_cse1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_003() runs on CseSimu {
522 523 524 525
					
					var integer v_remoteCseIndex := -1;
					
					//Test Configuration
526
					//f_cf02Up();
527 528 529
					
					//Preamble
					v_remoteCseIndex := f_cse_registrationRemoteCse();
530
					vc_ae1 := AeSimu.create("AE1") alive;
531
					vc_ae1.start(f_cse_preamble_registerAe());
532 533
					
				
534
				}
535 536 537 538 539
		  	  	
				/**
				 * @desc Check that the IUT rejects an AE registration (allowed App-ID, not allowed C-AE-ID-STEM provided by AE) 
				 * 
				 */
540 541 542 543 544 545 546 547 548 549 550
				testcase TC_CSE_REG_CRE_004() runs on Tester system CseSystem {
					
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
					v_ae1.start(f_CSE_REG_CRE_004());
			  	  	
					v_ae1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_004() runs on AeSimu {
551
		  	  	
552
					var MsgIn v_response;
553
					var RequestPrimitive v_request;
554 555
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
556
					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];
557 558
					
					//Test control
559
	                
560
					// Test component configuration
561
					f_cf01Up();
562
		  	  	
563
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
564
					//vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
565
					//TODO: create serviceSubscribedProfile, Node, and serviceSubscribedAppRule
566
					//v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile({"C*"}); //c_CRUDNDi);
567
					action(v_action);
568
					f_sleepIgnoreDef(PX_TCONFIG_IUT);
569
					
570
					//Test Body	
571
					//v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));				
572
	    											
573
					v_request := f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, PX_NOT_ALLOWED_C_AE_IDS[0]), -1);
574
			
575
					mcaPort.send(m_request(v_request));
576 577
					tc_ac.start;
					alt {
578
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4107))) {
579
							tc_ac.stop;
580
							setverdict(pass, __SCOPE__ & ": AE creation rejected.");
581
						}
582
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response{
583
							tc_ac.stop;
584
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
585
						}
586 587 588 589 590 591
						[] 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);
						}
592
						[] tc_ac.timeout {
593
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
594
						}
595
					}
596
									
597
					// Postamble
598
					f_cse_postamble_deleteResources();
599
						
600
					// Tear down
601
					f_cf01Down();
602 603
						
				}
604 605 606 607 608
		  	  	
				/**
				 * @desc Check that the IUT accepts an AE registration (allowed App-ID, S-AE-ID-STEM not provided by AE) 
				 * 
				 */
609 610 611 612 613 614 615 616 617 618 619
				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());
			  	  	
					v_cse1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_005() runs on CseSimu {
620
		  	  	
621 622
		  	  		var MsgIn v_request;
					var template RequestPrimitive v_requestPrimitive;
623 624
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
625
					var boolean v_handleResponses := false;
626 627
					
					//Test control
628
	                
629
					// Test component configuration
630
					f_cf02UpCseSimuMaster();
631
		  	  	
632
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
633
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
634 635
		
					//Test Body
636 637
					vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, -, "S", omit)));
					vc_ae1.done;
638
					
639 640
					v_requestPrimitive := mw_createAEAnnc(PX_CSE_ID & "/S", -, -, -);
					v_requestPrimitive.primitiveContent.aEAnnc.app_ID := PX_APP_ID;
641
	    									
642 643
					tc_ac.start;
					alt{
644
						[] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request {
645 646
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
647
							v_handleResponses := true;
648
						}
649
						[] mccPortIn.receive(mw_request(mw_createAEAnnc())) -> value v_request {
650
							tc_ac.stop;
651
							setverdict(fail, __SCOPE__ & ": AE creation redirected but wrong parameters");
652
							v_handleResponses := true;
653
						}
654
						[] mccPortIn.receive(mw_request(?))-> value v_request {
655 656
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Unexpected message received");
657
							v_handleResponses := true;
658 659 660 661 662
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}
663
									
664
					// Postamble
665 666 667 668 669
					if (v_handleResponses) {
						vc_ae1.start(f_cse_receiveResponse());
						f_cse_sendResponse(v_request);
						vc_ae1.done;
					}
670
					f_cse_postamble_deleteResourcesCSE();
671 672
					
					// Tear down
673
					f_cf02DownCseSimuMaster();
674 675
						
				}
676 677 678 679 680
				
				/**
				 * @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 
				 * 
				 */
681 682 683 684 685 686 687 688 689 690 691
				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;
				  	  		
				}
						
				function f_CSE_REG_CRE_006() runs on CseSimu {
692 693 694 695 696 697 698 699 700 701 702 703 704 705

					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
	
					//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
					f_cf02UpCseSimuMaster();

706
					//Preamble
707 708 709
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
					
					//Test Body
710
					vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S")));
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736
					vc_ae1.done;
							
					tc_ac.start;

					alt {
						[] mccPortIn.receive(mw_request(mw_createAEAnnc(PX_CSE_ID, f_getLocalResourceAddress(vc_cSEBaseIndex), -, "S"))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
					
					// 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 
				 * 
				 */
737 738 739 740 741 742 743 744 745 746 747
				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;
			  	  		
				}
					
				function f_CSE_REG_CRE_007() runs on AeSimu {
748 749 750 751 752 753 754 755 756 757 758 759 760 761

					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
					
					// Test component configuration
					f_cf02Up();
					
762
					//Preamble
763 764
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
					vc_cse1.done;
765 766
			
					mcaPort.send(m_request(f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S"),-1)));
767
					
768
					vc_cse1.start(f_cse_announcementProcedure_createHandler());
769 770 771 772 773 774
					vc_cse1.done;
					
					//Test Body
					tc_ac.start;
					
					alt {
775
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799
							tc_ac.stop;
							//continue to test the content
							if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){
								if (v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID == PX_APP_ID){
									setverdict(pass, __SCOPE__ & ": AE creation success.");
								}else{
									setverdict(fail, __SCOPE__ & ": Error in AE content.");
								}
							}else{
								setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist");
							}
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf02Down();

				}	// end of TC_CSE_REG_CRE_007
800

801 802 803 804
				/**
				 * @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 
				 * 
				 */
805 806 807 808 809 810 811 812 813 814 815
				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;
				  	  		
				}
						
				function f_CSE_REG_CRE_008() runs on CseSimu {
816
		  	  	
817
					var RequestPrimitive v_request;
818 819
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
820 821 822 823 824 825
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
826
	                
827
					// Test component configuration
828
					f_cf02UpCseSimuMaster();
829
		  	  	
830
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
831
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
832
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
833
					
834 835
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
								
836
					
837 838 839 840
					//TODO:
					//v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex)));
					//mcaPort.send(m_request(v_request));
					
841
					//Test Body
842
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
843
											
844
					tc_ac.start;
845
	
846
					alt {
847
						[] mccPortIn.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", "CSE_ID", -))) {
848 849 850
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
						}
851
						[] mccPortIn.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", "CSE_ID", -))) {
852
							tc_ac.stop;
853
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
854
						}
855
						[] mccPortIn.receive {
856
							tc_ac.stop;
857
							setverdict(fail, __SCOPE__ & ": Error while creating AE");
858 859
						}
						[] tc_ac.timeout {
860
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
861 862
						}
					}