diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 544fa3244733a7c6ff641808c72b1c6f5a49124b..62a4012b980b61a623a2fd868dc73895c8e45594 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -438,6 +438,7 @@ module OneM2M_Functions { * @verdict */ function f_getCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_request, integer p_parentIndex) runs on CseTester return RequestPrimitive { + var integer p_locresourceIndex := p_parentIndex; p_request.from_ := f_getOriginator(p_parentIndex); @@ -449,6 +450,14 @@ module OneM2M_Functions { if (p_resourceType == int9) {//group p_request.primitiveContent.any_1[0].Group_optional.memberIDs := {f_getResourceAddress(p_parentIndex)}; } + //@Martin + if(p_resourceType == int3){//container + //when a container is created by hosting cse for storing location information, the container is seen as a location container + if(PX_IS_LOC_CONTAINER){ + p_request.primitiveContent.any_1[0].Container_optional.locationID := f_getResourceId(vc_resourcesList[p_locresourceIndex].resource);//resourceID of the locationPolicy + } + } + if (p_resourceType == int15) {//pollingChannel p_request.from_ := vc_aeAux.aE_ID; diff --git a/LibOneM2M/OneM2M_Pixits.ttcn b/LibOneM2M/OneM2M_Pixits.ttcn index fc3d68deadccd60e72978c20fb9ac03095db7c2c..e18ee42e037ac84c4e58b6f10e698658ebf4f09b 100644 --- a/LibOneM2M/OneM2M_Pixits.ttcn +++ b/LibOneM2M/OneM2M_Pixits.ttcn @@ -55,16 +55,21 @@ module OneM2M_Pixits { modulepar XSD.ID PX_CSE_ID := "in-cse"; modulepar boolean PX_FROM_IS_AE_ID := true; + //@Martin + //for checking whether the locationPolicy creation request is originated from a ASN-AE + //NOTE: Apply to Device-based location request, and this requires Test System (TS) to activate ASN-AE mode to test IUT + modulepar boolean PX_IUT_IS_ASN_CSE := false; //default //set it to true when running Device-based location testcases + modulepar boolean PX_IUT_IS_MN_CSE := false; //default //set it to true when running Share-based location testcases //@Martin - //constant parameters for LOC - modulepar LocationSource PX_LOCATION_SOURCE := int1;//network-defined + //constant parameters for LOC modulepar XSD.Token PX_LOCATION_TARGET_ID := "{LOCATION-TARGET-ID}"; //SUPPOSE TO BE RECEIVED FROM LOCATION SERVER - modulepar XSD.AnyURI PX_LOCATION_SERVER_ADDRESS := "{LOCATION-SERVER-ADDRESS}"; + modulepar XSD.AnyURI PX_LOCATION_SERVER_ADDRESS := "{LOCATION-SERVER-ADDRESS}"; + modulepar charstring PX_LOCATION_UPDATE_PERIOD := "PT10M10S" ;//10 Minute 10 Seconds - modulepar charstring PX_LOCATION_UPDATE_PERIOD_INVALID := "-PT30M10S" ;//duration set to invalid value (minus value) - modulepar charstring PX_LOCATION_CONTAINER_NAME := "myLoContainer"; + modulepar charstring PX_LOCATION_CONTAINER_NAME := "myLoContainer"; - modulepar Labels LABELS := {"VALUE_1"}; + modulepar Labels LABELS := {"VALUE_1"}; + modulepar boolean PX_IS_LOC_CONTAINER := false;//default //set it to true when the container is created to store location information } // end of module diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 368ef332673f9ce1a5af231abcdad657a9329236..1e97ca00c4614a04510b06dc1a787bf821f5ea4a 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -569,7 +569,7 @@ module OneM2M_Templates { } }; - template (value) RequestPrimitive m_createSubscription(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_name := omit, in template (value) ListOfURIs p_notificationURI ) modifies m_create := { + 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 := { to_ := f_addPrefix(p_parentResourceAddress), from_ := PX_AE_ID_STEM, requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000), @@ -594,16 +594,24 @@ module OneM2M_Templates { }; //@Martin - template (value) RequestPrimitive m_createLocationPolicy(XSD.ID p_parentResourceAddress, 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 := { - to_ := p_parentResourceAddress, - from_ := PX_AE_ID_STEM, //AE originator id e.g. - requestIdentifier := "m_createLocationPolicy", //the requestIdentifier is supposed to be set similar as "C190XX7T/001" by prepending the AE-ID-Stem and slash(‘/’) in front of it + 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 resourceType := int10, primitiveContent := { - any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod, locationTargetID, locationServerAddress) }} + any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(locationSource, p_accessControlPolicyIDs, locationUpdatePeriod, locationTargetID, locationServerAddress) }} }, resultContent := int1//default }; + //@Martin + 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 := { + requestIdentifier := "m_createNotification" & f_rnd(1, 1000000), + primitiveContent := { + any_1 := {{ Notification := m_contentCreateNotification(resourcePresentation, notifEventType, subscriptionReference, notifForwardingURI)}} + }, + resultContent := int1 //default + + }; + }//end group Create @@ -1094,30 +1102,51 @@ module OneM2M_Templates { }; //@Martin - template (value) LocationPolicy_optional m_contentCreateLocationPolicy (in template (omit) AcpType p_accessControlPolicyIDs, in template (value) XSD.Duration locationUpdatePeriod, in template (value) NodeID locationTargetID, in template (value) XSD.AnyURI locationServerAddress) := { - resourceName := c_defaultResourceName, //O - resourceType := omit, //NP - resourceID := omit, //NP - parentID := omit, //NP - creationTime := omit, //NP - lastModifiedTime := omit, //NP - labels := LABELS,//O + template (value) LocationPolicy_optional m_contentCreateLocationPolicy (in template (value) LocationSource locationSource, in template (omit) AcpType p_accessControlPolicyIDs, in template (value) XSD.Duration locationUpdatePeriod, in template (value) NodeID locationTargetID, in template (value) XSD.AnyURI locationServerAddress) := { + resourceName := c_defaultResourceName, //O + resourceType := omit, //NP + resourceID := omit, //NP + parentID := omit, //NP + creationTime := omit, //NP + lastModifiedTime := omit, //NP + labels := LABELS,//O accessControlPolicyIDs := p_accessControlPolicyIDs, //O expirationTime := omit, //O dynamicAuthorizationConsultationIDs := omit, //O announceTo := omit, //O announcedAttribute := omit, //O - locationSource := PX_LOCATION_SOURCE, //M - locationUpdatePeriod := locationUpdatePeriod, //O - locationTargetID := locationTargetID, //O + locationSource := locationSource, //M + locationUpdatePeriod := locationUpdatePeriod, //O + locationTargetID := locationTargetID, //O locationServer := locationServerAddress,//O locationContainerID := omit, //NP locationContainerName := PX_LOCATION_CONTAINER_NAME,//O - locationStatus := omit, //NP + locationStatus := omit, //NP choice := omit //NP }; + //@Martin + template (value) Notification m_contentCreateNotification (in template (value) Representation p_resourcePresentation, + in template (omit) NotificationEventType p_notifEventType, + in template (omit) XSD.AnyURI p_subReference, + in template (omit) XSD.AnyURI p_notifForwardingURI) := { + notificationEvent := { + representation := p_resourcePresentation, + operationMonitor := { + operation := omit, + originator := omit + }, + notificationEventType := p_notifEventType + }, + verificationRequest := omit, + subscriptionDeletion := omit, + subscriptionReference := p_subReference, + creator := omit, + notificationForwardingURI := p_notifForwardingURI, + iPEDiscoveryRequest := omit + }; + }//end group ContentCreate group ContentUpdate { diff --git a/LibOneM2M/OneM2M_Types.ttcn b/LibOneM2M/OneM2M_Types.ttcn index f01fc996211cbd3ec4357d16a972cd588143be02..26d7c9e4101ef02c72abd41ee5a3813be9bdbcc6 100644 --- a/LibOneM2M/OneM2M_Types.ttcn +++ b/LibOneM2M/OneM2M_Types.ttcn @@ -6929,7 +6929,8 @@ group optionalResourceTypes { variant (choice.choice_list[-]) "untagged"; }; -} +}//end group + group invalidTypes { diff --git a/LibOneM2M/OneM2M_TypesAndValues.ttcn b/LibOneM2M/OneM2M_TypesAndValues.ttcn index fa733f7b304bec7177d9f3a58464f0dd0cf42914..81502671637561a87dfd2d9e0f556e00feaac973 100644 --- a/LibOneM2M/OneM2M_TypesAndValues.ttcn +++ b/LibOneM2M/OneM2M_TypesAndValues.ttcn @@ -22,6 +22,7 @@ module OneM2M_TypesAndValues { const XSD.String c_defaultResourceName := "MyResource"; const XSD.ID c_aeAuxName := "MyAe"; const XSD.String c_acpAuxName := "MyAcp"; + const charstring c_invalid_location_update_period := "-PT30M10S" ;//duration set to invalid value (minus value) //AccessControlOperations const XSD.Integer c_C := 1; diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index 13425403c21f60bb4901de105741ec62df66f50c..f8fbea26685ff0a5ae9dd8ac5e1ad9a9e968c2da 100644 --- a/OneM2M_Testcases.ttcn +++ b/OneM2M_Testcases.ttcn @@ -4279,10 +4279,10 @@ module OneM2M_Testcases { testcase TC_CSE_LOC_BV_001() runs on CseTester system CseSystem { - var integer v_aeAuxIndex := -1; - var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName; + var integer v_aeAuxIndex := -1; var RequestPrimitive v_request; var MsgIn v_response; + var LocationSource v_locationSource := int1;//Network-based //Test component configuration f_cf01Up(); @@ -4291,7 +4291,7 @@ module OneM2M_Testcases { v_aeAuxIndex := f_cse_preamble_registerAe(); //Set requestPrimitive - v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(p_aeResourceAddress, omit, omit, omit, omit), v_aeAuxIndex); + v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource, omit, omit, omit, omit), v_aeAuxIndex); //Test Body mcaPort.send(m_request(v_request)); @@ -4327,8 +4327,8 @@ module OneM2M_Testcases { group g_CSE_LOC_BV_002{ testcase TC_CSE_LOC_BV_002() runs on CseTester system CseSystem { - var integer v_aeAuxIndex := -1; - var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName; + var integer v_aeAuxIndex := -1; + var LocationSource v_locationSource := int1;//Network-based var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID; var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS; @@ -4342,7 +4342,7 @@ module OneM2M_Testcases { v_aeAuxIndex := f_cse_preamble_registerAe(); //Set requestPrimitive - v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(p_aeResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex); + v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex); // Test Body mcaPort.send(m_request(v_request)); @@ -4374,27 +4374,24 @@ module OneM2M_Testcases { group g_CSE_LOC_BO_001{ - testcase TC_CSE_LOC_BO_001() runs on CseTester system CseSystem {//no AE_ID presented in the from_ is assigned privilege to do locationPolicy resource create operation!! + testcase TC_CSE_LOC_BO_001() runs on CseTester system CseSystem {//the originator has no privileges to create a locationPolicy resource!! var integer v_aeAuxIndex := -1; - var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName; + var LocationSource v_locationSource := int1;//Network-based var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID; var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS; var RequestPrimitive v_request; - var MsgIn v_response; + var MsgIn v_response; //Test component configuration f_cf01Up(); //Preamble v_aeAuxIndex := f_cse_preamble_registerAe(int62);//c_RUDNDi //No resource creation privilege - - //Request target resource address - p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); - + //Set requestPrimitive - v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(p_aeResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex); + v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource,omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex); // Test Body mcaPort.send(m_request(v_request)); @@ -4428,7 +4425,7 @@ module OneM2M_Testcases { testcase TC_CSE_LOC_BO_002() runs on CseTester system CseSystem { var integer v_aeAuxIndex := -1; - var XSD.ID p_targetResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName & "/" & c_defaultResourceName; + var LocationSource v_locationSource := int1;//Netwok-based var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID; var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS; @@ -4442,7 +4439,7 @@ module OneM2M_Testcases { v_aeAuxIndex := f_cse_preamble_registerAe(); //Set requestPrimitive - v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(p_targetResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex); + v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex); // Test Body mcaPort.send(m_request(v_request)); @@ -4474,15 +4471,17 @@ module OneM2M_Testcases { group g_CSE_LOC_BI_001{ - testcase TC_CSE_LOC_BI_001() runs on CseTester system CseSystem {//reject a invalid update request with invalid attribtue locationUpdatePeriod + testcase TC_CSE_LOC_BI_001() runs on CseTester system CseSystem {//reject an invalid update request with invalid attribtue locationUpdatePeriod var integer v_aeAuxIndex := -1; var integer v_locPolicyResourceIndex := -1; - var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName; - var XSD.ID p_defaultResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName & "/" & c_defaultResourceName; - var XSD.Duration locationUpdatePeriod_invalid := PX_LOCATION_UPDATE_PERIOD_INVALID; + var LocationSource v_locationSource := int1;//Netwok-based + var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; + var XSD.Duration locationUpdatePeriod_invalid := c_invalid_location_update_period; + var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID; + var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS; var RequestPrimitive v_request; - var RequestPrimitive v_request_preamble; + var RequestPrimitive v_locpolicy_request_preamble; var MsgIn v_response; //Test component configuration @@ -4491,11 +4490,11 @@ module OneM2M_Testcases { //Preamble - register AE v_aeAuxIndex := f_cse_preamble_registerAe(); //Preamble - create a valid locationPolicy resource for later update use - v_request_preamble := valueof(m_createLocationPolicy(p_aeResourceAddress, omit, PX_LOCATION_UPDATE_PERIOD, PX_LOCATION_TARGET_ID, PX_LOCATION_SERVER_ADDRESS)); - v_locPolicyResourceIndex := f_cse_createResource(int10, v_request_preamble, v_aeAuxIndex); + v_locpolicy_request_preamble:= valueof(m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, locationTargetID, locationServerAddress)); + v_locPolicyResourceIndex := f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex); //Set requestPrimitive - v_request := f_getUpdateRequestPrimitive(int10, v_locPolicyResourceIndex, m_updateLocationPolicy(p_defaultResourceAddress, omit, locationUpdatePeriod_invalid)); + v_request := f_getUpdateRequestPrimitive(int10, v_locPolicyResourceIndex, m_updateLocationPolicy(f_getResourceAddress(v_locPolicyResourceIndex), omit, locationUpdatePeriod_invalid)); // Test Body mcaPort.send(m_request(v_request)); @@ -4523,6 +4522,488 @@ module OneM2M_Testcases { }//end testcase TC_CSE_LOC_BI_001 }//end group g_CSE_LOC_BI_001 + + group g_CSE_LOC_BV_003 { + + testcase TC_CSE_LOC_BV_003() runs on CseTester system CseSystem{ + //TO RETRIEVE a <container> resource that has created in cse and linked with a <locationPolicy> resource (network-based case) + + var integer v_aeAuxIndex := -1; + var integer v_locPolicyResourceIndex := -1; + var integer v_locContainerResourceIndex := -1; + var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; + var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID; + var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS; + var RequestPrimitive v_loc_request_preamble; + var RequestPrimitive v_container_request_preamble; + var MsgIn v_response; + var LocationSource v_locationSource := int1;//Network-based + + //Test component configuration + f_cf01Up(); + + //Preamble - register AE + v_aeAuxIndex := f_cse_preamble_registerAe(); + //Preamble - create a valid locationPolicy resource for later container resource creation + v_loc_request_preamble := valueof(m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, locationTargetID, locationServerAddress)); + v_container_request_preamble := valueof(m_createContainer(f_getResourceAddress(v_aeAuxIndex), omit));//no location-container name provided? + v_locPolicyResourceIndex := f_cse_createResource(int10, v_loc_request_preamble, v_aeAuxIndex);//created locationpolicy index + v_locContainerResourceIndex := f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index + + //Test Body - retrieve the created container resource + mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex))))); + tc_ac.start; + alt{ + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ + tc_ac.stop; + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Container_optional.locationID)){ + setverdict(fail, testcasename() & "No locationID is included in the response!"); + }else{ + setverdict(pass, testcasename() & "Container resource associated with locationPolicy resource is successfully retrieved with locationID included in the response!"); + } + + } + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{ + tc_ac.stop; + setverdict(fail, testcasename() & "Requested container resource is not found!"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource!"); + } + + } + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end testcase TC_CSE_LOC_BV_003 + + }//end group g_CSE_LOC_BV_003 + + group g_CSE_LOC_BV_004 { + + testcase TC_CSE_LOC_BV_004() runs on CseTester system CseSystem{ + //TO create a <locationPolicy> resource with locationSource set to Device-based + + var integer v_aeAuxIndex := -1; + var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; + var RequestPrimitive v_request; + var MsgIn v_response; + var LocationSource v_locationSource := int2;//Device-based + //Test component configuration + f_cf01Up(); + + + if(PX_IUT_IS_ASN_CSE){ + + //Preamble + v_aeAuxIndex := f_cse_preamble_registerAe(); + //Set requestPrimitive + v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, omit, omit), v_aeAuxIndex); + + // Test Body + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Resource locationPolicy is created successfuly with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode))&"!"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error occurrs with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)) & "while handling a valid locationPolicy resource create request!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": Timeout due to no response from requested server!"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + } + // Tear down + f_cf01Down(); + + }//end testcase TC_CSE_LOC_BV_004 + + }//end group g_CSE_LOC_BV_004 + + group g_CSE_LOC_BV_005 { + + testcase TC_CSE_LOC_BV_005() runs on CseTester system CseSystem{ + //TO create a <locationPolicy> resource with locationSource set to Share-based + + var integer v_aeAuxIndex := -1; + var LocationSource v_locationSource := int3;//Share-based + var RequestPrimitive v_request; + var MsgIn v_response; + + //Test component configuration + f_cf01Up(); + + + if(PX_IUT_IS_MN_CSE){ + + //Preamble + v_aeAuxIndex := f_cse_preamble_registerAe(); + //Set requestPrimitive + v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource, omit, omit, omit, omit), v_aeAuxIndex); + + // Test Body + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Resource locationPolicy is created successfuly with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode))&"!"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error occurrs with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)) & "while handling a valid locationPolicy resource create request!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": Timeout due to no response from requested server!"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + } + // Tear down + f_cf01Down(); + + }//end testcase TC_CSE_LOC_BV_005 + + }//end group g_CSE_LOC_BV_005 + + group g_CSE_LOC_BV_006 { + + testcase TC_CSE_LOC_BV_006_01() runs on CseTester system CseSystem{ + //TO NOTIFY a location information + + var integer v_aeAuxIndex := -1; + var integer v_locPolicyResourceIndex := -1; + var integer v_locContainerResourceIndex := -1; + var integer v_subscriptionResourceIndex := -1; + var LocationSource v_locationSource := int1;//Netwok-based + var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; + var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID; + var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS; + var RequestPrimitive v_locpolicy_request_preamble; + var RequestPrimitive v_container_request_preamble; + var RequestPrimitive v_subscription_request_preamble; + var MsgIn v_response; + + //Test component configuration + f_cf01Up(); + + //Preamble - register AE + v_aeAuxIndex := f_cse_preamble_registerAe(); + //Preamble - create a valid locationPolicy resource + v_locpolicy_request_preamble := valueof(m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, locationTargetID, locationServerAddress)); + v_container_request_preamble := valueof(m_createContainer(f_getResourceAddress(v_aeAuxIndex), omit));//no location-container name provided? + + v_locPolicyResourceIndex := f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index + v_locContainerResourceIndex := f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index + v_subscription_request_preamble := valueof(m_createSubscription(f_getResourceAddress(v_locContainerResourceIndex), c_defaultResourceName, -)); + v_subscriptionResourceIndex := f_cse_createResource(int23, v_subscription_request_preamble, v_locContainerResourceIndex); + + //Test Body - retrieve the <latest> resource of the created container resource linked with the locationPolicy resource + mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest")))); + tc_ac.start; + alt{ + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ + tc_ac.stop; + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Notification.notificationEvent)){ + setverdict(fail, testcasename() & "No NotificationEvent is included in the response!"); + }else{ + setverdict(pass, testcasename() & "Location information is successfully sent!"); + } + + } + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{ + tc_ac.stop; + setverdict(fail, testcasename() & "Requested container resource is not found!"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource!"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end testcase TC_CSE_LOC_BV_006_01 + + testcase TC_CSE_LOC_BV_006_02() runs on CseTester system CseSystem{ + //TO NOTIFY a location information + + var integer v_aeAuxIndex := -1; + var integer v_locPolicyResourceIndex := -1; + var integer v_locContainerResourceIndex := -1; + var integer v_subscriptionResourceIndex := -1; + var LocationSource v_locationSource := int2;//Device-based + var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; + var RequestPrimitive v_locpolicy_request_preamble; + var RequestPrimitive v_container_request_preamble; + var RequestPrimitive v_subscription_request_preamble; + var MsgIn v_response; + + //Test component configuration + f_cf01Up(); + + //Preamble - register AE + v_aeAuxIndex := f_cse_preamble_registerAe(); + //Preamble - create a valid locationPolicy resource + + v_locpolicy_request_preamble := valueof(m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, omit, omit)); + v_container_request_preamble := valueof(m_createContainer(f_getResourceAddress(v_aeAuxIndex), omit));//no location-container name provided? + + v_locPolicyResourceIndex := f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index + v_locContainerResourceIndex := f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index + v_subscription_request_preamble := valueof(m_createSubscription(f_getResourceAddress(v_locContainerResourceIndex), c_defaultResourceName, -)); + v_subscriptionResourceIndex := f_cse_createResource(int23, v_subscription_request_preamble, v_locContainerResourceIndex); + + //Test Body - retrieve the <latest> resource of the created container resource linked with the locationPolicy resource + mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest")))); + tc_ac.start; + alt{ + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ + tc_ac.stop; + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Notification.notificationEvent)){ + setverdict(fail, testcasename() & "No NotificationEvent is included in the response!"); + }else{ + setverdict(pass, testcasename() & "Location information is successfully sent!"); + } + + } + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{ + tc_ac.stop; + setverdict(fail, testcasename() & "Requested container resource is not found!"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource!"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end testcase TC_CSE_LOC_BV_006_02 + + testcase TC_CSE_LOC_BV_006_03() runs on CseTester system CseSystem{ + //TO NOTIFY a location information + + var integer v_aeAuxIndex := -1; + var integer v_locPolicyResourceIndex := -1; + var integer v_locContainerResourceIndex := -1; + var integer v_subscriptionResourceIndex := -1; + var LocationSource v_locationSource := int3;//Sharing-based + var RequestPrimitive v_locpolicy_request_preamble; + var RequestPrimitive v_container_request_preamble; + var RequestPrimitive v_subscription_request_preamble; + var MsgIn v_response; + + //Test component configuration + f_cf01Up(); + + //Preamble - register AE + v_aeAuxIndex := f_cse_preamble_registerAe(); + //Preamble - create a valid locationPolicy resource + + v_locpolicy_request_preamble := valueof(m_createLocationPolicy(v_locationSource, omit, omit, omit, omit)); + v_container_request_preamble := valueof(m_createContainer(f_getResourceAddress(v_aeAuxIndex), omit));//no location-container name provided? + + v_locPolicyResourceIndex := f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index + v_locContainerResourceIndex := f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index + v_subscription_request_preamble := valueof(m_createSubscription(f_getResourceAddress(v_locContainerResourceIndex), c_defaultResourceName, -)); + v_subscriptionResourceIndex := f_cse_createResource(int23, v_subscription_request_preamble, v_locContainerResourceIndex); + + //Test Body - retrieve the <latest> resource of the created container resource linked with the locationPolicy resource + mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest")))); + tc_ac.start; + alt{ + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ + tc_ac.stop; + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Notification.notificationEvent)){ + setverdict(fail, testcasename() & "No NotificationEvent is included in the response!"); + }else{ + setverdict(pass, testcasename() & "Location information is successfully sent!"); + } + + } + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{ + tc_ac.stop; + setverdict(fail, testcasename() & "Requested container resource is not found!"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource!"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end testcase TC_CSE_LOC_BV_006_03 + }//end group g_CSE_LOC_BV_006 + + /*group g_CSE_LOC_BV_007 { + testcase TC_CSE_LOC_BV_007() runs on CseTester system CseSystem{ + //TODO + }//end testcase TC_CSE_LOC_BV_007 + }//end group g_CSE_LOC_BV_007 + + group g_CSE_LOC_BV_008 { + testcase TC_CSE_LOC_BV_008() runs on CseTester system CseSystem{ + //TODO + }//end testcase TC_CSE_LOC_BV_008 + }//end group g_CSE_LOC_BV_008 + */ + + group g_CSE_LOC_BV_009 { + testcase TC_CSE_LOC_BV_009() runs on CseTester system CseSystem{ + //To CREATE a <subscription> resource as a child resource of the created <container> + + var integer v_aeAuxIndex := -1; + var integer v_locPolicyResourceIndex := -1; + var integer v_locContainerResourceIndex := -1; + var LocationSource v_locationSource := int1;//Netwok-based + var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; + var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID; + var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS; + var RequestPrimitive v_locpolicy_request_preamble; + var RequestPrimitive v_container_request_preamble; + var RequestPrimitive v_subscription_request_preamble; + var MsgIn v_response; + + //Test component configuration + f_cf01Up(); + + //Preamble - register AE + v_aeAuxIndex := f_cse_preamble_registerAe(); + //Preamble - create a valid locationPolicy resource + v_locpolicy_request_preamble := valueof(m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, locationTargetID, locationServerAddress)); + v_container_request_preamble := valueof(m_createContainer(f_getResourceAddress(v_aeAuxIndex), omit));//no location-container name provided? + + v_locPolicyResourceIndex := f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index + v_locContainerResourceIndex := f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index + v_subscription_request_preamble := valueof(m_createSubscription(f_getResourceAddress(v_locContainerResourceIndex), c_defaultResourceName, -)); + + //Test Body + mcaPort.send(m_request(valueof(f_getCreateRequestPrimitive(int23, v_subscription_request_preamble, v_locContainerResourceIndex)))); + tc_ac.start; + alt{ + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ + tc_ac.stop; + setverdict(pass, testcasename() & "Subscription resource is successfully!"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{ + tc_ac.stop; + setverdict(fail, testcasename() & "Requested container resource is not found!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating subscription resource!"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end testcase TC_CSE_LOC_BV_009 + }//end group g_CSE_LOC_BV_009 + + group g_CSE_LOC_BV_010 { + + testcase TC_CSE_LOC_BV_010() runs on CseTester system CseSystem{ + //TO RETRIEVE a <locationPolicy> resource that has created in cse + + var integer v_aeAuxIndex := -1; + var integer v_locPolicyResourceIndex := -1; + var RequestPrimitive v_locpolicy_request_preamble; + var MsgIn v_response; + var LocationSource v_locationSource := int1;//Netwok-based + var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; + var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID; + var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS; + + + //Test component configuration + f_cf01Up(); + + //Preamble - register AE + v_aeAuxIndex := f_cse_preamble_registerAe(); + //Preamble - create a valid locationPolicy resource for later container resource creation + v_locpolicy_request_preamble := valueof(m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, locationTargetID, locationServerAddress)); + v_locPolicyResourceIndex := f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index + + //Test Body - retrieve the created locationpolicy resource + mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locPolicyResourceIndex))))); + tc_ac.start; + alt{ + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ + tc_ac.stop; + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].LocationPolicy_optional.locationContainerID)){ + setverdict(fail, testcasename() & "No locationContainerID is included in the response!"); + }else{ + setverdict(pass, testcasename() & "LocationPolicy resource is successfully retrieved with locationContainerID included in the response!"); + } + + } + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{ + tc_ac.stop; + setverdict(fail, testcasename() & "Requested locationPolicy is not found!"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource!"); + } + + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end testcase TC_CSE_LOC_BV_010 + + }//end group g_CSE_LOC_BV_010 }//end group Location