OneM2M_Functions.ttcn 82.1 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/LibOneM2M/OneM2M_Functions.ttcn $
 *              $Id: OneM2M_Functions.ttcn 347 2017-08-11 08:48:20Z reinaortega $
11 12 13 14 15 16 17 18 19 20 21
 *  @desc       Module containing functions for oneM2M
 *
 */
module OneM2M_Functions {
	
	import from XSD all;
	import from OneM2M_Templates all;
	import from OneM2M_Types all;//{type XSD.ID};
	import from OneM2M_TypesAndValues all;
	import from OneM2M_TestSystem all;
	import from OneM2M_Pixits all;
22
	import from OneM2M_Pics all;
23 24 25
//	import from OneM2M_AdditionalTypes all;
	
	
26 27
	group ConfigFunctions {
		
28 29 30 31
		/**
			@desc Ports mapping and default behaviour activation for Config 1
		*/
		function f_cf01Up() runs on CseTester {
32
				
33
			// Variables
34 35
			vc_config := e_cf01;	
			
36 37 38 39
			// Map
			map(self:mcaPort, system:mcaPort);
			map(self:acPort, system:acPort);
			activate(a_default());
40
			activate(a_cse_cf01());
41
				
42
			// Connect
43
						
44
			//Initialze the IUT
45
							
46
		} // end f_cf01Up
47
		
48 49 50
		/**
		 * @desc Ports mapping and default behaviour activation for Config 02
		 */
51
		function f_cf02Up() runs on CseTester {
52
				
53
			// Variables
54 55
			vc_config := e_cf02;
				
56 57 58 59 60
			// Map
			map(self:mcaPort, system:mcaPort);
			map(self:mccPort, system:mccPort);
			map(self:acPort, system:acPort);
			activate(a_default());
61
			activate(a_cse_cf02());
62
				
63
			// Connect
64
					
65
			//Initialze the IUT
66
							
67
		} // end f_cf02Up
68
		
69 70 71 72
		/**
		 * @desc Ports mapping and default behaviour activation for Config 03
		 */
		function f_cf03Up() runs on AeTester {
73 74
		
			// Variables
75 76
			vc_config := e_cf03;
			
77 78 79 80
			// Map
			map(self:mcaPort, system:mcaPort);
			map(self:acPort, system:acPort);
			activate(a_default());
81
			activate(a_ae_cf03());
82 83 84 85 86 87 88
		
			// Connect
					
			//Initialze the IUT
					
		} // end f_cf03Up
		
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
		/**
		 * @desc Ports mapping and default behaviour activation for Config 04
		 */
		function f_cf04Up() runs on CseTester {

			// Variables
			vc_config := e_cf04;
	
			// Map
			map(self:mccPort, system:mccPort);
			map(self:acPort, system:acPort);
			activate(a_default());
			activate(a_cse_cf04());

			// Connect
			
			//Initialze the IUT
			
		} // end f_cf03Up

		/**
		 * @desc Ports unmapping
		 * @verdict 
		 */
		function f_cfCseTesterDown() runs on CseTester {
		
			if(vc_config == e_cf01) {
				f_cf01Down()
			} else if (vc_config == e_cf02){
				f_cf02Down()
			} 
		}
		/**
		 * @desc Ports unmapping
		 * @verdict 
		 */
		function f_cfAeTesterDown() runs on AeTester {
		
			if(vc_config == e_cf03) {
				f_cf03Down()
			} 
		}			
131 132 133
		/**
		 * @desc Ports unmapping
		 * @verdict 
134
		 */
135
		function f_cf01Down() runs on CseTester {
136
		
137
			unmap(self:mcaPort, system:mcaPort);
138 139
			unmap(self:acPort, system:acPort);
		}	
140 141 142 143
		/**
		 * @desc Ports unmapping
		 * @verdict 
		 */
144
		function f_cf02Down() runs on CseTester {
145
		
146
			unmap(self:mcaPort, system:mcaPort);
147
			unmap(self:mccPort, system:mccPort);
148
			unmap(self:acPort, system:acPort);
149
		}		
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
		/**
		 * @desc Ports unmapping for Config 03
		 */
		function f_cf03Down() runs on AeTester {
			
			unmap(self:mcaPort, system:mcaPort);
			unmap(self:acPort, system:acPort);
		}
		
		/**
		 * @desc Ports unmapping for Config 04
		 */
		function f_cf04Down() runs on CseTester {
	
			unmap(self:mccPort, system:mccPort);
			unmap(self:acPort, system:acPort);
		}
		
168
	}//end group configFunctions
169
	
170
	group CseFunctions {
171
	
172
		group PreambleFunctions {
173 174 175 176 177 178 179 180

			/**
			 * @desc Creation of auxiliar resources ACP for correct execution of the test case
			 * @param p_allowedOperations Allowed operations for the auxiliar AE resource
			 * @return Internal ACP resource index
			 * @verdict 
			 */
			function f_cse_preamble_createAcpAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) AccessControlOperations p_allowedOperations := int63) runs on CseTester return integer {//c_CRUDNDi
181
			
182
				return f_cse_createAccessControlPolicyAux(p_acpName, p_allowedOperations);
183
			
184 185
			}

186
	
187 188 189 190 191 192 193
			/**
			 * @desc Creation of auxiliar resources ACP and AE for correct execution of the test case
			 * @param p_allowedOperations Allowed operations for the auxiliar AE resource
			 * @return Internal AE resource index
			 * @verdict 
			 */
			function f_cse_preamble_registerAe(template (omit) AcpType p_accessControlPolicyIDs := omit, in template (omit) PoaList p_poaList := omit) runs on CseTester return integer {//c_CRUDNDi
194
			
195 196 197
				var RequestPrimitive v_request;
				var MsgIn v_response;
				var integer v_aeAuxIndex := -1;
198
								
199 200 201 202
				v_request := valueof(m_createAeAux(p_accessControlPolicyIDs, p_poaList));
				v_request.to_ := f_getResourceAddress();
				
				mcaPort.send(m_request(v_request));
203
				
204 205 206 207
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
						tc_ac.stop;
208 209 210 211 212 213 214 215
						setverdict(pass,__SCOPE__&":INFO: Application registered successfuly");
						if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) {
							vc_aeAux := v_response.primitive.responsePrimitive.primitiveContent.aE;
							
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							
							v_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							
216 217 218 219
							if(ispresent(vc_aeAux.aE_ID)){
								f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(vc_aeAux.aE_ID)));
							} else {
								f_sendAcPrimitive("AE-ID_changed", "0");
220 221
							}
						}
222 223 224
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
						tc_ac.stop;
225
						setverdict(inconc, __SCOPE__&":INFO: Error while registering application");
226 227 228 229
						stop;
					}
					[] mcaPort.receive {
						tc_ac.stop;
230
						setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
231
						stop;
232
					};
233
					[] tc_ac.timeout {
234
						setverdict(inconc, __SCOPE__&":INFO: No answer while registering resource");
235 236 237
						stop;
					}
				}	
238 239
				
				f_checkCseTesterStatus();
240
				return v_aeAuxIndex;
241
			
242
			}
243
			
244 245 246 247 248 249 250
			/**
			 * @desc Creation of auxiliar resources ACP and AE for correct execution of the test case
			 * @param p_allowedOperations Allowed operations for the auxiliar AE resource
			 * @return Internal AE resource index
			 * @verdict 
			 */
			function f_cse_preamble_registerAeWithId(XSD.ID p_appId, in template (value) AccessControlOperations p_allowedOperations := int63) runs on CseTester return integer {//c_CRUDNDi
251
			
252 253 254 255
				var RequestPrimitive v_request;
				var MsgIn v_response;
				var integer v_aeAuxIndex := -1;
				var integer v_acpAuxIndex := -1;
256
			
257 258 259 260
				if(PICS_ACP_SUPPORT){
					v_acpAuxIndex := f_cse_createAccessControlPolicyAux(p_allowedOperations := p_allowedOperations);
					vc_acpAuxIndex := v_acpAuxIndex;
				}
261
				
262 263 264
				if(v_acpAuxIndex != -1) {
					vc_resourcesIndexToBeDeleted := {v_acpAuxIndex};
					v_request := valueof(m_createAe(p_appId, {f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -));
265
					
266 267
					//TODO Test, to be removed
					v_request.to_ := f_getResourceAddress();
268
					
269 270 271 272 273 274 275 276 277
					mcaPort.send(m_request(v_request));
					//mcaPort.send(m_request(m_createAeAux(p_name, {PX_URI_CSE & PX_CSE_NAME & "/" & PX_ACPAUX_NAME})));
				} else {
					mcaPort.send(m_request(m_createAe(p_appId)));
				}
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
						tc_ac.stop;
278 279 280 281 282 283
						setverdict(pass, __SCOPE__&": INFO: Application registered successfuly");
						if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) {
							vc_aeAux := v_response.primitive.responsePrimitive.primitiveContent.aE;
							
							v_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							
284 285 286 287 288 289 290
							if(ispresent(vc_aeAux.aE_ID)){
								f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(vc_aeAux.aE_ID)));
							} else {
								f_sendAcPrimitive("AE-ID_changed", "0");
							}	
						}
					}
291 292
					[] mcaPort.receive(mw_response(mw_responsePrimitiveKO))
					{
293
						tc_ac.stop;
294
						setverdict(inconc, __SCOPE__&":INFO: Error while registering application");
295 296 297 298
						stop;
					}
					[] mcaPort.receive {
						tc_ac.stop;
299
						setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
300 301 302
						stop;
					}
					[] tc_ac.timeout {
303
						setverdict(inconc, __SCOPE__&":INFO: No answer while registering resource");
304 305 306
						stop;
					}
				}	
307 308
				
				f_checkCseTesterStatus();
309
				return v_aeAuxIndex;
310
			
311
			}
312 313 314
			
			function f_cse_preamble_createServiceSubscribedAppRule(in template ListOfM2MID p_allowedAEs := {""}) runs on CseTester return integer {//c_CRUDNDi
			
315
				var integer v_serviceSubscribedAppRuleIndex := -1;
316
	
317
				v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, m_createServiceSubscribedAppRule({"None"}, {PX_APP_ID}, valueof(p_allowedAEs)));
318
				
319
				return v_serviceSubscribedAppRuleIndex;
320
			
321
			}
322 323
			
			function f_cse_preamble_subscriptionVerification(out CseTester p_notifyHandler,in integer p_aeIndex, inout integer p_ae2Index, inout template RequestPrimitive p_createRequestPrimitive,in ResourceType p_resourceType, in ResponseStatusCode p_responseStatusCode := int2001) runs on CseTester {
324 325
				if(p_resourceType == int23){
					p_notifyHandler := CseTester.create("NotifyHandler") alive;
326 327 328
					p_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", {f_getAnnouncementTargetPoA("HTTP", PX_AE2_ADDRESS, "")}), -1); // AE2 is registred
					if(ischosen(p_createRequestPrimitive.primitiveContent.subscription)){		//this condition is necessary for Subscription TCs where notification URI is set in m_createSubscriptionAdvanced
						p_createRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(p_ae2Index)}; 
329
					}
330
					p_notifyHandler.start(f_cse_notifyProcedure_subscriptionVerificationHandler(p_aeIndex, p_responseStatusCode));
331 332
				}
			}
333
		
334
		}//end group preambleFunctions
335 336 337
		
		group PostambleFunctions {
	
338 339 340 341 342 343 344 345
			/**
			 * @desc Deletion of all resources created during the test case execution. IUT gets clean and ready for next execution
			 * @verdict 
			 */
			function f_cse_postamble_deleteResources() runs on CseTester {
				var integer i;
				var XSD.ID v_resourceAddress;
				var RequestPrimitive v_request;
346
				
347
				if (PX_RUN_POSTAMBLE) {
348
					
349 350 351 352 353
					for(i := lengthof(vc_resourcesIndexToBeDeleted) -1; i >=0; i := i - 1) {
						
						v_resourceAddress := f_getResourceAddress(vc_resourcesIndexToBeDeleted[i]); 
						
						v_request := valueof(m_deleteRequest(v_resourceAddress));
354 355 356 357 358 359 360 361 362 363 364
						
						//For deletion of AEs, priority is to use AE-ID in From parameter
						//For other resources PX_SUPER_USER should be able to do DELETE operation
						//TODO Replace below code by f_getOriginator
						v_request.from_ := f_getOriginator(vc_resourcesIndexToBeDeleted[i]);
//						if(PX_USE_RESOURCE_ID_AS_ORIGINATOR){
//							if(ischosen(vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.aE)) {	
//								v_request.from_ := vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.aE.aE_ID;
//							}
//						}
						
365
						mcaPort.send(m_request(v_request));
366
						
367 368 369 370
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
371
								log(__SCOPE__&" INFO: Resource " & v_request.to_ & " deleted");
372 373 374
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
375
								log(__SCOPE__&" INFO: Error while deleting resource " & v_request.to_);
376 377
							}
							[] tc_ac.timeout {
378
								log(__SCOPE__&" INFO: No answer while deleting resource " & v_request.to_);
379 380
							}	
						}	
381
						
382 383
					}
				}
384
							
385 386
				f_cse_postamble_default();
			}
387
			
388 389 390 391 392
			/**
			 * @desc Default postamble
			 * @verdict 
			 */
			function f_cse_postamble_default() runs on CseTester {
393
			}
394 395
			
			function f_is_component_done(in CseTester p_notifyHandler) runs on CseTester {
396
			
397 398 399 400 401 402
				tc_ac.start(10.0);
				alt {
					[] p_notifyHandler.done {
					tc_ac.stop;
					}
					[] tc_ac.timeout {
403
						setverdict(inconc, __SCOPE__ & "INFO: Notify verification not received");
404 405 406
					}
				}
			} //end f_is_component_done
407 408
			
			
409
		}//end group postambleFunctions
410 411 412
		
		group HelpingFunctions {
	
413 414 415 416 417 418 419 420 421
			/**
			 * @desc Creation of a resource
			 * @param p_resourceType Resource type of the resource to be created
			 * @param p_requestPrimitive Template request primitive
			 * @param p_parentIndex Internal resource index which indicates the parent of the resource to be created
			 * @return Internal resource index of the created resource
			 * @verdict 
			 */
			function f_cse_createResource(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create, integer p_parentIndex := -1) runs on CseTester return integer {
422
			
423 424 425
				var MsgIn v_response;
				var RequestPrimitive v_request;
				var integer v_resourceIndex := -1;
426
				
427
				v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, p_parentIndex);
428
			
429 430 431 432 433
				mcaPort.send(m_request(v_request));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
						tc_ac.stop;
434 435 436
						setverdict(pass, __SCOPE__&":INFO: Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly");
						f_checkAttributesToBeSaved(p_resourceType, v_request, v_response.primitive.responsePrimitive);
						v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, p_parentIndex);
437 438 439
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
						tc_ac.stop;
440
						setverdict(inconc, __SCOPE__&":INFO: Error while creating resource type " & int2str(enum2int(p_resourceType)));
441 442 443
					}
					[] mcaPort.receive {
						tc_ac.stop;
444
						setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
445 446
					}
					[] tc_ac.timeout {
447
						setverdict(inconc, __SCOPE__&":INFO: No answer while creating resource type " & int2str(enum2int(p_resourceType)));
448 449
					}
				}	
450 451 452
				
				f_checkCseTesterStatus();
				
453
				return v_resourceIndex;
454
		
455
			}
456
		
457 458 459 460 461 462 463 464 465 466 467
			/**
			 * @desc Creation of the auxiliar ACP resource
			 * @param p_acpName ACP name
			 * @param p_allowedOperations Allowed operations
			 * @return Internal resource index of the created auxiliar ACP resource
			 * @verdict 
			 */
			function f_cse_createAccessControlPolicyAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) AccessControlOperations p_allowedOperations := int63) runs on CseTester return integer{
				var RequestPrimitive v_request;
				var MsgIn v_response;
				var integer v_acpAuxIndex := -1;
468
				
469
				v_request := valueof(m_createAcpAux(p_acpName := p_acpName, p_allowedOperations := p_allowedOperations));
470
				
471
				v_request.to_ := f_getResourceAddress();
472
				
473 474 475 476 477
				mcaPort.send(m_request(v_request));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
						tc_ac.stop;
478 479 480
						setverdict(pass, __SCOPE__&":INFO: Resource type " & int2str(1) & " created successfuly");
						f_checkAttributesToBeSaved(int1, v_request, v_response.primitive.responsePrimitive);
						v_acpAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1);
481 482 483 484
						vc_acpAuxIndex := v_acpAuxIndex;
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
						tc_ac.stop;
485
						setverdict(inconc, __SCOPE__&":INFO: Error while creating resource type " & int2str(1));
486 487 488
					}
					[] mcaPort.receive {
						tc_ac.stop;
489
						setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
490 491
					}
					[] tc_ac.timeout {
492
						setverdict(inconc, __SCOPE__&":INFO: No answer while creating resource type " & int2str(1));
493 494
					}
				}	
495 496 497
				
				f_checkCseTesterStatus();
			
498
				return v_acpAuxIndex;
499
	
500
			}
501 502
				
				
503 504 505 506 507 508 509
			/**
			 * @desc Creation of the auxiliar Container resource
			 * @param p_parentIndex Internal resource index which indicates the parent of the Container resource to be created
			 * @return Internal resource index of the created Container resource
			 * @verdict 
			 */
			function f_cse_createContainerResourceAux (integer p_parentIndex := -1) runs on CseTester return integer {
510
			
511 512 513
				var RequestPrimitive v_request;
				var integer v_acpAuxIndex := -1;
				var integer v_containerResourceIndex := -1;
514
				
515
				v_acpAuxIndex := f_cse_createAccessControlPolicyAux(p_acpName := c_acpAuxName);//"MyAcp_2"
516
				
517
				v_request := valueof(m_createContainerBase);
518 519 520
				v_request.primitiveContent.container.accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)};
				v_request.primitiveContent.container.resourceName := "MyContainerAux";
				
521
				v_containerResourceIndex := f_cse_createResource(int3, v_request, p_parentIndex);
522
				
523
				return v_containerResourceIndex;		
524
		
525
			}
526
			
527 528 529 530 531 532 533 534 535 536 537 538 539
			/**
			 * @desc 
			 * @param p_requestPrimitive
			 * @verdict 
			 */
			function f_cse_updateResource(in RequestPrimitive p_requestPrimitive) runs on CseTester {
				var MsgIn v_response;

				mcaPort.send(m_request(p_requestPrimitive));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
						tc_ac.stop;
540
						setverdict(pass, __SCOPE__&":INFO: Attribute of resource updated successfuly");
541 542 543
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
						tc_ac.stop;
544
						setverdict(inconc, __SCOPE__&":INFO: Error while updating resource");
545 546 547
					}
					[] mcaPort.receive{
						tc_ac.stop;
548
						setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
549 550
					}
					[] tc_ac.timeout {
551
						setverdict(inconc, __SCOPE__&":INFO: No answer while updating resource");
552 553
					}
				}	
554 555 556
				
				f_checkCseTesterStatus();
				
557
			}// end f_cse_updateResource
558
			
559
			/**
560 561
			 * @desc 
			 * @param p_resourceIndex
562 563
			 * @verdict 
			 */
564 565 566 567
			function f_cse_retrieveResource(integer p_resourceIndex) runs on CseTester return PrimitiveContent{
				var MsgIn v_response;

				mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(p_resourceIndex), f_getOriginator(p_resourceIndex))));
568 569
				tc_ac.start;
				alt {
570
					[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
571
						tc_ac.stop;
572
						setverdict(pass, __SCOPE__&":INFO: Resource retrieved successfuly");
573
					}
574 575 576 577 578
					[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
						tc_ac.stop;
						setverdict(inconc, __SCOPE__&":INFO: Error while retrieving resource");
					}
					[] mcaPort.receive{
579
						tc_ac.stop;
580
						setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
581 582
					}
					[] tc_ac.timeout {
583
						setverdict(inconc, __SCOPE__&":INFO: No answer while retrieving resource");
584
					}
585 586 587 588 589 590 591
				}	
				
				f_checkCseTesterStatus();
				
				return v_response.primitive.responsePrimitive.primitiveContent;
				
			}// end f_cse_retrievingResource
592
			
593 594 595 596 597 598 599 600 601 602 603 604
			/**
			 * @desc 
			 * @param p_requestPrimitive
			 * @verdict 
			 */
			function f_cse_deleteResource(in integer p_index, in template (omit) RequestPrimitive p_requestPrimitive := omit) runs on CseTester {
				var RequestPrimitive v_request;
				
				if(not isvalue(p_requestPrimitive)) {
					v_request := valueof(m_deleteRequest(f_getResourceAddress(p_index)));
				} else {
					v_request := valueof(p_requestPrimitive);
605
				}
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656
				
				mcaPort.send(m_request(v_request));
						
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
						tc_ac.stop;
						setverdict(pass, __SCOPE__&"INFO: Resource " & v_request.to_ & " deleted");
						
						f_removeElementFromList(vc_resourcesIndexToBeDeleted, p_index);
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
						tc_ac.stop;
						setverdict(inconc, __SCOPE__&"INFO: Error while deleting resource " & v_request.to_);
					}
					[] tc_ac.timeout {
						setverdict(inconc, __SCOPE__&"INFO: No answer while deleting resource " & v_request.to_);
					}	
				}	
				
				f_checkCseTesterStatus();
				
			}// end f_cse_deleteResource
			
			/**
			 * @desc Check that a resource is present in the IUT (resourceId is known)
			 * @param p_resourceIndex Resource index 
			 * @return boolean
			 */
			function f_isResourcePresent (integer p_resourceIndex) runs on CseTester return boolean {
			
				//Check to see if the resource is present or not
				mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(p_resourceIndex), f_getOriginator(p_resourceIndex))));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) {
						tc_ac.stop;
						setverdict(pass, testcasename() & ": Resource present: " & f_getResourceAddress(p_resourceIndex));
						return true;
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitive(?, -))) {
						tc_ac.stop;
						setverdict(inconc, testcasename() & ": Wrong response status code in the response");
						return false;
					}
					[] tc_ac.timeout {
						setverdict(inconc, testcasename() & ": No answer while retrieving resource");
						return false;
					}
				}	
				return false;
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 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 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
			
			/**
			 * @desc Check that a resource is not present in the IUT (resourceId is NOT known)
			 * @param p_parentIndex Index of the parent resource
			 * @param p_resourceName Resource name (Hierarchical method is used)
			 * @return boolean
			 */
			function f_isResourceNotPresent (integer p_parentIndex, XSD.String p_resourceName) runs on CseTester return boolean {
			
				log(testcasename() & ":INFO: Hierarchical method is required to check the non presence of the resource");
				vc_addressingMethod := e_hierarchical;
				//Check to see if the resource has NOT been created
				mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(p_parentIndex) & "/" & p_resourceName, f_getOriginator(p_parentIndex))));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) {
						tc_ac.stop;
						setverdict(pass, testcasename() & ": Resource not present");
						vc_addressingMethod := PX_ADDRESSING_METHOD;
						return true;
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitive(?))) {
						tc_ac.stop;
						setverdict(inconc, testcasename() & ": Wrong response status code in the response");
						vc_addressingMethod := PX_ADDRESSING_METHOD;
						return false;
					}
					[] tc_ac.timeout {
						setverdict(inconc, testcasename() & ": No answer while retrieving resource");
						vc_addressingMethod := PX_ADDRESSING_METHOD;
						return false;
					}
				}	
				return false;
			}
			
			/**
			 * @desc Update of the auxiliar ACP resource
			 * @param p_allowedOperations New allowed operations
			 * @verdict 
			 */
			function f_cse_updateAcpAuxResource (in template (value) AccessControlOperations p_allowedOperations) runs on CseTester {
				var RequestPrimitive v_request;
				
				v_request := valueof(m_updateAcpBase);
				
				v_request.to_ := f_getResourceAddress(vc_acpAuxIndex);
				v_request.from_ := f_getOriginator(vc_acpAuxIndex);
				v_request.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {valueof(m_createAcr(PX_ACOR, p_allowedOperations))};
							
				mcaPort.send(m_request(v_request));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitiveOK))  {
						tc_ac.stop;
						setverdict(pass, __SCOPE__&":INFO: " & v_request.to_ & " resource updated successfuly");
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
						tc_ac.stop;
						setverdict(inconc, __SCOPE__&":INFO: Error while updating " & v_request.to_ & " resource");
					}
					[] tc_ac.timeout {
						setverdict(inconc, __SCOPE__&":INFO: No answer while updating " & v_request.to_ & " resource" );
					}
				}		
				
				f_checkCseTesterStatus();
			}   
			
			/**
			 * @desc Function to handle announcement of resources
			 * @param p_from
			 * @param p_to
			 * @verdict 
			 */
			 //TODO To finalize this function
			function f_cse_resourceAnnouncementHandler(template XSD.ID p_from := *, template XSD.ID p_to := ?) runs on CseTester {
				// Local variables
				var MsgIn v_request;
				var ResponsePrimitive v_responsePrimitive;
				
				map(self:mccPort, system:mccPort);
				map(self:acPort, system:acPort);
741

742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_request(mw_create(p_from, p_to))) -> value v_request {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ":INFO: Announcement received");
						v_responsePrimitive := f_getCreateResponsePrimitive(v_request.primitive.requestPrimitive.resourceType, v_request.primitive.requestPrimitive);
						mcaPort.send(m_response(v_responsePrimitive)); 						
					}
					[] mcaPort.receive{
						tc_ac.stop;
						setverdict(fail, __SCOPE__ & ":ERROR: Unexpected message received");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
					}
				}
758
	
759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 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 802 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 828 829 830 831
				unmap(self:mccPort, system:mccPort);
				unmap(self:acPort, system:acPort); 

			} //end f_cse_resourceAnnouncementHandler			
    		
			function f_checkAttributesToBeSaved (ResourceType p_resourceType, RequestPrimitive p_request, inout ResponsePrimitive p_response) {
				select (p_resourceType) {
					case (int1) {
						if(isvalue(p_response.primitiveContent.accessControlPolicy) and
								not(ispresent(p_response.primitiveContent.accessControlPolicy.resourceName))) {
							p_response.primitiveContent.accessControlPolicy.resourceName :=  p_request.primitiveContent.accessControlPolicy.resourceName;
							log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.accessControlPolicy.resourceName)
						}
					}
					case (int2) {
						if(isvalue(p_response.primitiveContent.aE) and
								not(ispresent(p_response.primitiveContent.aE.resourceName))) {
							p_response.primitiveContent.aE.resourceName :=  p_request.primitiveContent.aE.resourceName;
							log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.aE.resourceName)
						}
					}
					case (int3) {
						if(isvalue(p_response.primitiveContent.container) and
								not(ispresent(p_response.primitiveContent.container.resourceName))) {
							p_response.primitiveContent.container.resourceName :=  p_request.primitiveContent.container.resourceName;
							log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.container.resourceName)
						}
					}
					case (int4) {
						if(isvalue(p_response.primitiveContent.contentInstance) and
								not(ispresent(p_response.primitiveContent.contentInstance.resourceName))) {
							p_response.primitiveContent.contentInstance.resourceName :=  p_request.primitiveContent.contentInstance.resourceName;
							log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.contentInstance.resourceName)
						}
					}
					case (int15) {
						if (isvalue(p_response.primitiveContent.pollingChannel) and
								not(ispresent(p_response.primitiveContent.pollingChannel.resourceName))) {
							p_response.primitiveContent.pollingChannel.resourceName :=  p_request.primitiveContent.pollingChannel.resourceName;
							log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.pollingChannel.resourceName)
						}
					}
					case (int16) {
						if (isvalue(p_response.primitiveContent.remoteCSE) and
								not(ispresent(p_response.primitiveContent.remoteCSE.resourceName))) {
							p_response.primitiveContent.remoteCSE.resourceName :=  p_request.primitiveContent.remoteCSE.resourceName;
							log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.remoteCSE.resourceName)
						}
					}
					case (int18) {
						if (isvalue(p_response.primitiveContent.schedule) and
								not(ispresent(p_response.primitiveContent.schedule.resourceName))) {
							p_response.primitiveContent.schedule.resourceName :=  p_request.primitiveContent.schedule.resourceName;
							log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.schedule.resourceName)
						}
					}
					case (int23) {
						if (isvalue(p_response.primitiveContent.subscription) and
								not(ispresent(p_response.primitiveContent.subscription.resourceName))) {
							p_response.primitiveContent.subscription.resourceName :=  p_request.primitiveContent.subscription.resourceName;
							log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.subscription.resourceName)
						}
					}
					case (int9) {
						if (isvalue(p_response.primitiveContent.group_) and
								not(ispresent(p_response.primitiveContent.group_.resourceName))) {
							p_response.primitiveContent.group_.resourceName :=  p_request.primitiveContent.group_.resourceName;
							log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.group_.resourceName)
						}
					}
					case else {
						log(__SCOPE__&":WARNING: Resource Type "&int2str(enum2int(p_resourceType))&" not implemented");
					}
832
				}
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850
    
				// TODO test that if the resource name is returned is the same resource name as used in the create message
			}
		
			function f_compareURIs(in integer p_expectedURIIndex, in XSD.ID p_receivedURI) runs on CseTester return boolean{
				// Local variables
				var boolean v_matchResult := false;
    			
				if (f_isNonHierarchical(p_receivedURI)) {
					vc_addressingMethod := e_nonHierarchical;
				} else if (f_isHierarchical(p_receivedURI)) {
					vc_addressingMethod := e_hierarchical;
				}
				if (f_isScopeCseRelative(p_receivedURI)) {
					vc_primitiveScope := e_cseRelative;
				}
				if (f_isScopeSpRelative(p_receivedURI)) {
					vc_primitiveScope := e_spRelative;
851
				}
852 853 854 855 856
				if (f_isScopeAbsolute(p_receivedURI)) {
					vc_primitiveScope := e_absolute;
				}
    			
				if(match(f_getResourceAddress(p_expectedURIIndex), p_receivedURI)) {
857
					v_matchResult := true;
858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943
				} else {
					v_matchResult := false;
				}
				
				vc_primitiveScope := PX_PRIMITIVE_SCOPE;
				vc_addressingMethod := PX_ADDRESSING_METHOD;
    						
				return v_matchResult;
    
			} //end f_compareURIs	

			group NotificationFunctions { 
				
				function f_cse_notifyProcedure_subscriptionVerificationHandler(in integer p_creatorIndex, in ResponseStatusCode p_responseStatusCode := int2001) runs on CseTester {
					// Local variables
					var MsgIn v_request;
					var ResponsePrimitive v_responsePrimitive;
					var template Notification v_notificationRequest := mw_contentNotificationVerification;
    			
					map(self:mcaPort, system:mcaPort);
					map(self:acPort, system:acPort);
    			
					//Preparation of expected Notification verification
					//TODO To add checks for creator and subscription reference
					//v_notificationRequest.creator := p_creator; TODO To check what address format is to be expected
					//Some participants use SP relative UNSTRUCTURED
					//v_notificationRequest.subscriptionReference := "I Don't know which URI is expected"; // TODO mandatory parameter 
    			
					//Preparation of Notification response to be sent
					v_responsePrimitive := valueof(m_responseNotification(p_responseStatusCode, omit));
    	
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_request(mw_notify(valueof(v_notificationRequest)))) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Notification received");
							v_responsePrimitive.requestIdentifier := v_request.primitive.requestPrimitive.requestIdentifier;
//							if(f_isHierarchical(v_request.primitive.requestPrimitive.primitiveContent.notification.creator)) {
//								setverdict(fail, __SCOPE__ & ": Creator cannot contain a hierarchical address");
//								v_responsePrimitive.responseStatusCode := int4000;
//							}
//							if(f_compareURIs(p_creatorIndex, v_request.primitive.requestPrimitive.primitiveContent.notification.creator)) {
//								setverdict(pass, __SCOPE__ & ": Creator set to originator of the subscription creation primitive");
//							} else {
//								setverdict(fail, __SCOPE__ & ": Creator not set to originator of the subscription creation primitive");
//								v_responsePrimitive.responseStatusCode := int4000;
//							}
							mcaPort.send(m_httpResponse(v_responsePrimitive)); 						
						}
						[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_request {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ":ERROR: Notification received but verificationRequest isn't set to TRUE");							
						}
						[] mcaPort.receive{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No notification received");
						}
					}
    	
					//mcaPort.send(m_response(v_responsePrimitive));	// TODO have to be deleted
    
					unmap(self:mcaPort, system:mcaPort);
					unmap(self:acPort, system:acPort); 
    
				} //end f_subscriptionVerificationHandler
    		
				function f_cse_notifyProcedure_representationHandler(template PrimitiveContent p_primitiveContent) runs on CseTester {
					// Local variables
					var MsgIn v_request;
	    	
					map(self:mcaPort, system:mcaPort);
					map(self:acPort, system:acPort);
	    	
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_request {
							tc_ac.stop;
							if(f_check_notificationContent(v_request.primitive.requestPrimitive, p_primitiveContent)){
								setverdict(pass, __SCOPE__ & ":INFO: Notification received");
								mcaPort.send(m_response(valueof(m_responseNotification(int2001))));
							}
							else{
								setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
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
						[] mcaPort.receive{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR: No notification received");
						}
					}
	    	
	    		
					unmap(self:mcaPort, system:mcaPort);
					unmap(self:acPort, system:acPort); 
	    	
				} //end f_cse_notifyProcedure_representationHandler
	    		
				function f_cse_notifyProcedure_aggregatedNoficationHandler(template PrimitiveContent p_primitiveContent,in integer p_numberOfAggregatedNotification) runs on CseTester {
					// Local variables
					var MsgIn v_response;
    
					map(self:mcaPort, system:mcaPort);
					map(self:acPort, system:acPort);
    
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response {
							tc_ac.stop;
							if(p_numberOfAggregatedNotification == lengthof(v_response.primitive.requestPrimitive.primitiveContent.aggregatedNotification.notification_list)){
								if(f_check_notificationContent(v_response.primitive.requestPrimitive, p_primitiveContent)){
									setverdict(pass, __SCOPE__ & ": Notification received");
								}
								else{
									setverdict(fail, __SCOPE__ & ": Notification received but the content doesn't match");
								}
979
							}
980 981 982 983 984 985 986 987 988 989 990
							else {
								setverdict(fail, __SCOPE__ & ": Number of Notification in Aggregatednotification isn't right");
							}
						}
						[] mcaPort.receive{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error, unexpected message received");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No notification received");
						}
991
					}
992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025
    	
					unmap(self:mcaPort, system:mcaPort);
					unmap(self:acPort, system:acPort); 
    
				} //end f_cse_notifyProcedure_aggregatedNotificationHandler
	    		
				function f_cse_notifyProcedure_subscriptionDeletionHandler( template PrimitiveContent p_primitiveContent) runs on CseTester {
					var MsgIn v_response;
	
					map(self:mcaPort, system:mcaPort);
					map(self:acPort, system:acPort);
					
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_response {
							tc_ac.stop;
							mcaPort.send(m_response(valueof(m_responseNotification(int2001))));
							if(not(match(v_response.primitive.requestPrimitive.primitiveContent.notification.subscriptionDeletion, true))) {
								setverdict(fail, __SCOPE__ & ":ERROR: subscriptionDeletion attribute have to be set to TRUE");
							}
							if(f_check_notificationContent(v_response.primitive.requestPrimitive, p_primitiveContent)){
								setverdict(pass, __SCOPE__ & ":INFO: Notification received");
							}
							else{
								setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
							}
						}
						[] mcaPort.receive{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR: No notification received");
						}
1026
					}
1027 1028 1029
					
					unmap(self:mcaPort, system:mcaPort);
					unmap(self:acPort, system:acPort);  
1030
	
1031 1032 1033 1034 1035
				} //end f_cse_notifyProcedure_subscriptionDeletionHandler  
				
				function f_cse_notifyProcedure_noNotificationHandler() runs on CseTester {
					// Local variables
					var MsgIn v_response;
1036
	
1037 1038
					map(self:mcaPort, system:mcaPort);
					map(self:acPort, system:acPort);
1039
		
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087
					tc_ac.start(10.0);
					alt {
						[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error, Non expected notification received");
						}
						[] tc_ac.timeout {
							setverdict(pass, __SCOPE__ & ": No notification received");
						}
					}
	
					unmap(self:mcaPort, system:mcaPort);
					unmap(self:acPort, system:acPort); 
	
				} //end f_cse_notifyProcedure_noNotification Handler
				
				function f_check_notificationContent(in RequestPrimitive p_requestPrimitive, template PrimitiveContent p_primitiveContent) runs on CseTester return boolean{
					// Local variables
					var boolean v_matchResult := false;
					var integer i;
					var integer v_numberOfAggregatedNotification;
    	
					if (ischosen(p_primitiveContent.aE)){
						if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource)) {
							v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.aE, p_primitiveContent.aE)
						}
						else if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive)) {
							v_matchResult :=match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.aE, p_primitiveContent.aE)
						}
						else if (ischosen(p_requestPrimitive.primitiveContent.aggregatedNotification)) {
							v_matchResult := true;
							v_numberOfAggregatedNotification := lengthof(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list);
							for(i := 0; i< v_numberOfAggregatedNotification; i := i + 1){
								if(ischosen(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.resource)) {
									if(not (match(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.resource.aE, p_primitiveContent.aE))){
										v_matchResult := false;
									}
								}
								else if(ischosen(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive)) {
									if(not (match(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive.primitiveContent.aE, p_primitiveContent.aE))){
										v_matchResult := false;
									}
								}						
							}
							if (i == 0){
								v_matchResult := false;
							}
						}
1088
    
1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100
					}
    	
					if (ischosen(p_primitiveContent.container)){
						if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource)) {
							v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.container, p_primitiveContent.container)
						}
						else if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive)) {
							v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.container, p_primitiveContent.container)
						}
					}
    	
					return v_matchResult;
1101
    
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125
				} //end f_check_notificationContent	
				
			}// end of group NotificationFunctions 		
	    		
			/**
			 * @desc It determines whether the addressing method of the given address is non-hierarchical. Not valid for CSE-Base as target
			 * @param p_resourceAddress
			 * @return boolean
			 */
			function f_isNonHierarchical(XSD.ID p_resourceAddress) runs on Tester return boolean {	
				var integer i;
				var integer v_nbOfSlashes:= 0;
    			
				for (i := 0; i < lengthof(p_resourceAddress); i:= i+1){
					if(match (p_resourceAddress[i], "/")){
						v_nbOfSlashes:= v_nbOfSlashes+1;
					}
				}
				
				if(f_isScopeCseRelative(p_resourceAddress)) {
					if(v_nbOfSlashes == 0 ) {
						return true;
					} else {
						return false;
1126
					}
1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138
    				
				} else if (f_isScopeSpRelative(p_resourceAddress)){	
					if(v_nbOfSlashes == 2 ) {
						return true;
					} else {
						return false;
					}
				} else if (f_isScopeAbsolute(p_resourceAddress)){
					if(v_nbOfSlashes == 4 ) {
						return true;
					} else {
						return false;