OneM2M_Testcases_CSE_Release_1.ttcn 447 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
				testcase TC_CSE_REG_CRE_001() runs on AeSimu system CseSystem {
384
		  	  	
385
					var MsgIn v_response;
386
					var RequestPrimitive v_request;
387 388
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
389 390
					var charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AE-ID is allowed to register: " & PX_ALLOWED_C_AE_IDS[0];
					
391 392 393 394 395 396
					//Test control
					if(not(PICS_IN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case");
						stop;
					}
	                
397 398
					// Test component configuration
					f_cf01Up();
399 400
	                
					//Preamble
401 402 403
					action(v_action);
					f_sleepIgnoreDef(30.0);
					
404
					//Test Body
405
					v_request := valueof(m_createAe(PX_APP_ID, omit, f_getResourceAddress(-1, -, e_spRelative) & "/" & PX_ALLOWED_C_AE_IDS[0]));	
406
					
407
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
408
					
409
					mcaPort.send(m_request(v_request));
410
					
411 412
					tc_ac.start;
					alt {
413
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
414
							tc_ac.stop;
415 416 417
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							
418
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
419
						}
420
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
421
							tc_ac.stop;
422
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
423 424
						}
						[] tc_ac.timeout {
425
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
426 427
						}
					}	
428
									
429
					// Postamble
430 431 432 433
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
434 435
						
				}
436 437 438 439 440
		  	  	
				/**
				 * @desc Check that the IUT sends a registration CREATE Request with the value of the attribute ATTRIBUTE_NAME  of the AE resource
				 * 
				 */
441
				testcase TC_CSE_REG_CRE_002() runs on AeSimu system CseSystem {
442
		  	  	
443
					var MsgIn v_response;
444
					var RequestPrimitive v_request;
445 446
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
447 448
					
					//Test control
449
	                
450 451
					// Test component configuration
					f_cf01Up();
452
		  	  	
453
					//Preamble
454
					
455 456 457
					//Test Body
					v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));				
	    									
458
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
459
	
460 461 462
					mcaPort.send(m_request(v_request));
					tc_ac.start;
					alt {
463
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
464
							tc_ac.stop;
465 466 467
							
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
468
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
469
						}
470
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
471
							tc_ac.stop;
472
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
473 474
						}
						[] tc_ac.timeout {
475
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
476 477
						}
					}	
478
									
479
					// Postamble
480 481 482 483
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
484
						
485
				}
486 487

				/**
488 489 490 491 492 493 494 495
				 * @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. 
				 */
				
				testcase TC_CSE_REG_CRE_003() runs on CseSimu system CseSystem{
					
					var integer v_remoteCseIndex := -1;
					
					//Test Configuration
496
					//f_cf02Up();
497 498 499
					
					//Preamble
					v_remoteCseIndex := f_cse_registrationRemoteCse();
500
					vc_ae1 := AeSimu.create("AE1") alive;
501
					vc_ae1.start(f_cse_preamble_registerAe());
502 503
					
				
504
				}
505 506 507 508 509
		  	  	
				/**
				 * @desc Check that the IUT rejects an AE registration (allowed App-ID, not allowed C-AE-ID-STEM provided by AE) 
				 * 
				 */
510
				testcase TC_CSE_REG_CRE_004() runs on AeSimu system CseSystem {
511
		  	  	
512
					var MsgIn v_response;
513
					var RequestPrimitive v_request;
514 515
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
516
					var charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AE-ID is not allowed to register: " & PX_NOT_ALLOWED_C_AE_IDS[0];
517 518
					
					//Test control
519
	                
520
					// Test component configuration
521
					f_cf01Up();
522
		  	  	
523
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
524
					//vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
525
					//TODO: create serviceSubscribedProfile, Node, and serviceSubscribedAppRule
526
					//v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile({"C*"}); //c_CRUDNDi);
527 528
					action(v_action);
					f_sleepIgnoreDef(30.0);
529
					
530
					//Test Body	
531
					//v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));				
532
	    											
533
					v_request := f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, PX_NOT_ALLOWED_C_AE_IDS[0]), -1);
534
			
535
					mcaPort.send(m_request(v_request));
536 537
					tc_ac.start;
					alt {
538
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) {
539
							tc_ac.stop;
540
							setverdict(pass, __SCOPE__ & ": AE creation rejected.");
541
						}
542
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4005))) -> value v_response{
543
							tc_ac.stop;
544
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
545 546
						}
						[] tc_ac.timeout {
547
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
548
						}
549
					}
550
									
551
					// Postamble
552
					f_cse_postamble_deleteResources();
553
						
554
					// Tear down
555
					f_cf01Down();
556 557
						
				}
558 559 560 561 562
		  	  	
				/**
				 * @desc Check that the IUT accepts an AE registration (allowed App-ID, S-AE-ID-STEM not provided by AE) 
				 * 
				 */
563
				testcase TC_CSE_REG_CRE_005() runs on InCseSimu system CseSystem {
564
		  	  	
565 566
		  	  		var MsgIn v_request;
					var template RequestPrimitive v_requestPrimitive;
567 568
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
569
					var boolean v_handleResponses := false;
570 571
					
					//Test control
572
	                
573
					// Test component configuration
574
					f_cf02UpCseSimuMaster();
575
		  	  	
576
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
577
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
578 579
		
					//Test Body
580 581
					vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, -, "S", omit)));
					vc_ae1.done;
582
					
583 584
					v_requestPrimitive := mw_createAEAnnc(PX_CSE_ID & "/S", -, -, -);
					v_requestPrimitive.primitiveContent.aEAnnc.app_ID := PX_APP_ID;
585
	    									
586 587
					tc_ac.start;
					alt{
588
						[] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request {
589 590
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
591
							v_handleResponses := true;
592
						}
593
						[] mccPortIn.receive(mw_request(mw_createAEAnnc())) -> value v_request {
594
							tc_ac.stop;
595
							setverdict(fail, __SCOPE__ & ": AE creation redirected but wrong parameters");
596
							v_handleResponses := true;
597
						}
598
						[] mccPortIn.receive(mw_request(?))-> value v_request {
599 600
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Unexpected message received");
601
							v_handleResponses := true;
602 603 604 605 606
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}
607
									
608
					// Postamble
609 610 611 612 613
					if (v_handleResponses) {
						vc_ae1.start(f_cse_receiveResponse());
						f_cse_sendResponse(v_request);
						vc_ae1.done;
					}
614
					f_cse_postamble_deleteResourcesCSE();
615 616
					
					// Tear down
617
					f_cf02DownCseSimuMaster();
618 619
						
				}
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639
				
				/**
				 * @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 
				 * 
				 */
				testcase TC_CSE_REG_CRE_006() runs on InCseSimu system CseSystem {

					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();

640
					//Preamble
641 642 643
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
					
					//Test Body
644
					vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S")));
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685
					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 
				 * 
				 */
				testcase TC_CSE_REG_CRE_007() runs on AeSimu system CseSystem{

					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();
					
686
					//Preamble
687 688
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
					vc_cse1.done;
689 690
			
					mcaPort.send(m_request(f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S"),-1)));
691
					
692
					vc_cse1.start(f_cse_announcementProcedure_createHandler());
693 694 695 696 697 698
					vc_cse1.done;
					
					//Test Body
					tc_ac.start;
					
					alt {
699
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723
							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
724

725 726 727 728
				/**
				 * @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 
				 * 
				 */
729
				testcase TC_CSE_REG_CRE_008() runs on InCseSimu system CseSystem {
730
		  	  	
731
					var RequestPrimitive v_request;
732 733
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
734 735 736 737 738 739
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
740
	                
741
					// Test component configuration
742
					f_cf02UpCseSimuMaster();
743
		  	  	
744
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
745
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
746
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
747
					
748 749
					vc_ae1.done;
					
750 751 752 753
					//TODO:
					//v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex)));
					//mcaPort.send(m_request(v_request));
					
754
					//Test Body
755
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
756
											
757
					tc_ac.start;
758
	
759
					alt {
760
						[] mccPortIn.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", "CSE_ID", -))) {
761 762 763
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
						}
764
						[] mccPortIn.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", "CSE_ID", -))) {
765
							tc_ac.stop;
766
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
767
						}
768
						[] mccPortIn.receive {
769
							tc_ac.stop;
770
							setverdict(fail, __SCOPE__ & ": Error while creating AE");
771 772
						}
						[] tc_ac.timeout {
773
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
774 775
						}
					}	
776
									
777
					// Postamble
778
					f_cse_postamble_deleteResourcesCSE();
779 780
					
					// Tear down
781
					f_cf02DownCseSimuMaster();
782 783
						
				}
784 785 786 787 788
		  	  	
				/**
				 * @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), communication between MN-CSE and IN-CSE
				 *  
				 */
789
				testcase TC_CSE_REG_CRE_009() runs on MnCseSimu system CseSystem {
790
		  	  	
791
					var MsgIn v_response;
792
					var RequestPrimitive v_request;
793 794
					var integer v_aeAnncIndex := -1;
					var ResourceType v_resourceType := int2;
795 796 797 798 799 800
					
					//Test control
					if(not(PICS_IN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
801
	                
802
					// Test component configuration
803
					f_cf04Up();
804
		  	  	
805
					//Preamble
806 807
					
					vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
808 809
							
					//Create AEAnnc				
810
					v_aeAnncIndex := f_cse_announcementProcedure_announceResource(int2, m_createAEAnnc(-, PX_CSE1_ID & "/" & "S", PX_APP_ID, PX_CSE1_ID & "/" & "S"));
811 812 813 814 815 816
					
					//Update AEAnnc to simulate deregistration of AE
					v_request := f_getUpdateRequestPrimitive(f_getAnnouncedResourceType(int2),v_aeAnncIndex, valueof(m_updateAEAnncBase));//TODO 
					//v_request.primitiveContent.aEAnnc.link := "";//TODO To fix when base specs are fixed
					
					f_cse_updateAnnouncedResource(v_request);
817
					
818
					//Test Body
819
					v_request := valueof(m_updateAEAnncBase);			
820
	    									
821
					v_request := f_getUpdateRequestPrimitive(f_getAnnouncedResourceType(int2),v_aeAnncIndex, v_request);//TODO 
822
					v_request.primitiveContent.aEAnnc.labels := {"Credential-ID:None"};
823 824
		  	  		
					mccPort.send(m_request(v_request));
825
					tc_ac.start;
826
	
827
					alt {
828
						[] mccPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
829
							tc_ac.stop;
830 831
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
							//continue to test the content
832
						}
833
						[] mccPort.receive {
834
							tc_ac.stop;
835
							setverdict(fail, __SCOPE__ & ": Error while creating AE");
836 837
						}
						[] tc_ac.timeout {
838
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
839 840
						}
					}	
841 842 843
									
					//v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);	
									
844
					// Postamble
845
					f_cse_postamble_deleteResourcesCSE();
846 847
					
					// Tear down
848
					f_cf04Down();
849
						
850
				}
851 852


853 854 855 856
				/**
				 * @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), transfer response to the AE
				 * 
				 */
857
				testcase TC_CSE_REG_CRE_010() runs on AeSimu system CseSystem {
858 859
		  	  	
					var MsgIn v_response;
860
					var RequestPrimitive v_request;
861
					var integer v_aeIndex := -1;
862 863 864 865 866 867
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
868 869 870 871
	                
					// Test component configuration
					f_cf02Up();
		  	  	
872
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
873
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
874
					vc_cse1.done;
875
					
876 877
					v_aeIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S-AE-ID-STEM"));
					
878
					vc_cse1.start(f_cse_announcementProcedure_createHandler());
879
					vc_cse1.done;
880
					
881
					//TODO Deregister
882 883 884
					//f_cse_deleteResource(v_aeIndex);
					v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex)));
					mcaPort.send(m_request(v_request));
885
					
886
					//Test Body
887 888
					f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, f_getResourceId(vc_resourcesList[v_aeIndex].resource)));
					
889
					vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(PX_CSE_ID, -, -, -)));
890
					vc_cse1.done;
891
					
892 893 894
					tc_ac.start;
	
					alt {
895
						[] mcaPortIn.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
896 897
							tc_ac.stop;
							//continue to test the content
898 899 900 901 902 903 904 905 906
							if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){
								if (v_response.primitive.responsePrimitive.primitiveContent.aE.app_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");
							}
907
						}
908
						[] mcaPortIn.receive {
909 910
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE");
911
						}
912 913
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
914
						}
915 916 917 918
					}	
									
					// Postamble
					f_cse_postamble_deleteResources();
919
					
920 921
					// Tear down
					f_cf02Down();
922
						
923
				}; //end TC_CSE_REG_CRE_010
924

925 926 927 928 929 930 931 932 933 934
				/**
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and asking an CSE relative AE_ID by indicating AE_ID_Stem with character ‘C’.  
				 * 
				 */
				testcase TC_CSE_REG_CRE_011() runs on AeSimu system CseSystem {

					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
935 936
					
					//Test control
937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981
    
    
					// Test component configuration
					f_cf01Up();
    
					//Preamble

					//Test Body
					v_request := valueof(m_createAe(PX_APP_ID, omit, "C"));	
	
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
	
					mcaPort.send(m_request(v_request));
	
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
							
							if(v_response.primitive.responsePrimitive.primitiveContent.aE.resourceID[0] == "C"){
								setverdict(pass, __SCOPE__ & "Resource ID set correctly.");
							} else {
								setverdict(fail, __SCOPE__ & "Resource ID not set correctly.");
							}
							
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
					
					// Postamble
					f_cse_postamble_deleteResources();
	
					// Tear down
					f_cf01Down();
		
				}
982

983 984 985 986
				/**
				  * @desc Check that the IUT accepts an AE registration with the optional attribute OPTIONAL_ATTRIBUTE provided   
				  * 
				 */
987
				group g_CSE_REG_CRE_012 {
988
					
989 990 991 992 993
					testcase TC_CSE_REG_CRE_012_AE_LBL() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
						
						v_create.primitiveContent.aE.labels := {"labels"};
994
						v_ae1.start(f_CSE_REG_CRE_012(v_create));
995
						v_ae1.done;
996 997
					}
					
998 999 1000 1001 1002
					testcase TC_CSE_REG_CRE_012_AE_APN() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
						
						v_create.primitiveContent.aE.appName := "AeAppName";
1003
						v_ae1.start(f_CSE_REG_CRE_012(v_create));
1004
						v_ae1.done;
1005 1006
					}
					
1007 1008 1009 1010 1011
					testcase TC_CSE_REG_CRE_012_AE_POA() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
						
						v_create.primitiveContent.aE.pointOfAccess := {PX_AE1_ADDRESS};
1012
						v_ae1.start(f_CSE_REG_CRE_012(v_create));
1013
						v_ae1.done;
1014 1015 1016
					}
					
				}
1017

1018
				group g_CSE_REG_CRE_013 {
1019 1020 1021 1022 1023
					
					/**
					 * @desc Check that the IUT accepts a create request of <remoteCSE> resource with OPTIONAL_ATTRIBUTE. 
					 * 
					 */
1024
					testcase TC_CSE_REG_CRE_013_LBL() runs on Tester system CseSystem {
1025
						// Local variables
1026
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;	
1027
						const AttributeAux c_optionalAttribute := {"labels", omit};
1028 1029
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
                        						
1030
						v_createRequest.primitiveContent.remoteCSE.labels := {"MyLabel"};
1031
						
1032
						v_cse1.start(f_CSE_REG_CRE_013(v_createRequest, c_optionalAttribute));
1033
						v_cse1.done;
1034
						
1035 1036
					}
					
1037
					testcase TC_CSE_REG_CRE_013_CST() runs on Tester system CseSystem {
1038
						// Local variables
1039 1040
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;	
						const AttributeAux c_optionalAttribute := {"cseType", omit};
1041 1042
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
												
1043
						v_createRequest.primitiveContent.remoteCSE.cseType := int1;
1044
						
1045
						v_cse1.start(f_CSE_REG_CRE_013(v_createRequest, c_optionalAttribute));
1046
						v_cse1.done;
1047 1048
					}
					
1049
					testcase TC_CSE_REG_CRE_013_POA() runs on Tester system CseSystem {
1050
						// Local variables
1051 1052
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;	
						const AttributeAux c_optionalAttribute := {"pointOfAccess", omit};
1053
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
1054
	
1055 1056
						v_createRequest.primitiveContent.remoteCSE.pointOfAccess := {"http://" & PX_CSE1_ADDRESS & "/"};
	
1057
						v_cse1.start(f_CSE_REG_CRE_013(v_createRequest, c_optionalAttribute));
1058
						v_cse1.done;
1059 1060

					}
1061
					
1062
					testcase TC_CSE_REG_CRE_013_NL() runs on Tester system CseSystem {
1063
						// Local variables
1064 1065
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;	
						const AttributeAux c_optionalAttribute := {"nodeLink", omit};
1066
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
1067

1068
						v_createRequest.primitiveContent.remoteCSE.nodeLink := c_defaultNodeID;
1069

1070
						v_cse1.start(f_CSE_REG_CRE_013(v_createRequest, c_optionalAttribute));
1071
						v_cse1.done;
1072

1073 1074
					}
					
1075
				}// end group g_CSE_REG_CRE_BV_013	
1076

1077 1078 1079 1080
				/**
				 * @desc Check that the IUT rejects an AE registration (not allowed App-ID) 
				 * 
				 */
1081
				testcase TC_CSE_REG_CRE_016() runs on AeSimu system CseSystem {
1082 1083 1084 1085 1086
		  	  	
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
1087 1088
					var charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AppId is not allowed to register: " & PX_APP_ID;
	   
1089
					//Test control
1090 1091 1092
	                
					// Test component configuration
					f_cf01Up();
1093
					
1094 1095 1096 1097
					//Preamble
					action(v_action);
					f_sleepIgnoreDef(30.0);
											
1098 1099 1100 1101
					// Test Body
					v_request := valueof(m_createAe(PX_APP_ID, omit, omit));				
	    									
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, v_cseBaseIndex);
1102
					
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120
					mcaPort.send(m_request(v_request));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation rejected.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4005))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					// Postamble
					f_cse_postamble_deleteResources();
1121
					
1122 1123
					// Tear down
					f_cf01Down();
1124
						
1125
				}
1126
				
1127 1128 1129 1130
				/**
				 * @desc Check that the IUT rejects a create request of <AE> resource that doesn’t include the MANDATORY_ATTRIBUTE
				 * 
				 */
1131 1132
				group g_CSE_REG_CRE_017 {
					testcase TC_CSE_REG_CRE_017_API() runs on Tester system CseSystem {
1133 1134 1135 1136 1137 1138 1139
						
						//Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID);
						
						v_createRequest.primitiveContent.aE.app_ID := omit;	//Mandatory app_ID field is being set empty
	
1140
						v_ae1.start(f_CSE_REG_CRE_017(v_createRequest));
1141 1142
						v_ae1.done;
	
1143 1144
					}//end TC_CSE_REG_CRE_017_API
					testcase TC_CSE_REG_CRE_017_RR() runs on Tester system CseSystem {
1145 1146 1147 1148 1149 1150 1151
	
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID);
						
						v_createRequest.primitiveContent.aE.requestReachability := omit;	//Mandatory requestReachability field is being set empty
						
1152
						v_ae1.start(f_CSE_REG_CRE_017(v_createRequest));
1153
						v_ae1.done;
1154

1155
					}//end TC_CSE_REG_CRE_017_RR
1156
					
1157
				}//end g_CSE_REG_CRE_017
1158

1159 1160 1161 1162
				/**
				 * @desc Check that the IUT accepts an create request of <remoteCSE> resource with attributes multiplicity equals to 1. 
				 *  
				 */
1163
				testcase TC_CSE_REG_CRE_018() runs on CseSimu system CseSystem {
1164 1165 1166 1167 1168 1169 1170 1171
				
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var RequestPrimitive v_createRequestPrimitive := valueof(m_createRemoteCSEBase);	
					var ResourceType v_resourceType := int16;	//remoteCSE
					   
					// Test control
1172

1173 1174
					// Test component configuration
					f_cf04Up();
1175

1176 1177 1178
					// Test adapter configuration

					// Preamble
1179
				
1180 1181 1182 1183 1184 1185 1186 1187 1188
					// Test Body
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_createRequestPrimitive, -1);
	
					mccPort.send(m_request(v_request));
					tc_ac.start;
					alt {
						[] mccPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
1189 1190
							f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16);
1191
						}
1192 1193 1194
						[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
1195
						}
1196 1197 1198 1199 1200 1201 1202 1203
						[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating resource type remoteCSE");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource type remoteCSE");
						}
					}	
1204
			
1205
					// Postamble
1206
					f_cse_postamble_deleteResourcesCSE();
1207 1208 1209
	
					// Tear down
					f_cf04Down();
1210

1211
				}//end TC_CSE_REG_CRE_018
1212
				
1213 1214 1215 1216
				/**
				 * @desc Check that the IUT accepts an create request of <remoteCSE> resource with attributes multiplicity equals to 1 without the preconfigured CSE-ID
				 *
				 */
1217
				testcase TC_CSE_REG_CRE_019() runs on CseSimu system CseSystem {
1218
				
1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var RequestPrimitive v_createRequestPrimitive := valueof(m_createRemoteCSEBase);	
					var ResourceType v_resourceType := int16;	//remoteCSE
	   
					// Test control

					// Test component configuration
					f_cf04Up();

					// Test adapter configuration

					// Preamble

					// Test Body
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_createRequestPrimitive, -1);

					mccPort.send(m_request(v_request));
					tc_ac.start;
					alt {
						[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
1243 1244
							f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16);
1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255
						}
						[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating resource type remoteCSE");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource type remoteCSE");
						}
					}	

					// Postamble
1256
					f_cse_postamble_deleteResourcesCSE();
1257 1258 1259 1260

					// Tear down
					f_cf04Down();

1261
				}//end TC_CSE_REG_CRE_019
1262

1263 1264 1265 1266
				/**
	 			 * @desc Check that the IUT accepts a response from IN_CSE on the success update of AEAnnc during AE registration with preprovisioned SP_relative_AE_ID
				 * 
				 */
1267
				 //TODO TO BE FINALIZED
1268 1269 1270 1271 1272 1273 1274 1275
				testcase TC_CSE_REG_CRE_020() runs on AeSimu system CseSystem {

					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var ResourceType v_resourceType := int2;
					
					//Test control
1276 1277
					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");
1278 1279 1280 1281 1282 1283
					   stop;
					}
    
					// Test component configuration
					f_cf02Up();

1284
					//Preamble
1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
					vc_cse1.done;
	
					v_request := valueof(m_createAe(PX_APP_ID, omit, omit));				
						
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);

					mcaPort.send(m_request(v_request));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
							tc_ac.stop;
		
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
	
1311
					vc_cse1.start(f_cse_announcementProcedure_updateHandler());
1312 1313 1314 1315 1316 1317 1318 1319 1320