OneM2M_Testcases_CSE_Release_1.ttcn 482 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 34 35 36 37 38 39 40 41 42
			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 {
43 44 45
				
				timer t_ac := 5.0;
				var integer i; 
46 47
				var XSD.ID v_resourceAddress;
				var RequestPrimitive v_request;
48 49 50
				map(self:mcaPort, system:mcaPort); 
					
				for (i:=0; i<lengthof(PX_RESOURCES_TO_BE_DELETED); i:= i+1) {  
51 52 53
					
					v_resourceAddress := f_getResourceAddress() & "/" & PX_RESOURCES_TO_BE_DELETED[i]; 
						
54 55
					v_request := valueof(m_delete(v_resourceAddress, PX_SUPER_AE_ID));
					    
56
					f_send(e_mca_port, m_request(v_request));
57
					
58 59
					t_ac.start;
					alt {
60
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
61
							t_ac.stop;
62
							log(__SCOPE__ & ":Resource deleted");
63
							//setverdict(pass);
64
						}
65
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
66
							t_ac.stop;
67
							log(__SCOPE__ & ":Error while deleting resource");
68
							//setverdict(fail);
69 70 71
						}
						[] mcaPort.receive {
							t_ac.stop;
72
							log(__SCOPE__ & ":Unexpected message received");
73
							//setverdict(inconc);
74 75
						}
						[] t_ac.timeout {
76
							log(__SCOPE__ & ":No answer while deleting resource");
77
							//setverdict(inconc);
78 79 80 81 82 83 84 85
						}	
					}	
				}
			
				unmap(self:mcaPort, system:mcaPort); 
				stop;
			}	
		
86
		}//end group helpingTestCases
87 88 89 90 91
	
	}//end group oneM2M_demos
	
	group CSE {
		
92 93 94 95 96 97 98 99 100
		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
					 * 
					 */
101
					testcase TC_CSE_GEN_CRE_001_CSR() 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_cseRelative));
						v_ae1.done;
108
					}
109

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

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

131 132 133 134
					/**
					 * @desc Check that the IUT accepts the creation of a  resource using structured resource identifier
					 * 
					 */
135
					testcase TC_CSE_GEN_CRE_002_CSR() 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_cseRelative));
						v_ae1.done;
142
					}
143

144
					testcase TC_CSE_GEN_CRE_002_SPR() 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_spRelative));
						v_ae1.done;
151
					}
152
					
153
					testcase TC_CSE_GEN_CRE_002_ABS() runs on Tester system CseSystem {
154 155
						// Local variables
							
156 157 158 159
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_absolute));
						v_ae1.done;
160
					}
161
				
162
				} // end of group g_CSE_GEN_CRE_002
163
				
164 165 166 167 168 169 170 171 172
			} // 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
					 * 
					 */
173
					testcase TC_CSE_GEN_RET_001_CSR() 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_cseRelative));
						v_ae1.done;
180
					}
181

182
					testcase TC_CSE_GEN_RET_001_SPR() runs on Tester system CseSystem {
183 184
						// Local variables
						
185 186 187 188
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_spRelative));
						v_ae1.done;
189
					}
190
					
191
					testcase TC_CSE_GEN_RET_001_ABS() runs on Tester system CseSystem {
192
						// Local variables
193 194 195 196
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_absolute));
						v_ae1.done;
197 198
					}
								
199
				
200 201 202 203 204 205 206 207
				} // 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
					 * 
					 */
208
					testcase TC_CSE_GEN_RET_002_CSR() runs on Tester system CseSystem {
209
						// Local variables
210 211 212 213
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_cseRelative));
						v_ae1.done;
214
					}
215

216
					testcase TC_CSE_GEN_RET_002_SPR() 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_spRelative));
						v_ae1.done;
223
					}
224
					
225
					testcase TC_CSE_GEN_RET_002_ABS() runs on Tester system CseSystem {
226 227
						// Local variables
							
228 229 230 231
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_absolute));
						v_ae1.done;
232 233
					}
								
234 235 236
				} // end of group g_CSE_GEN_RET_002
				
			} // end of group Retrieve
237
			
238 239
			group Update {
				group g_CSE_GEN_UPD_001 {
240

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

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

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

312 313 314 315
					/**
					 * @desc Check that the IUT accepts the deletion of a <container>  resource using unstructured resource identifier
					 *  
					 */
316
					testcase TC_CSE_GEN_DEL_001_CSR() 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_cseRelative));
						v_ae1.done;
323 324
					}

325
					testcase TC_CSE_GEN_DEL_001_SPR() 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_spRelative));
						v_ae1.done;
332
					}
333
					
334
					testcase TC_CSE_GEN_DEL_001_ABS() runs on Tester system CseSystem {
335 336
						// Local variables
							
337 338 339 340
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_absolute));
						v_ae1.done;
341 342 343 344 345 346 347 348 349 350
					}
								
				} // 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
					 * 
					 */
351
					testcase TC_CSE_GEN_DEL_002_CSR() runs on Tester system CseSystem {
352 353
						// Local variables
						                        
354 355 356 357
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_cseRelative));
						v_ae1.done;
358 359
					}

360
					testcase TC_CSE_GEN_DEL_002_SPR() runs on Tester system CseSystem {
361
						// Local variables
362
						
363 364 365 366
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_spRelative));
						v_ae1.done;
367
					}
368
					
369
					testcase TC_CSE_GEN_DEL_002_ABS() runs on Tester system CseSystem {
370 371
						// Local variables
							
372 373 374 375
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_absolute));
						v_ae1.done;
376 377 378 379 380 381 382 383 384 385 386 387 388
					}
								
				} // end of group g_CSE_GEN_DEL_002
				
			} // end of group Delete
		
		} // end of group Generic
		
		group Registration {
			
			group Create{
				
				/**
389
				 * @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.  
390 391
				 * 
				 */
392
				group g_CSE_REG_CRE_001 {
393
					
394
					testcase TC_CSE_REG_CRE_001_CAE() runs on Tester system CseSystem {
395
					
396 397 398 399 400 401
						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;
			  	  		
					}
402
					
403 404 405 406 407 408 409 410
					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;
			  	  		
					}
411
					
412
				}//end group g_CSE_REG_CRE_001 
413

414
				/**
415
				 * @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.
416 417
				 * 
				 */
418 419 420
				group g_CSE_REG_CRE_002 {

					testcase TC_CSE_REG_CRE_002_CAE() runs on Tester system CseSystem {
421
						
422 423 424 425 426 427
						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;
				  	  		
					}
428
						
429 430 431 432 433 434 435 436 437 438
					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 
439 440

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

651 652
					var MsgIn v_request;
					var template RequestPrimitive v_requestPrimitive;
653
					var integer v_cseBaseIndex := -1;
654 655
					const  charstring v_cseId := PX_CSE_ID;
					template XSD.AnyURI v_link := pattern "{v_cseId}/?*";
656 657 658 659 660 661 662 663
	
					//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
664
					f_cf02UpCseSimuMaster(int1);
665

666
					//Preamble
667 668 669
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
					
					//Test Body
670 671 672 673
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, "S")));
					
					v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/S", -, -, v_link);
					
674 675 676
					tc_ac.start;

					alt {
677
						[] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request {
678 679
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
680 681 682 683 684 685
							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);
686 687 688 689 690 691
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
					
692 693
					vc_ae1.done;
					
694 695 696 697 698 699 700 701 702 703 704 705
					// 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 
				 * 
				 */
706 707 708 709 710 711 712 713 714 715 716
				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 {
717 718

					var MsgIn v_response;
719
					var template RequestPrimitive v_requestPrimitive;
720
					var integer v_aeIndex := -1;
721 722 723
					var integer v_aeAnncIndex := -1;
					const  charstring v_cseId := PX_CSE_ID;
					template XSD.AnyURI v_link := pattern "{v_cseId}/?*";
724 725 726 727 728 729 730 731
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
					
					// Test component configuration
732
					f_cf02Up(int1);
733
					
734
					//Preamble
735 736
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
					vc_cse1.done;
737
			
738
					v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/S", -, -, v_link);
739
					
740 741
					vc_cse1.start(f_cse_announcementProcedure_createHandler(v_requestPrimitive));
					
742
					f_send(e_mca_port, m_request(f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S"),-1)));
743 744 745 746
					
					//Test Body
					tc_ac.start;
					alt {
747
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
748
							tc_ac.stop;
749
							
750 751 752 753 754
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
755 756 757 758 759 760 761 762 763 764 765 766 767 768
					
					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");
				  	}	
769 770 771 772 773 774 775
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf02Down();

				}	// end of TC_CSE_REG_CRE_007
776

777 778 779 780
				/**
				 * @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 
				 * 
				 */
781 782 783 784 785 786 787 788 789 790 791
				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 {
792
		  	  	
793
					var RequestPrimitive v_request;
794
					var template RequestPrimitive v_updateAeAnnc := mw_updateAEAnnc;
795
					var integer v_cseBaseIndex := -1;
796 797 798
					var integer v_aeIndex := -1;
					var integer v_aeIndex_ae1 := -1;
					var integer v_aeAnncIndex := -1;
799
					var ResourceType v_resourceType := int2;
800 801 802 803 804 805
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
806
	                
807
					// Test component configuration
808
					f_cf02UpCseSimuMaster(int1);
809
		  	  	
810
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
811
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
812
					
813
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
814
					
815 816
					v_aeAnncIndex := f_cse_announcementProcedure_createHandler(-, -, -);
					
817
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
818
					
819 820 821 822 823 824
					v_aeIndex_ae1 := f_getLatestResourceIndex(vc_ae1);
					
					v_aeIndex := f_getLatestResource(vc_ae1);
					
					vc_ae1.start(f_cse_deleteResource(v_aeIndex_ae1));
					
825 826
					v_updateAeAnnc.primitiveContent.aEAnnc.link := "INACTIVE";
					f_cse_announcementProcedure_updateHandler(v_updateAeAnnc, -, v_aeAnncIndex);
827 828
					
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
829
					
830
					//Test Body
831
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, vc_resourcesList[v_aeIndex].resource.aE.aE_ID)));
832
											
833
					tc_ac.start;
834
	
835
					alt {
836
						[] mccPortIn.receive(mw_request(mw_updateAEAnnc)) -> value vc_request {
837
							tc_ac.stop;
838 839
							setverdict(pass, __SCOPE__ & ": AE Announced UPDATE received");
							f_processUpdateRequestPrimitive(vc_request.primitive.requestPrimitive);
840
							f_send(e_mcc_in_port, m_response(vc_response.primitive.responsePrimitive));
841
						}
842
						[] mccPortIn.receive(mw_request(mw_update)) {
843
							tc_ac.stop;
844
							setverdict(fail, __SCOPE__ & ": Wrong UPDATE request received ");
845 846
						}
						[] tc_ac.timeout {
847
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
848 849
						}
					}	
850 851
					
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
852
									
853
					// Postamble
854
					f_cse_postamble_deleteResourcesCSE();
855 856
					
					// Tear down
857
					f_cf02DownCseSimuMaster();