From 2bf89753782f1fbf194571b99d1b6162c5a3242c Mon Sep 17 00:00:00 2001
From: Neeta Meshram <neeta@cdot.in>
Date: Thu, 9 Dec 2021 12:05:07 +0530
Subject: [PATCH] Test cases for 3GPP-IWK for SCEF based NIDD implemented.

---
 OneM2M_Testcases_CSE_Release_4.ttcn | 761 +++++++++++++++++++++++++++-
 1 file changed, 760 insertions(+), 1 deletion(-)

diff --git a/OneM2M_Testcases_CSE_Release_4.ttcn b/OneM2M_Testcases_CSE_Release_4.ttcn
index 0928c70..e6f5248 100644
--- a/OneM2M_Testcases_CSE_Release_4.ttcn
+++ b/OneM2M_Testcases_CSE_Release_4.ttcn
@@ -13,6 +13,8 @@
  */
 module OneM2M_Testcases_CSE_Release_4 {
 
+	import from OneM2M_Types_3GPP_T8 all;
+
 	import from OneM2M_TestSystem all;
 	import from OneM2M_Templates all;
 	import from OneM2M_Types all;
@@ -4596,7 +4598,7 @@ module OneM2M_Testcases_CSE_Release_4 {
 				var template PrimitiveContent v_contentResponseUri;
 				var template PrimitiveContent v_contentResponseRequestResource;
 				var RequestStatus v_requestStatus;
-				var URI v_requestResourceURI;
+				var OneM2M_Types.URI v_requestResourceURI;
 				var template PrimitiveContent v_primitiveContent;
 				var template RequestPrimitive v_createContainerRequest := m_createContainerBase;
 				var template RequestPrimitive v_createPrimitveProfile;
@@ -7695,6 +7697,763 @@ module OneM2M_Testcases_CSE_Release_4 {
 			} // Basic_Operation
 		} // Service_Subscription_User_Profile
 		
+		group IWK_3GPP{
+			
+			group Scef_Based_NIDD {
+				
+				/* @desk Check that IUT sends NIDD configuration request when it receives create request of <serviceSubscribedNode> resource
+				 *
+				 */
+				testcase TC_CSE_3GPP_NIDD_001() runs on Tester system ScefSystem {
+						
+					var ScefSimu v_scef := ScefSimu.create("SCEF") alive;
+						
+					v_scef.start(f_CSE_3GPP_NIDD_001());
+					v_scef.done;
+						
+				} // end testcase TC_CSE_3GPP_NIDD_001
+				
+				function f_CSE_3GPP_NIDD_001() runs on ScefSimu system ScefSystem{
+					var template RequestPrimitive v_createRequest := m_createServiceSubscribedNode;
+					var integer v_aeIndex := -1;
+					var RequestPrimitive v_request;
+					var OneM2M_Types_3GPP_T8.URI v_requestResourceURI;
+					var template T8Request v_requestPrimitive;
+					var NiddConfiguration v_niddConfiguration;
+					var RequestBody niddConfig := {individualNiddConfiguration := v_niddConfiguration};
+
+					
+					v_createRequest.primitiveContent.serviceSubscribedNode.niddRequired := true;
+					v_createRequest.primitiveContent.serviceSubscribedNode.nodeID := "M2M-Ext-ID";
+					
+					// Test component configuration
+					f_cf05Up();
+					
+					//Preamble
+					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
+					
+					// Test Body
+					v_request := f_getCreateRequestPrimitive(int20, v_createRequest, v_aeIndex);
+					
+					f_send(e_mcaPort, m_request(v_request));
+					
+					
+					v_requestPrimitive := mw_t8_request_post(v_requestResourceURI, -,  niddConfig);
+					tc_ac.start;
+					alt{
+						[] mcnPortIn.receive(mw_t8Request(v_requestPrimitive)) {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": NIDD configuration received.");
+						}
+						[] mcnPortIn.receive(mw_t8Request(?)){
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Other operation received");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer");
+						}
+					}
+					
+					// Postamble
+					//f_cse_postamble_deleteResourcesCSE();
+					
+					//Tear Down
+					f_cf05Down();
+				} // end of function f_CSE_3GPP_NIDD_001
+				
+				/* @desk Check that IUT sends NIDD configuration request when it receives update request of <serviceSubscribedNode> resource
+				with niddRequired attribute set to TRUE			 *
+				 */
+				testcase TC_CSE_3GPP_NIDD_002() runs on Tester system ScefSystem {
+						
+					var ScefSimu v_scef := ScefSimu.create("SCEF") alive;
+						
+					v_scef.start(f_CSE_3GPP_NIDD_002());
+					v_scef.done;
+						
+				} // end testcase TC_CSE_3GPP_NIDD_002
+				
+				function f_CSE_3GPP_NIDD_002() runs on ScefSimu system ScefSystem{
+					var template RequestPrimitive v_createRequest := m_createServiceSubscribedNode;
+					var template RequestPrimitive v_updateRequest := m_updateServiceSubscribedNode;
+					var integer v_aeIndex := -1;
+					var integer v_resourceIndex := -1;
+					var RequestPrimitive v_request;
+					var OneM2M_Types_3GPP_T8.URI v_requestResourceURI;
+					var template T8Request v_requestPrimitive;
+					var NiddConfiguration v_niddConfiguration;
+					var RequestBody niddConfig := {individualNiddConfiguration := v_niddConfiguration};
+					//var template NiddConfiguration v_niddConfiguration;
+
+					
+					v_createRequest.primitiveContent.serviceSubscribedNode.niddRequired := false;
+					v_createRequest.primitiveContent.serviceSubscribedNode.nodeID := "M2M-Ext-ID";
+					
+					v_updateRequest.primitiveContent.serviceSubscribedNode.niddRequired := true;
+					
+					// Test component configuration
+					f_cf05Up();
+					
+					//Preamble
+					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
+					
+					
+					v_resourceIndex := f_cse_createResource(int20, v_createRequest, v_aeIndex);
+					
+					
+					// Test Body
+					
+					v_request := f_getUpdateRequestPrimitive(int20, v_resourceIndex, v_updateRequest);
+					f_send(e_mcaPort, m_request(v_request));
+					
+					
+					v_requestPrimitive := mw_t8_request_post(v_requestResourceURI, -, niddConfig);
+					tc_ac.start;
+					alt{
+						[] mcnPortIn.receive(mw_t8Request(v_requestPrimitive)) {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": NIDD configuration received.");
+						}
+						[] mcnPortIn.receive(mw_t8Request(?)){
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Other operation received");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer");
+						}
+					}
+					
+					// Postamble
+					//f_cse_postamble_deleteResourcesCSE();
+					
+					//Tear Down
+					f_cf05Down();
+				} // end of function f_CSE_3GPP_NIDD_002
+				
+				/* @desk Check that IUT sends NIDD configuration delete request when it receives update request of <serviceSubscribedNode> resource
+				with niddRequired attribute set to FALSE		 *
+				 */
+				testcase TC_CSE_3GPP_NIDD_003() runs on Tester system ScefSystem {
+						
+					var ScefSimu v_scef := ScefSimu.create("SCEF") alive;
+						
+					v_scef.start(f_CSE_3GPP_NIDD_003());
+					v_scef.done;
+						
+				} // end testcase TC_CSE_3GPP_NIDD_003
+				
+				function f_CSE_3GPP_NIDD_003() runs on ScefSimu system ScefSystem{
+					var template RequestPrimitive v_createRequest := m_createServiceSubscribedNode;
+					var template RequestPrimitive v_updateRequest := m_updateServiceSubscribedNode;
+					var integer v_aeIndex := -1;
+					var integer v_resourceIndex := -1;
+					var RequestPrimitive v_request;
+					var OneM2M_Types_3GPP_T8.URI v_requestResourceURI;
+					var template T8Request v_requestPrimitive;
+					var NiddConfiguration v_niddConfiguration;
+					var RequestBody niddConfig := {individualNiddConfiguration := v_niddConfiguration};
+					var RequestHeaders v_requestHeader;
+					//var template NiddConfiguration v_niddConfiguration;
+
+					
+					v_createRequest.primitiveContent.serviceSubscribedNode.niddRequired := true;
+					v_createRequest.primitiveContent.serviceSubscribedNode.nodeID := "M2M-Ext-ID";
+					
+					v_updateRequest.primitiveContent.serviceSubscribedNode.niddRequired := false;
+					
+					// Test component configuration
+					f_cf05Up();
+					
+					//Preamble
+					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
+					
+					
+					v_resourceIndex := f_cse_createResource(int20, v_createRequest, v_aeIndex);
+					
+					
+					// Test Body
+					
+					v_request := f_getUpdateRequestPrimitive(int20, v_resourceIndex, v_updateRequest);
+					f_send(e_mcaPort, m_request(v_request));
+					
+					
+					v_requestPrimitive := m_t8_request_delete(v_requestResourceURI,v_requestHeader , niddConfig); // NIDD configuration delete request
+					tc_ac.start;
+					alt{
+						[] mcnPortIn.receive(mw_t8Request(v_requestPrimitive)) {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": NIDD configuration received.");
+						}
+						[] mcnPortIn.receive(mw_t8Request(?)){
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Other operation received");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer");
+						}
+					}
+					
+					// Postamble
+					//f_cse_postamble_deleteResourcesCSE();
+					
+					//Tear Down
+					f_cf05Down();
+				} // end of function f_CSE_3GPP_NIDD_003
+				
+
+				
+				/* @desk Check that IUT sends NIDD configuration delete request when it receives delete request of <serviceSubscribedNode> resource		 *
+				 */
+				testcase TC_CSE_3GPP_NIDD_004() runs on Tester system ScefSystem {
+						
+					var ScefSimu v_scef := ScefSimu.create("SCEF") alive;
+						
+					v_scef.start(f_CSE_3GPP_NIDD_004());
+					v_scef.done;
+						
+				} // end testcase TC_CSE_3GPP_NIDD_004
+				
+				function f_CSE_3GPP_NIDD_004() runs on ScefSimu system ScefSystem{
+					var template RequestPrimitive v_createRequest := m_createServiceSubscribedNode;
+					var integer v_aeIndex := -1;
+					var integer v_resourceIndex := -1;
+					var RequestPrimitive v_request;
+					var OneM2M_Types_3GPP_T8.URI v_requestResourceURI;
+					var template T8Request v_requestPrimitive;
+					var NiddConfiguration v_niddConfiguration;
+					var RequestBody niddConfig := {individualNiddConfiguration := v_niddConfiguration};
+					var RequestHeaders v_requestHeader; // := {header_name := "header1"};
+					//var template NiddConfiguration v_niddConfiguration;
+
+					
+					v_createRequest.primitiveContent.serviceSubscribedNode.niddRequired := true;
+					v_createRequest.primitiveContent.serviceSubscribedNode.nodeID := "M2M-Ext-ID";
+					
+					
+					
+					// Test component configuration
+					f_cf05Up();
+					
+					//Preamble
+					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
+					
+					
+					v_resourceIndex := f_cse_createResource(int20, v_createRequest, v_aeIndex);
+					
+					
+					// Test Body
+					
+					v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
+					f_send(e_mcaPort, m_request(v_request));
+					
+					
+					v_requestPrimitive := m_t8_request_delete(v_requestResourceURI, v_requestHeader, niddConfig); // NIDD configuration delete request 
+					tc_ac.start;
+					alt{
+						[] mcnPortIn.receive(mw_t8Request(v_requestPrimitive)) {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": NIDD configuration delete received.");
+						}
+						[] mcnPortIn.receive(mw_t8Request(?)){
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Other operation received");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer");
+						}
+					}
+					
+					// Postamble
+					//f_cse_postamble_deleteResourcesCSE();
+					
+					//Tear Down
+					f_cf05Down();
+				} // end of function f_CSE_3GPP_NIDD_004
+				
+				
+		/* @desk Check that IUT issues Scef-based Mobile Termnated(MT) NIDD downlink data transfer request if the size of the oneM2M request primitive to be sent is less than maximumPacketSize
+		 *
+		 */
+		testcase TC_CSE_3GPP_NIDD_005() runs on Tester system ScefSystem {
+						
+			var ScefSimu v_scef := ScefSimu.create("SCEF") alive;
+						
+			v_scef.start(f_CSE_3GPP_NIDD_005());
+			v_scef.done;
+		} // end testcase TC_CSE_3GPP_NIDD_005
+				
+		function f_CSE_3GPP_NIDD_005() runs on ScefSimu system ScefSystem{
+			var template RequestPrimitive v_createRequest := m_createContentInstanceBase;
+			var integer v_aeIndex := -1;
+			var integer v_ae2Index := -1;
+			var integer v_resourceIndexContainer := -1;
+			var integer v_resourceIndexSubscription := -1;
+			var template RequestPrimitive v_requestContainer := m_createContainerBase;
+			var template RequestPrimitive v_requestSubscription;
+			var OneM2M_Types.RequestPrimitive v_request;
+			var OneM2M_Types_3GPP_T8.URI v_requestResourceURI;
+			var template T8Request v_requestPrimitiveNIDDConfig;
+			const OneM2M_Types_3GPP_T8.ExternalId c_externalID := "M2M-Ext-ID";
+			const integer c_maxPacketSize := 1200;
+			var NiddConfiguration v_niddConfiguration :=
+			{
+				externalId := c_externalID,
+				maximumPacketSize := c_maxPacketSize
+						
+			}; // Should contain ExternalId and MaxPacketsize
+			var RequestBody niddConfig :=
+			{
+				individualNiddConfiguration := v_niddConfiguration
+			};
+			var RequestHeaders v_requestHeader; // := {header_name := "header1"};
+			var template T8Request v_requestPrimitiveNiddDownlinkDataTransfer;
+			var NiddDownlinkDataTransfer v_niddDownlinkDataTransfer;  //Should contain Notification in data field
+			var RequestBody v_niddDLDataTransferBody :=
+			{
+				individualNiddDownlinkDataDelivery := v_niddDownlinkDataTransfer
+			};
+					 
+			var template PrimitiveContent v_contentNotification := {contentInstance := mw_contentContentInstance_rc1};// all attributes expected
+			//var template NiddConfiguration v_niddConfiguration;
+					
+			// Test component configuration
+			f_cf05Up();
+					
+			//Preamble
+			//f_send(e_mcaPort, m_request(v_request));
+			//Sending NIDD config request with ExternalId "M2M-Ext-ID" and MaxPacketSize
+			v_requestPrimitiveNIDDConfig := m_t8_request_post(v_requestResourceURI, v_requestHeader, niddConfig); // NIDD configuration delete request
+			mcnPort.send(mw_t8Request(v_requestPrimitiveNIDDConfig));
+			//Registering AE with ExternalId "M2M-Ext-ID"
+			v_aeIndex := f_cse_preamble_registerAeWithExternalId(-,-,-, "M2M-Ext-ID");//c_CRUDNDi);
+			v_ae2Index := f_cse_preamble_registerAe();
+					
+					
+			if (vc_ae1.running) {
+				vc_ae1.stop;
+			}
+					
+			v_resourceIndexContainer := f_cse_createResource(int3, v_requestContainer, v_ae2Index);
+			v_requestSubscription := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndexContainer), -, {f_getResourceAddress(v_aeIndex)}, m_eventNotificationCriteria({int3}), -, omit, omit, omit, -, omit);
+			v_resourceIndexSubscription := f_cse_createResource(int23, v_requestSubscription, v_ae2Index);//Subscription
+					
+			// Test Body
+					
+			v_request := f_getCreateRequestPrimitive(int4, v_createRequest, v_ae2Index);
+			f_send(e_mcaPort, m_request(v_request));
+					
+			vc_ae1.start(f_cse_notifyProcedure_representationHandler(v_contentNotification)); // check if the notification is well received and if its content matchs
+					
+			/*if(sizeof(v_contentNotification) < c_maxPacketSize)
+			{
+			v_niddDownlinkDataTransfer :=
+			{
+			data := (charstring)v_contentNotification
+			};
+			}*/
+			v_requestPrimitiveNiddDownlinkDataTransfer := mw_t8_request_post(v_requestResourceURI, -,  v_niddDLDataTransferBody);
+					 
+			tc_ac.start;
+			alt{
+				[] mcnPortIn.receive(mw_t8Request(v_requestPrimitiveNiddDownlinkDataTransfer)) {
+					tc_ac.stop;
+					setverdict(pass, __SCOPE__ & ": NIDD downlink data transfer received.");
+				}
+				[] mcnPortIn.receive(mw_t8Request(?)){
+					tc_ac.stop;
+					setverdict(fail, __SCOPE__ & ": Other operation received");
+				}
+				[] tc_ac.timeout {
+					setverdict(fail, __SCOPE__ & ": No answer");
+				}
+			}
+					
+			// Postamble
+			//f_cse_postamble_deleteResourcesCSE();
+					
+			//Tear Down
+			f_cf05Down();
+		} // end of function f_CSE_3GPP_NIDD_005
+				
+		/* @desk Check that IUT does not issue Scef-based Mobile Termnated(MT) NIDD downlink data transfer request if the size of the oneM2M request primitive to be sent is more than maximumPacketSize
+		 *
+		 */
+		testcase TC_CSE_3GPP_NIDD_006() runs on Tester system ScefSystem {
+						
+			var ScefSimu v_scef := ScefSimu.create("SCEF") alive;
+						
+			v_scef.start(f_CSE_3GPP_NIDD_006());
+			v_scef.done;
+						
+		} // end testcase TC_CSE_3GPP_NIDD_006
+				
+		function f_CSE_3GPP_NIDD_006() runs on ScefSimu system ScefSystem{
+			var template RequestPrimitive v_createRequest := m_createContentInstanceBase;
+			var integer v_aeIndex := -1;
+			var integer v_ae2Index := -1;
+			var integer v_resourceIndexContainer := -1;
+			var integer v_resourceIndexSubscription := -1;
+			var template RequestPrimitive v_requestContainer := m_createContainerBase;
+			var template RequestPrimitive v_requestSubscription;
+			var OneM2M_Types.RequestPrimitive v_request;
+			var OneM2M_Types_3GPP_T8.URI v_requestResourceURI;
+			var template T8Request v_requestPrimitiveNIDDConfig;
+			const OneM2M_Types_3GPP_T8.ExternalId c_externalID := "M2M-Ext-ID";
+			const integer c_maxPacketSize := 20; //Notification content will more than 20 Bytes
+			var NiddConfiguration v_niddConfiguration :=
+			{
+				externalId := c_externalID,
+				maximumPacketSize := c_maxPacketSize
+						
+			}; // Should contain ExternalId and MaxPacketsize
+			var RequestBody niddConfig :=
+			{
+				individualNiddConfiguration := v_niddConfiguration
+			};
+			var RequestHeaders v_requestHeader; // := {header_name := "header1"};
+			var template T8Request v_requestPrimitiveNiddDownlinkDataTransfer;
+			var NiddDownlinkDataTransfer v_niddDownlinkDataTransfer;  //Should contain Notification in data field
+			var RequestBody v_niddDLDataTransferBody :=
+			{
+				individualNiddDownlinkDataDelivery := v_niddDownlinkDataTransfer
+			};
+					 
+			var template PrimitiveContent v_contentNotification := {contentInstance := mw_contentContentInstance_rc1};// all attributes expected
+			//var template NiddConfiguration v_niddConfiguration;
+					
+			// Test component configuration
+			f_cf05Up();
+					
+			//Preamble
+			//f_send(e_mcaPort, m_request(v_request));
+			//Sending NIDD config request with ExternalId "M2M-Ext-ID" and MaxPacketSize
+			v_requestPrimitiveNIDDConfig := m_t8_request_post(v_requestResourceURI, v_requestHeader, niddConfig); // NIDD configuration delete request
+			mcnPort.send(mw_t8Request(v_requestPrimitiveNIDDConfig));
+			//Registering AE with ExternalId "M2M-Ext-ID"
+			v_aeIndex := f_cse_preamble_registerAeWithExternalId(-,-,-, "M2M-Ext-ID");//c_CRUDNDi);
+			v_ae2Index := f_cse_preamble_registerAe();
+					
+					
+			if(vc_ae1.running) {
+				vc_ae1.stop;
+			};
+					
+			v_resourceIndexContainer := f_cse_createResource(int3, v_requestContainer, v_ae2Index);
+			v_requestSubscription := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndexContainer), -, {f_getResourceAddress(v_aeIndex)}, m_eventNotificationCriteria({int3}), -, omit, omit, omit, -, omit);
+			v_resourceIndexSubscription := f_cse_createResource(int23, v_requestSubscription, v_ae2Index);//Subscription
+					
+			// Test Body
+					
+			v_request := f_getCreateRequestPrimitive(int4, v_createRequest, v_ae2Index);
+			f_send(e_mcaPort, m_request(v_request));
+					
+			vc_ae1.start(f_cse_notifyProcedure_representationHandler(v_contentNotification)); // check if the notification is well received and if its content matchs
+					
+			/*if(sizeof(v_contentNotification) < c_maxPacketSize)
+			{
+			v_niddDownlinkDataTransfer :=
+			{
+			data := (charstring)v_contentNotification
+			};
+			}*/
+			v_requestPrimitiveNiddDownlinkDataTransfer := mw_t8_request_post(v_requestResourceURI, -,  v_niddDLDataTransferBody);
+					 
+			tc_ac.start;
+			alt{
+				[] mcnPortIn.receive(mw_t8Request(v_requestPrimitiveNiddDownlinkDataTransfer)) {
+					tc_ac.stop;
+					setverdict(fail, __SCOPE__ & ": NIDD downlink data transfer received.");
+				}
+				[] mcnPortIn.receive(mw_t8Request(?)){
+					tc_ac.stop;
+					setverdict(pass, __SCOPE__ & ": NIDD downlink data transfer not received.");
+				}
+				[] tc_ac.timeout {
+					setverdict(pass, __SCOPE__ & ": NIDD downlink data transfer not received. Timeout has occurred.");
+				}
+			}
+					
+			// Postamble
+			//f_cse_postamble_deleteResourcesCSE();
+					
+			//Tear Down
+			f_cf05Down();
+		} // end of function f_CSE_3GPP_NIDD_006
+				
+		/* @desk Check that IUT issues Scef-based Mobile Termnated(MT) NIDD downlink data transfer request if the size of the oneM2M response primitive to be sent is more than maximumPacketSize
+		 *
+		 */
+		testcase TC_CSE_3GPP_NIDD_007() runs on Tester system ScefSystem {
+						
+			var ScefSimu v_scef := ScefSimu.create("SCEF") alive;
+						
+			v_scef.start(f_CSE_3GPP_NIDD_007());
+			v_scef.done;
+						
+		} // end testcase TC_CSE_3GPP_NIDD_007
+				
+		function f_CSE_3GPP_NIDD_007() runs on ScefSimu system ScefSystem{
+			var template RequestPrimitive v_createRequest := m_createAe(PX_TS_AE1.appId, omit, omit);
+			var OneM2M_Types_3GPP_T8.URI v_requestResourceURI;
+			var template T8Request v_requestPrimitiveNIDDConfig;
+			const OneM2M_Types_3GPP_T8.ExternalId c_externalID := "M2M-Ext-ID";
+			const integer c_maxPacketSize := 1200; //Notification content will more than 20 Bytes
+			var NiddConfiguration v_niddConfiguration :=
+			{
+				externalId := c_externalID,
+				maximumPacketSize := c_maxPacketSize
+						
+			}; // Should contain ExternalId and MaxPacketsize
+			var RequestBody niddConfig :=
+			{
+				individualNiddConfiguration := v_niddConfiguration
+			};
+					 
+			var template T8Request v_requestPrimitiveNIDDUplink;
+					
+			v_createRequest.primitiveContent.aE.m2M_Ext_ID := "M2M-Ext-ID";
+			var universal charstring v_chr1 := any2unistr(v_createRequest);
+			var NiddUplinkDataNotification v_niddUplinkDataNotification :=
+			{
+				data := v_chr1
+			};
+			var RequestBody niddUplink :=
+			{
+				niddUplinkDataNotification := v_niddUplinkDataNotification
+			};
+			var RequestHeaders v_requestHeader; // := {header_name := "header1"};
+			var template T8Request v_requestPrimitiveNiddDownlinkDataTransfer;
+			var NiddDownlinkDataTransfer v_niddDownlinkDataTransfer;  //Should contain Notification in data field
+			var RequestBody v_niddDLDataTransferBody :=
+			{
+				individualNiddDownlinkDataDelivery := v_niddDownlinkDataTransfer
+			};
+					 
+					
+					
+			// Test component configuration
+			f_cf05Up();
+					
+			//Preamble
+			//f_send(e_mcaPort, m_request(v_request));
+			//Sending NIDD config request with ExternalId "M2M-Ext-ID" and MaxPacketSize
+			v_requestPrimitiveNIDDConfig := m_t8_request_post(v_requestResourceURI, v_requestHeader, niddConfig); // NIDD configuration create request
+			mcnPort.send(mw_t8Request(v_requestPrimitiveNIDDConfig));
+					
+			// Test Body
+			v_requestPrimitiveNIDDUplink := m_t8_request_post(v_requestResourceURI, v_requestHeader, niddUplink); // NIDD Uplink data transfer request
+			mcnPort.send(mw_t8Request(v_requestPrimitiveNIDDUplink));
+					
+			/*if(sizeof(v_contentNotification) < c_maxPacketSize)
+			{
+			v_niddDownlinkDataTransfer :=
+			{
+			data := (charstring)v_contentNotification
+			};
+			}*/
+			v_requestPrimitiveNiddDownlinkDataTransfer := mw_t8_request_post(v_requestResourceURI, -,  v_niddDLDataTransferBody);
+					 
+			tc_ac.start;
+			alt{
+				[] mcnPortIn.receive(mw_t8Request(v_requestPrimitiveNiddDownlinkDataTransfer)) {
+					tc_ac.stop;
+					setverdict(pass, __SCOPE__ & ": NIDD downlink data transfer received.");
+				}
+				[] mcnPortIn.receive(mw_t8Request(?)){
+					tc_ac.stop;
+					setverdict(fail, __SCOPE__ & ": Other operation received");
+				}
+				[] tc_ac.timeout {
+					setverdict(fail, __SCOPE__ & ": No Answer");
+				}
+			}
+					
+			// Postamble
+			//f_cse_postamble_deleteResourcesCSE();
+					
+			//Tear Down
+			f_cf05Down();
+		} // end of function f_CSE_3GPP_NIDD_007
+				
+		testcase TC_CSE_3GPP_NIDD_008() runs on Tester system ScefSystem {
+						
+			var ScefSimu v_scef := ScefSimu.create("SCEF") alive;
+						
+			v_scef.start(f_CSE_3GPP_NIDD_008());
+			v_scef.done;
+						
+		} // end testcase TC_CSE_3GPP_NIDD_008
+				
+				
+		function f_CSE_3GPP_NIDD_008() runs on ScefSimu system ScefSystem{
+			var template RequestPrimitive v_createRequest := m_createAe(PX_TS_AE1.appId, omit, omit);
+			var OneM2M_Types_3GPP_T8.URI v_requestResourceURI;
+			var template T8Request v_requestPrimitiveNIDDConfig;
+			const OneM2M_Types_3GPP_T8.ExternalId c_externalID := "M2M-Ext-ID";
+			const integer c_maxPacketSize := 1200; //Notification content will more than 20 Bytes
+			var NiddConfiguration v_niddConfiguration :=
+			{
+				externalId := c_externalID,
+				maximumPacketSize := c_maxPacketSize
+						
+			}; // Should contain ExternalId and MaxPacketsize
+			var RequestBody niddConfig :=
+			{
+				individualNiddConfiguration := v_niddConfiguration
+			};
+					 
+			var template T8Request v_requestPrimitiveNIDDUplink;
+					
+			v_createRequest.primitiveContent.aE.m2M_Ext_ID := "M2M-Ext-ID";
+			var universal charstring v_chr1 := any2unistr(v_createRequest);
+			var NiddUplinkDataNotification v_niddUplinkDataNotification :=
+			{
+				data := v_chr1
+			};
+			var RequestBody niddUplink :=
+			{
+				niddUplinkDataNotification := v_niddUplinkDataNotification
+			};
+			var RequestHeaders v_requestHeader; // := {header_name := "header1"};
+			var template T8Request v_requestPrimitiveNiddDownlinkDataTransfer;
+			var NiddDownlinkDataTransfer v_niddDownlinkDataTransfer;  //Should contain Notification in data field
+			var RequestBody v_niddDLDataTransferBody :=
+			{
+				individualNiddDownlinkDataDelivery := v_niddDownlinkDataTransfer
+			};
+					 
+			var template T8Request v_requestPrimitiveNiddDownlinkDataDeliveryStatusNotification;
+			var NiddDownlinkDataDeliveryStatusNotification v_niddDownlinkDataDeliveryStatusNotification;  //Should contain Notification in data field
+			var RequestBody v_niddDLDataStatusNotificationBody :=
+			{
+				niddDownlinkDataDeliveryStatusNotification := v_niddDownlinkDataDeliveryStatusNotification
+			};
+					
+			// Test component configuration
+			f_cf05Up();
+					
+			//Preamble
+			//f_send(e_mcaPort, m_request(v_request));
+			//Sending NIDD config request with ExternalId "M2M-Ext-ID" and MaxPacketSize
+			v_requestPrimitiveNIDDConfig := m_t8_request_post(v_requestResourceURI, v_requestHeader, niddConfig); // NIDD configuration create request
+			mcnPort.send(mw_t8Request(v_requestPrimitiveNIDDConfig));
+					
+			//Scef sent MO request
+			v_requestPrimitiveNIDDUplink := m_t8_request_post(v_requestResourceURI, v_requestHeader, niddUplink); // NIDD Uplink data transfer request
+			mcnPort.send(mw_t8Request(v_requestPrimitiveNIDDUplink));
+					
+			//IUT sent MT request
+			v_requestPrimitiveNiddDownlinkDataTransfer := mw_t8_request_post(v_requestResourceURI, -,  v_niddDLDataTransferBody);
+			mcnPortIn.receive(mw_t8Request(v_requestPrimitiveNiddDownlinkDataTransfer));
+					
+			// Test Body
+			//Scef send niddDownlink data delivery notification
+			v_requestPrimitiveNiddDownlinkDataDeliveryStatusNotification := m_t8_request_post(v_requestResourceURI, v_requestHeader, v_niddDLDataStatusNotificationBody); // NIDD Uplink data transfer request
+			mcnPort.send(mw_t8Request(v_requestPrimitiveNiddDownlinkDataDeliveryStatusNotification));
+					
+			tc_ac.start;
+			alt{
+				[] mcnPortIn.receive(mw_t8Response(mw_t8_response_204_no_content)) { //Check if 204 no content is received from IUT
+					tc_ac.stop;
+					setverdict(pass, __SCOPE__ & ": 204 no content is received.");
+				}
+				[] mcnPortIn.receive(mw_t8Request(?)){
+					tc_ac.stop;
+					setverdict(fail, __SCOPE__ & ": Other operation received");
+				}
+				[] tc_ac.timeout {
+					setverdict(fail, __SCOPE__ & ": No Answer");
+				}
+			}
+					
+			// Postamble
+			//f_cse_postamble_deleteResourcesCSE();
+					
+			//Tear Down
+			f_cf05Down();
+		} // end of function f_CSE_3GPP_NIDD_008
+				
+				
+		testcase TC_CSE_3GPP_NIDD_009() runs on Tester system ScefSystem {
+						
+			var ScefSimu v_scef := ScefSimu.create("SCEF") alive;
+						
+			v_scef.start(f_CSE_3GPP_NIDD_009());
+			v_scef.done;
+						
+		} // end testcase TC_CSE_3GPP_NIDD_009
+				
+		function f_CSE_3GPP_NIDD_009() runs on ScefSimu system ScefSystem{
+			var template RequestPrimitive v_createRequest := m_createAe(PX_TS_AE1.appId, omit, omit);
+			var OneM2M_Types_3GPP_T8.URI v_requestResourceURI;
+			var template T8Request v_requestPrimitiveNIDDConfig;
+			const OneM2M_Types_3GPP_T8.ExternalId c_externalID := "M2M-Ext-ID";
+			const integer c_maxPacketSize := 1200; //Notification content will more than 20 Bytes
+			var NiddConfiguration v_niddConfiguration :=
+			{
+				externalId := c_externalID,
+				maximumPacketSize := c_maxPacketSize
+						
+			}; // Should contain ExternalId and MaxPacketsize
+			var RequestBody niddConfig :=
+			{
+				individualNiddConfiguration := v_niddConfiguration
+			};
+					 
+			var template T8Request v_requestPrimitiveNIDDUplink;
+					
+			v_createRequest.primitiveContent.aE.m2M_Ext_ID := "M2M-Ext-ID";
+			var universal charstring v_chr1 := any2unistr(v_createRequest);
+			var NiddUplinkDataNotification v_niddUplinkDataNotification :=
+			{
+				data := v_chr1
+			};
+			var RequestBody niddUplink :=
+			{
+				niddUplinkDataNotification := v_niddUplinkDataNotification
+			};
+			var RequestHeaders v_requestHeader; // := {header_name := "header1"};
+					
+			// Test component configuration
+			f_cf05Up();
+					
+			//Preamble
+			//f_send(e_mcaPort, m_request(v_request));
+			//Sending NIDD config request with ExternalId "M2M-Ext-ID" and MaxPacketSize
+			v_requestPrimitiveNIDDConfig := m_t8_request_post(v_requestResourceURI, v_requestHeader, niddConfig); // NIDD configuration create request
+			mcnPort.send(mw_t8Request(v_requestPrimitiveNIDDConfig));
+					
+			// Test Body
+			//Scef sent MO request
+			v_requestPrimitiveNIDDUplink := m_t8_request_post(v_requestResourceURI, v_requestHeader, niddUplink); // NIDD Uplink data transfer request
+			mcnPort.send(mw_t8Request(v_requestPrimitiveNIDDUplink));
+					
+			tc_ac.start;
+			alt{
+				[] mcnPortIn.receive(mw_t8Response(mw_t8_response_204_no_content)) { //Check if 204 no content is received from IUT
+					tc_ac.stop;
+					setverdict(pass, __SCOPE__ & ": 204 no content is received.");
+				}
+				[] mcnPortIn.receive(mw_t8Request(?)){
+					tc_ac.stop;
+					setverdict(fail, __SCOPE__ & ": Other operation received");
+				}
+				[] tc_ac.timeout {
+					setverdict(fail, __SCOPE__ & ": No Answer");
+				}
+			}
+					
+			// Postamble
+			//f_cse_postamble_deleteResourcesCSE();
+					
+			//Tear Down
+			f_cf05Down();
+		} // end of function f_CSE_3GPP_NIDD_009
+	} // end group Scef_Based_NIDD
+			
+			
+} // end group IWK_3GPP
+		
 	}//end group CSE
 
 }		
-- 
GitLab