OneM2M_Templates.ttcn 66.6 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 114 2016-09-09 07:12:19Z 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
			};
    	}//end group Retrieve

    	group Update {
199 200
    		
    		template (value) RequestPrimitive m_update := {
201 202
				operation := int3,
				to_ := "NotInitialized",
203 204
				from_ := "NotInitialized",
				requestIdentifier := "m_update" & f_rnd(1, 1000000),
205
				resourceType := omit,
206
				primitiveContent:= omit,
207
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
208 209 210 211 212 213 214 215 216 217 218
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
219 220 221 222 223
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
224
			};
225 226 227 228 229 230 231 232 233 234 235
        	
			/**
			 * @desc Base UPDATE request primitive for Container resource
			 */
			template (value) RequestPrimitive m_updateContainerBase modifies m_update:= {
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_updateContainer" & f_rnd(1, 1000000),
				primitiveContent:= {
							any_1 := {{Container_optional := m_contentUpdateContainer}}
				}
			};
236
			
237 238 239
			/**
			 * @desc Base UPDATE request primitive for AccessControlPolicy resource
			 */        				
240
			template (value) RequestPrimitive m_updateAcpBase modifies m_update := {
241
				from_ := PX_AE_ID_STEM,
242
				requestIdentifier := "m_updateAcp" & f_rnd(1, 1000000),
243
				primitiveContent:= {
244
							any_1 := {{AccessControlPolicy_optional := m_contentUpdateAcp}}
245
				}
246 247
			};
			
248 249 250
			/**
			 * @desc Base UPDATE request primitive for Group resource
			 */
251
			template (value) RequestPrimitive m_updateGroupBase modifies m_update := {
252
				from_ := PX_AE_ID_STEM,
253
				requestIdentifier := "m_updateGroup" & f_rnd(1, 1000000),
254
				primitiveContent:= {
255
							any_1 := {{Group_optional := m_contentUpdateGroup}}
256
				}
257 258
			};
			
259 260 261
			/**
			 * @desc Base UPDATE request primitive for Schedule resource
			 */
262
			template (value) RequestPrimitive m_updateScheduleBase modifies m_update := {
263
				from_ := PX_AE_ID_STEM,
264
				requestIdentifier := "m_updateSchedule" & f_rnd(1, 1000000),
265
				primitiveContent:= {
266
							any_1 := {{Schedule_optional := m_contentUpdateSchedule}}
267
				}
268 269
			};
			
270 271 272
			/**
			 * @desc Base UPDATE request primitive for PollingChannel resource
			 */
273
			template (value) RequestPrimitive m_updatePollingChannelBase modifies m_update := {
274
				from_ := PX_AE_ID_STEM,
275
				requestIdentifier := "m_updatePollingChannel" & f_rnd(1, 1000000),
276
				primitiveContent:= {
277
							any_1 := {{PollingChannel_optional := m_contentUpdatePollingChannel}}
278
				}
279 280
			};
			
281 282 283
			/**
			 * @desc Base UPDATE request primitive for Subscription resource
			 */
284
			template (value) RequestPrimitive m_updateSubscriptionBase modifies m_update := {
285
				from_ := PX_AE_ID_STEM,
286
				requestIdentifier := "m_updateSubscription" & f_rnd(1, 1000000),
287
				primitiveContent:= {
288
							any_1 := {{Subscription_optional := m_contentUpdateSubscription}}
289
				}
290
			};
291 292
			
			//@Martin
293
        	template (value) RequestPrimitive m_updateLocationPolicy(XSD.ID p_locResourceAddress, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod) modifies m_update := {
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
294
        	  	to_ 				:= p_locResourceAddress,
295 296 297 298
        	  	from_				:= PX_AE_ID_STEM, //AE originator id e.g.
        	  	requestIdentifier	:= "m_updateLocationPolicy",
        	  	primitiveContent	:= {        	    
        	    			any_1 := {{ LocationPolicy_optional := m_contentUpdateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod) }}
299 300
        		}
			  };
301
        	
302 303 304
    	}//end group Update
    	
    	group Create {
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331

			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

			};
332
        	
333 334 335
			/**
			 * @desc Base CREATE request primitive for AE resource (AUX)
			 */
336
			//Added by @Naum
337 338 339 340 341 342 343 344 345
			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)}}	
				},
346
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
347 348 349 350 351 352 353 354 355 356 357
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
358 359 360 361 362
				discoveryResultType := *,
				tokens := *,
				tokenIDs := *,
				localTokenIDs := ?,
				tokenReqIndicator := *
363
			};
364 365

			//Added by @Naum
366
			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 := {
367 368 369 370
				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 := {
371
					any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName, p_appId)}}	
372
				}
373
			};
374
        	
375
        	template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIDs := omit ) modifies m_create := {
376
        		from_ := PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"//@Martin
377
        		requestIdentifier := "m_createAe" & f_rnd(1, 1000000),
378
        		resourceType := int2,
379
        		primitiveContent := {
380
        			any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName)}}	
381 382
        		}
			};
383
        	
384 385 386
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource
			 */
387
			template (value) RequestPrimitive m_createAcpBase modifies m_create := {
388
				requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
389
				resourceType := int1,
390
				primitiveContent := {
391
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp ()}}
392
				}
393 394
			};
				
395
        	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 := {
396
        		to_ := f_addPrefix(p_parentResourceAddress),
397
        		from_ := PX_AE_ID_STEM,
398
        		requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
399
        		resourceType := int1,
400
        		primitiveContent := {
401
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_name, p_acor, p_allowedOperations)}}
402
        		}
403 404
        	};
        	
405 406 407 408
       	
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource (AUX)
			 */
409
        	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 := {
410
        		from_ := PX_AE_ID_STEM,
411
        		requestIdentifier := "m_createAcpAux" & f_rnd(1, 1000000),
412
        		resourceType := int1,
413
        		primitiveContent := {
414
        			any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_acpName, p_acor, p_allowedOperations)}}	
415
        		}
416 417
        	};
        	
418
			//Added by @Naum
419
			template (value) RequestPrimitive m_createCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) modifies m_create := {
420 421
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_createCSE" & f_rnd(1, 1000000),
422
				resourceType := int1,//FIXME Is this the value for CSEBase? In any case, this template is not used at all
423 424
				primitiveContent := {
					any_1 := {{CSEBase_optional := m_contentCreateCSEBase (p_serviceSubscribedAppRule)}}
425
				}
426 427
			};
        	
428 429 430 431
       	
			/**
			 * @desc Base CREATE request primitive for Container resource
			 */
432
			template (value) RequestPrimitive m_createContainerBase modifies m_create := {
433
				requestIdentifier := "m_createContainer" & f_rnd(1, 1000000),
434
				resourceType := int3,
435 436
				primitiveContent := {
					
437
					any_1 := {{Container_optional := m_contentCreateContainer}}
438
				}
439 440
			};
	
441
    		template (value) RequestPrimitive m_createContainer(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_resourceName) modifies m_create := {
442
    			to_ := f_addPrefix(p_parentResourceAddress),
443
    			from_ := PX_AE_ID_STEM,
444
    			requestIdentifier := "m_createContainer" & f_rnd(1, 1000000),
445
    			resourceType := int3,
446
    			primitiveContent := {
447
    				any_1 := {{Container_optional := m_contentCreateContainer}}
448
    			}
449 450
    		};
        	
451
    		template (value) RequestPrimitive m_createContentInstance(XSD.ID p_parentResourceAddress, XSD.String p_primitiveContent) modifies m_create := {
452
    			to_ := f_addPrefix(p_parentResourceAddress),
453
    			from_ := "admin:admin",
454
    			requestIdentifier := "m_createContentInstance" & f_rnd(1, 1000000),
455
    			resourceType := int4,
456
    			primitiveContent := {
457
    				any_1 := {{ContentInstance_optional := m_contentCreateContentInstance(p_primitiveContent)}}	
458
    			}
459 460
    		};
    		
461 462 463 464
       	
			/**
			 * @desc Base CREATE request primitive for Group resource
			 */
465
			template (value) RequestPrimitive m_createGroupBase modifies m_create := {
466
				requestIdentifier := "m_createGroup" & f_rnd(1, 1000000),
467 468
				resourceType := int9,
				primitiveContent := {
469
					any_1 := {{Group_optional := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & "NotInitialized"}, omit)}}	//TODO: p_resourceId
470 471
				}
			};
472
        	
473
        	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 := {
474
        		to_ := f_addPrefix(p_parentResourceAddress),
475
        		from_ := PX_AE_ID_STEM,
476
        		requestIdentifier := "m_createGroup" & f_rnd(1, 1000000),
477
        		resourceType := int9,
478
        		primitiveContent := {
479
        			any_1 := {{Group_optional := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & valueof(p_memberId)}, p_accessControlPolicyIDs)}}	//TODO: p_resourceId
480
        		}
481 482
        	};
        	
483 484 485 486
       	
			/**
			 * @desc Base CREATE request primitive for PollingChannel resource
			 */
487
			template (value) RequestPrimitive m_createPollingChannelBase modifies m_create := {
488
				requestIdentifier := "m_createPollingChannel" & f_rnd(1, 1000000),
489 490
				resourceType := int15,
				primitiveContent := {
491
					any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel (omit)}}	
492 493
				}
			};
494
        	
495
        	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 := {
496
        		to_ := f_addPrefix(p_parentResourceAddress),
497
        		from_ := p_originatorId,
498
        		requestIdentifier := "m_createPollingChannel" & f_rnd(1, 1000000),
499
        		resourceType := int15,
500
        		primitiveContent := {
501
        			any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel ()}}	
502
        		}
503 504
        	};
        	
505 506 507
			/**
			 * @desc Base CREATE request primitive for Schedule resource
			 */
508
        	template (value) RequestPrimitive m_createScheduleBase modifies m_create := {
509
        		requestIdentifier := "m_createSchedule" & f_rnd(1, 1000000),
510
        		resourceType := int18,
511
        		primitiveContent := {
512
        			any_1 := {{Schedule_optional := m_contentCreateSchedule ({{"0,0,0 1 2,1,1,*"}})}}	
513
        		}
514 515
        	};
        	
516
        	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 := {
517
        		to_ := f_addPrefix(p_parentResourceAddress),
518
        		from_ := PX_AE_ID_STEM,
519
        		requestIdentifier := "m_createSchedule" & f_rnd(1, 1000000),
520
        		resourceType := int18,
521
        		primitiveContent := {
522
        			any_1 := {{Schedule_optional := m_contentCreateSchedule (p_scheduleElement)}}	
523
        		}
524 525
        	};
        	
526
			//Added by @Naum
527
			template (value) RequestPrimitive m_createServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedApp_IDs, in ListOfM2MID p_allowedAEs) modifies m_create := {
528 529
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_createCSE" & f_rnd(1, 1000000),
530
				resourceType := int1,//FIXME Is this the correct value?
531
				primitiveContent := {
532
					any_1 := {{ServiceSubscribedAppRule_optional := m_contentCreateServiceSubscribedAppRule (p_applicableCredIDs, p_allowedApp_IDs, p_allowedAEs)}}
533
				}
534
			};
535
        	
536 537 538 539
       	
			/**
			 * @desc Base CREATE request primitive for Subscription resource
			 */
540
			template (value) RequestPrimitive m_createSubscriptionBase modifies m_create := {
541
				requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000),
542
				resourceType := int23,
543
				primitiveContent := {
544
					any_1 := {{Subscription_optional := m_contentCreateSubscription ({"Not Initialized"})}}	
545
				}
546 547
			};
        	
548
        	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 := {
549
        		to_ := f_addPrefix(p_parentResourceAddress),
550
        		from_ := PX_AE_ID_STEM,
551
        		requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000),
552
        		resourceType := int23,
553
        		primitiveContent := {
554
					any_1 := {{Subscription_optional := m_contentCreateSubscription (p_notificationURI)}}	
555
        		}
556
        	};
557 558
        	
        	//@Martin
559
        	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
560
        	  	to_ 				:= p_parentResourceAddress,
561
        	  	from_				:= PX_AE_ID_STEM, //AE originator id e.g.
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
562
        	  	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
563 564 565
        	  	resourceType		:= int10,
        	  	primitiveContent	:= {        	    
        	    			any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod, locationTargetID, locationServerAddress) }}
566 567
        	  	},
			  	resultContent := int1//default
568 569
        	};
        	
570 571 572 573
    	}//end group Create
    	
    	group Delete {
    	
574
        	template (value) RequestPrimitive m_deleteRequest(XSD.ID p_resourceAddress) := {
575
        		operation := int4,
576
        		to_ := f_addPrefix(p_resourceAddress),
577
        		from_ := PX_AE_ID_STEM,
578
        		requestIdentifier := "m_deleteAe" & f_rnd(1, 1000000),
579
        		resourceType := omit,
580
        		primitiveContent := omit, 
581
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
582 583 584 585 586 587 588 589 590 591 592
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
593 594 595 596 597
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
598 599 600

        	};
        	
601 602 603 604 605 606 607
			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, 
608
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
609 610 611 612 613 614 615 616 617 618 619
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
620 621 622 623 624
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
625

626 627
			};
        	
628 629 630 631 632
    	}//end group Delete
	}//end group RequestPrimitives
	
	group ContentCreate {
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
633

634
			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) := {
635 636 637 638 639 640 641 642 643
    		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
644
    		dynamicAuthorizationConsultationIDs := omit, //TODO Check whether it is optional or mandatory for create operation
645 646 647 648 649 650 651 652 653
			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
654
			e2eSecInfo := omit, //TODO Check whether it is optional or mandatory for create operation
655 656
			choice := omit//NP
		};	
657
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
658 659 660 661 662
    	/**
    	 * @desc Base primitiveContent for CREATE operation for AE resource
    	 * @param p_name Resource name
    	 * @param p_accessControlPolicyIDs ACP IDs for the AE
    	 */
663
    	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
664

665 666 667 668 669 670 671 672 673
			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
674
    		dynamicAuthorizationConsultationIDs := omit, //TODO Check whether it is optional or mandatory for create operation
675 676 677
    		announceTo := omit,//O
    		announcedAttribute := omit,//O
    		appName := omit,//O
678
			app_ID := p_appId,//M
679
    		aE_ID := omit,//NP
680
    		pointOfAccess := omit, //O {"http://127.0.0.1:1400/monitor"},//{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
681 682
    		ontologyRef := omit,//O
    		nodeLink := omit,//NP
683
    		requestReachability := true,//M
684
    		contentSerialization := omit,//O
685
			e2eSecInfo := omit, //TODO Check whether it is optional or mandatory for create operation
686 687
    		choice := omit//NP
    	};	
688
    	
689 690 691 692 693
    	/**
    	 * @desc Base primitiveContent for CREATE operation for AccessControlPolicy resource
    	 * @param p_name Resource name
    	 * @param p_acor Allowed originators
    	 * @param p_allowedOperations Allowed operations
694
    	 */
695 696 697 698 699 700 701 702 703 704 705
    	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
706 707 708
			privileges := {
				accessControlRule_list := {
					{
709 710
						accessControlOriginators := p_acor,//{"*"},//{PX_AE_ID_STEM}, //{"admin:admin"},
						accessControlOperations := p_allowedOperations,
711 712
						accessControlContexts_list := omit,
						accessControlAuthenticationFlag := omit
713 714
					}
				}
715
			},//M
716 717 718
			selfPrivileges := {
				accessControlRule_list := {
					{
719 720
						accessControlOriginators := p_acor, //{"*"},//{PX_AE_ID_STEM}, //{"admin:admin"},
						accessControlOperations := int63,
721 722
						accessControlContexts_list := omit,
						accessControlAuthenticationFlag := omit
723
					}
724 725 726
				}
			},//M
			choice := omit //NP
727 728
		};
    	
729 730
		//added by @Naum
		template (value) CSEBase_optional m_contentCreateCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) := {
731
			resourceName := omit,
732
			resourceType := omit,
733 734 735 736 737 738 739 740 741 742 743
			resourceID := omit,
			parentID := omit,
			creationTime := omit,
			lastModifiedTime := omit,
			labels := omit,
			accessControlPolicyIDs := omit,
			cseType := omit,
			cSE_ID := omit,
			supportedResourceType := omit,
			pointOfAccess := omit,
			nodeLink := omit,
744
			e2eSecInfo := omit, //TODO Check whether it is optional or mandatory for create operation
745 746 747 748
			choice := {
				choice_list := {{
				  serviceSubscribedAppRule := p_serviceSubscribedAppRule
				}}
749 750
			}
		}
751
    	
752 753 754 755 756 757
    	/**
    	 * @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
758
    	 */
759
    	template (value) Group_optional m_contentCreateGroup (	in template (value) XSD.NonNegativeInteger p_maxNrOfMembers,
760 761 762 763
    															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
764 765 766 767 768 769 770 771
			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
772
    		dynamicAuthorizationConsultationIDs := omit, //TODO Check whether it is optional or mandatory for create operation
773 774 775 776 777 778 779 780 781 782 783 784 785
			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
			choice := omit//NP
    	};    	
786
    	
787 788 789 790
    	/**
    	 * @desc Base primitiveContent for CREATE operation for PollingChannel resource
    	 * @param p_accessControlPolicyIDs ACP IDs for the PollingChannel
    	 * @param p_name Resource name
791
    	 */
792
    	template (value) PollingChannel_optional m_contentCreatePollingChannel (in template (omit) XSD.String p_name := c_defaultResourceName) := {
793
			resourceName := p_name,//O
794 795 796 797 798 799
            resourceType := omit,//NP
            resourceID := omit,//NP
            parentID := omit,//NP
            creationTime := omit,//NP
            lastModifiedTime := omit,//NP
            labels := omit,//O
800
            expirationTime := omit//O
801
    	};    	
802
    	
803 804 805 806
    	/**
    	 * @desc Base primitiveContent for CREATE operation for Schedule resource
    	 * @param p_scheduleElement Schedule
    	 * @param p_name Resource name
807 808 809 810
    	 */
    	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
811 812 813 814 815 816 817 818 819 820 821 822
			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
    	};    	
823
    	
824
		template (value) ServiceSubscribedAppRule_optional m_contentCreateServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedApp_IDs, in ListOfM2MID p_allowedAEs) := {
825 826 827 828 829 830 831 832 833
		  	resourceName := omit,
			resourceType := omit,
			resourceID := omit,
			parentID := omit,
			creationTime := omit,
			lastModifiedTime := omit,
			labels := omit,
			accessControlPolicyIDs := omit,
			expirationTime := omit,
834
    		dynamicAuthorizationConsultationIDs := omit, //TODO Check whether it is optional or mandatory for create operation
835 836 837
			applicableCredIDs := p_applicableCredIDs,
			allowedApp_IDs := p_allowedApp_IDs,
			allowedAEs := p_allowedAEs,
838 839
			choice := omit
		}
840
    	
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
841

842 843 844 845
    	/**
    	 * @desc Base primitiveContent for CREATE operation for Subscription resource
    	 * @param p_notificationURI Notification URI
    	 * @param p_name Resource name
846 847 848
    	 */
    	template (value) Subscription_optional m_contentCreateSubscription (in template (value) ListOfURIs p_notificationURI,
																			in template (omit) XSD.String p_name := c_defaultResourceName) := {
849 850 851 852 853 854 855 856 857
			resourceName := c_defaultResourceName,//O
			resourceType := omit,//NP
			resourceID := omit,//NP
			parentID := omit,//NP
			creationTime := omit,//NP
			lastModifiedTime := omit,//NP
			labels := omit,//O
			accessControlPolicyIDs := omit,//O
			expirationTime := omit,//O
858
    		dynamicAuthorizationConsultationIDs := omit, //TODO Check whether it is optional or mandatory for create operation
859
			creator := omit,//O
860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875
			eventNotificationCriteria := omit,//O
			expirationCounter := omit,//O
			notificationURI := p_notificationURI,//M
			groupID := omit,//O
			notificationForwardingURI := omit,//O
			batchNotify := omit,//O
			rateLimit := omit,//O
			preSubscriptionNotify := omit,//O
			pendingNotification := omit,//O
			notificationStoragePriority := omit,//O
			latestNotify := omit,//O
			notificationContentType := int1, //TODO Set to omit once xsd is fixed,//O
			notificationEventCat := omit,//O
			subscriberURI := omit,//O
			choice := omit//NP
    	};   	
876
    	
877 878 879
    	/**
    	 * @desc Base primitiveContent for CREATE operation for ContentInstance resource
    	 * @param p_primitiveContent Content for the ContentInstance
880
    	 */
881 882 883 884 885 886 887 888 889 890 891 892 893 894 895
    	template (value) ContentInstance_optional m_contentCreateContentInstance(XSD.String p_primitiveContent) := {
			resourceName := c_defaultResourceName,//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
			stateTag := omit,//NP
			creator := omit,//O
			contentInfo := "a",//O
			contentSize := omit,//NP
896
			contentRef := omit, //TODO Check whether it is optional or mandatory for create operation
897 898 899 900 901
			ontologyRef := omit,//O
			content := { 
				embed_values := {p_primitiveContent},
				attr := omit,
				elem_list := {}  
902 903
			}, //M
			choice := omit // TODO Check whether it is optional or mandatory for create operation
904 905
		};
		
906 907 908
    	/**
    	 * @desc Base primitiveContent for CREATE operation for Container resource
    	 * @param p_name Resource name
909 910 911
    	 */
    	template (value) Container_optional m_contentCreateContainer (in template (omit) XSD.String p_name := c_defaultResourceName):= {
			resourceName := p_name,//O
912 913 914 915 916 917 918 919
			resourceType := omit,//NP
			resourceID := omit,//NP
			parentID := omit,//NP
			creationTime := omit,//NP
			lastModifiedTime := omit,//NP
			labels := omit,//O
			accessControlPolicyIDs := omit,//O
			expirationTime := omit,//O
920
    		dynamicAuthorizationConsultationIDs := omit, //TODO Check whether it is optional or mandatory for create operation