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

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

						v_ae1.start(f_CSE_GEN_CRE_001(e_spRelative));
						v_ae1.done;
107
					}
108
					
109
					testcase TC_CSE_GEN_CRE_001_ABS() runs on Tester system CseSystem {
110
						// Local variables
111 112 113 114
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_001(e_absolute));
						v_ae1.done;
115 116
					}
								
117
					function f_CSE_GEN_CRE_001(in PrimitiveScope p_primitiveScope) runs on AeSimu {
118 119 120 121 122
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
123 124
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
125 126 127 128 129 130 131 132 133 134 135 136 137 138
											   
						// Test control
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
139
					
140 141 142 143
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
144 145
						v_addressingMethod := e_nonHierarchical;
						v_primitiveScope := p_primitiveScope;
146
						v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_resourceIndex);
147
						v_request.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource created using non-hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating container resource using non-hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_CRE_001				
176
				
177 178 179 180
				
				} // end of group g_CSE_GEN_CRE_001
				
				group g_CSE_GEN_CRE_002 {
181

182 183 184 185
					/**
					 * @desc Check that the IUT accepts the creation of a  resource using structured resource identifier
					 * 
					 */
186
					testcase TC_CSE_GEN_CRE_002_CSR() runs on Tester system CseSystem {
187 188
						// Local variables
						                        
189 190 191 192
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_cseRelative));
						v_ae1.done;
193
					}
194

195
					testcase TC_CSE_GEN_CRE_002_SPR() runs on Tester system CseSystem {
196 197
						// Local variables
						
198 199 200 201
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_spRelative));
						v_ae1.done;
202
					}
203
					
204
					testcase TC_CSE_GEN_CRE_002_ABS() runs on Tester system CseSystem {
205 206
						// Local variables
							
207 208 209 210
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_absolute));
						v_ae1.done;
211 212
					}
								
213
					function f_CSE_GEN_CRE_002(in PrimitiveScope p_primitiveScope) runs on AeSimu {
214 215 216 217 218
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
219 220
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
221 222 223 224 225 226 227 228 229 230 231 232 233 234
											   
						// Test control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
235
					
236 237 238 239
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
240 241
						v_addressingMethod := e_hierarchical;
						v_primitiveScope := p_primitiveScope;
242
						v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_resourceIndex);
243 244
						v_request.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
												
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
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource created using hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating container resource using hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_CRE_002				
272 273
				
				
274
				} // end of group g_CSE_GEN_CRE_002
275
				
276 277 278 279 280 281 282 283 284
			} // 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
					 * 
					 */
285
					testcase TC_CSE_GEN_RET_001_CSR() runs on Tester system CseSystem {
286 287
						// Local variables
						                        
288 289 290 291
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_cseRelative));
						v_ae1.done;
292
					}
293

294
					testcase TC_CSE_GEN_RET_001_SPR() runs on Tester system CseSystem {
295 296
						// Local variables
						
297 298 299 300
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_spRelative));
						v_ae1.done;
301
					}
302
					
303
					testcase TC_CSE_GEN_RET_001_ABS() runs on Tester system CseSystem {
304
						// Local variables
305 306 307 308
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_absolute));
						v_ae1.done;
309 310
					}
								
311
					function f_CSE_GEN_RET_001(in PrimitiveScope p_primitiveScope) runs on AeSimu {
312 313 314 315
    				
						// Local variables
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
316 317
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
318 319 320 321 322 323 324 325 326 327 328 329 330 331
											   
						// Test control
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
332
					
333
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
334
					
335 336
						// Test Body
						//Force usage of Non-Hierarchical addressing method
337 338
						v_addressingMethod := e_nonHierarchical;
						v_primitiveScope := p_primitiveScope;
339
						
340
						mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope), f_getOriginator(v_resourceIndex))));
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource retrieved using non-hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving container resource using non-hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
362
					
363 364
						// Tear down
						f_cf01Down();
365
    				
366
					}//end f_CSE_GEN_RET_001				
367 368
				
				
369 370 371 372 373 374 375 376
				} // 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
					 * 
					 */
377
					testcase TC_CSE_GEN_RET_002_CSR() runs on Tester system CseSystem {
378
						// Local variables
379 380 381 382
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_cseRelative));
						v_ae1.done;
383
					}
384

385
					testcase TC_CSE_GEN_RET_002_SPR() runs on Tester system CseSystem {
386 387
						// Local variables
						
388 389 390 391
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_spRelative));
						v_ae1.done;
392
					}
393
					
394
					testcase TC_CSE_GEN_RET_002_ABS() runs on Tester system CseSystem {
395 396
						// Local variables
							
397 398 399 400
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_absolute));
						v_ae1.done;
401 402
					}
								
403
					function f_CSE_GEN_RET_002(in PrimitiveScope p_primitiveScope) runs on AeSimu {
404 405 406 407
    				
						// Local variables
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
408 409
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
410 411 412 413 414 415 416 417 418 419 420 421 422 423
											   
						// Test control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
424
					
425 426 427 428
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
429 430
						v_addressingMethod := e_hierarchical;
						v_primitiveScope := p_primitiveScope;
431
						
432
						mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope), f_getOriginator(v_resourceIndex))));tc_ac.start;
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
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource retrieved using hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving container resource using hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_RET_002				
				
				} // end of group g_CSE_GEN_RET_002
				
			} // end of group Retrieve
462
			
463 464
			group Update {
				group g_CSE_GEN_UPD_001 {
465

466 467 468 469
					/**
					 * @desc Check that the IUT accepts the update of a <container>  resource using unstructured resource identifier
					 * 
					 */
470
					testcase TC_CSE_GEN_UPD_001_CSR() runs on Tester system CseSystem {
471
						// Local variables
472 473 474 475
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_cseRelative));
						v_ae1.done;
476
					}
477

478
					testcase TC_CSE_GEN_UPD_001_SPR() runs on Tester system CseSystem {
479
						// Local variables
480 481 482 483
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_spRelative));
						v_ae1.done;
484
					}
485
					
486
					testcase TC_CSE_GEN_UPD_001_ABS() runs on Tester system CseSystem {
487 488
						// Local variables
							
489 490 491 492
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_absolute));
						v_ae1.done;
493 494
					}
								
495
					function f_CSE_GEN_UPD_001(in PrimitiveScope p_primitiveScope) runs on AeSimu {
496 497 498 499 500
    				
						// Local variables
						var RequestPrimitive v_updateRequest := valueof(m_updateContainerBase);
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
501 502
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
503 504 505 506 507 508 509 510 511 512 513 514 515 516
											   
						// Test control
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
517
					
518
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
519
					
520 521
						// Test Body
						//Force usage of Non-Hierarchical addressing method
522 523
						v_addressingMethod := e_nonHierarchical;
						v_primitiveScope := p_primitiveScope;
524
						
525 526 527
						v_updateRequest.primitiveContent.container.labels := {"MyLabel"};
						
						v_updateRequest := f_getUpdateRequestPrimitive(int3, v_resourceIndex, v_updateRequest);
528
						v_updateRequest.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551
						
						mcaPort.send(m_request(v_updateRequest));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource updated using non-hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while updating container resource using non-hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
552
					
553 554 555 556
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_UPD_001				
557
				
558 559 560 561 562 563 564 565
				} // 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
					 * 
					 */
566
					testcase TC_CSE_GEN_UPD_002_CSR() runs on Tester system CseSystem {
567 568
						// Local variables
						                        
569 570 571 572
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_cseRelative));
						v_ae1.done;
573 574
					}

575
					testcase TC_CSE_GEN_UPD_002_SPR() runs on Tester system CseSystem {
576 577
						// Local variables
						
578 579 580 581
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_spRelative));
						v_ae1.done;
582
					}
583
					
584
					testcase TC_CSE_GEN_UPD_002_ABS() runs on Tester system CseSystem {
585
						// Local variables
586
							
587 588 589 590
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_absolute));
						v_ae1.done;
591
					}
592
								
593
					function f_CSE_GEN_UPD_002(in PrimitiveScope p_primitiveScope) runs on AeSimu {
594
    				
595 596 597 598
						// Local variables
						var RequestPrimitive v_updateRequest := valueof(m_updateContainerBase);
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
599 600
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
601 602 603 604 605 606
											   
						// Test control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
607
    				
608 609
						// Test component configuration
						f_cf01Up();
610
    				
611
						// Test adapter configuration
612
    				
613 614 615 616 617 618 619
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
620 621
						v_addressingMethod := e_hierarchical;
						v_primitiveScope := p_primitiveScope;
622 623 624 625
						
						v_updateRequest.primitiveContent.container.labels := {"MyLabel"};
						
						v_updateRequest := f_getUpdateRequestPrimitive(int3, v_resourceIndex, v_updateRequest);
626
						v_updateRequest.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
627 628 629 630 631 632 633
						
						mcaPort.send(m_request(v_updateRequest));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource updated using hierarchical addressing method");
634
							}
635 636 637 638 639 640 641 642 643 644 645 646
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while updating container resource using hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource");
							}
						}	
647
    								
648 649
						// Postamble
						f_cse_postamble_deleteResources();
650
					
651 652
						// Tear down
						f_cf01Down();
653
    				
654 655 656 657 658 659
					}//end f_CSE_GEN_UPD_002				
				
				
				} // end of group g_CSE_GEN_UPD_002
				
			} // end of group Update
660
			
661 662
			group Delete {
				group g_CSE_GEN_DEL_001 {
663

664 665 666 667
					/**
					 * @desc Check that the IUT accepts the deletion of a <container>  resource using unstructured resource identifier
					 *  
					 */
668
					testcase TC_CSE_GEN_DEL_001_CSR() runs on Tester system CseSystem {
669 670
						// Local variables
						                        
671 672 673 674
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_cseRelative));
						v_ae1.done;
675 676
					}

677
					testcase TC_CSE_GEN_DEL_001_SPR() runs on Tester system CseSystem {
678 679
						// Local variables
						
680 681 682 683
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_spRelative));
						v_ae1.done;
684
					}
685
					
686
					testcase TC_CSE_GEN_DEL_001_ABS() runs on Tester system CseSystem {
687 688
						// Local variables
							
689 690 691 692
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_absolute));
						v_ae1.done;
693 694
					}
								
695
					function f_CSE_GEN_DEL_001(in PrimitiveScope p_primitiveScope) runs on AeSimu {
696 697 698 699 700
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
701 702
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
703 704 705 706 707 708 709 710 711 712 713 714 715 716
											   
						// Test control
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
717
					
718
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
719
					
720 721
						// Test Body
						//Force usage of Non-Hierarchical addressing method
722 723
						v_addressingMethod := e_nonHierarchical;
						v_primitiveScope := p_primitiveScope;
724
						
725
						v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope), f_getOriginator(v_resourceIndex)));
726
												
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource deleted using non-hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while deleting container resource using non-hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
749
					
750 751 752 753 754 755 756 757 758 759 760 761 762 763
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_DEL_001				
				
				
				} // 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
					 * 
					 */
764
					testcase TC_CSE_GEN_DEL_002_CSR() runs on Tester system CseSystem {
765 766
						// Local variables
						                        
767 768 769 770
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_cseRelative));
						v_ae1.done;
771 772
					}

773
					testcase TC_CSE_GEN_DEL_002_SPR() runs on Tester system CseSystem {
774
						// Local variables
775
						
776 777 778 779
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_spRelative));
						v_ae1.done;
780
					}
781
					
782
					testcase TC_CSE_GEN_DEL_002_ABS() runs on Tester system CseSystem {
783 784
						// Local variables
							
785 786 787 788
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_absolute));
						v_ae1.done;
789 790
					}
								
791
					function f_CSE_GEN_DEL_002(in PrimitiveScope p_primitiveScope) runs on AeSimu {
792 793 794 795 796
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
797 798
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
799 800 801 802 803 804 805 806 807 808 809 810 811 812
											   
						// Test control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
813
					
814
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
815
					
816 817
						// Test Body
						//Force usage of Non-Hierarchical addressing method
818 819
						v_addressingMethod := e_hierarchical;
						v_primitiveScope := p_primitiveScope;
820
						
821
						v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope), f_getOriginator(v_resourceIndex)));
822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource deleted using hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while deleting container resource using hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
845
					
846 847
						// Tear down
						f_cf01Down();
848
    				
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865
					}//end f_CSE_GEN_DEL_002				
				
				
				} // end of group g_CSE_GEN_DEL_002
				
			} // end of group Delete
		
		} // end of group Generic
		
		group Registration {
			
			group Create{
				
				/**
				 * @desc Check that the IUT accepts an AE registration (allowed App-ID, C-AE-ID-STEM not provided by AE)  
				 * 
				 */
866
				testcase TC_CSE_REG_CRE_001() runs on AeSimu system CseSystem {
867
		  	  	
868
					var MsgIn v_response;
869
					var RequestPrimitive v_request;
870 871 872
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
	                
873 874
					// Test component configuration
					f_cf01Up();
875 876
	                
					//Preamble
877
					v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile({"S*"}); //c_CRUDNDi);
878 879 880 881
					
					//Test Body
					v_request := valueof(m_createAe(PX_APP_ID, omit, omit));	
					
882
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
883
					
884
					mcaPort.send(m_request(v_request));
885
					
886 887
					tc_ac.start;
					alt {
888
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) {
889
							tc_ac.stop;
890
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
891
						}
892
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
893
							tc_ac.stop;
894
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
895 896
						}
						[] tc_ac.timeout {
897
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
898 899
						}
					}	
900
									
901
					// Postamble
902 903 904 905
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
906 907
						
				}
908 909 910 911 912
		  	  	
				/**
				 * @desc Check that the IUT sends a registration CREATE Request with the value of the attribute ATTRIBUTE_NAME  of the AE resource
				 * 
				 */
913
				testcase TC_CSE_REG_CRE_002() runs on AeSimu system CseSystem {
914
		  	  	
915
					var MsgIn v_response;
916
					var RequestPrimitive v_request;
917 918 919
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
	                
920 921
					// Test component configuration
					f_cf01Up();
922 923
		  	  	
					//Preambule
924
					
925 926 927
					//Test Body
					v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));				
	    									
928
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
929
	
930 931 932
					mcaPort.send(m_request(v_request));
					tc_ac.start;
					alt {
933
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) {
934
							tc_ac.stop;
935
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
936
						}
937
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
938
							tc_ac.stop;
939
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
940 941
						}
						[] tc_ac.timeout {
942
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
943 944
						}
					}	
945
									
946
					// Postamble
947 948 949 950
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
951 952
						
				}
953 954 955 956 957
		  	  	
				/**
				 * @desc Check that the IUT rejects an AE registration (allowed App-ID, not allowed C-AE-ID-STEM provided by AE) 
				 * 
				 */
958
				testcase TC_CSE_REG_CRE_004() runs on AeSimu system CseSystem {
959
		  	  	
960
					var MsgIn v_response;
961
					var RequestPrimitive v_request;
962 963 964
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
	                
965 966
					// Test component configuration
					f_cf01Up();
967 968
		  	  	
					//Preambule
969 970
					//vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase);
					//TODO: create serviceSubscribedProfile, Node, and serviceSubscribedAppRule
971
					//v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile({"C*"}); //c_CRUDNDi);
972
					
973
					//Test Body	
974
					//v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));				
975
	    											
976
					f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "C"));
977
			
978 979
					tc_ac.start;
					alt {
980
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) {
981
							tc_ac.stop;
982
							setverdict(pass, __SCOPE__ & ": AE creation rejected.");
983
						}
984
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4005))) -> value v_response{
985
							tc_ac.stop;
986
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
987 988
						}
						[] tc_ac.timeout {
989
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
990
						}
991
					}
992
									
993
					// Postamble
994
					f_cse_postamble_deleteResources();
995
						
996 997
					// Tear down
					f_cf01Down();
998 999
						
				}
1000 1001 1002 1003 1004
		  	  	
				/**
				 * @desc Check that the IUT accepts an AE registration (allowed App-ID, S-AE-ID-STEM not provided by AE) 
				 * 
				 */
1005
				testcase TC_CSE_REG_CRE_005() runs on InCseSimu system CseSystem {
1006
		  	  	
1007
					var RequestPrimitive v_request;
1008 1009 1010
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
	                
1011
					// Test component configuration
1012
					f_cf02UpCseSimuMaster();
1013 1014
		  	  	
					//Preambule
1015 1016
					//v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule({"S"});//c_CRUDNDi);
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase);
1017 1018
		
					//Test Body
1019
					vc_aeSimu.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, omit)));				
1020
	    									
1021
					//v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, v_cseBaseIndex);
1022
		  	  		
1023
					//mcaPort.send(m_request(v_request));
1024
					tc_ac.start;
1025
					alt{
1026 1027 1028 1029 1030
						[]mccPort.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", "CSE_ID", -))){
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
						}
						[]mccPort.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", "CSE_ID", -))){
1031
							tc_ac.stop;
1032
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
1033
						}
1034
						[] mccPort.receive {
1035
							tc_ac.stop;
Miguel Angel Reina Ortega's avatar