OneM2M_Templates.ttcn 73.1 KB
Newer Older
1 2 3 4 5 6 7 8
/**
 *  Copyright Notification
 *  No part of this document may be reproduced, in an electronic retrieval system or otherwise, except as authorized by written permission.
 *  The copyright and the foregoing restriction extend to reproduction in all media.
 *  © 2016, oneM2M Partners Type 1 (ARIB, ATIS, CCSA, ETSI, TIA, TSDSI, TTA, TTC).
 *  All rights reserved.
 *  
 *  @author     ETSI
9
 *  @version    $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Templates.ttcn $
10
 *              $Id: OneM2M_Templates.ttcn 162 2016-11-09 09:09:44Z carres $
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
	
	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},
47
    		host := PX_SUT_ADDRESS,
48 49 50 51 52
    		xmlNamespace := PX_XML_NAMESPACE,
    		protocolBinding := PX_PROTOCOL_BINDING,
    		serialization := PX_SERIALIZATION, 
    		nullFields := p_nullFields
    	};
53 54 55 56 57 58 59
    	
		/** 
		 * @desc Base template for response sending operations
		 * @param p_responsePrimitive
		 */
		template (value) MsgOut m_response(in template (value) ResponsePrimitive p_responsePrimitive, in template (omit) AttributeList_1 p_nullFields := omit ) := {
			primitive := { responsePrimitive := p_responsePrimitive},
60
			host := PX_SUT_ADDRESS,
61 62 63 64 65
			xmlNamespace := PX_XML_NAMESPACE,
			protocolBinding := PX_PROTOCOL_BINDING,
			serialization := PX_SERIALIZATION, 
			nullFields := p_nullFields
		};
66 67 68 69 70 71 72 73 74 75 76 77 78
    	//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}
		};
    	
79
	}//end of group primitives
80 81 82 83 84 85 86 87 88 89
	
	group RequestPrimitives { 
		
		group Retrieve {
	
        	/**
			 * @desc 
			 */
        	template (value) RequestPrimitive m_retrieveCseBase := {
        		operation := int2,
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
90
        		to_ := PX_URI_CSE,//c_uri_cse,//@Martin
91
        		from_ := "admin:admin",
92 93
        		requestIdentifier := "m_retrieveCseBase" & f_rnd(1, 1000000),
        		resourceType := omit,
94
				primitiveContent := omit,
95
				roleIDs := {"1234abcd@role-issuer.com"}, // TODO Find a correct value 
96 97 98 99 100 101 102 103 104 105 106
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
107 108 109 110 111
        		discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value
				tokenReqIndicator := omit
112
        	};
113

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

    	group Update {
212 213
    		
    		template (value) RequestPrimitive m_update := {
214 215
				operation := int3,
				to_ := "NotInitialized",
216 217
				from_ := "NotInitialized",
				requestIdentifier := "m_update" & f_rnd(1, 1000000),
218
				resourceType := omit,
219
				primitiveContent:= omit,
220
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
221 222 223 224 225 226 227 228 229 230 231
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
232 233 234 235 236
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
237
			};
238
        	
239 240 241 242 243 244 245 246 247 248 249
			/**
			 * @desc Base UPDATE request primitive for Ae resource
			 */
			template (value) RequestPrimitive m_updateAeBase modifies m_update:= {
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_updateAe" & f_rnd(1, 1000000),
				primitiveContent:= {
							any_1 := {{AE_optional := m_contentUpdateAe}}
				}
			};
        	
250 251 252 253 254 255 256 257 258 259
			/**
			 * @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}}
				}
			};
260
			
261 262 263
			/**
			 * @desc Base UPDATE request primitive for AccessControlPolicy resource
			 */        				
264
			template (value) RequestPrimitive m_updateAcpBase modifies m_update := {
265
				from_ := PX_AE_ID_STEM,
266
				requestIdentifier := "m_updateAcp" & f_rnd(1, 1000000),
267
				primitiveContent:= {
268
							any_1 := {{AccessControlPolicy_optional := m_contentUpdateAcp}}
269
				}
270 271
			};
			
272 273 274
			/**
			 * @desc Base UPDATE request primitive for Group resource
			 */
275
			template (value) RequestPrimitive m_updateGroupBase modifies m_update := {
276
				from_ := PX_AE_ID_STEM,
277
				requestIdentifier := "m_updateGroup" & f_rnd(1, 1000000),
278
				primitiveContent:= {
279
							any_1 := {{Group_optional := m_contentUpdateGroup}}
280
				}
281 282
			};
			
283 284 285
			/**
			 * @desc Base UPDATE request primitive for Schedule resource
			 */
286
			template (value) RequestPrimitive m_updateScheduleBase modifies m_update := {
287
				from_ := PX_AE_ID_STEM,
288
				requestIdentifier := "m_updateSchedule" & f_rnd(1, 1000000),
289
				primitiveContent:= {
290
							any_1 := {{Schedule_optional := m_contentUpdateSchedule}}
291
				}
292 293
			};
			
294 295 296
			/**
			 * @desc Base UPDATE request primitive for PollingChannel resource
			 */
297
			template (value) RequestPrimitive m_updatePollingChannelBase modifies m_update := {
298
				from_ := PX_AE_ID_STEM,
299
				requestIdentifier := "m_updatePollingChannel" & f_rnd(1, 1000000),
300
				primitiveContent:= {
301
							any_1 := {{PollingChannel_optional := m_contentUpdatePollingChannel}}
302
				}
303 304
			};
			
305 306 307
			/**
			 * @desc Base UPDATE request primitive for Subscription resource
			 */
308
			template (value) RequestPrimitive m_updateSubscriptionBase modifies m_update := {
309
				from_ := PX_AE_ID_STEM,
310
				requestIdentifier := "m_updateSubscription" & f_rnd(1, 1000000),
311
				primitiveContent:= {
312
							any_1 := {{Subscription_optional := m_contentUpdateSubscription}}
313
				}
314
			};
315 316
			
			//@Martin
317
        	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
318
        	  	to_ 				:= p_locResourceAddress,
319 320 321 322
        	  	from_				:= PX_AE_ID_STEM, //AE originator id e.g.
        	  	requestIdentifier	:= "m_updateLocationPolicy",
        	  	primitiveContent	:= {        	    
        	    			any_1 := {{ LocationPolicy_optional := m_contentUpdateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod) }}
323 324
        		}
			  };
325
        	
326 327 328
    	}//end group Update
    	
    	group Create {
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355

			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

			};
356
        	
357 358 359
			/**
			 * @desc Base CREATE request primitive for AE resource (AUX)
			 */
360
			//Added by @Naum
361 362 363 364 365 366 367 368 369
			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)}}	
				},
370
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
371 372 373 374 375 376 377 378 379 380 381
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
382 383 384 385 386
				discoveryResultType := *,
				tokens := *,
				tokenIDs := *,
				localTokenIDs := ?,
				tokenReqIndicator := *
387
			};
388 389

			//Added by @Naum
390
			template (value) RequestPrimitive m_createAe(XSD.ID p_appId, template (omit) AcpType p_accessControlPolicyIDs := omit,template (omit) XSD.ID p_from := omit, template (omit) XSD.NCName p_resourceName :=  c_aeAuxName, in template (omit) PoaList p_poaList := omit) modifies m_create := {
391 392 393 394
				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 := {
395
					any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs,p_resourceName, p_appId, p_poaList)}}	
396
				}
397
			};
398
        	
399
        	template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIDs := omit, in template (omit) PoaList p_poaList) modifies m_create := {
400
        		from_ := PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"//@Martin
401
        		requestIdentifier := "m_createAe" & f_rnd(1, 1000000),
402
        		resourceType := int2,
403
        		primitiveContent := {
404
        			any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName, -, p_poaList)}}	
405 406
        		}
			};
407
        	
408 409 410
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource
			 */
411
			template (value) RequestPrimitive m_createAcpBase modifies m_create := {
412
				requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
413
				resourceType := int1,
414
				primitiveContent := {
415
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp ()}}
416
				}
417 418
			};
				
419
        	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 := {
420
        		to_ := p_parentResourceAddress,
421
        		from_ := PX_AE_ID_STEM,
422
        		requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
423
        		resourceType := int1,
424
        		primitiveContent := {
425
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_name, p_acor, p_allowedOperations)}}
426
        		}
427 428
        	};
        	
429 430 431 432
       	
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource (AUX)
			 */
433
        	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 := {
434
        		from_ := PX_SUPER_USER,
435
        		requestIdentifier := "m_createAcpAux" & f_rnd(1, 1000000),
436
        		resourceType := int1,
437
        		primitiveContent := {
438
        			any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_acpName, p_acor, p_allowedOperations)}}	
439
        		}
440 441
        	};
        	
442
			//Added by @Naum
443
			template (value) RequestPrimitive m_createCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) modifies m_create := {
444 445
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_createCSE" & f_rnd(1, 1000000),
446
				resourceType := int1,//FIXME Is this the value for CSEBase? In any case, this template is not used at all
447 448
				primitiveContent := {
					any_1 := {{CSEBase_optional := m_contentCreateCSEBase (p_serviceSubscribedAppRule)}}
449
				}
450 451
			};
        	
452 453 454 455
       	
			/**
			 * @desc Base CREATE request primitive for Container resource
			 */
456
			template (value) RequestPrimitive m_createContainerBase modifies m_create := {
457
				requestIdentifier := "m_createContainer" & f_rnd(1, 1000000),
458
				resourceType := int3,
459 460
				primitiveContent := {
					
461
					any_1 := {{Container_optional := m_contentCreateContainer}}
462
				}
463 464
			};
	
465
    		template (value) RequestPrimitive m_createContainer(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_resourceName) modifies m_create := {
466
    			to_ := p_parentResourceAddress,
467
    			from_ := PX_AE_ID_STEM,
468
    			requestIdentifier := "m_createContainer" & f_rnd(1, 1000000),
469
    			resourceType := int3,
470
    			primitiveContent := {
471
    				any_1 := {{Container_optional := m_contentCreateContainer}}
472
    			}
473 474
    		};
        	
475
    		template (value) RequestPrimitive m_createContentInstance(XSD.ID p_parentResourceAddress, XSD.String p_primitiveContent) modifies m_create := {
476
    			to_ := p_parentResourceAddress,
477
    			from_ := "admin:admin",
478
    			requestIdentifier := "m_createContentInstance" & f_rnd(1, 1000000),
479
    			resourceType := int4,
480
    			primitiveContent := {
481
    				any_1 := {{ContentInstance_optional := m_contentCreateContentInstance(p_primitiveContent)}}	
482
    			}
483 484
    		};
    		
485 486 487 488
       	
			/**
			 * @desc Base CREATE request primitive for Group resource
			 */
489
			template (value) RequestPrimitive m_createGroupBase modifies m_create := {
490
				requestIdentifier := "m_createGroup" & f_rnd(1, 1000000),
491 492
				resourceType := int9,
				primitiveContent := {
493
					any_1 := {{Group_optional := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & "NotInitialized"}, omit)}}	//TODO: p_resourceId
494 495
				}
			};
496
        	
497
        	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 := {
498
        		to_ := p_parentResourceAddress,
499
        		from_ := PX_AE_ID_STEM,
500
        		requestIdentifier := "m_createGroup" & f_rnd(1, 1000000),
501
        		resourceType := int9,
502
        		primitiveContent := {
503
        			any_1 := {{Group_optional := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & valueof(p_memberId)}, p_accessControlPolicyIDs)}}	//TODO: p_resourceId
504
        		}
505 506
        	};
        	
507 508 509 510
       	
			/**
			 * @desc Base CREATE request primitive for PollingChannel resource
			 */
511
			template (value) RequestPrimitive m_createPollingChannelBase modifies m_create := {
512
				requestIdentifier := "m_createPollingChannel" & f_rnd(1, 1000000),
513 514
				resourceType := int15,
				primitiveContent := {
515
					any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel (-)}}	
516 517
				}
			};
518
        	
519
        	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 := {
520
        		to_ := p_parentResourceAddress,
521
        		from_ := p_originatorId,
522
        		requestIdentifier := "m_createPollingChannel" & f_rnd(1, 1000000),
523
        		resourceType := int15,
524
        		primitiveContent := {
525
        			any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel ()}}	
526
        		}
527 528
        	};
        	
529 530 531
			/**
			 * @desc Base CREATE request primitive for Schedule resource
			 */
532
        	template (value) RequestPrimitive m_createScheduleBase modifies m_create := {
533
        		requestIdentifier := "m_createSchedule" & f_rnd(1, 1000000),
534
        		resourceType := int18,
535
        		primitiveContent := {
536
        			any_1 := {{Schedule_optional := m_contentCreateSchedule ({{"0,0,0 1 2,1,1,*"}})}}	
537
        		}
538 539
        	};
        	
540
        	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 := {
541
        		to_ := p_parentResourceAddress,
542
        		from_ := PX_AE_ID_STEM,
543
        		requestIdentifier := "m_createSchedule" & f_rnd(1, 1000000),
544
        		resourceType := int18,
545
        		primitiveContent := {
546
        			any_1 := {{Schedule_optional := m_contentCreateSchedule (p_scheduleElement)}}	
547
        		}
548 549
        	};
        	
550
			//Added by @Naum
551
			template (value) RequestPrimitive m_createServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedApp_IDs, in ListOfM2MID p_allowedAEs) modifies m_create := {
552
				from_ := PX_AE_ID_STEM,
553 554
				requestIdentifier := "m_createServiceSubscribedAppRule" & f_rnd(1, 1000000),
				resourceType := int19,//FIXME Is this the correct value?
555
				primitiveContent := {
556
					any_1 := {{ServiceSubscribedAppRule_optional := m_contentCreateServiceSubscribedAppRule (p_applicableCredIDs, p_allowedApp_IDs, p_allowedAEs)}}
557
				}
558
			};
559
        	
560 561 562 563
       	
			/**
			 * @desc Base CREATE request primitive for Subscription resource
			 */
564
			template (value) RequestPrimitive m_createSubscriptionBase modifies m_create := {
565
				requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000),
566
				resourceType := int23,
567
				primitiveContent := {
568
					any_1 := {{Subscription_optional := m_contentCreateSubscription ({"Not Initialized"})}}	
569
				}
570 571
			};
        	
572
        	template (value) RequestPrimitive m_createSubscription(XSD.ID p_parentResourceAddress, in template (omit)  XSD.String p_name, in template (value) ListOfURIs p_notificationURI := {"NotInitialized"}) modifies m_create := {
573
        		to_ := p_parentResourceAddress,
574
        		from_ := PX_AE_ID_STEM,
575
        		requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000),
576
        		resourceType := int23,
577
        		primitiveContent := {
578
					any_1 := {{Subscription_optional := m_contentCreateSubscription (p_notificationURI, p_name)}}	
579
        		}
580
        	};
581
        	
582 583 584 585 586 587 588 589 590 591 592 593 594 595
			template (value) RequestPrimitive m_createSubscriptionAdvanced(	XSD.ID p_parentResourceAddress, 
																		   in template (omit)  XSD.String p_name := omit,
																		   in template (value) ListOfURIs p_notificationURI,
																		   in template (omit) EventNotificationCriteria p_eventNotificationCriteria := omit,
																		   in template (omit) XSD.PositiveInteger p_expirationCounter := omit,
																		   in template (omit) BatchNotify p_batchNotify := omit,
																		   in template (omit) XSD.Boolean p_latestNotify := omit,
																		   in template (omit) XSD.AnyURI p_subscriberURI := omit,
																		   in template (omit) NotificationContentType p_notificationContentType := int1) modifies m_createSubscription := {
				primitiveContent := {
					any_1 := {{Subscription_optional := m_contentCreateSubscriptionAdvanced (p_notificationURI, p_name, p_eventNotificationCriteria, p_expirationCounter, p_batchNotify, p_latestNotify, p_subscriberURI, p_notificationContentType)}}	
				}
			};
        	
596
        	//@Martin
597 598
        	template (value) RequestPrimitive m_createLocationPolicy(in template (value) LocationSource locationSource, 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 := {
        	  	requestIdentifier	:= "m_createLocationPolicy" & f_rnd(1, 1000000), //the requestIdentifier is supposed to be set similar as "C190XX7T/001"  by prepending the AE-ID-Stem and slash(‘/’) in front of it
599 600
        	  	resourceType		:= int10,
        	  	primitiveContent	:= {        	    
601
        	    			any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(locationSource, p_accessControlPolicyIDs, locationUpdatePeriod, locationTargetID, locationServerAddress) }}
602 603
        	  	},
			  	resultContent := int1//default
604
        	};
605
        	//@Martin
606
        	template (value) RequestPrimitive m_createNotification(in template (value) Representation resourcePresentation, in template (omit)NotificationEventType notifEventType, in template (omit) XSD.AnyURI subscriptionReference, in template (omit) XSD.AnyURI notifForwardingURI) modifies m_create := {
607 608
        	  requestIdentifier	:= "m_createNotification" & f_rnd(1, 1000000),
        	  primitiveContent	:= {	
609
        	    			any_1 :=	{{ Notification := m_contentCreateNotification(resourcePresentation, notifEventType, subscriptionReference, notifForwardingURI)}}        	    
610 611 612 613
        	  },
        	  resultContent		:= int1 //default
        	  
        	};
614
        	
615
        	
616 617 618 619
    	}//end group Create
    	
    	group Delete {
    	
620
        	template (value) RequestPrimitive m_deleteRequest(XSD.ID p_resourceAddress) := {
621
        		operation := int4,
622
        		to_ := p_resourceAddress,
623
        		from_ := PX_SUPER_USER,
624
        		requestIdentifier := "m_deleteResource" & f_rnd(1, 1000000),
625
        		resourceType := omit,
626
        		primitiveContent := omit, 
627
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
628 629 630 631 632 633 634 635 636 637 638
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
639 640 641 642 643
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
644 645 646

        	};
        	
647 648 649 650 651 652 653
			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, 
654
				roleIDs := {"1234abcd@role-issuer.com"},//TODO Find a correct value 
655 656 657 658 659 660 661 662 663 664 665
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
666 667 668 669 670
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
				localTokenIDs := {"Fixme"},//TODO Find a correct value,
				tokenReqIndicator := omit
671

672 673
			};
        	
674
    	}//end group Delete
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739
    	
    	group Notify {
    		
			/**
			 * @desc Base NOTIFY request primitive
			 */
			template RequestPrimitive mw_notifyBase := {
				operation := int5,
				to_ := ?,
				from_ := *,
				requestIdentifier := ?,
				resourceType := *,
				primitiveContent := { any_1 := {{ Notification := mw_contentNotificationBase}} },
				roleIDs := ?,
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
				discoveryResultType := *,
				tokens := *,
				tokenIDs := *,
				localTokenIDs := ?,
				tokenReqIndicator := *
			};
			
			/**
			 * @desc Base NOTIFY request primitive
			 */
			template RequestPrimitive mw_aggregatedNotifyBase := {
				operation := int5,
				to_ := ?,
				from_ := *,
				requestIdentifier := ?,
				resourceType := *,
				primitiveContent := { any_1 := {{ AggregatedNotification := ?}} },
				roleIDs :=?,
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
				discoveryResultType := *,
				tokens := *,
				tokenIDs := *,
				localTokenIDs := ?,
				tokenReqIndicator := *
			};
			
			/**
			 * @desc Base NOTIFY request primitive
			 */
			
740
			template RequestPrimitive mw_notify(in template Notification p_notification) modifies mw_notifyBase := {
741 742 743 744 745 746 747 748 749
				primitiveContent := { 
					any_1 := {{ Notification := p_notification}}
				}
			};
			

			
    		
    	}//end of group Notify
750 751 752 753
	}//end group RequestPrimitives
	
	group ContentCreate {
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
754

755
			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) := {
756 757 758 759 760 761 762 763 764
    		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
765
    		dynamicAuthorizationConsultationIDs := omit, //TODO Check whether it is optional or mandatory for create operation
766 767 768 769 770 771 772 773 774
			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
775
			e2eSecInfo := omit, //TODO Check whether it is optional or mandatory for create operation
776 777
			choice := omit//NP
		};	
778
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
779 780 781 782 783
    	/**
    	 * @desc Base primitiveContent for CREATE operation for AE resource
    	 * @param p_name Resource name
    	 * @param p_accessControlPolicyIDs ACP IDs for the AE
    	 */
784
    	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, in template (omit) PoaList p_poaList) := {
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
785

786 787 788 789 790 791 792 793 794
			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
795
    		dynamicAuthorizationConsultationIDs := omit, //O
796 797 798
    		announceTo := omit,//O
    		announcedAttribute := omit,//O
    		appName := omit,//O
799
			app_ID := p_appId,//M
800
    		aE_ID := omit,//NP
801
    		pointOfAccess := p_poaList, //O {"http://127.0.0.1:1400/monitor"},//{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
802 803
    		ontologyRef := omit,//O
    		nodeLink := omit,//NP
804
    		requestReachability := true,//M
805
    		contentSerialization := omit,//O
806
			e2eSecInfo := omit, //O
807 808
    		choice := omit//NP
    	};	
809
    	
810 811 812 813 814
    	/**
    	 * @desc Base primitiveContent for CREATE operation for AccessControlPolicy resource
    	 * @param p_name Resource name
    	 * @param p_acor Allowed originators
    	 * @param p_allowedOperations Allowed operations
815
    	 */
816 817 818 819 820 821 822 823 824 825 826
    	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
827 828 829
			privileges := {
				accessControlRule_list := {
					{
830 831
						accessControlOriginators := p_acor,//{"*"},//{PX_AE_ID_STEM}, //{"admin:admin"},
						accessControlOperations := p_allowedOperations,
832 833
						accessControlContexts_list := omit,
						accessControlAuthenticationFlag := omit
834 835
					}
				}
836
			},//M
837 838 839
			selfPrivileges := {
				accessControlRule_list := {
					{
840 841
						accessControlOriginators := p_acor, //{"*"},//{PX_AE_ID_STEM}, //{"admin:admin"},
						accessControlOperations := int63,
842 843
						accessControlContexts_list := omit,
						accessControlAuthenticationFlag := omit
844
					}
845 846 847
				}
			},//M
			choice := omit //NP
848 849
		};
    	
850 851
		//added by @Naum
		template (value) CSEBase_optional m_contentCreateCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) := {
852
			resourceName := omit,
853
			resourceType := omit,
854 855 856 857 858 859 860 861 862 863 864
			resourceID := omit,
			parentID := omit,
			creationTime := omit,
			lastModifiedTime := omit,
			labels := omit,
			accessControlPolicyIDs := omit,
			cseType := omit,
			cSE_ID := omit,
			supportedResourceType := omit,
			pointOfAccess := omit,
			nodeLink := omit,
865
			e2eSecInfo := omit, 
866 867 868 869
			choice := {
				choice_list := {{
				  serviceSubscribedAppRule := p_serviceSubscribedAppRule
				}}
870 871
			}
		}
872
    	
873 874 875 876 877 878
    	/**
    	 * @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
879
    	 */
880
    	template (value) Group_optional m_contentCreateGroup (	in template (value) XSD.NonNegativeInteger p_maxNrOfMembers,
881 882 883 884
    															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
885 886 887 888 889 890 891 892
			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
893
    		dynamicAuthorizationConsultationIDs := omit, //O
894 895 896
			announceTo := omit,//O
			announcedAttribute := omit,//O
			creator := omit,//O
897
			memberType := omit,//O
898 899 900 901 902 903 904 905 906
			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
    	};    	
907
    	
908 909 910 911
    	/**
    	 * @desc Base primitiveContent for CREATE operation for PollingChannel resource
    	 * @param p_accessControlPolicyIDs ACP IDs for the PollingChannel
    	 * @param p_name Resource name
912
    	 */
913
    	template (value) PollingChannel_optional m_contentCreatePollingChannel (in template (omit) XSD.String p_name := c_defaultResourceName) := {
914
			resourceName := p_name,//O
915 916 917 918 919 920
            resourceType := omit,//NP
            resourceID := omit,//NP
            parentID := omit,//NP
            creationTime := omit,//NP
            lastModifiedTime := omit,//NP
            labels := omit,//O
921
            expirationTime := omit//O
922
    	};    	
923
    	
924 925