OneM2M_PermutationFunctions.ttcn 351 KB
Newer Older
1 2 3 4 5 6 7
/**
 *  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.
 *  
8
 *  @author     oneM2M/ETSI
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
 *  @desc       Module containing test cases for oneM2M
 *
 */
module OneM2M_PermutationFunctions {

	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;
	import from LibCommon_Time all;
	import from OneM2M_Pics all;
	import from OneM2M_Functions all;
	import from XSD all;
	
	group AE {
		
		group General {
			
			group Create {
						
30
					function f_AE_GEN_CRE_001(PrimitiveScope p_primitiveScope) runs on CseSimu system AeSystem {
31 32 33 34
						
						var template UtTriggerPrimitive v_utRequest := m_utCreateContainer;
						var integer v_resourceIndex := -1;
						var MsgIn v_request;
35
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid CREATE Request for container to ";
36 37
						
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
38
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
39 40 41 42 43 44
							stop;
						}

						f_cf03Up();
						
						//Send Trigger Message
45
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(-, e_nonHierarchical, p_primitiveScope);
46
						f_ae_sendUtPrimitive(v_utRequest, v_action & f_getLocalResourceAddress(-, e_nonHierarchical, p_primitiveScope));
47 48 49
						
						tc_ac.start;
						alt {
50
							[] mcaPortIn.receive(mw_request(mw_createContainer(-,v_utRequest.requestPrimitive.to_))) -> value v_request {
51
								tc_ac.stop;
52
								setverdict(pass, __SCOPE__ & " : Container creation request received successfuly");
53
								v_resourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);	
54
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
55
							}
56
							[] mcaPortIn.receive(mw_request(mw_createContainer())) -> value v_request {
57
								tc_ac.stop;
58
								setverdict(fail, __SCOPE__ & " : Create Request with unexpected target");
59
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
60 61 62
								stop;
							}
							[] tc_ac.timeout {
63
								setverdict(fail, __SCOPE__ & " : No answer while creating resource");
64 65 66 67 68 69 70
								stop;
							}
						}
						
						// Postamble
						f_cf03Down();
					}
71
					function f_AE_GEN_CRE_002(PrimitiveScope p_primitiveScope) runs on CseSimu system AeSystem {
72
						var MsgIn v_request;
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
73
						var Integer v_resourceIndex := -1;
74
						var template UtTriggerPrimitive v_utRequest := m_utCreateContainer;
75
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid CREATE Request for container to ";
76 77 78 79
						
						
						//Test Control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
80
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
81 82 83 84 85 86
							stop;
						}
	
						f_cf03Up();
	
						//Send Trigger Message
87
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(-, e_hierarchical, p_primitiveScope);
88
						f_ae_sendUtPrimitive(v_utRequest,v_action  & f_getLocalResourceAddress(-, e_hierarchical, p_primitiveScope));
89 90 91 92
							
	
						tc_ac.start;
						alt {
93
							[] mcaPortIn.receive(mw_request(mw_createContainer(-,v_utRequest.requestPrimitive.to_))) -> value v_request {
94
								tc_ac.stop;
95
								setverdict(pass, __SCOPE__ & " : Container creation request received successfuly");
96
								v_resourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);	
97
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
98
							}
99
							[] mcaPortIn.receive(mw_request(mw_createContainer())) -> value v_request {
100
								tc_ac.stop;
101
								setverdict(fail, __SCOPE__ & " : Create Request with unexpected target");
102
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
103 104 105
								stop;
							}
							[] tc_ac.timeout {
106
								setverdict(fail, __SCOPE__ & " : No answer while creating resource");
107 108 109 110 111 112 113 114 115 116 117 118
								stop;
							}
						}
	
						// Postamble
						f_cf03Down();
					}
				
			} //end group Create
			
			group Update {
						
119
					function f_AE_GEN_UPD_001(PrimitiveScope p_primitiveScope) runs on CseSimu system AeSystem {
120
						var MsgIn v_request;
121
						var template UtTriggerPrimitive v_utRequest := m_utUpdateContainer;
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
122
						var integer v_resourceIndex;
123
						var PrimitiveContent v_localResource;
124
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid UPDATE Request for container to ";
125 126 127
						
						
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
128
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
129 130 131 132 133 134
							stop;
						}
						
						f_cf03Up();
						
						//Send Trigger Message
Miguel Angel Reina Ortega's avatar
Fix #47  
Miguel Angel Reina Ortega committed
135
						v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
136 137
						v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex, e_nonHierarchical, p_primitiveScope);
138
						f_ae_sendUtPrimitive(v_utRequest,v_action  & f_getLocalResourceAddress(v_resourceIndex, e_nonHierarchical, p_primitiveScope));
139 140 141
						
						tc_ac.start;
						alt {
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
142
							[] mcaPortIn.receive(mw_request(mw_updateContainer(-,v_utRequest.requestPrimitive.to_))) -> value v_request {
143
								tc_ac.stop;
144
								setverdict(pass, __SCOPE__ & " : Container update request received successfuly");
145
								f_processUpdateRequestPrimitive(v_request.primitive.requestPrimitive);
146
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
147
							}
148
							[] mcaPortIn.receive(mw_request(mw_updateContainer())) {
149
								tc_ac.stop;
150
								setverdict(fail, __SCOPE__ & " : Update Request with unexpected target");
151
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
152 153 154
								stop;
							}
							[] tc_ac.timeout {
155
								setverdict(fail, __SCOPE__ & " : No answer while updating resource");
156 157 158 159 160 161 162
								stop;
							}
						}
						
						// Postamble
						f_cf03Down();
					}
163
					function f_AE_GEN_UPD_002(PrimitiveScope p_primitiveScope) runs on CseSimu system AeSystem {
164
						var MsgIn v_request;
165
						var template UtTriggerPrimitive v_utRequest := m_utUpdateContainer;
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
166
						var integer v_resourceIndex := -1;
167
						var PrimitiveContent v_localResource;
168
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid UPDATE Request for container to ";
169 170
						
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
171
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
172 173 174 175 176 177
							stop;
						}
	
						f_cf03Up();
	
						//Send Trigger Message
Miguel Angel Reina Ortega's avatar
Fix #47  
Miguel Angel Reina Ortega committed
178
						v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
179 180
						v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex, e_hierarchical, p_primitiveScope);
181
						f_ae_sendUtPrimitive(v_utRequest,v_action & f_getLocalResourceAddress(v_resourceIndex, e_hierarchical, p_primitiveScope));
182 183 184
								
						tc_ac.start;
						alt {
185
							[] mcaPortIn.receive(mw_request(mw_updateContainer(-,v_utRequest.requestPrimitive.to_))) -> value v_request {
186
								tc_ac.stop;
187
								setverdict(pass, __SCOPE__ & " : Container update request received successfuly");
188
								f_processUpdateRequestPrimitive(v_request.primitive.requestPrimitive);
189
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
190
							}
191
							[] mcaPortIn.receive(mw_request(mw_updateContainer())) {
192
								tc_ac.stop;
193
								setverdict(fail, __SCOPE__ & " : Update Request with unexpected target");
194
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
195 196 197
								stop;
							}
							[] tc_ac.timeout {
198
								setverdict(fail, __SCOPE__ & " : No answer while updating resource");
199 200 201 202 203 204 205 206 207 208 209 210
								stop;
							}
						}
	
						// Postamble
						f_cf03Down();
					}
				
			} //end group Update
			
			group Retrieve {
						
211
					function f_AE_GEN_RET_001(PrimitiveScope p_primitiveScope) runs on CseSimu system AeSystem {
212
						var MsgIn v_request;
213 214
						var template UtTriggerPrimitive v_utRequest;
                        var integer v_resourceIndex := -1;
215
						var PrimitiveContent v_localResource;
216
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid RETRIEVE Request for container to ";
217 218
						
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
219
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
220 221 222 223 224 225
							stop;
						}
			
						f_cf03Up();
			
						//Send Trigger Message
Miguel Angel Reina Ortega's avatar
Fix #47  
Miguel Angel Reina Ortega committed
226
						v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
227
						v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
228
						v_utRequest := m_utRetrieve(f_getLocalResourceAddress(v_resourceIndex, e_nonHierarchical, p_primitiveScope));
229
						f_ae_sendUtPrimitive(v_utRequest,v_action & f_getLocalResourceAddress(v_resourceIndex, e_nonHierarchical, p_primitiveScope));
230
                        
231 232
						tc_ac.start;
						alt {
233
							[] mcaPortIn.receive(mw_request(mw_retrieve(v_utRequest.requestPrimitive.to_))) -> value v_request {
234
								tc_ac.stop;
235
								setverdict(pass, __SCOPE__ & " : Container retrieve request received successfuly");
236
								f_processRetrieveRequestPrimitive(v_request.primitive.requestPrimitive);
237
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
238
							}
239
							[] mcaPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request {
240
								tc_ac.stop;
241
								setverdict(fail, __SCOPE__ & " : Retrieve request with unexpected target");
242
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
243 244 245
								stop;
							}
							[] tc_ac.timeout {
246
								setverdict(fail, __SCOPE__ & " : No answer while retrieving resource");
247 248 249 250 251 252 253
								stop;
							}
						}
			
						// Postamble
						f_cf03Down();
					}
254
					function f_AE_GEN_RET_002(PrimitiveScope p_primitiveScope) runs on CseSimu system AeSystem {
255
						var MsgIn v_request;
256 257
						var template UtTriggerPrimitive v_utRequest;
                        var integer v_resourceIndex := -1;
258
						var PrimitiveContent v_localResource;
259
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid RETRIEVE Request for container to ";
260 261
						
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
262
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
263 264 265 266 267 268
							stop;
						}

						f_cf03Up();

						//Send Trigger Message
Miguel Angel Reina Ortega's avatar
Fix #47  
Miguel Angel Reina Ortega committed
269
						v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
270
						v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
271
						v_utRequest := m_utRetrieve(f_getLocalResourceAddress(v_resourceIndex, e_hierarchical, p_primitiveScope));
272
                        f_ae_sendUtPrimitive(v_utRequest,v_action & f_getLocalResourceAddress(v_resourceIndex, e_hierarchical, p_primitiveScope));
273
						
274 275
						tc_ac.start;
						alt {
276
							[] mcaPortIn.receive(mw_request(mw_retrieve(v_utRequest.requestPrimitive.to_))) -> value v_request {
277
								tc_ac.stop;
278
								setverdict(pass, __SCOPE__ & " : Container retrieve request received successfuly");
279
								f_processRetrieveRequestPrimitive(v_request.primitive.requestPrimitive);
280
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
281
							}
282
							[] mcaPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request {
283
								tc_ac.stop;
284
								setverdict(fail, __SCOPE__ & " : Retrieve request with unexpected target");
285
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
286 287 288
								stop;
							}
							[] tc_ac.timeout {
289
								setverdict(fail, __SCOPE__ & " : No answer while retrieving resource");
290 291 292 293 294 295 296 297 298 299 300 301
								stop;
							}
						}

						// Postamble
						f_cf03Down();
					}
	
			} //end group Retrieve
						
			group Delete {
						
302
					function f_AE_GEN_DEL_001(PrimitiveScope p_primitiveScope) runs on CseSimu system AeSystem {
303
						var MsgIn v_request;
304
						var template UtTriggerPrimitive v_utRequest := m_utDelete;
305 306
						var integer v_auxInteger;
						var PrimitiveContent v_localResource;
307
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid DELETE Request for container to ";
308 309

						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
310
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
311 312 313 314 315 316
							stop;
						}
			
						f_cf03Up();
			
						//Send Trigger Message
Miguel Angel Reina Ortega's avatar
Fix #47  
Miguel Angel Reina Ortega committed
317
						v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
318
						v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
319
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_auxInteger, e_nonHierarchical, p_primitiveScope);
320
						f_ae_sendUtPrimitive(v_utRequest,v_action  & f_getLocalResourceAddress(v_auxInteger, e_nonHierarchical, p_primitiveScope));
321 322 323
			
						tc_ac.start;
						alt {
324
							[] mcaPortIn.receive(mw_request(mw_delete(v_utRequest.requestPrimitive.to_))) -> value v_request {
325
								tc_ac.stop;
326 327
								setverdict(pass, __SCOPE__ & " : Container delete request received successfuly");
								f_processDeleteRequestPrimitive(v_request.primitive.requestPrimitive);
328
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
329
							}
330
							[] mcaPortIn.receive(mw_request(mw_delete(?))) -> value v_request {
331
								tc_ac.stop;
332
								setverdict(fail, __SCOPE__ & " : Delete request with unexpected target");
333
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
334 335 336
								stop;
							}
							[] tc_ac.timeout {
337
								setverdict(fail, __SCOPE__ & " : No answer while updating resource");
338 339 340 341 342 343 344
								stop;
							}
						}
			
						// Postamble
						f_cf03Down();
					}
345
					function f_AE_GEN_DEL_002(PrimitiveScope p_primitiveScope) runs on CseSimu system AeSystem {
346
						var MsgIn v_request;
347
						var template UtTriggerPrimitive v_utRequest := m_utDelete;
348 349
						var integer v_auxInteger;
						var PrimitiveContent v_localResource;
350
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid DELETE Request for container to ";
351 352
						
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
353
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
354 355 356 357 358
							stop;
						}

						f_cf03Up();

359
						//Send Trigger Message
360
						v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
361
						v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
362
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_auxInteger, e_hierarchical, p_primitiveScope);
363
						f_ae_sendUtPrimitive(v_utRequest,v_action & f_getLocalResourceAddress(v_auxInteger, e_hierarchical, p_primitiveScope));
364 365 366 367
				

						tc_ac.start;
						alt {
368
							[] mcaPortIn.receive(mw_request(mw_delete(v_utRequest.requestPrimitive.to_))) -> value v_request {
369
								tc_ac.stop;
370 371
								setverdict(pass, __SCOPE__ & " : Container delete request received successfuly");
								f_processDeleteRequestPrimitive(v_request.primitive.requestPrimitive);
372
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
373
							}
374
							[] mcaPortIn.receive(mw_request(mw_delete(?))) -> value v_request {
375
								tc_ac.stop;
376
								setverdict(fail, __SCOPE__ & " : Delete request with unexpected target");
377
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
378 379 380
								stop;
							}
							[] tc_ac.timeout {
381
								setverdict(fail, __SCOPE__ & " : No answer while updating resource");
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397
								stop;
							}
						}

						// Postamble
						f_cf03Down();
					}
	
			} //end group Delete
			
		}//end group General

		group Registration {
			
			group Create {
						
398
				   function f_AE_REG_CRE_002(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu system AeSystem {
399 400
	
						//primitives for mcaPortIn
401
					    var MsgIn v_request;
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
402 403 404
					    var integer v_parentIndex := -1;
					    var integer v_resourceIndex := -1;
					    var PrimitiveContent v_resource;
405 406 407 408 409
						var ResponsePrimitive v_responsePrimitive;
	
					   f_cf03Up();
	
					   //Send Trigger Message
410 411
					   p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(-, -, -);
					   p_request.to_ := p_utRequest.requestPrimitive.to_;
412
					   f_ae_sendUtPrimitive(p_utRequest,p_action & f_getLocalResourceAddress(-, -, -));
413 414 415 416
	
					   //Test behavior
					   tc_ac.start;
					   alt{
Miguel Angel Reina Ortega's avatar
Fix #38  
Miguel Angel Reina Ortega committed
417
							[] mcaPortIn.receive(mw_request(p_request)) -> value v_request {
418
							   tc_ac.stop;
419
							   setverdict(pass, __SCOPE__ & " : AE registration request is accepted!!");
420 421
							   v_resourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);	
							
422
							   //send back responsePrimitive
423
							   f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
424
						   }
425
							[] mcaPortIn.receive(mw_request(mw_createAe())) -> value v_request {
426
							   tc_ac.stop;
427
							   setverdict(fail, __SCOPE__ & " : Unexpected AE registration request");
428
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
429 430
						   }
						   [] tc_ac.timeout{
431
							   setverdict(fail, __SCOPE__ & " : Timeout due to no response received from requested SUT!");
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
						   }
	
					   }
	
					   // Postamble
					   f_cf03Down();
			   		}
			
			} // End of subgroup Create
			
			group Delete {
			
			}// End Delete subgroup

		}//end Registration subgroup

		group Data_Management_and_Repository {
			
			group Create {
			
452
					function f_AE_DMR_CRE_003(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu system AeSystem {
453
						var MsgIn v_request;
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
454
						var integer v_resourceIndex := -1;
Miguel Angel Reina Ortega's avatar
Fix #38  
Miguel Angel Reina Ortega committed
455 456
						var PrimitiveContent v_localResource;
						var integer v_containerIndex := -1;
457
						
458 459 460
						//Test component configuration
						f_cf03Up();
	
461 462
						//send triggering
						v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
463
						v_containerIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
464 465
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_containerIndex, -, -);
						p_request.to_ := p_utRequest.requestPrimitive.to_;
466
						f_ae_sendUtPrimitive(p_utRequest,p_action & f_getLocalResourceAddress(v_containerIndex, -, -));
467 468 469 470 471 472
	
						//Test behavior
						tc_ac.start;
						alt{
	
							//receive MsgIn requestPrimitive
473
							[] mcaPortIn.receive(mw_request(p_request)) -> value v_request {
474
								tc_ac.stop;
475
								setverdict(pass, __SCOPE__ & " : ContentInstance creation request is accepted!!");
476
								v_resourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);	
477
								//send back responsePrimitive
478
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
479 480
							}
	
481
							[] mcaPortIn.receive(mw_request(mw_create)) -> value v_request{
482
								tc_ac.stop;
483
								setverdict(fail, __SCOPE__ & " : Unexpected CREATE request ");
484
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
485 486
							}
							[] tc_ac.timeout{
487
								setverdict(fail, __SCOPE__ & " : Timeout due to no response received from requested SUT!");
488 489 490 491 492 493
							}
						}
	
						// Postamble
						f_cf03Down();
					}
494
					function f_AE_DMR_CRE_004(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu system AeSystem {
495
						var MsgIn v_request;
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
496
						var integer v_resourceIndex := -1;
497
						
498 499 500 501
						//Test component configuration
						f_cf03Up();
	
						//send triggering primitive to SUT
502 503
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(-, -, -);
						p_request.to_ := p_utRequest.requestPrimitive.to_;
504
						f_ae_sendUtPrimitive(p_utRequest,p_action & f_getLocalResourceAddress(-, -, -));
505 506 507 508 509 510
	
						//Test behavior
						tc_ac.start;
						alt{
	
							//receive MsgIn requestPrimitive
511
							[] mcaPortIn.receive(mw_request(p_request)) -> value v_request {
512
								tc_ac.stop;
513
								setverdict(pass, __SCOPE__ & " : Container creation request is accepted!!");
514
								v_resourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);	
515
								//send back responsePrimitive
516
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
517
							}
518
							[] mcaPortIn.receive(mw_request(mw_create)) {
519
								tc_ac.stop;
520
								setverdict(fail, __SCOPE__ & " : Unexpected CREATE request ");
521
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
522 523
							}
							[] tc_ac.timeout{
524
								setverdict(fail, __SCOPE__ & " : Timeout due to no response received from requested SUT!");
525 526 527 528 529 530 531 532 533 534 535
							}
						}
	
						// Postamble
						f_cf03Down();
					}
				 
			}//End of subgroup Create
			
			group Update {
				
536
				   function f_AE_DMR_UPD_001(template UtTriggerPrimitive p_utRequest, in universal charstring p_action, template RequestPrimitive p_expectedUpdateRequest) runs on CseSimu system AeSystem {
537 538 539
	
						//primitives for mcaPortIn
					   	var MsgIn v_request;
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
540
						var integer v_resourceIndex := -1;
541
					   	var PrimitiveContent v_localResource;
542
					   	
543 544 545
					   	f_cf03Up();
					   
					   	//Preamble
546
						
547
					   	//Send Tr
Miguel Angel Reina Ortega's avatar
Fix #71  
Miguel Angel Reina Ortega committed
548
					    v_localResource := f_generateLocalResource(valueof(m_primitiveContentAe(m_contentCreateAe(omit, -, -, omit))), vc_cSEBaseIndex, int2);
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
549 550
						v_resourceIndex := f_setLocalResource(v_localResource, int2, vc_cSEBaseIndex);
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex);
551
					   	f_ae_sendUtPrimitive(p_utRequest,p_action & f_getLocalResourceAddress(v_resourceIndex));
552 553 554 555 556 557 558
	
					   //Test behavior
					   
					   tc_ac.start;
					   alt{
							[] mcaPortIn.receive(mw_request(p_expectedUpdateRequest)) -> value v_request {
							   tc_ac.stop;
559
							   setverdict(pass, __SCOPE__ & " : AE update request is accepted!");
560
							   f_processUpdateRequestPrimitive(v_request.primitive.requestPrimitive);
561
							   f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
562
							}
563
							[] mcaPortIn.receive(mw_request(mw_update)) -> value v_request {
564
							   tc_ac.stop;
565
							   setverdict(fail, __SCOPE__ & " : Unexpected UPDATE request");
566
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
567 568
						   }
						   [] tc_ac.timeout{
569
							   setverdict(fail, __SCOPE__ & " : Timeout due to no response received from requested SUT!");
570 571 572 573 574 575 576 577
						   }
	
					   }
	
					   // Postamble
					   f_cf03Down();
					}
	
578
					function f_AE_DMR_UPD_002(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu system AeSystem {
579
						var MsgIn v_request;
580
						var PrimitiveContent v_localResource;
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
581
						var integer v_resourceIndex := -1;
582 583 584 585

						//Test component configuration
						f_cf03Up();

586 587
						//send triggering 
						v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
588 589
						v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex);
590
						f_ae_sendUtPrimitive(p_utRequest,p_action & f_getLocalResourceAddress(v_resourceIndex));
591 592 593 594 595 596

						//Test behavior
						tc_ac.start;
						alt{

							//receive MsgIn requestPrimitive
597
							[] mcaPortIn.receive(mw_request(p_request)) -> value v_request {
598
								tc_ac.stop;
599
								setverdict(pass, __SCOPE__ & " : Container update request is accepted!!");
600
								f_processUpdateRequestPrimitive(v_request.primitive.requestPrimitive);
601
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
602
							}
603
							[] mcaPortIn.receive(mw_request(mw_update)) {
604
								tc_ac.stop;
605
								setverdict(fail, __SCOPE__ & " : Unexpected UPDATE request");
606
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
607 608
							}
							[] tc_ac.timeout{
609
								setverdict(fail, __SCOPE__ & " : Timeout due to no response received from requested SUT!");
610 611 612 613 614 615 616 617 618 619 620
							}
						}

						// Postamble
						f_cf03Down();
					}

			}//End of subgroup Update

			group Retrieve {
				
621
					function f_AE_DMR_RET_001(ResourceType p_resourceType, in template (omit) PrimitiveContent p_primitiveContent, in universal charstring p_action) runs on CseSimu system AeSystem {
622 623
		
						//variables
624
						var template UtTriggerPrimitive v_utRequest;
625 626
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
627
						var PrimitiveContent v_localResource;
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
628
						var integer v_resourceIndex := -1;
629
						
630 631 632
						//Test component configuration
						f_cf03Up();
		
633
						//send triggering message
634 635 636 637 638 639
					    if(p_resourceType != int5) {
					    	v_localResource := f_generateLocalResource(p_primitiveContent, vc_cSEBaseIndex, p_resourceType);
					    	v_resourceIndex := f_setLocalResource(v_localResource, p_resourceType, vc_cSEBaseIndex);
					    } else {
					    	v_resourceIndex := vc_cSEBaseIndex;
					    }
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
640
						v_utRequest := m_utRetrieve(f_getLocalResourceAddress(v_resourceIndex));
641
						f_ae_sendUtPrimitive(v_utRequest,p_action & f_getLocalResourceAddress(v_resourceIndex));
642 643 644 645
						
						//Test behavior
						tc_ac.start;
						alt{
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
646
							[] mcaPortIn.receive(mw_request(mw_retrieve(f_getLocalResourceAddress(v_resourceIndex)))) -> value v_request {
647
								tc_ac.stop;
648
								setverdict(pass, __SCOPE__ & " : retrieve resource type request is accepted!!");
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
649
								v_responsePrimitive := valueof(m_responsePrimitive(int2000, v_request.primitive.requestPrimitive.requestIdentifier, vc_localResourcesList[v_resourceIndex].resource));
650
								f_send(e_mca_in_port, m_response(v_responsePrimitive));
651
							}
652
							[] mcaPortIn.receive (mw_request(mw_retrieve(?))){
653
								tc_ac.stop;
654
								setverdict(fail, __SCOPE__ & " : Retrieve request for unexpected target");
655
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
656 657
							}
							[] tc_ac.timeout{
658
								setverdict(fail, __SCOPE__ & " : Timeout due to no response received from requested SUT!");
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678
							}
						}
		
						// Postamble
						f_cf03Down();
					}
					

			}//End of subgroup Retrieve
			
			group Delete {
			
			}

		}//end DMR subgroup

		group Subscription_and_Notification {
			
			group Create {
				
679
					function f_AE_SUB_CRE_002(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu system AeSystem {
680 681
	
						var MsgIn v_request;
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
682 683 684
						var integer v_parentIndex := -1;
						var integer v_resourceIndex := -1;
						var PrimitiveContent v_resource;
685 686 687 688 689
						var ResponsePrimitive v_responsePrimitive;

						f_cf03Up();

						//send triggering primitive to SUT
690
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress();
691
						f_ae_sendUtPrimitive(p_utRequest,p_action);
692 693 694 695 696 697

						//Test behavior
						tc_ac.start;
						alt{
							[] mcaPortIn.receive(mw_request(p_request)) -> value v_request {
								tc_ac.stop;
698
								setverdict(pass, __SCOPE__ & " : Subscription creation request is accepted!");
699
								v_parentIndex := f_getLocalResourceIndex(v_request.primitive.requestPrimitive.to_);
Miguel Angel Reina Ortega's avatar
Fix #47  
Miguel Angel Reina Ortega committed
700
								v_resource := f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentIndex, v_request.primitive.requestPrimitive.resourceType);
Miguel Angel Reina Ortega's avatar
Fix #44  
Miguel Angel Reina Ortega committed
701 702
								v_resourceIndex := f_setLocalResource(v_resource, v_request.primitive.requestPrimitive.resourceType, v_parentIndex);	
								v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, vc_localResourcesList[v_resourceIndex].resource));
703
								//send back responsePrimitive
704
								f_send(e_mca_in_port, m_response(v_responsePrimitive));
705 706 707
							}
							[] mcaPortIn.receive {
								tc_ac.stop;
708
								setverdict(fail, __SCOPE__ & " : Subscription creation request is rejected due to not including the optional attribute!");
709
								f_send(e_mca_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
710 711
							}
							[] tc_ac.timeout{
712
								setverdict(fail, __SCOPE__ & " : Timeout due to no response received from requested SUT!");
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740
							}
						}

						// Postamble
						f_cf03Down();

					}
			
			}//End Create Group
			
			group Notify {
				
			}//End of Notify group


		}//end SUB subgroup


	}//end group AE
	
	
		
	group CSE {
		
		group Generic {
			
			group Create {
								
741
					function f_CSE_GEN_CRE_001(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
											   
						// Test control
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
						v_addressingMethod := e_nonHierarchical;
						v_primitiveScope := p_primitiveScope;
						v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_resourceIndex);
						v_request.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
						
773
						f_send(e_mca_port, m_request(v_request));
774
						
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource created using non-hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating container resource using non-hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_CRE_001				
				
802
					function f_CSE_GEN_CRE_002(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
											   
						// Test control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
828
						//Force usage of Hierarchical addressing method
829 830 831 832 833
						v_addressingMethod := e_hierarchical;
						v_primitiveScope := p_primitiveScope;
						v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_resourceIndex);
						v_request.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
												
834
						f_send(e_mca_port, m_request(v_request));
835