OneM2M_Templates.ttcn 72.3 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://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Templates.ttcn $
 *              $Id: OneM2M_Templates.ttcn 103 2016-08-30 09:39:32Z reinaortega $
11 12 13 14 15 16 17 18 19 20 21
 *  @desc       Module containing templates for oneM2M
 *
 */
module OneM2M_Templates {

	import from XSD all;
	import from OneM2M_Types all;
	import from OneM2M_TestSystem all;
	import from OneM2M_TypesAndValues all;
	//import from OneM2M_AdditionalTypes all;
	import from OneM2M_Pixits all;
22
	import from OneM2M_Functions all;
23

24
		
25 26 27 28 29 30
	/**
	 * @desc Get a converted to string random number 
	 * @param p_lower Lower limit 
	 * @param p_upper Upper limit
	 * @return Random number converted to string
	 * @verdict 
31
	 */
32 33 34 35 36
	function f_rnd(in integer p_lower, in integer p_upper) return charstring {
		
		return int2str(float2int(rnd() * int2float(p_upper - p_lower + 1)) + p_lower);	
	}

37 38 39

	/* Templates */
	/** 
40
	 * @desc Base template for request sending operations
41 42
	 * @param p_requestPrimitive
	 */
43
	template (value) M2MRequestPrimitive m_request(in template (value) RequestPrimitive p_requestPrimitive, in template (omit) AttributeList_1 p_nullFields := omit ) := {
44 45 46
		requestPrimitive_ := p_requestPrimitive,
		host := PX_HOST_ADDRESS,
		xmlNamespace := PX_XML_NAMESPACE,
47
		protocolBinding := PX_PROTOCOL_BINDING,
48 49
		serialization := PX_SERIALIZATION, 
		nullFields := p_nullFields
50 51
	};
	//Added by @Naum
52
	template M2MRequestPrimitive mw_request(in template RequestPrimitive p_requestPrimitive, in template (omit) AttributeList_1 p_nullFields := omit ) := {
53
		requestPrimitive_ := p_requestPrimitive,
54 55 56 57 58
		host := omit,
		xmlNamespace := omit,
		protocolBinding := omit,
		serialization := omit, 
		nullFields := omit
59 60 61 62 63 64 65 66 67 68 69
	};
	
	group RequestPrimitives { 
		
		group Retrieve {
	
        	/**
			 * @desc 
			 */
        	template (value) RequestPrimitive m_retrieveCseBase := {
        		operation := int2,
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
70
        		to_ := PX_URI_CSE,//c_uri_cse,//@Martin
71
        		from_ := "admin:admin",
72 73
        		requestIdentifier := "m_retrieveCseBase" & f_rnd(1, 1000000),
        		resourceType := omit,
74 75
				primitiveContent := omit,
				role := omit,
76 77 78 79 80 81 82 83 84 85 86 87 88
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
        		discoveryResultType := omit	
        	};
89

90 91 92 93
			/**
			 * @desc Base RETRIEVE request primitive
			 * @param p_targetResourceAddress Target resource address
			 * @param p_originator Originator (from)
94 95
			 */
			template (value) RequestPrimitive m_retrieveResource(XSD.ID p_targetResourceAddress, in XSD.ID p_originator := PX_AE_ID_STEM) := {
96
				operation := int2,
97
				to_ := f_addPrefix(p_targetResourceAddress),
98
				from_ := p_originator,
99 100
				requestIdentifier := "m_retrieveResource" & f_rnd(1, 1000000),
				resourceType := omit,
101 102
				primitiveContent := omit,
				role := omit,
103 104 105 106 107 108 109 110 111 112 113 114 115 116
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	
			};
        	
117 118 119 120 121 122
			/**
			 * @desc RETRIEVE request primitive for a single attribute in To field ("targetResourceAddress#AttributeName")
			 * @param p_targetResourceAddress Target resource address (including "#AttributeName")
			 * @param p_originator Originator (from)
			 */
        	template (value) RequestPrimitive m_retrieveResourceAttributeToOption(XSD.ID p_targetResourceAddress, in XSD.ID p_originator := PX_AE_ID_STEM) := {
123
        		operation := int2,
124
        		to_ := f_addPrefix(p_targetResourceAddress),
125
        		from_ := p_originator,
126 127
        		requestIdentifier := "m_retrieveResourceAttributeOptionTo" & f_rnd(1, 1000000),
        		resourceType := omit,
128 129
				primitiveContent := omit, 
				role := omit,
130 131 132 133 134 135 136 137 138 139 140 141 142 143
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	
        	};
        	
144 145 146 147 148
			/**
			 * @desc RETRIEVE request primtive containing the target attributes in the primitiveContent field
			 * @param p_targetResourceAddress Target resource address 
			 * @param p_attributeList Target attribute list
			 * @param p_originator Originator (from)
149 150
			 */
			template (value) RequestPrimitive m_retrieveResourceAttributeContentOption(XSD.ID p_targetResourceAddress, in template (value) AttributeList_1 p_attributeList, in XSD.ID p_originator := PX_AE_ID_STEM ) := {
151
				operation := int2,
152
				to_ := f_addPrefix(p_targetResourceAddress),
153
				from_ := p_originator,
154 155
				requestIdentifier := "m_retrieveResourceAttributeContentOption" & f_rnd(1, 1000000),
				resourceType := omit,
156 157
				primitiveContent := {
					any_1 := {{AttributeList := p_attributeList}}
158
				},
159
				role := omit,
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	
			};
    	}//end group Retrieve

    	group Update {
        	
177 178
			/**
			 * @desc Base UPDATE request primitive for Container resource
179
			 */
180 181 182 183
			template (value) RequestPrimitive m_updateContainerBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
184 185
				requestIdentifier := "m_updateContainer" & f_rnd(1, 1000000),
				resourceType := omit,
186
				primitiveContent:= {
187
							any_1 := {{Container_optional := m_contentUpdateContainer}}
188
				},
189
				role := omit,
190 191 192 193 194 195 196 197 198 199 200 201 202 203
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	
			};
			
204 205 206
			/**
			 * @desc Base UPDATE request primitive for AccessControlPolicy resource
			 */        				
207 208 209 210
			template (value) RequestPrimitive m_updateAcpBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
211 212
				requestIdentifier := "m_updateAcp" & f_rnd(1, 1000000),
				resourceType := omit,
213
				primitiveContent:= {
214
							any_1 := {{AccessControlPolicy_optional := m_contentUpdateAcp}}
215
				},
216
				role := omit,
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

			};
			
232 233 234
			/**
			 * @desc Base UPDATE request primitive for Group resource
			 */
235 236 237 238
			template (value) RequestPrimitive m_updateGroupBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
239 240
				requestIdentifier := "m_updateGroup" & f_rnd(1, 1000000),
				resourceType := omit,
241
				primitiveContent:= {
242
							any_1 := {{Group_optional := m_contentUpdateGroup}}
243
				},
244
				role := omit,
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

			};
			
260 261 262
			/**
			 * @desc Base UPDATE request primitive for Schedule resource
			 */
263 264 265 266
			template (value) RequestPrimitive m_updateScheduleBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
267 268
				requestIdentifier := "m_updateSchedule" & f_rnd(1, 1000000),
				resourceType := omit,
269
				primitiveContent:= {
270
							any_1 := {{Schedule_optional := m_contentUpdateSchedule}}
271
				},
272
				role := omit,
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

			};
			
288 289 290
			/**
			 * @desc Base UPDATE request primitive for PollingChannel resource
			 */
291 292 293 294
			template (value) RequestPrimitive m_updatePollingChannelBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
295 296
				requestIdentifier := "m_updatePollingChannel" & f_rnd(1, 1000000),
				resourceType := omit,
297
				primitiveContent:= {
298
							any_1 := {{PollingChannel_optional := m_contentUpdatePollingChannel}}
299
				},
300
				role := omit,
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

			};
			
316 317 318
			/**
			 * @desc Base UPDATE request primitive for Subscription resource
			 */
319 320 321 322
			template (value) RequestPrimitive m_updateSubscriptionBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
323 324
				requestIdentifier := "m_updateSubscription" & f_rnd(1, 1000000),
				resourceType := omit,
325
				primitiveContent:= {
326
							any_1 := {{Subscription_optional := m_contentUpdateSubscription}}
327
				},
328
				role := omit,
329 330 331 332 333 334 335 336 337 338 339 340 341 342
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

			};
343 344
			
			//@Martin
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
345
        	template (value) RequestPrimitive m_updateLocationPolicy(XSD.ID p_locResourceAddress, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod) := {
346
        	  	operation 			:= int3,  //create
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
347
        	  	to_ 				:= p_locResourceAddress,
348 349
        	  	from_				:= PX_AE_ID_STEM, //AE originator id e.g.
        	  	requestIdentifier	:= "m_updateLocationPolicy",
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
350
        	  	resourceType		:= omit,//NP
351 352 353 354 355 356 357 358 359 360
        	  	primitiveContent	:= {        	    
        	    			any_1 := {{ LocationPolicy_optional := m_contentUpdateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod) }}
        	  },
        	  	role := omit,
			  	originatingTimestamp := omit,
			  	requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
361
				resultContent := int1,//default
362 363 364 365 366 367 368
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit 
        	};
        	
369 370 371 372
    	}//end group Update
    	
    	group Create {
        	
373 374 375
			/**
			 * @desc Base CREATE request primitive for AE resource (AUX)
			 */
376
			//Added by @Naum
377 378 379 380 381 382 383 384 385
			template RequestPrimitive mw_createAEannc(template (omit) AcpType p_accessControlPolicyIDs := omit,template (omit) XSD.ID p_from := omit, XSD.ID p_appId) := {
				operation := int1,
				to_ := ?,
				from_ := p_from,//PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"
				requestIdentifier := ?,
				resourceType := int10002,
				primitiveContent := {
					any_1 := {{AEAnnc_optional := mw_contentCreateAEannc(c_aeAuxName, p_accessControlPolicyIDs, p_appId)}}	
				},
386 387 388 389 390 391 392 393 394 395 396 397 398
				role := *,
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
				discoveryResultType := *
399
			};
400 401

			//Added by @Naum
402 403 404 405 406 407 408
			template (value) RequestPrimitive m_createAe(XSD.ID p_appId, template (omit) AcpType p_accessControlPolicyIDs := omit,template (omit) XSD.ID p_from := omit) := {
				operation := int1,
				to_ := "Not Initialized",
				from_ := p_from,//PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"
				requestIdentifier := "m_createAe" & f_rnd(1, 1000000),
				resourceType := int2,
				primitiveContent := {
409
					any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName, p_appId)}}	
410
				},
411 412 413 414 415 416 417 418 419 420 421 422 423 424
				role := omit,
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

425
			};
426
        	
427
        	template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIDs := omit ) := {
428
        		operation := int1,
429
        		to_ := "Not Initialized",
430
        		from_ := PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"//@Martin
431
        		requestIdentifier := "m_createAe" & f_rnd(1, 1000000),
432
        		resourceType := int2,
433
        		primitiveContent := {
434
        			any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName)}}	
435
        		},
436
				role := omit,
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
        	
452 453 454
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource
			 */
455 456 457
			template (value) RequestPrimitive m_createAcpBase := {
				operation := int1,
				to_ := "NotInitialized",
458
				from_ := "NotInitialized",
459
				requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
460
				resourceType := int1,
461
				primitiveContent := {
462
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp ()}}
463
				},
464
				role := omit,
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

			};
				
480
        	template (value) RequestPrimitive m_createAcp(XSD.ID p_parentResourceAddress, in template (omit)  XSD.String p_name := c_defaultResourceName, in template (value) ListOfURIs p_acor := PX_ACOR, in template (value) AccessControlOperations p_allowedOperations := int63) := {
481
        		operation := int1,
482
        		to_ := f_addPrefix(p_parentResourceAddress),
483
        		from_ := PX_AE_ID_STEM,
484
        		requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
485
        		resourceType := int1,
486
        		primitiveContent := {
487
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_name, p_acor, p_allowedOperations)}}
488
        		},
489
				role := omit,
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
        	
505 506 507 508
       	
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource (AUX)
			 */
509
        	template (value) RequestPrimitive m_createAcpAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) ListOfURIs p_acor := PX_ACOR, in template (value) AccessControlOperations p_allowedOperations := int63 ) := {
510
        		operation := int1,
511
        		to_ := "Not Initialized",
512
        		from_ := PX_AE_ID_STEM,
513
        		requestIdentifier := "m_createAcpAux" & f_rnd(1, 1000000),
514
        		resourceType := int1,
515
        		primitiveContent := {
516
        			any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_acpName, p_acor, p_allowedOperations)}}	
517
        		},
518
				role := omit,
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
        	
534 535
			//Added by @Naum
			template (value) RequestPrimitive m_createCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) := {
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
				operation := int1,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_createCSE" & f_rnd(1, 1000000),
				resourceType := int1,
				primitiveContent := {
					any_1 := {{CSEBase_optional := m_contentCreateCSEBase (p_serviceSubscribedAppRule)}}
				},
				role := omit,
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

			};
        	
560 561 562 563
       	
			/**
			 * @desc Base CREATE request primitive for Container resource
			 */
564 565 566
			template (value) RequestPrimitive m_createContainerBase := {
				operation := int1,
				to_ := "NotInitialized",
567
				from_ := "NotInitialized",
568
				requestIdentifier := "m_createContainer" & f_rnd(1, 1000000),
569
				resourceType := int3,
570 571
				primitiveContent := {
					
572
					any_1 := {{Container_optional := m_contentCreateContainer}}
573
				},
574
				role := omit,
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

			};
	
590
    		template (value) RequestPrimitive m_createContainer(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_resourceName) := {
591
    			operation := int1,
592
    			to_ := f_addPrefix(p_parentResourceAddress),
593
    			from_ := PX_AE_ID_STEM,
594
    			requestIdentifier := "m_createContainer" & f_rnd(1, 1000000),
595
    			resourceType := int3,
596
    			primitiveContent := {
597
    				any_1 := {{Container_optional := m_contentCreateContainer}}
598
    			},
599
				role := omit,
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

    		};
        	
615
    		template (value) RequestPrimitive m_createContentInstance(XSD.ID p_parentResourceAddress, XSD.String p_primitiveContent) := {
616
    			operation := int1,
617
    			to_ := f_addPrefix(p_parentResourceAddress),
618
    			from_ := "admin:admin",
619
    			requestIdentifier := "m_createContentInstance" & f_rnd(1, 1000000),
620
    			resourceType := int4,
621
    			primitiveContent := {
622
    				any_1 := {{ContentInstance_optional := m_contentCreateContentInstance(p_primitiveContent)}}	
623
    			},
624
				role := omit,
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

    		};
    		
640 641 642 643
       	
			/**
			 * @desc Base CREATE request primitive for Group resource
			 */
644
			template (value) RequestPrimitive m_createGroupBase := {
645 646
				operation := int1,
				to_ := "NotInitialized",
647
				from_ := "NotInitialized",
648
				requestIdentifier := "m_createGroup" & f_rnd(1, 1000000),
649 650
				resourceType := int9,
				primitiveContent := {
651
					any_1 := {{Group_optional := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & "NotInitialized"}, omit)}}	//TODO: p_resourceId
652 653
				},
				role := omit,
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

				};
        	
669
        	template (value) RequestPrimitive m_createGroup(XSD.ID p_parentResourceAddress, in template (omit)  XSD.String p_name, in template (omit) AcpType p_accessControlPolicyIDs, in template (value) XSD.AnyURI p_memberId ) := {
670
        		operation := int1,
671
        		to_ := f_addPrefix(p_parentResourceAddress),
672
        		from_ := PX_AE_ID_STEM,
673
        		requestIdentifier := "m_createGroup" & f_rnd(1, 1000000),
674
        		resourceType := int9,
675
        		primitiveContent := {
676
        			any_1 := {{Group_optional := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & valueof(p_memberId)}, p_accessControlPolicyIDs)}}	//TODO: p_resourceId
677
        		},
678
				role := omit,
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
        	
694 695 696 697
       	
			/**
			 * @desc Base CREATE request primitive for PollingChannel resource
			 */
698
			template (value) RequestPrimitive m_createPollingChannelBase := {
699 700
				operation := int1,
				to_ := "NotInitialized",
701
				from_ := "NotInitialized",
702
				requestIdentifier := "m_createPollingChannel" & f_rnd(1, 1000000),
703 704
				resourceType := int15,
				primitiveContent := {
705
					any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel (omit)}}	
706 707
				},
				role := omit,
708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

				};
        	
723
        	template (value) RequestPrimitive m_createPollingChannel(XSD.ID p_parentResourceAddress, in template (value)XSD.ID p_originatorId, in template (omit) AcpType p_accessControlPolicyIDs ) := {
724
        		operation := int1,
725
        		to_ := f_addPrefix(p_parentResourceAddress),
726
        		from_ := p_originatorId,
727
        		requestIdentifier := "m_createPollingChannel" & f_rnd(1, 1000000),
728
        		resourceType := int15,
729
        		primitiveContent := {
730
        			any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel (p_accessControlPolicyIDs)}}	
731
        		},
732
				role := omit,
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
        	
748 749 750
			/**
			 * @desc Base CREATE request primitive for Schedule resource
			 */
751 752 753
        	template (value) RequestPrimitive m_createScheduleBase := {
        		operation := int1,
        		to_ := "NotInitialized",
754
        		from_ := "NotInitialized",
755
        		requestIdentifier := "m_createSchedule" & f_rnd(1, 1000000),
756
        		resourceType := int18,
757
        		primitiveContent := {
758
        			any_1 := {{Schedule_optional := m_contentCreateSchedule ({{"0,0,0 1 2,1,1,*"}})}}	
759
        		},
760
				role := omit,
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775
        		originatingTimestamp := omit,
        		requestExpirationTimestamp := omit,
        		resultExpirationTimestamp := omit,
        		operationExecutionTime := omit,
        		responseType := omit,
        		resultPersistence := omit,
        		resultContent := omit,
        		eventCategory := omit,
        		deliveryAggregation := omit,
        		groupRequestIdentifier := omit,
        		filterCriteria := omit,
        		discoveryResultType := omit	
        
        	};
        	
776
        	template (value) RequestPrimitive m_createSchedule(XSD.ID p_parentResourceAddress, in template (omit)  XSD.String p_name, in template (value) ScheduleEntries p_scheduleElement ) := {
777
        		operation := int1,
778
        		to_ := f_addPrefix(p_parentResourceAddress),
779
        		from_ := PX_AE_ID_STEM,
780
        		requestIdentifier := "m_createSchedule" & f_rnd(1, 1000000),
781
        		resourceType := int18,
782
        		primitiveContent := {
783
        			any_1 := {{Schedule_optional := m_contentCreateSchedule (p_scheduleElement)}}	
784
        		},
785
				role := omit,
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
        	
801
			//Added by @Naum
802
			template (value) RequestPrimitive m_createServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedApp_IDs, in ListOfM2MID p_allowedAEs) := {
803 804 805 806 807 808
				operation := int1,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_createCSE" & f_rnd(1, 1000000),
				resourceType := int1,
				primitiveContent := {
809
					any_1 := {{ServiceSubscribedAppRule_optional := m_contentCreateServiceSubscribedAppRule (p_applicableCredIDs, p_allowedApp_IDs, p_allowedAEs)}}
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825
				},
				role := omit,
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

			};
826
        	
827 828 829 830
       	
			/**
			 * @desc Base CREATE request primitive for Subscription resource
			 */
831 832 833
			template (value) RequestPrimitive m_createSubscriptionBase := {
				operation := int1,
				to_ := "NotInitialized",
834
				from_ := "NotInitialized",
835
				requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000),
836
				resourceType := int23,
837
				primitiveContent := {
838
					any_1 := {{Subscription_optional := m_contentCreateSubscription ({"Not Initialized"})}}	
839
				},
840
				role := omit,
841 842 843 844 845 846 847 848 849 850 851 852 853 854 855
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

			};
        	
856
        	template (value) RequestPrimitive m_createSubscription(XSD.ID p_parentResourceAddress, in template (omit)  XSD.String p_name, in template (value) ListOfURIs p_notificationURI ) := {
857
        		operation := int1,
858
        		to_ := f_addPrefix(p_parentResourceAddress),
859
        		from_ := PX_AE_ID_STEM,
860
        		requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000),
861
        		resourceType := int23,
862
        		primitiveContent := {
863
					any_1 := {{Subscription_optional := m_contentCreateSubscription (p_notificationURI)}}	
864
        		},
865
				role := omit,
866 867 868 869 870 871 872 873 874 875 876 877 878 879
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
880 881
        	
        	//@Martin
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
882
        	template (value) RequestPrimitive m_createLocationPolicy(XSD.ID p_parentResourceAddress, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod, in template (omit) NodeID locationTargetID, in template (omit) XSD.AnyURI locationServerAddress) := {
883
        	  	operation 			:= int1,  //create
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
884
        	  	to_ 				:= p_parentResourceAddress,
885
        	  	from_				:= PX_AE_ID_STEM, //AE originator id e.g.
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
886
        	  	requestIdentifier	:= "m_createLocationPolicy", //the requestIdentifier is supposed to be set similar as "C190XX7T/001"  by prepending the AE-ID-Stem and slash(‘/’) in front of it
887 888 889 890 891 892 893 894 895 896 897
        	  	resourceType		:= int10,
        	  	primitiveContent	:= {        	    
        	    			any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod, locationTargetID, locationServerAddress) }}
        	  },
        	  	role := omit,
			  	originatingTimestamp := omit,
			  	requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
898
				resultContent := int1,//default
899 900 901 902 903 904 905
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	        	  
        	};
        	
906 907 908 909
    	}//end group Create
    	
    	group Delete {
    	
910
        	template (value) RequestPrimitive m_deleteRequest(XSD.ID p_resourceAddress) := {
911
        		operation := int4,
912
        		to_ := f_addPrefix(p_resourceAddress),
913
        		from_ := PX_AE_ID_STEM,
914
        		requestIdentifier := "m_deleteAe" & f_rnd(1, 1000000),
915
        		resourceType := omit,
916 917
        		primitiveContent := omit, 
        		role := omit,
918 919 920 921 922 923 924 925 926 927 928 929 930 931 932
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
        	
933 934 935 936 937 938 939
			template (value) RequestPrimitive m_delete(XSD.ID p_resourceAddress) := {
				operation := int4,
				to_ := p_resourceAddress,
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_deleteAe" & f_rnd(1, 1000000),
				resourceType := omit,
				primitiveContent := omit, 
940
				role := omit,
941 942 943 944 945 946 947 948 949 950 951 952 953
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

954 955
			};
        	
956 957 958 959 960
    	}//end group Delete
	}//end group RequestPrimitives
	
	group ContentCreate {
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
961

962
			template (value) AEAnnc_optional mw_contentCreateAEannc (in template (omit)  XSD.String p_name, in template (omit) AcpType p_accessControlPolicyIDs, XSD.ID p_appId := PX_APP_ID) := {
963 964 965 966 967 968 969 970 971
    		resourceName := p_name,//O
    		resourceType := omit,//NP
    		resourceID := omit,//NP
    		parentID := omit,//NP
    		creationTime := omit,//NP
    		lastModifiedTime := omit,//NP
    		labels := omit,//O
    		accessControlPolicyIDs := p_accessControlPolicyIDs,//O
    		expirationTime := omit,//O
972 973 974 975 976 977 978 979 980 981 982
			link := omit,//O
			appName := omit,//O
			app_ID := p_appId,//M
			aE_ID := omit,//NP
			pointOfAccess := omit, //{"http://127.0.0.1:1400/monitor"},//O //{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
			ontologyRef := omit,//O
			nodeLink := omit,//NP
			requestReachability := true,//M
			contentSerialization := omit,//O
			choice := omit//NP
		};	
983
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
984 985 986 987 988
    	/**
    	 * @desc Base primitiveContent for CREATE operation for AE resource
    	 * @param p_name Resource name
    	 * @param p_accessControlPolicyIDs ACP IDs for the AE
    	 */
989
    	template (value) AE_optional m_contentCreateAe (in template (omit) AcpType p_accessControlPolicyIDs, in template (omit)  XSD.String p_name := c_defaultResourceName, in template (omit) XSD.ID p_appId := PX_APP_ID) := {
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
990

991 992 993 994 995 996 997 998 999
			resourceName := p_name,//O
			resourceType := omit,//NP
			resourceID := omit,//NP
			parentID := omit,//NP
			creationTime := omit,//NP
			lastModifiedTime := omit,//NP
			labels := omit,//O
			accessControlPolicyIDs := p_accessControlPolicyIDs,//O
			expirationTime := omit,//O
1000 1001 1002
    		announceTo := omit,//O
    		announcedAttribute := omit,//O
    		appName := omit,//O
1003
			app_ID := p_appId,//M
1004
    		aE_ID := omit,//NP
1005
    		pointOfAccess := omit, //O {"http://127.0.0.1:1400/monitor"},//{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
1006 1007
    		ontologyRef := omit,//O
    		nodeLink := omit,//NP
1008
    		requestReachability := true,//M
1009 1010 1011
    		contentSerialization := omit,//O
    		choice := omit//NP
    	};	
1012
    	
1013 1014 1015 1016 1017
    	/**
    	 * @desc Base primitiveContent for CREATE operation for AccessControlPolicy resource
    	 * @param p_name Resource name
    	 * @param p_acor Allowed originators
    	 * @param p_allowedOperations Allowed operations
1018
    	 */
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029
    	template (value) AccessControlPolicy_optional m_contentCreateAcp (in template (omit) XSD.String p_name := c_defaultResourceName, in template (value) ListOfURIs p_acor := PX_ACOR, in template (value) AccessControlOperations p_allowedOperations := int63 ) := {
			resourceName := p_name,//O
			resourceType := omit,//NP
			resourceID := omit,//NP
			parentID := omit,//NP
			creationTime := omit,//NP
			lastModifiedTime := omit,//NP
			labels := omit,//O
			expirationTime := omit,//O
			announceTo := omit,//O
			announcedAttribute := omit,//O
1030 1031 1032
			privileges := {
				accessControlRule_list := {
					{
1033 1034
						accessControlOriginators := p_acor,//{"*"},//{PX_AE_ID_STEM}, //{"admin:admin"},
						accessControlOperations := p_allowedOperations,
1035 1036 1037
						accessControlContexts_list := omit
					}
				}
1038
			},//M
1039 1040 1041
			selfPrivileges := {
				accessControlRule_list := {
					{
1042 1043
						accessControlOriginators := p_acor, //{"*"},//{PX_AE_ID_STEM}, //{"admin:admin"},
						accessControlOperations := int63,
1044 1045
						accessControlContexts_list := omit
					}
1046 1047 1048
				}
			},//M
			choice := omit //NP
1049 1050
		};
    	
1051 1052
		//added by @Naum
		template (value) CSEBase_optional m_contentCreateCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) := {
1053
			resourceName := omit,
1054
			resourceType := omit,
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065
			resourceID := omit,
			parentID := omit,
			creationTime := omit,
			lastModifiedTime := omit,
			labels := omit,
			accessControlPolicyIDs := omit,
			cseType := omit,
			cSE_ID := omit,
			supportedResourceType := omit,
			pointOfAccess := omit,
			nodeLink := omit,
1066
    		
1067 1068 1069 1070
			choice := {
				choice_list := {{
				  serviceSubscribedAppRule := p_serviceSubscribedAppRule
				}}
1071 1072
			}
		}
1073
    	
1074 1075 1076 1077 1078 1079
    	/**
    	 * @desc Base primitiveContent for CREATE operation for Group resource
    	 * @param p_maxNrOfMembers Max number of members
    	 * @param p_memberIds Member IDs
    	 * @param p_accessControlPolicyIDs ACP IDs for the Group
    	 * @param p_name Resource name
1080
    	 */
1081
    	template (value) Group_optional m_contentCreateGroup (	in template (value) XSD.NonNegativeInteger p_maxNrOfMembers,