diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 1569f13c02b27dee45c0e8ba94ef0b0815cc3c3b..4c82245310548a0cd5dc5b47ce4ff3fdff7f33d4 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 0a3bec5d73b2214780463a2d91b856c2a4e16a94..659ae07d052764dda256d7f957f9068d488c5b65 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 6177b6181df7ceaafaaf60456bf7f68ee6c4848c..35546a658cb6a0e37de8314419566d665bead91b 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 f86ce322b79ade3714e7ae671da61fc1ef2be67f..c0a0b6aad88f989111faa166deb9004cdee96ef4 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,11 @@ module OneM2M_Testcases { f_cf01Up(); //Preambule - v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule({"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; @@ -955,7 +954,7 @@ module OneM2M_Testcases { * @desc Check that the IUT rejects an AE registration (allowed App-ID, not allowed C-AE-ID-STEM provided by AE) * */ - testcase TC_CSE_REG_CRE_004() runs on InCseSimu system CseSystem { + testcase TC_CSE_REG_CRE_004() runs on AeSimu system CseSystem { var MsgIn v_response; var RequestPrimitive v_request; @@ -963,24 +962,25 @@ module OneM2M_Testcases { var ResourceType v_resourceType := int2; // Test component configuration - f_cf01UpCseSimuMaster(); + f_cf01Up(); //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*"}); //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"))); + f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "C")); tc_ac.start; alt { - [] mccPort.receive(mw_response(mw_responsePrimitive(int4005))) { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) { tc_ac.stop; setverdict(pass, __SCOPE__ & ": AE creation rejected."); } - [] mccPort.receive(mw_response(mw_responsePrimitiveInverse(int4005))) -> value v_response{ + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4005))) -> value v_response{ tc_ac.stop; setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode))); } @@ -990,10 +990,10 @@ module OneM2M_Testcases { } // Postamble - f_cse_postamble_deleteResourcesCSE(); + f_cse_postamble_deleteResources(); // Tear down - f_cf01DownCseSimuMaster(); + f_cf01Down(); } @@ -1022,7 +1022,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 +1065,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"))); @@ -1163,10 +1172,13 @@ module OneM2M_Testcases { f_cf02Up(); //Preambule + vc_cseSimu.start(f_cse_registrationRemoteCse(mw_createRemoteCSEBase)); + v_aeIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S-AE-ID-STEM")); vc_cseSimu.start(f_cse_resourceAnnouncementHandler()); + //TODO Deregister //f_cse_deleteResource(v_aeIndex); v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex))); @@ -1522,7 +1534,54 @@ module OneM2M_Testcases { // Tear down f_cf01Down(); - }//end TC_CSE_REG_CRE_024 + }//end TC_CSE_REG_CRE_025 + + /** + * @desc Check that the IUT rejects the create request of <CSEBase> resource. + * + */ + testcase TC_CSE_REG_CRE_027() runs on InCseSimu system CseSystem { + + // Local variables + var RequestPrimitive v_request; + var integer v_cseBaseIndex := -1; + var ResourceType v_resourceType := int2; + + // Test control + + // Test component configuration + f_cf01UpCseSimuMaster(); + + // Test adapter configuration + + // Preamble + vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase); + + // Test Body + vc_aeSimu.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, omit))); + + tc_ac.start; + alt { + [] mccPort.receive(mw_response(mw_responsePrimitive(int2001))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": AE creation successful."); + } + [] mccPort.receive { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while creating AE"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating AE"); + } + } + + // Postamble + f_cse_postamble_deleteResourcesCSE(); + + // Tear down + f_cf01DownCseSimuMaster(); + + }//end TC_CSE_REG_CRE_027 /** * @desc Check that the IUT rejects registration of already registered AE (C-AE-ID-STEM provided by AE)