OneM2M_Templates.ttcn 84.2 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 225 2017-03-08 15:36:54Z 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
	group Primitives {
41 42 43 44
    	/** 
    	 * @desc Base template for request sending operations
    	 * @param p_requestPrimitive
    	 */
45
    	template (value) MsgOut m_request(in template (value) RequestPrimitive p_requestPrimitive, in template (omit) AttributeAux_list p_forcedFields := omit) := {
46
    		primitive := { requestPrimitive := p_requestPrimitive},
47
    		host := PX_SUT_ADDRESS,
48 49 50
    		xmlNamespace := PX_XML_NAMESPACE,
    		protocolBinding := PX_PROTOCOL_BINDING,
    		serialization := PX_SERIALIZATION, 
51
    		forcedFields := p_forcedFields
52
    	};
53 54 55 56 57
    	
		/** 
		 * @desc Base template for response sending operations
		 * @param p_responsePrimitive
		 */
58
		template (value) MsgOut m_response(in template (value) ResponsePrimitive p_responsePrimitive, in template (omit) AttributeAux_list p_forcedFields := omit) := {
59
			primitive := { responsePrimitive := p_responsePrimitive},
60
			host := PX_SUT_ADDRESS,
61 62 63
			xmlNamespace := PX_XML_NAMESPACE,
			protocolBinding := PX_PROTOCOL_BINDING,
			serialization := PX_SERIALIZATION, 
64
			forcedFields := p_forcedFields
65
		};
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 := omit, 
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
        		discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
110
				localTokenIDs := omit,
111
				tokenRequestIndicator := 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 := omit, 
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
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
141
				localTokenIDs := omit,
142
				tokenRequestIndicator := 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 := omit,
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
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
172
				localTokenIDs := omit,
173
				tokenRequestIndicator := 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 := omit,
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
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
206
				localTokenIDs := omit,
207
				tokenRequestIndicator := 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 := omit, 
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
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
235
				localTokenIDs := omit,
236
				tokenRequestIndicator := 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 275 276 277 278 279
			template (value) RequestPrimitive m_updateAcpPrivileges(in template(omit) SetOfAcrs p_privileges := omit, in template(omit) SetOfAcrs p_selfPrivileges := omit) modifies m_update := {
				from_ := PX_AE_ID_STEM,
				requestIdentifier := "m_updateAcp" & f_rnd(1, 1000000),
				primitiveContent:= {
							any_1 := {{AccessControlPolicy_optional := m_contentUpdateAcpPrivileges(p_privileges, p_selfPrivileges)}}
				}
			};
			
280 281 282
			/**
			 * @desc Base UPDATE request primitive for Group resource
			 */
283
			template (value) RequestPrimitive m_updateGroupBase modifies m_update := {
284
				from_ := PX_AE_ID_STEM,
285
				requestIdentifier := "m_updateGroup" & f_rnd(1, 1000000),
286
				primitiveContent:= {
287
							any_1 := {{Group_optional := m_contentUpdateGroup}}
288
				}
289 290
			};
			
291 292 293
			/**
			 * @desc Base UPDATE request primitive for Schedule resource
			 */
294
			template (value) RequestPrimitive m_updateScheduleBase modifies m_update := {
295
				from_ := PX_AE_ID_STEM,
296
				requestIdentifier := "m_updateSchedule" & f_rnd(1, 1000000),
297
				primitiveContent:= {
298
							any_1 := {{Schedule_optional := m_contentUpdateSchedule}}
299
				}
300 301
			};
			
302 303 304
			/**
			 * @desc Base UPDATE request primitive for PollingChannel resource
			 */
305
			template (value) RequestPrimitive m_updatePollingChannelBase modifies m_update := {
306
				from_ := PX_AE_ID_STEM,
307
				requestIdentifier := "m_updatePollingChannel" & f_rnd(1, 1000000),
308
				primitiveContent:= {
309
							any_1 := {{PollingChannel_optional := m_contentUpdatePollingChannel}}
310
				}
311 312
			};
			
313 314 315
			/**
			 * @desc Base UPDATE request primitive for Subscription resource
			 */
316
			template (value) RequestPrimitive m_updateSubscriptionBase modifies m_update := {
317
				from_ := PX_AE_ID_STEM,
318
				requestIdentifier := "m_updateSubscription" & f_rnd(1, 1000000),
319
				primitiveContent:= {
320
							any_1 := {{Subscription_optional := m_contentUpdateSubscription}}
321
				}
322
			};
323 324
			
			//@Martin
325
        	template (value) RequestPrimitive m_updateLocationPolicy(XSD.ID p_locResourceAddress, in template (omit) AcpType p_accessControlPolicyIds, in template (omit) XSD.Duration p_locationUpdatePeriod) modifies m_update := {
oneM2MTester Develop Team's avatar
oneM2MTester Develop Team committed
326
        	  	to_ 				:= p_locResourceAddress,
327 328 329
        	  	from_				:= PX_AE_ID_STEM, //AE originator id e.g.
        	  	requestIdentifier	:= "m_updateLocationPolicy",
        	  	primitiveContent	:= {        	    
330
        	    			any_1 := {{ LocationPolicy_optional := m_contentUpdateLocationPolicy(p_accessControlPolicyIds, p_locationUpdatePeriod) }}
331 332
        		}
			  };
333
        	
334 335 336
    	}//end group Update
    	
    	group Create {
337 338 339 340 341

			template (value) RequestPrimitive m_create := {
				operation := int1,
				to_ := "NotInitialized",
				from_ := "NotInitialized",
342
				requestIdentifier := testcasename() & "-m_create" & f_rnd(1, 1000000),
343 344
				resourceType := omit,
				primitiveContent := omit,
345
				roleIDs := omit,
346 347 348 349 350 351 352 353 354 355 356 357 358 359
				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,
360
				localTokenIDs := omit,
361
				tokenRequestIndicator := omit
362 363

			};
364
        	
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395
			/**
			 * @desc Base Reception template for create operation
			 */
			template RequestPrimitive mw_create(template XSD.ID p_from := *, template XSD.ID p_to := ?) := {
				operation := int1,
				to_ := ?,
				from_ := p_from,
				requestIdentifier := ?,
				resourceType := ?,
				primitiveContent := {
					any_1 := ?	
				},
				roleIDs := *,
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
				discoveryResultType := *,
				tokens := *,
				tokenIDs := *,
				localTokenIDs := *,
				tokenRequestIndicator := *
			}
			
396 397 398
			/**
			 * @desc Base CREATE request primitive for AE resource (AUX)
			 */
399
			//Added by @Naum
400
			template RequestPrimitive mw_createAEannc(template (omit) AcpType p_accessControlPolicyIds := omit, template (omit) XSD.ID p_to := omit, template (omit) XSD.ID p_from := omit, XSD.ID p_appId, XSD.ID p_stemId := omit) := {
401
				operation := int1,
402
				to_ := p_to,
403 404 405 406
				from_ := p_from,//PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"
				requestIdentifier := ?,
				resourceType := int10002,
				primitiveContent := {
407
					any_1 := {{AEAnnc_optional := mw_contentCreateAEannc("Credential-ID:None", p_accessControlPolicyIds, p_appId, p_to & "/" & p_stemId)}}	
408
				},
409
				roleIDs := *,
410 411 412 413 414 415 416 417 418 419 420
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
421 422 423
				discoveryResultType := *,
				tokens := *,
				tokenIDs := *,
424
				localTokenIDs := *,
425
				tokenRequestIndicator := *
426
			};
427 428

			//Added by @Naum
429
			template (value) RequestPrimitive m_createAe(XSD.ID p_appId, template (omit) AcpType p_accessControlPolicyIds := omit,template (omit) XSD.ID p_from := omit, template (omit) ResourceName p_resourceName :=  c_aeAuxName, in template (omit) PoaList p_poaList := omit) modifies m_create := {
430
				from_ := p_from,//PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"
431
				requestIdentifier := testcasename() & "-m_createAe" & f_rnd(1, 1000000),
432 433
				resourceType := int2,
				primitiveContent := {
434
					any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIds,p_resourceName, p_appId, p_poaList)}}	
435
				}
436
			};
437
        	
438 439 440 441 442 443 444 445 446 447
			/**
			 * @desc Reception template for AE registration
			 */
			template RequestPrimitive mw_createAe(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_create := {
				resourceType := int2,
				primitiveContent := {
					any_1 := {{AE_optional := ?}}	
				}
			};  
			        	
448
        	template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIds := omit, in template (omit) PoaList p_poaList) modifies m_create := {
449
        		from_ := PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"//@Martin
450
        		requestIdentifier := testcasename() & "-m_createAe" & f_rnd(1, 1000000),
451
        		resourceType := int2,
452
        		primitiveContent := {
453
        			any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIds, c_aeAuxName, -, p_poaList)}}	
454 455
        		}
			};
456
        	
457 458 459
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource
			 */
460
			template (value) RequestPrimitive m_createAcpBase modifies m_create := {
461
				requestIdentifier := testcasename() & "-m_createAcp" & f_rnd(1, 1000000),
462
				resourceType := int1,
463
				primitiveContent := {
464
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp ()}}
465
				}
466 467
			};
				
468
        	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 := {
469
        		to_ := p_parentResourceAddress,
470
        		from_ := PX_AE_ID_STEM,
471
        		requestIdentifier := testcasename() & "-m_createAcp" & f_rnd(1, 1000000),
472
        		resourceType := int1,
473
        		primitiveContent := {
474
					any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_name, p_acor, p_allowedOperations)}}
475
        		}
476 477
        	};
        	
478 479 480 481
       	
			/**
			 * @desc Base CREATE request primitive for AccessControlPolicy resource (AUX)
			 */
482
        	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 := {
483
        		from_ := PX_SUPER_USER,
484
        		requestIdentifier := testcasename() & "-m_createAcpAux" & f_rnd(1, 1000000),
485
        		resourceType := int1,
486
        		primitiveContent := {
487
        			any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_acpName, p_acor, p_allowedOperations)}}	
488
        		}
489 490
        	};
        	
491
			//Added by @Naum
492
			template (value) RequestPrimitive m_createCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) modifies m_create := {
493
				from_ := PX_AE_ID_STEM,
494
				requestIdentifier := testcasename() & "-m_createCSE" & f_rnd(1, 1000000),
495
				resourceType := int1,//FIXME Is this the value for CSEBase? In any case, this template is not used at all
496 497
				primitiveContent := {
					any_1 := {{CSEBase_optional := m_contentCreateCSEBase (p_serviceSubscribedAppRule)}}
498
				}
499 500
			};
        	
501 502 503 504
       	
			/**
			 * @desc Base CREATE request primitive for Container resource
			 */
505
			template (value) RequestPrimitive m_createContainerBase modifies m_create := {
506
				requestIdentifier := testcasename() & "-m_createContainer" & f_rnd(1, 1000000),
507
				resourceType := int3,
508 509
				primitiveContent := {
					
510
					any_1 := {{Container_optional := m_contentCreateContainer}}
511
				}
512 513
			};
	
514
    		template (value) RequestPrimitive m_createContainer(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_resourceName := c_defaultResourceName) modifies m_create := {
515
    			to_ := p_parentResourceAddress,
516
    			from_ := PX_AE_ID_STEM,
517
    			requestIdentifier := testcasename() & "-m_createContainer" & f_rnd(1, 1000000),
518
    			resourceType := int3,
519
    			primitiveContent := {
520
    				any_1 := {{Container_optional := m_contentCreateContainer(p_resourceName)}}
521
    			}
522 523
    		};
        	
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
			/**
			 * @desc Reception template for CREATE Container
			 */
			template RequestPrimitive mw_createContainer(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_create := {
				resourceType := int3,
				primitiveContent := {
					any_1 := {{Container_optional := ?}}	
				}
			};  
			
			/**
			 * @desc Reception template for CREATE FlexContainer
			 */
			template RequestPrimitive mw_createFlexContainer(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_create := {
				resourceType := int28, 
				primitiveContent := {
					any_1 := {{FlexContainer_optional := ?}}	
				}
			};  
			
			/**
			 * @desc Reception template for CREATE GenericInterworkingOperationInstance
			 */
			template RequestPrimitive mw_createGenericIwkOpInstance(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_create := {
				resourceType := int28,  // FIXME: not found in TS004
				primitiveContent := {
					any_1 := {{GenericInterworkingOperationInstance_optional := ?}}	
				}
			}; 
        	
554
    		template (value) RequestPrimitive m_createContentInstance(XSD.ID p_parentResourceAddress, XSD.String p_primitiveContent) modifies m_create := {
555
    			to_ := p_parentResourceAddress,
556
    			from_ := "admin:admin",
557
    			requestIdentifier := testcasename() & "-m_createContentInstance" & f_rnd(1, 1000000),
558
    			resourceType := int4,
559
    			primitiveContent := {
560
    				any_1 := {{ContentInstance_optional := m_contentCreateContentInstance(p_primitiveContent)}}	
561
    			}
562 563
    		};
    		
564 565 566 567
       	
			/**
			 * @desc Base CREATE request primitive for Group resource
			 */
568
			template (value) RequestPrimitive m_createGroupBase modifies m_create := {
569
				requestIdentifier := testcasename() & "-m_createGroup" & f_rnd(1, 1000000),
570 571
				resourceType := int9,
				primitiveContent := {
572
					any_1 := {{Group_optional := m_contentCreateGroup (1, {"NotInitialized"}, omit, omit)}}	//TODO: p_resourceId
573 574
				}
			};
575
        	
576
        	template (value) RequestPrimitive m_createGroup(in template (value) XSD.NonNegativeInteger p_maxNrOfMembers,
577
															in template (value) ListOfURIs p_memberIds := {"NotInitialized"},
578
															in template (omit) AcpType p_accessControlPolicyIds,
579 580 581 582
															in template (omit) MemberType p_memberType := omit,
															in template (omit) ConsistencyStrategy p_consistencyStrategy := omit,
															in template (omit) ListOfURIs p_membersAccessControlPolicyIDs := omit,
															in template (omit) XSD.String p_name := "MyGroup") modifies m_create := {
583
        		requestIdentifier := testcasename() & "-m_createGroup" & f_rnd(1, 1000000),
584
        		resourceType := int9,
585
        		primitiveContent := {
586
        			any_1 := {{Group_optional := m_contentCreateGroup (p_maxNrOfMembers, p_memberIds, p_accessControlPolicyIds, p_memberType, p_consistencyStrategy, p_membersAccessControlPolicyIDs, p_name)}}	//TODO: p_resourceId
587
        		}
588 589
        	};
        	
590 591 592 593
       	
			/**
			 * @desc Base CREATE request primitive for PollingChannel resource
			 */
594
			template (value) RequestPrimitive m_createPollingChannelBase modifies m_create := {
595
				requestIdentifier := testcasename() & "-m_createPollingChannel" & f_rnd(1, 1000000),
596 597
				resourceType := int15,
				primitiveContent := {
598
					any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel (-)}}	
599 600
				}
			};
601
        	
602
        	template (value) RequestPrimitive m_createPollingChannel(XSD.ID p_parentResourceAddress, in template (value)XSD.ID p_originatorId) modifies m_create := {
603
        		to_ := p_parentResourceAddress,
604
        		from_ := p_originatorId,
605
        		requestIdentifier := testcasename() & "-m_createPollingChannel" & f_rnd(1, 1000000),
606
        		resourceType := int15,
607
        		primitiveContent := {
608
        			any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel ()}}	
609
        		}
610 611
        	};
        	
612 613 614
			/**
			 * @desc Base CREATE request primitive for Schedule resource
			 */
615
        	template (value) RequestPrimitive m_createScheduleBase modifies m_create := {
616
        		requestIdentifier := testcasename() & "-m_createSchedule" & f_rnd(1, 1000000),
617
        		resourceType := int18,
618
        		primitiveContent := {
619
        			any_1 := {{Schedule_optional := m_contentCreateSchedule ({{"0,0,0 1 2,1,1,*"}})}}	
620
        		}
621 622
        	};
        	
623
        	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 := {
624
        		to_ := p_parentResourceAddress,
625
        		from_ := PX_AE_ID_STEM,
626
        		requestIdentifier := testcasename() & "-m_createSchedule" & f_rnd(1, 1000000),
627
        		resourceType := int18,
628
        		primitiveContent := {
629
        			any_1 := {{Schedule_optional := m_contentCreateSchedule (p_scheduleElement, p_name)}}	
630
        		}
631 632
        	};
        	
633
			//Added by @Naum
634
			template (value) RequestPrimitive m_createServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedAppIDs, in ListOfM2MID p_allowedAEs) modifies m_create := {
635
				from_ := PX_AE_ID_STEM,
636
				requestIdentifier := testcasename() & "-m_createServiceSubscribedAppRule" & f_rnd(1, 1000000),
637
				resourceType := int19,//FIXME Is this the correct value?
638
				primitiveContent := {
639
					any_1 := {{ServiceSubscribedAppRule_optional := m_contentCreateServiceSubscribedAppRule (p_applicableCredIDs, p_allowedAppIDs, p_allowedAEs)}}
640
				}
641
			};
642
        	
643 644 645 646
       	
			/**
			 * @desc Base CREATE request primitive for Subscription resource
			 */
647
			template (value) RequestPrimitive m_createSubscriptionBase modifies m_create := {
648
				requestIdentifier := testcasename() & "-m_createSubscription" & f_rnd(1, 1000000),
649
				resourceType := int23,
650
				primitiveContent := {
651
					any_1 := {{Subscription_optional := m_contentCreateSubscription ({"NotInitialized"})}}	
652
				}
653 654
			};
        	
655
        	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 := {
656
        		to_ := p_parentResourceAddress,
657
        		from_ := PX_AE_ID_STEM,
658
        		requestIdentifier := testcasename() & "-m_createSubscription" & f_rnd(1, 1000000),
659
        		resourceType := int23,
660
        		primitiveContent := {
661
					any_1 := {{Subscription_optional := m_contentCreateSubscription (p_notificationURI, p_name)}}	
662
        		}
663
        	};
664
        	
665 666 667 668 669 670 671 672 673 674 675 676 677 678
			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)}}	
				}
			};
        	
679
        	//@Martin
680 681
        	template (value) RequestPrimitive m_createLocationPolicy(in template (value) LocationSource p_locationSource, in template (omit) AcpType p_accessControlPolicyIds, in template (omit) XSD.Duration p_locationUpdatePeriod, in template (omit) NodeID p_locationTargetID, in template (omit) XSD.AnyURI p_locationServerAddress) modifies m_create := {
        		
682
        	  	requestIdentifier	:= testcasename() & "-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
683 684
        	  	resourceType		:= int10,
        	  	primitiveContent	:= {        	    
685
        	    			any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(p_locationSource, p_accessControlPolicyIds, p_locationUpdatePeriod, p_locationTargetID, p_locationServerAddress) }}
686 687
        	  	},
			  	resultContent := int1//default
688
        	};
689
        	//@Martin
690
        	template (value) RequestPrimitive m_createNotification(in template (value) Representation p_resourcePresentation, in template (omit)NotificationEventType p_notifEventType, in template (omit) XSD.AnyURI p_subscriptionReference, in template (omit) XSD.AnyURI p_notifForwardingURI) modifies m_create := {
691
        	  requestIdentifier	:= testcasename() & "-m_createNotification" & f_rnd(1, 1000000),
692
        	  primitiveContent	:= {	
693
        	    			any_1 :=	{{ Notification := m_contentCreateNotification(p_resourcePresentation, p_notifEventType, p_subscriptionReference, p_notifForwardingURI)}}        	    
694 695 696 697
        	  },
        	  resultContent		:= int1 //default
        	  
        	};
698
        	
699 700 701 702 703 704 705 706 707 708
			/**
			 * @desc Reception template for SemanticDescriptor creation
			 */
			template RequestPrimitive mw_createSemanticDescriptor(template XSD.ID p_from := *, template XSD.ID p_to := ?, template SemanticDescriptor_optional p_semanticDescriptor := mw_contentCreateSemanticDescriptor) modifies mw_create := {
				resourceType := int24,
				primitiveContent := {
					any_1 := {{SemanticDescriptor_optional := p_semanticDescriptor}}	
				}
			};
			
709 710 711 712
    	}//end group Create
    	
    	group Delete {
    	
713
        	template (value) RequestPrimitive m_deleteRequest(XSD.ID p_resourceAddress) := {
714
        		operation := int4,
715
        		to_ := p_resourceAddress,
716
        		from_ := PX_SUPER_USER,
717
        		requestIdentifier := testcasename() & "-m_deleteResource" & f_rnd(1, 1000000),
718
        		resourceType := omit,
719
        		primitiveContent := omit, 
720
				roleIDs := omit, 
721 722 723 724 725 726 727 728 729 730 731
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
732 733 734
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
735
				localTokenIDs := omit, 
736
				tokenRequestIndicator := omit
737 738 739

        	};
        	
740 741 742 743
			template (value) RequestPrimitive m_delete(XSD.ID p_resourceAddress) := {
				operation := int4,
				to_ := p_resourceAddress,
				from_ := PX_AE_ID_STEM,
744
				requestIdentifier := testcasename() & "-m_deleteAe" & f_rnd(1, 1000000),
745 746
				resourceType := omit,
				primitiveContent := omit, 
747
				roleIDs := omit, 
748 749 750 751 752 753 754 755 756 757 758
				originatingTimestamp := omit,
				requestExpirationTimestamp := omit,
				resultExpirationTimestamp := omit,
				operationExecutionTime := omit,
				responseType := omit,
				resultPersistence := omit,
				resultContent := omit,
				eventCategory := omit,
				deliveryAggregation := omit,
				groupRequestIdentifier := omit,
				filterCriteria := omit,
759 760 761
				discoveryResultType := omit,
				tokens := omit,
				tokenIDs := omit,
762
				localTokenIDs := omit,
763
				tokenRequestIndicator := omit
764

765 766
			};
        	
767
    	}//end group Delete
768 769 770 771 772 773 774 775 776 777 778 779 780
    	
    	group Notify {
    		
			/**
			 * @desc Base NOTIFY request primitive
			 */
			template RequestPrimitive mw_notifyBase := {
				operation := int5,
				to_ := ?,
				from_ := *,
				requestIdentifier := ?,
				resourceType := *,
				primitiveContent := { any_1 := {{ Notification := mw_contentNotificationBase}} },
781
				roleIDs := *,
782 783 784 785 786 787 788 789 790 791 792 793 794 795
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
				discoveryResultType := *,
				tokens := *,
				tokenIDs := *,
796
				localTokenIDs := *,
797
				tokenRequestIndicator := *
798 799 800 801 802 803 804 805 806 807 808 809
			};
			
			/**
			 * @desc Base NOTIFY request primitive
			 */
			template RequestPrimitive mw_aggregatedNotifyBase := {
				operation := int5,
				to_ := ?,
				from_ := *,
				requestIdentifier := ?,
				resourceType := *,
				primitiveContent := { any_1 := {{ AggregatedNotification := ?}} },
810
				roleIDs := *,
811 812 813 814 815 816 817 818 819 820 821 822 823 824
				originatingTimestamp := *,
				requestExpirationTimestamp := *,
				resultExpirationTimestamp := *,
				operationExecutionTime := *,
				responseType := *,
				resultPersistence := *,
				resultContent := *,
				eventCategory := *,
				deliveryAggregation := *,
				groupRequestIdentifier := *,
				filterCriteria := *,
				discoveryResultType := *,
				tokens := *,
				tokenIDs := *,
825
				localTokenIDs := *,
826
				tokenRequestIndicator := *
827 828 829 830 831 832
			};
			
			/**
			 * @desc Base NOTIFY request primitive
			 */
			
833
			template RequestPrimitive mw_notify(in template Notification p_notification) modifies mw_notifyBase := {
834 835 836 837 838 839 840 841 842
				primitiveContent := { 
					any_1 := {{ Notification := p_notification}}
				}
			};
			

			
    		
    	}//end of group Notify
843 844 845 846
	}//end group RequestPrimitives
	
	group ContentCreate {
		
Miguel Angel Reina Ortega's avatar
Miguel Angel Reina Ortega committed
847

848 849
		template AEAnnc_optional mw_contentCreateAEannc (in template (omit)  XSD.String p_labels, in template (omit) AcpType p_accessControlPolicyIds, XSD.ID p_appId := PX_APP_ID, XSD.AnyURI p_nodeLink := omit) := {
    		resourceName := *,//O
850 851 852 853 854
    		resourceType := omit,//NP
    		resourceID := omit,//NP
    		parentID := omit,//NP
    		creationTime := omit,//NP
    		lastModifiedTime := omit,//NP
855
    		labels := p_labels,//O
856 857
    		accessControlPolicyIDs := p_accessControlPolicyIds,//O
    		expirationTime := *,//O
858
    		dynamicAuthorizationConsultationIDs := omit, //TODO Check whether it is optional or mandatory for create operation
859 860
			link := *,//O
			appName := *,//O
861 862
			app_ID := p_appId,//M
			aE_ID := omit,//NP
863 864
			pointOfAccess := *, //{"http://127.0.0.1:1400/monitor"},//O //{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
			ontologyRef := *,//O
865
			nodeLink := p_nodeLink,//NP