From 960e7d770eb829bf4616b647b3e4ee90351f0d91 Mon Sep 17 00:00:00 2001 From: Naum Spaseski <naum.spaseski@gmail.com> Date: Thu, 7 Sep 2017 17:23:31 +0200 Subject: [PATCH] STF351: Added f_cse_preamble_createServiceSubscribedProfile and corrected CSE/REG/CRE/001,004,005,008 Signed-off-by: Naum Spaseski <naum.spaseski@gmail.com> --- LibOneM2M/OneM2M_Functions.ttcn | 15 +++++++++++++++ LibOneM2M/OneM2M_Templates.ttcn | 17 +++++++++++++++++ LibOneM2M/OneM2M_Types.ttcn | 33 +++++++++++++++++++++++++++++++++ OneM2M_Testcases.ttcn | 28 +++++++++++++++++++--------- 4 files changed, 84 insertions(+), 9 deletions(-) diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 4f2285a..40bf907 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -399,6 +399,21 @@ module OneM2M_Functions { } + function f_cse_preamble_createServiceSubscribedProfile(in template ListOfM2MID p_allowedAEs := {""}) runs on AeSimu return integer {//c_CRUDNDi + + var integer v_serviceSubscribedAppRuleIndex := -1; + var integer v_serviceSubscribedProfileIndex := -1; + var template RequestPrimitive m_request := m_createM2mServiceSubscriptionProfileBase; + + m_request.primitiveContent.m2mServiceSubscriptionProfile.choice.choice_list[0].serviceSubscribedNode := m_contentServiceSubscribedNode; + v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, m_createServiceSubscribedAppRule({"None"}, {PX_APP_ID}, valueof(p_allowedAEs))); + m_request.primitiveContent.m2mServiceSubscriptionProfile.choice.choice_list[0].serviceSubscribedNode.ruleLinks := {f_getResourceAddress(v_serviceSubscribedAppRuleIndex)}; + v_serviceSubscribedProfileIndex := f_cse_createResource(int11, m_request); + + return v_serviceSubscribedProfileIndex; + + } + function f_cse_preamble_subscriptionVerification(out AeSimu p_ae2,in integer p_aeIndex, inout integer p_ae2Index, inout template RequestPrimitive p_createRequestPrimitive,in ResourceType p_resourceType, in ResponseStatusCode p_responseStatusCode := int2001) runs on AeSimu { if(p_resourceType == int23){ p_ae2 := AeSimu.create("AE2") alive; diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 0a3bec5..659ae07 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -1863,6 +1863,23 @@ module OneM2M_Templates { allowedAEs := omit, choice := omit //NP }; + + template ServiceSubscribedNode_optional m_contentServiceSubscribedNode := { + resourceName := "MyServiceServiceSubscribedNodeResource", //O + resourceType := omit, //M + resourceID := omit, //M + parentID := omit, //M + creationTime := omit, //M + lastModifiedTime := omit, //M + labels := omit, //O + accessControlPolicyIDs := omit, //O + expirationTime := omit, //M + nodeID := omit, //M + cSE_ID := omit, //O + deviceIdentifier := omit, //M + ruleLinks := omit, //O + choice := omit //O + }; }//end group ContentCreate group ContentUpdate { diff --git a/LibOneM2M/OneM2M_Types.ttcn b/LibOneM2M/OneM2M_Types.ttcn index 6177b61..35546a6 100644 --- a/LibOneM2M/OneM2M_Types.ttcn +++ b/LibOneM2M/OneM2M_Types.ttcn @@ -5124,6 +5124,39 @@ group optionalResourceTypes { variant (choice.subscription_list[-]) "name as 'subscription'"; }; + type record ServiceSubscribedNode_optional + { + ResourceName resourceName optional, + ResourceType resourceType optional, + XSD.ID resourceID optional, + NhURI parentID optional, + Timestamp creationTime optional, + Timestamp lastModifiedTime optional, + Labels labels optional, + AcpType accessControlPolicyIDs optional, + Timestamp expirationTime optional, + NodeID nodeID optional, + XSD.ID cSE_ID optional, + record of DeviceID deviceIdentifier optional, + ListOfURIs ruleLinks optional, + union { + record length(1 .. infinity) of ChildResourceRef childResource_list, + record length(1 .. infinity) of Subscription subscription_list + } choice optional + } + with { + variant "name as uncapitalized"; + variant "element"; + variant (resourceName) "attribute"; + variant (cSE_ID) "name as 'CSE-ID'"; + variant (deviceIdentifier) "list"; + variant (choice) "untagged"; + variant (choice.childResource_list) "untagged"; + variant (choice.childResource_list[-]) "name as 'childResource'"; + variant (choice.subscription_list) "untagged"; + variant (choice.subscription_list[-]) "name as 'subscription'"; + }; + type record StatsCollect_optional { ResourceName resourceName optional, diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index 215cc63..42f9681 100644 --- a/OneM2M_Testcases.ttcn +++ b/OneM2M_Testcases.ttcn @@ -873,12 +873,12 @@ module OneM2M_Testcases { f_cf01Up(); //Preamble - v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule({"S-AE-ID-STEM"}); //c_CRUDNDi); + v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile({"S*"}); //c_CRUDNDi); //Test Body v_request := valueof(m_createAe(PX_APP_ID, omit, omit)); - v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, v_cseBaseIndex); + v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1); mcaPort.send(m_request(v_request)); @@ -920,12 +920,12 @@ module OneM2M_Testcases { f_cf01Up(); //Preambule - v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule({"C-AE-ID-STEM"});//c_CRUDNDi); + v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile({"C-AE-ID-STEM"});//c_CRUDNDi); //Test Body v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM")); - v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, v_cseBaseIndex); + v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1); mcaPort.send(m_request(v_request)); tc_ac.start; @@ -966,13 +966,14 @@ module OneM2M_Testcases { f_cf01UpCseSimuMaster(); //Preambule - //v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule(-);//c_CRUDNDi); - vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase); + //vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase); + //TODO: create serviceSubscribedProfile, Node, and serviceSubscribedAppRule + v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile(-);//c_CRUDNDi); //Test Body //v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM")); - vc_aeSimu.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"))); + vc_aeSimu.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "C"))); tc_ac.start; alt { @@ -1022,7 +1023,11 @@ module OneM2M_Testcases { //mcaPort.send(m_request(v_request)); tc_ac.start; alt{ - []mccPort.receive(mw_request(mw_createAEAnnc("/S", "CSE_ID", -))){ + []mccPort.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", "CSE_ID", -))){ + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": AE creation redirected."); + } + []mccPort.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", "CSE_ID", -))){ tc_ac.stop; setverdict(pass, __SCOPE__ & ": AE creation redirected."); } @@ -1061,7 +1066,12 @@ module OneM2M_Testcases { //Preambule vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase); - + vc_aeSimu.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S"))); + + //TODO: + //v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex))); + //mcaPort.send(m_request(v_request)); + //Test Body vc_aeSimu.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S"))); -- GitLab