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
 *  @version    $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Templates.ttcn $
10
 *              $Id: OneM2M_Templates.ttcn 105 2016-08-31 13:01:46Z 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

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

97 98 99 100
			/**
			 * @desc Base RETRIEVE request primitive
			 * @param p_targetResourceAddress Target resource address
			 * @param p_originator Originator (from)
101 102
			 */
			template (value) RequestPrimitive m_retrieveResource(XSD.ID p_targetResourceAddress, in XSD.ID p_originator := PX_AE_ID_STEM) := {
103
				operation := int2,
104
				to_ := f_addPrefix(p_targetResourceAddress),
105
				from_ := p_originator,
106 107
				requestIdentifier := "m_retrieveResource" & f_rnd(1, 1000000),
				resourceType := omit,
108 109
				primitiveContent := omit,
				role := omit,
110 111 112 113 114 115 116 117 118 119 120 121 122 123
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	
			};
        	
124 125 126 127 128 129
			/**
			 * @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) := {
130
        		operation := int2,
131
        		to_ := f_addPrefix(p_targetResourceAddress),
132
        		from_ := p_originator,
133 134
        		requestIdentifier := "m_retrieveResourceAttributeOptionTo" & f_rnd(1, 1000000),
        		resourceType := omit,
135 136
				primitiveContent := omit, 
				role := omit,
137 138 139 140 141 142 143 144 145 146 147 148 149 150
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	
        	};
        	
151 152 153 154 155
			/**
			 * @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)
156 157
			 */
			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 ) := {
158
				operation := int2,
159
				to_ := f_addPrefix(p_targetResourceAddress),
160
				from_ := p_originator,
161 162
				requestIdentifier := "m_retrieveResourceAttributeContentOption" & f_rnd(1, 1000000),
				resourceType := omit,
163 164
				primitiveContent := {
					any_1 := {{AttributeList := p_attributeList}}
165
				},
166
				role := omit,
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
				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 {
        	
184 185
			/**
			 * @desc Base UPDATE request primitive for Container resource
186
			 */
187 188 189 190
			template (value) RequestPrimitive m_updateContainerBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
191 192
				requestIdentifier := "m_updateContainer" & f_rnd(1, 1000000),
				resourceType := omit,
193
				primitiveContent:= {
194
							any_1 := {{Container_optional := m_contentUpdateContainer}}
195
				},
196
				role := omit,
197 198 199 200 201 202 203 204 205 206 207 208 209 210
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	
			};
			
211 212 213
			/**
			 * @desc Base UPDATE request primitive for AccessControlPolicy resource
			 */        				
214 215 216 217
			template (value) RequestPrimitive m_updateAcpBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
218 219
				requestIdentifier := "m_updateAcp" & f_rnd(1, 1000000),
				resourceType := omit,
220
				primitiveContent:= {
221
							any_1 := {{AccessControlPolicy_optional := m_contentUpdateAcp}}
222
				},
223
				role := omit,
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

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

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

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

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

			};
350 351
			
			//@Martin
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
352
        	template (value) RequestPrimitive m_updateLocationPolicy(XSD.ID p_locResourceAddress, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod) := {
353
        	  	operation 			:= int3,  //create
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
354
        	  	to_ 				:= p_locResourceAddress,
355 356
        	  	from_				:= PX_AE_ID_STEM, //AE originator id e.g.
        	  	requestIdentifier	:= "m_updateLocationPolicy",
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
357
        	  	resourceType		:= omit,//NP
358 359 360 361 362 363 364 365 366 367
        	  	primitiveContent	:= {        	    
        	    			any_1 := {{ LocationPolicy_optional := m_contentUpdateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod) }}
        	  },
        	  	role := omit,
			  	originatingTimestamp := omit,
			  	requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
368
				resultContent := int1,//default
369 370 371 372 373 374 375
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit 
        	};
        	
376 377 378 379
    	}//end group Update
    	
    	group Create {
        	
380 381 382
			/**
			 * @desc Base CREATE request primitive for AE resource (AUX)
			 */
383
			//Added by @Naum
384 385 386 387 388 389 390 391 392
			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)}}	
				},
393 394 395 396 397 398 399 400 401 402 403 404 405
				role := *,
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
				discoveryResultType := *
406
			};
407 408

			//Added by @Naum
409 410 411 412 413 414 415
			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 := {
416
					any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName, p_appId)}}	
417
				},
418 419 420 421 422 423 424 425 426 427 428 429 430 431
				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	

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

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

			};
				
487
        	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) := {
488
        		operation := int1,
489
        		to_ := f_addPrefix(p_parentResourceAddress),
490
        		from_ := PX_AE_ID_STEM,
491
        		requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
492
        		resourceType := int1,
493
        		primitiveContent := {
494
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_name, p_acor, p_allowedOperations)}}
495
        		},
496
				role := omit,
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
        	
512 513 514 515
       	
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource (AUX)
			 */
516
        	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 ) := {
517
        		operation := int1,
518
        		to_ := "Not Initialized",
519
        		from_ := PX_AE_ID_STEM,
520
        		requestIdentifier := "m_createAcpAux" & f_rnd(1, 1000000),
521
        		resourceType := int1,
522
        		primitiveContent := {
523
        			any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_acpName, p_acor, p_allowedOperations)}}	
524
        		},
525
				role := omit,
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
        	
541 542
			//Added by @Naum
			template (value) RequestPrimitive m_createCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) := {
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566
				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	

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

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

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

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

				};
        	
676
        	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 ) := {
677
        		operation := int1,
678
        		to_ := f_addPrefix(p_parentResourceAddress),
679
        		from_ := PX_AE_ID_STEM,
680
        		requestIdentifier := "m_createGroup" & f_rnd(1, 1000000),
681
        		resourceType := int9,
682
        		primitiveContent := {
683
        			any_1 := {{Group_optional := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & valueof(p_memberId)}, p_accessControlPolicyIDs)}}	//TODO: p_resourceId
684
        		},
685
				role := omit,
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

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

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

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

        	};
        	
808
			//Added by @Naum
809
			template (value) RequestPrimitive m_createServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedApp_IDs, in ListOfM2MID p_allowedAEs) := {
810 811 812 813 814 815
				operation := int1,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_createCSE" & f_rnd(1, 1000000),
				resourceType := int1,
				primitiveContent := {
816
					any_1 := {{ServiceSubscribedAppRule_optional := m_contentCreateServiceSubscribedAppRule (p_applicableCredIDs, p_allowedApp_IDs, p_allowedAEs)}}
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832
				},
				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	

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

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

        	};
887 888
        	
        	//@Martin
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
889
        	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) := {
890
        	  	operation 			:= int1,  //create
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
891
        	  	to_ 				:= p_parentResourceAddress,
892
        	  	from_				:= PX_AE_ID_STEM, //AE originator id e.g.
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
893
        	  	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
894 895 896 897 898 899 900 901 902 903 904
        	  	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,
905
				resultContent := int1,//default
906 907 908 909 910 911 912
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	        	  
        	};
        	
913 914 915 916
    	}//end group Create
    	
    	group Delete {
    	
917
        	template (value) RequestPrimitive m_deleteRequest(XSD.ID p_resourceAddress) := {
918
        		operation := int4,
919
        		to_ := f_addPrefix(p_resourceAddress),
920
        		from_ := PX_AE_ID_STEM,
921
        		requestIdentifier := "m_deleteAe" & f_rnd(1, 1000000),
922
        		resourceType := omit,
923 924
        		primitiveContent := omit, 
        		role := omit,
925 926 927 928 929 930 931 932 933 934 935 936 937 938 939
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

        	};
        	
940 941 942 943 944 945 946
			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, 
947
				role := omit,
948 949 950 951 952 953 954 955 956 957 958 959 960
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit	

961 962
			};
        	
963 964 965 966 967
    	}//end group Delete
	}//end group RequestPrimitives
	
	group ContentCreate {
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
968

969
			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) := {
970 971 972 973 974 975 976 977 978
    		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
979 980 981 982 983 984 985 986 987 988 989
			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
		};	
990
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
991 992 993 994 995
    	/**
    	 * @desc Base primitiveContent for CREATE operation for AE resource
    	 * @param p_name Resource name
    	 * @param p_accessControlPolicyIDs ACP IDs for the AE
    	 */
996
    	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
997

998 999 1000 1001 1002 1003 1004 1005 1006
			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
1007 1008 1009
    		announceTo := omit,//O
    		announcedAttribute := omit,//O
    		appName := omit,//O
1010
			app_ID := p_appId,//M
1011
    		aE_ID := omit,//NP
1012
    		pointOfAccess := omit, //O {"http://127.0.0.1:1400/monitor"},//{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
1013 1014
    		ontologyRef := omit,//O
    		nodeLink := omit,//NP
1015
    		requestReachability := true,//M
1016 1017 1018
    		contentSerialization := omit,//O
    		choice := omit//NP
    	};	
1019
    	
1020 1021 1022 1023 1024
    	/**
    	 * @desc Base primitiveContent for CREATE operation for AccessControlPolicy resource
    	 * @param p_name Resource name
    	 * @param p_acor Allowed originators
    	 * @param p_allowedOperations Allowed operations
1025
    	 */
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036
    	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
1037 1038 1039
			privileges := {
				accessControlRule_list := {
					{
1040 1041
						accessControlOriginators := p_acor,//{"*"},//{PX_AE_ID_STEM}, //{"admin:admin"},
						accessControlOperations := p_allowedOperations,
1042 1043 1044
						accessControlContexts_list := omit
					}
				}
1045
			},//M
1046 1047 1048
			selfPrivileges := {
				accessControlRule_list := {
					{
1049 1050
						accessControlOriginators := p_acor, //{"*"},//{PX_AE_ID_STEM}, //{"admin:admin"},
						accessControlOperations := int63,
1051 1052
						accessControlContexts_list := omit
					}
1053 1054 1055
				}
			},//M
			choice := omit //NP
1056 1057
		};
    	
1058 1059
		//added by @Naum
		template (value) CSEBase_optional m_contentCreateCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) := {
1060
			resourceName := omit,
1061
			resourceType := omit,
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072
			resourceID := omit,
			parentID := omit,
			creationTime := omit,
			lastModifiedTime := omit,
			labels := omit,
			accessControlPolicyIDs := omit,
			cseType := omit,
			cSE_ID := omit,
			supportedResourceType := omit,
			pointOfAccess := omit,
			nodeLink := omit,
1073
    		
1074 1075 1076 1077
			choice := {
				choice_list := {{
				  serviceSubscribedAppRule := p_serviceSubscribedAppRule
				}}
1078 1079
			}
		}
1080
    	
1081 1082 1083 1084 1085 1086
    	/**
    	 * @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
1087
    	 */
1088
    	template (value) Group_optional m_contentCreateGroup (	in template (value) XSD.NonNegativeInteger p_maxNrOfMembers,
1089 1090 1091 1092
    															in template (value) ListOfURIs p_memberIds,
    															in template (omit) AcpType p_accessControlPolicyIDs,
																in template (omit) XSD.String p_name := c_defaultResourceName) := {
			resourceName := p_name,//O
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103