diff --git a/OneM2M_Functions.ttcn b/OneM2M_Functions.ttcn index 34b4f7e1f6ec346ef0c6bb0b98995d70e0653440..e431ffc526f8880b6fb9225610f52b8bb5dabf7a 100644 --- a/OneM2M_Functions.ttcn +++ b/OneM2M_Functions.ttcn @@ -106,7 +106,8 @@ module OneM2M_Functions { return v_aeAuxIndex; } - + + }//end group preambleFunctions group postambleFunctions { diff --git a/OneM2M_Templates.ttcn b/OneM2M_Templates.ttcn index 824f586e50b55abd571e8e32f98396a841319172..e8450d7321b15436f496357be0b51ec2108614c3 100644 --- a/OneM2M_Templates.ttcn +++ b/OneM2M_Templates.ttcn @@ -339,6 +339,32 @@ module OneM2M_Templates { discoveryResultType := omit }; + + //@Martin + template (value) RequestPrimitive m_updateLocationPolicy(XSD.ID p_aeResourceAddress, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod) := { + operation := int3, //create + to_ := p_aeResourceAddress, + from_ := PX_AE_ID_STEM, //AE originator id e.g. + requestIdentifier := "m_updateLocationPolicy", + resourceType := omit, + primitiveContent := { + any_1 := {{ LocationPolicy_optional := m_contentUpdateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod) }} + }, + role := omit, + originatingTimestamp := omit, + requestExpirationTimestamp := omit, + resultExpirationTimestamp := omit, + operationExecutionTime := omit, + responseType := omit, + resultPersistence := omit, + resultContent := int1,//omit, + eventCategory := omit, + deliveryAggregation := omit, + groupRequestIdentifier := omit, + filterCriteria := omit, + discoveryResultType := omit + }; + }//end group Update group Create { @@ -376,7 +402,7 @@ module OneM2M_Templates { template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIDs := omit ) := { operation := int1, to_ := "Not Initialized", - from_ := omit,//PX_AE_ID_STEM,//TODO We should use omit, "s", or "c" + from_ := PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"//@Martin requestIdentifier := "m_createAe" & f_rnd(1, 1000000), resourceType := int2, primitiveContent := { @@ -750,6 +776,32 @@ module OneM2M_Templates { discoveryResultType := omit }; + + //@Martin + template (value) RequestPrimitive m_createLocationPolicy(XSD.ID p_aeResourceAddress, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod, in template (omit) NodeID locationTargetID, in template (omit) XSD.AnyURI locationServerAddress) := { + operation := int1, //create + to_ := p_aeResourceAddress, + from_ := PX_AE_ID_STEM, //AE originator id e.g. + requestIdentifier := "m_createLocationPolicy", + resourceType := int10, + primitiveContent := { + any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod, locationTargetID, locationServerAddress) }} + }, + role := omit, + originatingTimestamp := omit, + requestExpirationTimestamp := omit, + resultExpirationTimestamp := omit, + operationExecutionTime := omit, + responseType := omit, + resultPersistence := omit, + resultContent := int1,//omit, + eventCategory := omit, + deliveryAggregation := omit, + groupRequestIdentifier := omit, + filterCriteria := omit, + discoveryResultType := omit + }; + }//end group Create group Delete { @@ -992,6 +1044,30 @@ module OneM2M_Templates { choice := omit//NP }; + //@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 := {"location_test"}, //O + accessControlPolicyIDs := p_accessControlPolicyIDs, //O + expirationTime := omit, //O + announceTo := omit, //O + announcedAttribute := omit, //O + locationSource := int1, //Network_based //M + locationUpdatePeriod := locationUpdatePeriod, //O + locationTargetID := locationTargetID, //O + locationServer := locationServerAddress,//O + locationContainerID := omit, //NP + locationContainerName := omit, //O + locationStatus := omit, //NP + choice := omit //NP + + }; + }//end group ContentCreate group ContentUpdate { @@ -1165,6 +1241,30 @@ module OneM2M_Templates { oldest := omit,//NP choice := omit//NP }; + + //@Martin + template (value) LocationPolicy_optional m_contentUpdateLocationPolicy (in template (omit) AcpType p_accessControlPolicyIDs, in template (value) XSD.Duration locationUpdatePeriod) := { + resourceName := omit,//NP + resourceType := omit,//NP + resourceID := omit,//NP + parentID := omit,//NP + creationTime := omit,//NP + lastModifiedTime := omit,//NP + labels := {"location_test"},//O + accessControlPolicyIDs := p_accessControlPolicyIDs,//O + expirationTime := omit,//O + announceTo := omit,//O + announcedAttribute := omit,//O + locationSource := omit,//NP + locationUpdatePeriod := locationUpdatePeriod, //O + locationTargetID := omit, //NP + locationServer := omit, //NP + locationContainerID := omit, //NP + locationContainerName := omit, //O + locationStatus := omit, //NP + choice := omit //NP + }; + }//end group ContentUpdate group responseContent { diff --git a/OneM2M_TestSystem.ttcn b/OneM2M_TestSystem.ttcn index e480aa53978b20cc1a52ee48156ffa9a06bc4f17..7b52694b602bd62f6447a0393535a29fe58cf6bd 100644 --- a/OneM2M_TestSystem.ttcn +++ b/OneM2M_TestSystem.ttcn @@ -85,3 +85,6 @@ module OneM2M_TestSystem { } }// end of module +with{ + extension "anytype charstring" +} \ No newline at end of file diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index ce37639594c18b40de11fbc8b6bafa8d0a7d5089..d39e81495ef4050d073ca7f530e88ac2d897c1b1 100644 --- a/OneM2M_Testcases.ttcn +++ b/OneM2M_Testcases.ttcn @@ -3533,6 +3533,277 @@ module OneM2M_Testcases { }//end group Data_Management_and_Repository + //@Martin + group Location { + + group g_CSE_LOC_BV{ + + testcase TC_CSE_LOC_BV_001() runs on M2M system M2MSystem { + + var integer v_aeAuxIndex := -1; + var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName; + + var RequestPrimitive v_request; + var M2MResponsePrimitive v_response; + + //Test component configuration + f_cf01Up(); + + //Preamble + v_aeAuxIndex := f_preamble_registerAe(); + + //Request target resource address + p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); //v_request.to_ + + //Set requestPrimitive + v_request := valueof(m_createLocationPolicy(p_aeResourceAddress, omit, omit, omit, omit)); + + //Set request originator + v_request.from_ := f_getOriginator(v_aeAuxIndex); + + //Set returned content type + v_request.resultContent := int1;//Attributes //supposed to be defined by user + + //Test Body + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt{ + [] mcaPort.receive(mw_response(int4000)) -> value v_response { //BAD REQUEST + tc_ac.stop; + setverdict(pass, testcasename() & "Resource <locationPolicy> create request is rejected due to invalid request body message!!"); + } + [] mcaPort.receive(mw_responseKO) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while handling an invalid locationPolicy resource create request!"); + } + [] mcaPort.receive(mw_responseOK) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Created a locationPolicy resource with an invalid create request!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource locationPolicy!"); + } + + } + // Postamble + f_postamble_deleteResources(); + + }// end testcase TC_CSE_LOC_BV_001 + + testcase TC_CSE_LOC_BV_002() runs on M2M system M2MSystem { + + var integer v_aeAuxIndex := -1; + var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName; + var XSD.Duration locationUpdatePeriod := "PT30M10S" ;//duration set to 30Minute 10 seconds + var XSD.Token locationTargetID := "{LOCATION_TARGET_ID}"; + var XSD.AnyURI locationServerAddress := "{LOCATION_SERVER_ADDRESS}"; + var RequestPrimitive v_request; + var M2MResponsePrimitive v_response; + + //Test component configuration + f_cf01Up(); + + //Preamble + v_aeAuxIndex := f_preamble_registerAe(); + + //Request target resource address + p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); //v_request.to_ + + //Set requestPrimitive + v_request := valueof(m_createLocationPolicy(p_aeResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress)); + + //Set request originator + v_request.from_ := f_getOriginator(v_aeAuxIndex); + + //Set returned content type + v_request.resultContent := int1;//Attributes + + // Test Body + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_responseOK) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Resource locationPolicy is created successfuly!"); + } + [] mcaPort.receive(mw_responseKO) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while creating resource locationPolicy!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource locationPolicy!"); + } + } + + // Postamble + f_postamble_deleteResources(); + + }// end testcase TC_CSE_LOC_BV_002 + + }//end group g_CSE_LOC_BV + + + group g_CSE_LOC_BO{ + + testcase TC_CSE_LOC_BO_001() runs on M2M system M2MSystem {//no AE_ID presented in the from_ is assigned privilege to do locationPolicy resource create operation!! + + var integer v_aeAuxIndex := -1; + var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName; + var XSD.Duration locationUpdatePeriod := "PT30M10S" ;//duration set to 30Minute 10 seconds + var XSD.Token locationTargetID := "{LOCATION_TARGET_ID}"; + var XSD.AnyURI locationServerAddress := "{LOCATION_SERVER_ADDRESS}"; + var RequestPrimitive v_request; + var M2MResponsePrimitive v_response; + + //Test component configuration + f_cf01Up(); + + //Preamble + v_aeAuxIndex := f_preamble_registerAe(int62);//c_RUDNDi //No resource creation privilege + + //Request target resource address + p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); //v_request.to_ + + //Set requestPrimitive + v_request := valueof(m_createLocationPolicy(p_aeResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress)); + + //Set request originator + v_request.from_ := f_getOriginator(v_aeAuxIndex); + + //Set returned content type + v_request.resultContent := int1;//Attributes + + // Test Body + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int4103)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Access denied to create a resource including locationPolicy!"); + } + [] mcaPort.receive(mw_responseOK) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error! IUT failed to check the access privilege of originator!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No response received from IUT!"); + } + } + + // Postamble + f_postamble_deleteResources(); + + + } // end testcase TC_CSE_LOC_BO_001 + + testcase TC_CSE_LOC_BO_002() runs on M2M system M2MSystem { + + var integer v_aeAuxIndex := -1; + var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName; + var XSD.ID p_targetResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName & "/" & c_defaultResourceName; + var XSD.Duration locationUpdatePeriod := "PT30M10S" ;//duration set to 30Minute 10 seconds + var XSD.Token locationTargetID := "{LOCATION_TARGET_ID}";//format?? + var XSD.AnyURI locationServerAddress := "{LOCATION_SERVER_ADDRESS}";//format??? + var RequestPrimitive v_request; + var M2MResponsePrimitive v_response; + + //Test component configuration + f_cf01Up(); + + //Preamble + v_aeAuxIndex := f_preamble_registerAe(); + + //Request target resource address + p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); //v_request.to_ + + //Set requestPrimitive + v_request := valueof(m_createLocationPolicy(p_targetResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress)); + + //Set request originator + v_request.from_ := f_getOriginator(v_aeAuxIndex); + + //Set returned content type + v_request.resultContent := int1;//Attributes + + + // Test Body + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int4000)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": The targeted resource is not found!!"); + } + [] mcaPort.receive(mw_responseOK) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error!! Created a resource under a parent resource that does not exist!!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No response received from IUT!!"); + } + } + + // Postamble + f_postamble_deleteResources(); + }// end testcase TC_CSE_LOC_BO_00D2 + + }//end group g_CSE_LOC_BO + + + group g_CSE_LOC_BI{ + + testcase TC_CSE_LOC_BI_001() runs on M2M system M2MSystem {//reject a invalid update request with invalid attribtue locationUpdatePeriod + + var integer v_aeAuxIndex := -1; + var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName; + var XSD.Duration locationUpdatePeriod := "-PT30M10S" ;//duration set to invalid value (minus value) + var RequestPrimitive v_request; + var M2MResponsePrimitive v_response; + + //Test component configuration + f_cf01Up(); + + //Preamble + v_aeAuxIndex := f_preamble_registerAe(); + + //Request target resource address + p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); //v_request.to_ + + //Set requestPrimitive + v_request := valueof(m_updateLocationPolicy(p_aeResourceAddress, omit, locationUpdatePeriod)); + + //Set request originator + v_request.from_ := f_getOriginator(v_aeAuxIndex); + + //Set returned content type + v_request.resultContent := int1;//Attributes + + // Test Body + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(int4000)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Update locationPolicy resource is rejected!!"); + } + [] mcaPort.receive(mw_responseOK) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource locationPolicy!"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No response received from IUT while updating resource locationPolicy!"); + } + } + + // Postamble + f_postamble_deleteResources(); + + }//end testcase TC_CSE_LOC_BI_001 + + }//end group g_CSE_LOC_BI + + + }//end group Location }//end group CSE diff --git a/OneM2M_Types.ttcn b/OneM2M_Types.ttcn index a9c646126d56f38af36c11be8564a515b88436b5..762f8188174b8cfb5e44f58d9389c06c67676bb0 100644 --- a/OneM2M_Types.ttcn +++ b/OneM2M_Types.ttcn @@ -4286,6 +4286,46 @@ group optionalResourceTypes { variant (choice) "untagged"; }; + //@Martin + type record LocationPolicy_optional + { + XSD.NCName 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, + ListOfURIs announceTo optional, + record length(1 .. infinity) of XSD.NCName announcedAttribute optional, + LocationSource locationSource optional, + XSD.Duration locationUpdatePeriod optional, + NodeID locationTargetID optional, + XSD.AnyURI locationServer optional, + XSD.AnyURI locationContainerID optional, + XSD.String locationContainerName optional, + XSD.String locationStatus optional, + union { + record length(1 .. infinity) of ChildResourceRef childResource_list, + record length(1 .. infinity) of union { + Subscription subscription + } choice_list + } choice optional + + } + with { + variant "name as uncapitalized"; + variant "element"; + variant (resourceName) "attribute"; + variant (announcedAttribute) "list"; + variant (choice) "untagged"; + variant (choice.childResource_list) "untagged"; + variant (choice.childResource_list[-]) "name as 'childResource'"; + variant (choice.choice_list) "untagged"; + variant (choice.choice_list[-]) "untagged"; + }; } @@ -4394,6 +4434,22 @@ group invalidTypes { NotificationContentType notificationContentType optional, EventCat notificationEventCat optional } + + //@Martin + type record LocationPolicy_update_invalid { + Timestamp creationTime optional,//invalid field to be used for BI tests + Timestamp lastModifiedTime optional,//invalid field to be used for BI tests + Labels labels optional, + AcpType accessControlPolicyIDs optional, + Timestamp expirationTime optional, + LocationSource locationSource optional,//invalid field to be used for BI tests + XSD.Duration locationUpdatePeriod optional, + NodeID locationTargetID optional,//invalid field to be used for BI tests + XSD.AnyURI locationServer optional,//invalid field to be used for BI tests + XSD.AnyURI locationContainerID optional,//invalid field to be used for BI tests + XSD.String locationContainerName optional, + XSD.String locationStatus optional//invalid field to be used for BI tests + } }//end group invalidTypes @@ -4422,5 +4478,5 @@ with { encode "XML"; variant "namespace as 'http://www.onem2m.org/xml/protocols' prefix 'm2m'"; variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'"; - extension "anytype charstring, AnyURI, AttributeList, AE, AccessControlPolicy, AccessControlPolicy_optional, ACP_update_invalid, AE_optional, AE_update_invalid,Container_optional, Container_update_invalid, ContentInstance_optional, ContentInstance_update_invalid, Group_optional, Group_update_invalid, Schedule_optional, Schedule_update_invalid, Subscription_optional, Subscription_update_invalid, PollingChannel_optional, PollingChannel_update_invalid" + extension "anytype charstring, AnyURI, AttributeList, AE, AccessControlPolicy, AccessControlPolicy_optional, ACP_update_invalid, AE_optional, AE_update_invalid,Container_optional, Container_update_invalid, ContentInstance_optional, ContentInstance_update_invalid, Group_optional, Group_update_invalid, Schedule_optional, Schedule_update_invalid, Subscription_optional, Subscription_update_invalid, PollingChannel_optional, PollingChannel_update_invalid, LocationPolicy_optional, LocationPolicy_update_invalid" }