OneM2M_Testcases_CSE_Release_1.ttcn 495 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 43 44
			testcase TC_DELETE_RESOURCES() runs on Tester system CseSystem {
				// Local variables
				                        
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
				v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
				v_ae1.done;
	            
				v_ae1.start(f_DELETE_RESOURCES());
				v_ae1.done;
			}
			
			function f_DELETE_RESOURCES() runs on AeSimu system CseSystem {
45 46 47
				
				timer t_ac := 5.0;
				var integer i; 
48 49
				var XSD.ID v_resourceAddress;
				var RequestPrimitive v_request;
50 51 52
				map(self:mcaPort, system:mcaPort); 
					
				for (i:=0; i<lengthof(PX_RESOURCES_TO_BE_DELETED); i:= i+1) {  
53 54 55
					
					v_resourceAddress := f_getResourceAddress() & "/" & PX_RESOURCES_TO_BE_DELETED[i]; 
						
56 57
					v_request := valueof(m_delete(v_resourceAddress, PX_SUPER_AE_ID));
					    
58
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
59
					
60 61
					t_ac.start;
					alt {
62
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
63
							t_ac.stop;
64
							log(__SCOPE__ & ":Resource deleted");
65
							//setverdict(pass);
66
						}
67
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
68
							t_ac.stop;
69
							log(__SCOPE__ & ":Error while deleting resource");
70
							//setverdict(fail);
71 72 73
						}
						[] mcaPort.receive {
							t_ac.stop;
74
							log(__SCOPE__ & ":Unexpected message received");
75
							//setverdict(inconc);
76 77
						}
						[] t_ac.timeout {
78
							log(__SCOPE__ & ":No answer while deleting resource");
79
							//setverdict(inconc);
80 81 82 83 84 85 86 87
						}	
					}	
				}
			
				unmap(self:mcaPort, system:mcaPort); 
				stop;
			}	
		
88
		}//end group helpingTestCases
89 90 91 92 93
	
	}//end group oneM2M_demos
	
	group CSE {
		
94 95 96 97 98 99 100 101 102
		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
					 * 
					 */
103
					testcase TC_CSE_GEN_CRE_001_CSR() runs on Tester system CseSystem {
104 105
						// Local variables
						                        
106
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
107 108
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
109 110 111
                        
						v_ae1.start(f_CSE_GEN_CRE_001(e_cseRelative));
						v_ae1.done;
112
					}
113

114
					testcase TC_CSE_GEN_CRE_001_SPR() runs on Tester system CseSystem {
115 116
						// Local variables
						
117
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
118 119
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
120 121 122

						v_ae1.start(f_CSE_GEN_CRE_001(e_spRelative));
						v_ae1.done;
123
					}
124
					
125
					testcase TC_CSE_GEN_CRE_001_ABS() runs on Tester system CseSystem {
126
						// Local variables
127
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
128 129
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
130 131 132
                        
						v_ae1.start(f_CSE_GEN_CRE_001(e_absolute));
						v_ae1.done;
133
					}				
134 135 136 137
				
				} // end of group g_CSE_GEN_CRE_001
				
				group g_CSE_GEN_CRE_002 {
138

139 140 141 142
					/**
					 * @desc Check that the IUT accepts the creation of a  resource using structured resource identifier
					 * 
					 */
143
					testcase TC_CSE_GEN_CRE_002_CSR() runs on Tester system CseSystem {
144 145
						// Local variables
						                        
146
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
147 148
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
149 150 151
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_cseRelative));
						v_ae1.done;
152
					}
153

154
					testcase TC_CSE_GEN_CRE_002_SPR() runs on Tester system CseSystem {
155 156
						// Local variables
						
157
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
158 159
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
160 161 162
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_spRelative));
						v_ae1.done;
163
					}
164
					
165
					testcase TC_CSE_GEN_CRE_002_ABS() runs on Tester system CseSystem {
166 167
						// Local variables
							
168
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
169 170
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
171 172 173
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_absolute));
						v_ae1.done;
174
					}
175
				
176
				} // end of group g_CSE_GEN_CRE_002
177
				
178 179 180 181 182 183 184 185 186
			} // 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
					 * 
					 */
187
					testcase TC_CSE_GEN_RET_001_CSR() runs on Tester system CseSystem {
188 189
						// Local variables
						                        
190
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
191 192
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
193 194 195
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_cseRelative));
						v_ae1.done;
196
					}
197

198
					testcase TC_CSE_GEN_RET_001_SPR() runs on Tester system CseSystem {
199 200
						// Local variables
						
201
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
202 203
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
204 205 206
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_spRelative));
						v_ae1.done;
207
					}
208
					
209
					testcase TC_CSE_GEN_RET_001_ABS() runs on Tester system CseSystem {
210
						// Local variables
211
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
212 213
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
214 215 216
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_absolute));
						v_ae1.done;
217 218
					}
								
219
				
220 221 222 223 224 225 226 227
				} // 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
					 * 
					 */
228
					testcase TC_CSE_GEN_RET_002_CSR() runs on Tester system CseSystem {
229
						// Local variables
230
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
231 232
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
233 234 235
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_cseRelative));
						v_ae1.done;
236
					}
237

238
					testcase TC_CSE_GEN_RET_002_SPR() runs on Tester system CseSystem {
239 240
						// Local variables
						
241
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
242 243
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
244 245 246
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_spRelative));
						v_ae1.done;
247
					}
248
					
249
					testcase TC_CSE_GEN_RET_002_ABS() runs on Tester system CseSystem {
250 251
						// Local variables
							
252
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
253 254
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
255 256 257
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_absolute));
						v_ae1.done;
258 259
					}
								
260 261 262
				} // end of group g_CSE_GEN_RET_002
				
			} // end of group Retrieve
263
			
264 265
			group Update {
				group g_CSE_GEN_UPD_001 {
266

267 268 269 270
					/**
					 * @desc Check that the IUT accepts the update of a <container>  resource using unstructured resource identifier
					 * 
					 */
271
					testcase TC_CSE_GEN_UPD_001_CSR() runs on Tester system CseSystem {
272
						// Local variables
273
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
274 275
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
276 277 278
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_cseRelative));
						v_ae1.done;
279
					}
280

281
					testcase TC_CSE_GEN_UPD_001_SPR() runs on Tester system CseSystem {
282
						// Local variables
283
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
284 285
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
286 287 288
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_spRelative));
						v_ae1.done;
289
					}
290
					
291
					testcase TC_CSE_GEN_UPD_001_ABS() runs on Tester system CseSystem {
292 293
						// Local variables
							
294
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
295 296
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
297 298 299
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_absolute));
						v_ae1.done;
300 301
					}
								
302 303 304 305 306 307 308 309
				} // 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
					 * 
					 */
310
					testcase TC_CSE_GEN_UPD_002_CSR() runs on Tester system CseSystem {
311 312
						// Local variables
						                        
313
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
314 315
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
316 317 318
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_cseRelative));
						v_ae1.done;
319 320
					}

321
					testcase TC_CSE_GEN_UPD_002_SPR() runs on Tester system CseSystem {
322 323
						// Local variables
						
324
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
325 326
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
327 328 329
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_spRelative));
						v_ae1.done;
330
					}
331
					
332
					testcase TC_CSE_GEN_UPD_002_ABS() runs on Tester system CseSystem {
333
						// Local variables
334
							
335
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
336 337
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
338 339 340
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_absolute));
						v_ae1.done;
341
					}
342 343 344 345
								
				} // end of group g_CSE_GEN_UPD_002
				
			} // end of group Update
346
			
347 348
			group Delete {
				group g_CSE_GEN_DEL_001 {
349

350 351 352 353
					/**
					 * @desc Check that the IUT accepts the deletion of a <container>  resource using unstructured resource identifier
					 *  
					 */
354
					testcase TC_CSE_GEN_DEL_001_CSR() runs on Tester system CseSystem {
355 356
						// Local variables
						                        
357
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
358 359
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
360 361 362
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_cseRelative));
						v_ae1.done;
363 364
					}

365
					testcase TC_CSE_GEN_DEL_001_SPR() runs on Tester system CseSystem {
366 367
						// Local variables
						
368
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
369 370
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
371 372 373
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_spRelative));
						v_ae1.done;
374
					}
375
					
376
					testcase TC_CSE_GEN_DEL_001_ABS() runs on Tester system CseSystem {
377 378
						// Local variables
							
379
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
380 381
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
382 383 384
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_absolute));
						v_ae1.done;
385 386 387 388 389 390 391 392 393 394
					}
								
				} // 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
					 * 
					 */
395
					testcase TC_CSE_GEN_DEL_002_CSR() runs on Tester system CseSystem {
396 397
						// Local variables
						                        
398
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
399 400
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
401 402 403
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_cseRelative));
						v_ae1.done;
404 405
					}

406
					testcase TC_CSE_GEN_DEL_002_SPR() runs on Tester system CseSystem {
407
						// Local variables
408
						
409
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
410 411
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
412 413 414
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_spRelative));
						v_ae1.done;
415
					}
416
					
417
					testcase TC_CSE_GEN_DEL_002_ABS() runs on Tester system CseSystem {
418 419
						// Local variables
							
420
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
421 422
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
423 424 425
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_absolute));
						v_ae1.done;
426 427 428 429 430 431 432 433 434 435 436 437 438
					}
								
				} // end of group g_CSE_GEN_DEL_002
				
			} // end of group Delete
		
		} // end of group Generic
		
		group Registration {
			
			group Create{
				
				/**
439
				 * @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.  
440 441
				 * 
				 */
442
				group g_CSE_REG_CRE_001 {
443
					
444
					testcase TC_CSE_REG_CRE_001_CAE() runs on Tester system CseSystem {
445
					
446 447 448 449 450 451 452 453
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_ae1.start(f_CSE_REG_CRE_001(PX_ALLOWED_C_AE_IDS[0]));
			  	  		v_ae1.done;
			  	  		
					}
454
					
455 456 457 458 459 460 461 462 463 464
					testcase TC_CSE_REG_CRE_001_SAE() runs on Tester system CseSystem {
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_ae1.start(f_CSE_REG_CRE_001(PX_ALLOWED_S_AE_IDS[0]));
			  	  		v_ae1.done;
			  	  		
					}
465
					
466
				}//end group g_CSE_REG_CRE_001 
467

468
				/**
469
				 * @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.
470 471
				 * 
				 */
472 473 474
				group g_CSE_REG_CRE_002 {

					testcase TC_CSE_REG_CRE_002_CAE() runs on Tester system CseSystem {
475
						
476 477 478 479 480 481 482 483
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							
						v_ae1.start(f_CSE_REG_CRE_002(PX_ALLOWED_C_AE_IDS[0]));
				  	  	v_ae1.done;
				  	  		
					}
484
						
485 486 487 488 489 490 491 492 493 494 495 496
					testcase TC_CSE_REG_CRE_002_SAE() runs on Tester system CseSystem {
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							
						v_ae1.start(f_CSE_REG_CRE_002(PX_ALLOWED_S_AE_IDS[0]));
				  	  	v_ae1.done;
				  	  		
					}

				}//end group g_CSE_REG_CRE_002 
497 498

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

712 713
					var MsgIn v_request;
					var template RequestPrimitive v_requestPrimitive;
714
					var integer v_cseBaseIndex := -1;
715 716
					const  charstring v_cseId := PX_CSE_ID;
					template XSD.AnyURI v_link := pattern "{v_cseId}/?*";
717 718 719 720 721 722 723 724
	
					//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
725
					f_cf02UpCseSimuMaster(int1);
726

727
					//Preamble
728 729 730
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
					
					//Test Body
731 732 733 734
					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);
					
735 736 737
					tc_ac.start;

					alt {
738
						[] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request {
739 740
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
741 742 743 744 745 746
							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);
747 748 749 750 751 752
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
					
753 754
					vc_ae1.done;
					
755 756 757 758 759 760 761 762 763 764 765 766
					// 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 
				 * 
				 */
767 768 769
				testcase TC_CSE_REG_CRE_007() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
770 771
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
772 773 774 775 776 777 778 779
						
					v_ae1.start(f_CSE_REG_CRE_007());
			  	  	
					v_ae1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_007() runs on AeSimu {
780 781

					var MsgIn v_response;
782
					var template RequestPrimitive v_requestPrimitive;
783
					var integer v_aeIndex := -1;
784 785 786
					var integer v_aeAnncIndex := -1;
					const  charstring v_cseId := PX_CSE_ID;
					template XSD.AnyURI v_link := pattern "{v_cseId}/?*";
787 788 789 790 791 792 793 794
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
					
					// Test component configuration
795
					f_cf02Up(int1);
796
					
797
					//Preamble
798 799
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
					vc_cse1.done;
800
			
801
					v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/S", -, -, v_link);
802
					
803 804 805
					vc_cse1.start(f_cse_announcementProcedure_createHandler(v_requestPrimitive));
					
					mcaPort.send(f_getMsgOutPrimitive(m_request(f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S"),-1))));
806 807 808 809
					
					//Test Body
					tc_ac.start;
					alt {
810
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
811
							tc_ac.stop;
812
							
813 814 815 816 817
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
818 819 820 821 822 823 824 825 826 827 828 829 830 831
					
					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");
				  	}	
832 833 834 835 836 837 838
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf02Down();

				}	// end of TC_CSE_REG_CRE_007
839

840 841 842 843
				/**
				 * @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 
				 * 
				 */
844 845 846
				testcase TC_CSE_REG_CRE_008() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
847 848
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
					v_cse1.done;
849 850 851 852 853 854 855 856
							
					v_cse1.start(f_CSE_REG_CRE_008());
				  	  	
					v_cse1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_008() runs on CseSimu {
857
		  	  	
858
					var RequestPrimitive v_request;
859
					var template RequestPrimitive v_updateAeAnnc := mw_updateAEAnnc;
860
					var integer v_cseBaseIndex := -1;
861 862 863
					var integer v_aeIndex := -1;
					var integer v_aeIndex_ae1 := -1;
					var integer v_aeAnncIndex := -1;
864
					var ResourceType v_resourceType := int2;
865 866 867 868 869 870
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
871
	                
872
					// Test component configuration
873
					f_cf02UpCseSimuMaster(int1);
874
		  	  	
875
					//Preamble
Antonio Castillo Verdugo's avatar
Antonio Castillo Verdugo committed
876
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
877
					
878
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
879
					
880 881
					v_aeAnncIndex := f_cse_announcementProcedure_createHandler(-, -, -);
					
882
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
883
					
884 885 886 887 888 889
					v_aeIndex_ae1 := f_getLatestResourceIndex(vc_ae1);
					
					v_aeIndex := f_getLatestResource(vc_ae1);
					
					vc_ae1.start(f_cse_deleteResource(v_aeIndex_ae1));
					
890 891
					v_updateAeAnnc.primitiveContent.aEAnnc.link := "INACTIVE";
					f_cse_announcementProcedure_updateHandler(v_updateAeAnnc, -, v_aeAnncIndex);
892 893
					
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
894
					
895
					//Test Body
896
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, vc_resourcesList[v_aeIndex].resource.aE.aE_ID)));
897
											
898
					tc_ac.start;
899
	
900
					alt {
901
						[] mccPortIn.receive(mw_request(mw_updateAEAnnc)) -> value vc_request {