OneM2M_Templates.ttcn 67.5 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 111 2016-09-05 21:03:29Z 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
				primitiveContent := omit,
82
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
83 84 85 86 87 88 89 90 91 92 93
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
94 95 96 97 98
        		discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value
				tokenReqIndicator := omit
99
        	};
100

101 102 103 104
			/**
			 * @desc Base RETRIEVE request primitive
			 * @param p_targetResourceAddress Target resource address
			 * @param p_originator Originator (from)
105 106
			 */
			template (value) RequestPrimitive m_retrieveResource(XSD.ID p_targetResourceAddress, in XSD.ID p_originator := PX_AE_ID_STEM) := {
107
				operation := int2,
108
				to_ := f_addPrefix(p_targetResourceAddress),
109
				from_ := p_originator,
110 111
				requestIdentifier := "m_retrieveResource" & f_rnd(1, 1000000),
				resourceType := omit,
112
				primitiveContent := omit,
113
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
114 115 116 117 118 119 120 121 122 123 124
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
125 126 127 128 129
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
130 131
			};
        	
132 133 134 135 136 137
			/**
			 * @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) := {
138
        		operation := int2,
139
        		to_ := f_addPrefix(p_targetResourceAddress),
140
        		from_ := p_originator,
141 142
        		requestIdentifier := "m_retrieveResourceAttributeOptionTo" & f_rnd(1, 1000000),
        		resourceType := omit,
143
				primitiveContent := omit, 
144
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
145 146 147 148 149 150 151 152 153 154 155
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
156 157 158 159 160
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
161 162
        	};
        	
163 164 165 166 167
			/**
			 * @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)
168 169
			 */
			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 ) := {
170
				operation := int2,
171
				to_ := f_addPrefix(p_targetResourceAddress),
172
				from_ := p_originator,
173 174
				requestIdentifier := "m_retrieveResourceAttributeContentOption" & f_rnd(1, 1000000),
				resourceType := omit,
175 176
				primitiveContent := {
					any_1 := {{AttributeList := p_attributeList}}
177
				},
178
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
179 180 181 182 183 184 185 186 187 188 189
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
190 191 192 193 194
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
195 196 197 198 199
			};
    	}//end group Retrieve

    	group Update {
        	
200 201
			/**
			 * @desc Base UPDATE request primitive for Container resource
202
			 */
203 204 205 206
			template (value) RequestPrimitive m_updateContainerBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
207 208
				requestIdentifier := "m_updateContainer" & f_rnd(1, 1000000),
				resourceType := omit,
209
				primitiveContent:= {
210
							any_1 := {{Container_optional := m_contentUpdateContainer}}
211
				},
212
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
213 214 215 216 217 218 219 220 221 222 223
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
224 225 226 227 228
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
229 230
			};
			
231 232 233
			/**
			 * @desc Base UPDATE request primitive for AccessControlPolicy resource
			 */        				
234 235 236 237
			template (value) RequestPrimitive m_updateAcpBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
238 239
				requestIdentifier := "m_updateAcp" & f_rnd(1, 1000000),
				resourceType := omit,
240
				primitiveContent:= {
241
							any_1 := {{AccessControlPolicy_optional := m_contentUpdateAcp}}
242
				},
243
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
244 245 246 247 248 249 250 251 252 253 254
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
255 256 257 258 259
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
260 261 262

			};
			
263 264 265
			/**
			 * @desc Base UPDATE request primitive for Group resource
			 */
266 267 268 269
			template (value) RequestPrimitive m_updateGroupBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
270 271
				requestIdentifier := "m_updateGroup" & f_rnd(1, 1000000),
				resourceType := omit,
272
				primitiveContent:= {
273
							any_1 := {{Group_optional := m_contentUpdateGroup}}
274
				},
275
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
276 277 278 279 280 281 282 283 284 285 286
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
287 288 289 290 291
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
292 293 294

			};
			
295 296 297
			/**
			 * @desc Base UPDATE request primitive for Schedule resource
			 */
298 299 300 301
			template (value) RequestPrimitive m_updateScheduleBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
302 303
				requestIdentifier := "m_updateSchedule" & f_rnd(1, 1000000),
				resourceType := omit,
304
				primitiveContent:= {
305
							any_1 := {{Schedule_optional := m_contentUpdateSchedule}}
306
				},
307
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
308 309 310 311 312 313 314 315 316 317 318
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
319 320 321 322 323
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
324 325 326

			};
			
327 328 329
			/**
			 * @desc Base UPDATE request primitive for PollingChannel resource
			 */
330 331 332 333
			template (value) RequestPrimitive m_updatePollingChannelBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
334 335
				requestIdentifier := "m_updatePollingChannel" & f_rnd(1, 1000000),
				resourceType := omit,
336
				primitiveContent:= {
337
							any_1 := {{PollingChannel_optional := m_contentUpdatePollingChannel}}
338
				},
339
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
340 341 342 343 344 345 346 347 348 349 350
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
351 352 353 354 355
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
356 357 358

			};
			
359 360 361
			/**
			 * @desc Base UPDATE request primitive for Subscription resource
			 */
362 363 364 365
			template (value) RequestPrimitive m_updateSubscriptionBase := {
				operation := int3,
				to_ := "NotInitialized",
				from_ := PX_AE_ID_STEM,
366 367
				requestIdentifier := "m_updateSubscription" & f_rnd(1, 1000000),
				resourceType := omit,
368
				primitiveContent:= {
369
							any_1 := {{Subscription_optional := m_contentUpdateSubscription}}
370
				},
371
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
372 373 374 375 376 377 378 379 380 381 382
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
383 384 385 386 387
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
388 389

			};
390 391
			
			//@Martin
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
392
        	template (value) RequestPrimitive m_updateLocationPolicy(XSD.ID p_locResourceAddress, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod) := {
393
        	  	operation 			:= int3,  //create
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
394
        	  	to_ 				:= p_locResourceAddress,
395 396
        	  	from_				:= PX_AE_ID_STEM, //AE originator id e.g.
        	  	requestIdentifier	:= "m_updateLocationPolicy",
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
397
        	  	resourceType		:= omit,//NP
398 399 400
        	  	primitiveContent	:= {        	    
        	    			any_1 := {{ LocationPolicy_optional := m_contentUpdateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod) }}
        	  },
401
			  roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
402 403 404 405 406 407
			  	originatingTimestamp := omit,
			  	requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
408
				resultContent := int1,//default
409 410 411 412
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
413 414 415 416 417
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
418 419
        	};
        	
420 421 422
    	}//end group Update
    	
    	group Create {
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449

			template (value) RequestPrimitive m_create := {
				operation := int1,
				to_ := "NotInitialized",
				from_ := "NotInitialized",
				requestIdentifier := "m_create" & f_rnd(1, 1000000),
				resourceType := omit,
				primitiveContent := omit,
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit

			};
450
        	
451 452 453
			/**
			 * @desc Base CREATE request primitive for AE resource (AUX)
			 */
454
			//Added by @Naum
455 456 457 458 459 460 461 462 463
			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)}}	
				},
464
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
465 466 467 468 469 470 471 472 473 474 475
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
476 477 478 479 480
				discoveryResultType := *,
				tokens := *,
				tokenIDs := *,
				localTokenIDs := ?,
				tokenReqIndicator := *
481
			};
482 483

			//Added by @Naum
484
			template (value) RequestPrimitive m_createAe(XSD.ID p_appId, template (omit) AcpType p_accessControlPolicyIDs := omit,template (omit) XSD.ID p_from := omit) modifies m_create := {
485 486 487 488
				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 := {
489
					any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName, p_appId)}}	
490
				}
491
			};
492
        	
493
        	template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIDs := omit ) modifies m_create := {
494
        		from_ := PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"//@Martin
495
        		requestIdentifier := "m_createAe" & f_rnd(1, 1000000),
496
        		resourceType := int2,
497
        		primitiveContent := {
498
        			any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName)}}	
499 500
        		}
			};
501
        	
502 503 504
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource
			 */
505
			template (value) RequestPrimitive m_createAcpBase modifies m_create := {
506
				requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
507
				resourceType := int1,
508
				primitiveContent := {
509
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp ()}}
510
				}
511 512
			};
				
513
        	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) modifies m_create := {
514
        		to_ := f_addPrefix(p_parentResourceAddress),
515
        		from_ := PX_AE_ID_STEM,
516
        		requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
517
        		resourceType := int1,
518
        		primitiveContent := {
519
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_name, p_acor, p_allowedOperations)}}
520
        		}
521 522
        	};
        	
523 524 525 526
       	
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource (AUX)
			 */
527
        	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 ) modifies m_create := {
528
        		from_ := PX_AE_ID_STEM,
529
        		requestIdentifier := "m_createAcpAux" & f_rnd(1, 1000000),
530
        		resourceType := int1,
531
        		primitiveContent := {
532
        			any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_acpName, p_acor, p_allowedOperations)}}	
533
        		}
534 535
        	};
        	
536
			//Added by @Naum
537
			template (value) RequestPrimitive m_createCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) modifies m_create := {
538 539 540 541 542
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_createCSE" & f_rnd(1, 1000000),
				resourceType := int1,
				primitiveContent := {
					any_1 := {{CSEBase_optional := m_contentCreateCSEBase (p_serviceSubscribedAppRule)}}
543
				}
544 545
			};
        	
546 547 548 549
       	
			/**
			 * @desc Base CREATE request primitive for Container resource
			 */
550
			template (value) RequestPrimitive m_createContainerBase modifies m_create := {
551
				requestIdentifier := "m_createContainer" & f_rnd(1, 1000000),
552
				resourceType := int3,
553 554
				primitiveContent := {
					
555
					any_1 := {{Container_optional := m_contentCreateContainer}}
556
				}
557 558
			};
	
559
    		template (value) RequestPrimitive m_createContainer(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_resourceName) modifies m_create := {
560
    			to_ := f_addPrefix(p_parentResourceAddress),
561
    			from_ := PX_AE_ID_STEM,
562
    			requestIdentifier := "m_createContainer" & f_rnd(1, 1000000),
563
    			resourceType := int3,
564
    			primitiveContent := {
565
    				any_1 := {{Container_optional := m_contentCreateContainer}}
566
    			}
567 568
    		};
        	
569
    		template (value) RequestPrimitive m_createContentInstance(XSD.ID p_parentResourceAddress, XSD.String p_primitiveContent) modifies m_create := {
570
    			to_ := f_addPrefix(p_parentResourceAddress),
571
    			from_ := "admin:admin",
572
    			requestIdentifier := "m_createContentInstance" & f_rnd(1, 1000000),
573
    			resourceType := int4,
574
    			primitiveContent := {
575
    				any_1 := {{ContentInstance_optional := m_contentCreateContentInstance(p_primitiveContent)}}	
576
    			}
577 578
    		};
    		
579 580 581 582
       	
			/**
			 * @desc Base CREATE request primitive for Group resource
			 */
583
			template (value) RequestPrimitive m_createGroupBase modifies m_create := {
584
				requestIdentifier := "m_createGroup" & f_rnd(1, 1000000),
585 586
				resourceType := int9,
				primitiveContent := {
587
					any_1 := {{Group_optional := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & "NotInitialized"}, omit)}}	//TODO: p_resourceId
588 589
				}
			};
590
        	
591
        	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 ) modifies m_create := {
592
        		to_ := f_addPrefix(p_parentResourceAddress),
593
        		from_ := PX_AE_ID_STEM,
594
        		requestIdentifier := "m_createGroup" & f_rnd(1, 1000000),
595
        		resourceType := int9,
596
        		primitiveContent := {
597
        			any_1 := {{Group_optional := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & valueof(p_memberId)}, p_accessControlPolicyIDs)}}	//TODO: p_resourceId
598
        		}
599 600
        	};
        	
601 602 603 604
       	
			/**
			 * @desc Base CREATE request primitive for PollingChannel resource
			 */
605
			template (value) RequestPrimitive m_createPollingChannelBase modifies m_create := {
606
				requestIdentifier := "m_createPollingChannel" & f_rnd(1, 1000000),
607 608
				resourceType := int15,
				primitiveContent := {
609
					any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel (omit)}}	
610 611
				}
			};
612
        	
613
        	template (value) RequestPrimitive m_createPollingChannel(XSD.ID p_parentResourceAddress, in template (value)XSD.ID p_originatorId, in template (omit) AcpType p_accessControlPolicyIDs ) modifies m_create := {
614
        		to_ := f_addPrefix(p_parentResourceAddress),
615
        		from_ := p_originatorId,
616
        		requestIdentifier := "m_createPollingChannel" & f_rnd(1, 1000000),
617
        		resourceType := int15,
618
        		primitiveContent := {
619
        			any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel (p_accessControlPolicyIDs)}}	
620
        		}
621 622
        	};
        	
623 624 625
			/**
			 * @desc Base CREATE request primitive for Schedule resource
			 */
626
        	template (value) RequestPrimitive m_createScheduleBase modifies m_create := {
627
        		requestIdentifier := "m_createSchedule" & f_rnd(1, 1000000),
628
        		resourceType := int18,
629
        		primitiveContent := {
630
        			any_1 := {{Schedule_optional := m_contentCreateSchedule ({{"0,0,0 1 2,1,1,*"}})}}	
631
        		}
632 633
        	};
        	
634
        	template (value) RequestPrimitive m_createSchedule(XSD.ID p_parentResourceAddress, in template (omit)  XSD.String p_name, in template (value) ScheduleEntries p_scheduleElement ) modifies m_create := {
635
        		to_ := f_addPrefix(p_parentResourceAddress),
636
        		from_ := PX_AE_ID_STEM,
637
        		requestIdentifier := "m_createSchedule" & f_rnd(1, 1000000),
638
        		resourceType := int18,
639
        		primitiveContent := {
640
        			any_1 := {{Schedule_optional := m_contentCreateSchedule (p_scheduleElement)}}	
641
        		}
642 643
        	};
        	
644
			//Added by @Naum
645
			template (value) RequestPrimitive m_createServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedApp_IDs, in ListOfM2MID p_allowedAEs) modifies m_create := {
646 647 648 649
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_createCSE" & f_rnd(1, 1000000),
				resourceType := int1,
				primitiveContent := {
650
					any_1 := {{ServiceSubscribedAppRule_optional := m_contentCreateServiceSubscribedAppRule (p_applicableCredIDs, p_allowedApp_IDs, p_allowedAEs)}}
651
				}
652
			};
653
        	
654 655 656 657
       	
			/**
			 * @desc Base CREATE request primitive for Subscription resource
			 */
658
			template (value) RequestPrimitive m_createSubscriptionBase modifies m_create := {
659
				requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000),
660
				resourceType := int23,
661
				primitiveContent := {
662
					any_1 := {{Subscription_optional := m_contentCreateSubscription ({"Not Initialized"})}}	
663
				}
664 665
			};
        	
666
        	template (value) RequestPrimitive m_createSubscription(XSD.ID p_parentResourceAddress, in template (omit)  XSD.String p_name, in template (value) ListOfURIs p_notificationURI ) modifies m_create := {
667
        		to_ := f_addPrefix(p_parentResourceAddress),
668
        		from_ := PX_AE_ID_STEM,
669
        		requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000),
670
        		resourceType := int23,
671
        		primitiveContent := {
672
					any_1 := {{Subscription_optional := m_contentCreateSubscription (p_notificationURI)}}	
673
        		}
674
        	};
675 676
        	
        	//@Martin
677
        	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) modifies m_create := {
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
678
        	  	to_ 				:= p_parentResourceAddress,
679
        	  	from_				:= PX_AE_ID_STEM, //AE originator id e.g.
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
680
        	  	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
681 682 683
        	  	resourceType		:= int10,
        	  	primitiveContent	:= {        	    
        	    			any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod, locationTargetID, locationServerAddress) }}
684 685
        	  	},
			  	resultContent := int1//default
686 687
        	};
        	
688 689 690 691
    	}//end group Create
    	
    	group Delete {
    	
692
        	template (value) RequestPrimitive m_deleteRequest(XSD.ID p_resourceAddress) := {
693
        		operation := int4,
694
        		to_ := f_addPrefix(p_resourceAddress),
695
        		from_ := PX_AE_ID_STEM,
696
        		requestIdentifier := "m_deleteAe" & f_rnd(1, 1000000),
697
        		resourceType := omit,
698
        		primitiveContent := omit, 
699
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
700 701 702 703 704 705 706 707 708 709 710
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
711 712 713 714 715
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
716 717 718

        	};
        	
719 720 721 722 723 724 725
			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, 
726
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
727 728 729 730 731 732 733 734 735 736 737
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
738 739 740 741 742
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
743

744 745
			};
        	
746 747 748 749 750
    	}//end group Delete
	}//end group RequestPrimitives
	
	group ContentCreate {
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
751

752
			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) := {
753 754 755 756 757 758 759 760 761
    		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
762 763 764 765 766 767 768 769 770 771 772
			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
		};	
773
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
774 775 776 777 778
    	/**
    	 * @desc Base primitiveContent for CREATE operation for AE resource
    	 * @param p_name Resource name
    	 * @param p_accessControlPolicyIDs ACP IDs for the AE
    	 */
779
    	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
780

781 782 783 784 785 786 787 788 789
			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
790 791 792
    		announceTo := omit,//O
    		announcedAttribute := omit,//O
    		appName := omit,//O
793
			app_ID := p_appId,//M
794
    		aE_ID := omit,//NP
795
    		pointOfAccess := omit, //O {"http://127.0.0.1:1400/monitor"},//{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
796 797
    		ontologyRef := omit,//O
    		nodeLink := omit,//NP
798
    		requestReachability := true,//M
799 800 801
    		contentSerialization := omit,//O
    		choice := omit//NP
    	};	
802
    	
803 804 805 806 807
    	/**
    	 * @desc Base primitiveContent for CREATE operation for AccessControlPolicy resource
    	 * @param p_name Resource name
    	 * @param p_acor Allowed originators
    	 * @param p_allowedOperations Allowed operations
808
    	 */
809 810 811 812 813 814 815 816 817 818 819
    	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
820 821 822
			privileges := {
				accessControlRule_list := {
					{
823 824
						accessControlOriginators := p_acor,//{"*"},//{PX_AE_ID_STEM}, //{"admin:admin"},
						accessControlOperations := p_allowedOperations,
825 826
						accessControlContexts_list := omit,
						accessControlAuthenticationFlag := omit
827 828
					}
				}
829
			},//M
830 831 832
			selfPrivileges := {
				accessControlRule_list := {
					{
833 834
						accessControlOriginators := p_acor, //{"*"},//{PX_AE_ID_STEM}, //{"admin:admin"},
						accessControlOperations := int63,
835 836
						accessControlContexts_list := omit,
						accessControlAuthenticationFlag := omit
837
					}
838 839 840
				}
			},//M
			choice := omit //NP
841 842
		};
    	
843 844
		//added by @Naum
		template (value) CSEBase_optional m_contentCreateCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) := {
845
			resourceName := omit,
846
			resourceType := omit,
847 848 849 850 851 852 853 854 855 856 857
			resourceID := omit,
			parentID := omit,
			creationTime := omit,
			lastModifiedTime := omit,
			labels := omit,
			accessControlPolicyIDs := omit,
			cseType := omit,
			cSE_ID := omit,
			supportedResourceType := omit,
			pointOfAccess := omit,
			nodeLink := omit,
858
    		
859 860 861 862
			choice := {
				choice_list := {{
				  serviceSubscribedAppRule := p_serviceSubscribedAppRule
				}}
863 864
			}
		}
865
    	
866 867 868 869 870 871
    	/**
    	 * @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
872
    	 */
873
    	template (value) Group_optional m_contentCreateGroup (	in template (value) XSD.NonNegativeInteger p_maxNrOfMembers,
874 875 876 877
    															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
878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899
			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
			announceTo := omit,//O
			announcedAttribute := omit,//O
			creator := omit,//O
			memberType := int2,//TODO: To be set to omit //O
			currentNrOfMembers := omit,//NP
			maxNrOfMembers := p_maxNrOfMembers,//M
			memberIDs := p_memberIds,//M
			membersAccessControlPolicyIDs := omit,//O
			memberTypeValidated := omit,//NP
			consistencyStrategy := omit,//O
			groupName := omit,//O
			fanOutPoint := omit,//NP
			choice := omit//NP
    	};    	
900
    	
901 902 903 904
    	/**
    	 * @desc Base primitiveContent for CREATE operation for PollingChannel resource
    	 * @param p_accessControlPolicyIDs ACP IDs for the PollingChannel
    	 * @param p_name Resource name
905 906 907 908
    	 */
    	template (value) PollingChannel_optional m_contentCreatePollingChannel (in template (omit) AcpType p_accessControlPolicyIDs, 
																				in template (omit) XSD.String p_name := c_defaultResourceName) := {
			resourceName := p_name,//O
909 910 911 912 913 914 915 916 917 918
            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
            pollingChannelURI := omit//NP
    	};    	
919
    	
920 921 922 923
    	/**
    	 * @desc Base primitiveContent for CREATE operation for Schedule resource
    	 * @param p_scheduleElement Schedule
    	 * @param p_name Resource name
924 925 926 927
    	 */
    	template (value) Schedule_optional m_contentCreateSchedule (in template (value) ScheduleEntries p_scheduleElement,
																	in template (omit) XSD.String p_name := c_defaultResourceName) := {
			resourceName := p_name,//O
928 929 930 931 932 933 934 935 936 937 938 939
			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
			scheduleElement := p_scheduleElement,//M
			choice := omit//NP
    	};    	
940
    	
941
		template (value) ServiceSubscribedAppRule_optional m_contentCreateServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedApp_IDs, in ListOfM2MID p_allowedAEs) := {
942 943 944 945 946 947 948 949 950
		  	resourceName := omit,
			resourceType := omit,
			resourceID := omit,
			parentID := omit,
			creationTime := omit,
			lastModifiedTime := omit,
			labels := omit,
			accessControlPolicyIDs := omit,
			expirationTime := omit,
951 952 953
			applicableCredIDs := p_applicableCredIDs,
			allowedApp_IDs := p_allowedApp_IDs,
			allowedAEs := p_allowedAEs,
954 955
			choice := omit
		}
956
    	
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
957

958 959 960 961
    	/**
    	 * @desc Base primitiveContent for CREATE operation for Subscription resource
    	 * @param p_notificationURI Notification URI
    	 * @param p_name Resource name
962 963 964
    	 */
    	template (value) Subscription_optional m_contentCreateSubscription (in template (value) ListOfURIs p_notificationURI,
																			in template (omit) XSD.String p_name := c_defaultResourceName) := {
965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990
			resourceName := c_defaultResourceName,//O
			resourceType := omit,//NP
			resourceID := omit,//NP
			parentID := omit,//NP
			creationTime := omit,//NP
			lastModifiedTime := omit,//NP
			labels := omit,<