diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index c84585ed1eaec0cff437e6d4ca939d2b5856c561..6c4fc437e878ca46d6a71a9c2f1fcc2694925f91 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -35,6 +35,7 @@ module OneM2M_Functions { // Map map(self:mcaPort, system:mcaPort); + map(self:mcaPortIn, system:mcaPortIn); map(self:acPort, system:acPort); activate(a_default()); @@ -65,10 +66,6 @@ module OneM2M_Functions { map(self:mcaPort, system:mcaPort); map(self:mcaPortIn, system:mcaPortIn); map(self:acPort, system:acPort); - - activate(a_default()); - activate(a_cse_cf01()); - activate(a_cse_cf01_ae2()); //For mcaPortIn //Initialze the IUT @@ -87,6 +84,9 @@ module OneM2M_Functions { // Map map(self:mcaPort, system:mcaPort); map(self:acPort, system:acPort); + if(PX_UT_IMPLEMENTED) { + map(self:utPort, system:utPort); + } activate(a_default()); activate(a_cse_cf02_ae1()); vc_cse1.start(f_cf02UpCse1()); @@ -112,10 +112,7 @@ module OneM2M_Functions { map(self:mccPort, system:mccPort); map(self:mccPortIn, system:mccPortIn); map(self:acPort, system:acPort); - - activate(a_default()); - activate(a_cse_cf02_cse1()); - + v_cSEBaseResource := f_cse_generateLocalResource(-, -1, int5); vc_cSEBaseIndex := f_setLocalResource(v_cSEBaseResource, int5, -1); @@ -166,9 +163,6 @@ module OneM2M_Functions { map(self:mcaPortIn, system:mcaPortIn); map(self:acPort, system:acPort); - activate(a_default()); - activate(a_cse_cf02_ae1()); - //Initialze the IUT } // end f_cf02UpAe1 @@ -262,6 +256,9 @@ module OneM2M_Functions { unmap(self:mcaPort, system:mcaPort); unmap(self:acPort, system:acPort); + if(PX_UT_IMPLEMENTED){ + unmap(self:utPort, system:utPort); + } unmap(vc_cse1:mccPort, system:mccPort); unmap(vc_cse1:mccPortIn, system:mccPortIn); unmap(vc_cse1:acPort, system:acPort); @@ -520,7 +517,10 @@ module OneM2M_Functions { var RequestPrimitive v_request; var MsgIn v_response; - + + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + v_request := valueof(m_createAeAux(p_accessControlPolicyIDs, p_poaList)); v_request := f_getCreateRequestPrimitive(int2, v_request, -1); @@ -576,6 +576,9 @@ module OneM2M_Functions { var RequestPrimitive v_request; + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + if(PICS_ACP_SUPPORT){ vc_acpAuxIndex := f_cse_createAccessControlPolicyAux(p_allowedOperations := p_allowedOperations); } @@ -822,7 +825,10 @@ module OneM2M_Functions { var RequestPrimitive v_request; var integer v_resourceIndex := -1; - + + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, p_parentIndex); mcaPort.send(m_request(v_request)); @@ -1162,84 +1168,7 @@ module OneM2M_Functions { f_checkAeSimuStatus(); } - /** - * @desc Handling of announcement of resources - * @param p_from Expected originator of the request primitive - * @param p_to Expected receiver of the request primitive - * @verdict - */ - //TODO To finalize this function - function f_cse_resourceAnnouncementHandler(template XSD.ID p_from := *, template XSD.ID p_to := ?) runs on CseSimu { - // Local variables - var MsgIn v_request; - var ResponsePrimitive v_responsePrimitive; - - tc_ac.start; - alt { - [] mccPortIn.receive(mw_request(mw_create(p_from, p_to))) -> value v_request { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ":INFO: Announcement received"); - //TODO Save resource and generate required attributes - v_responsePrimitive := f_getCreateResponsePrimitive(v_request.primitive.requestPrimitive.resourceType, v_request.primitive.requestPrimitive); - mccPortIn.send(m_response(v_responsePrimitive)); - f_checkAttributesToBeSaved(v_request.primitive.requestPrimitive.resourceType, v_request.primitive.requestPrimitive, vc_response.primitive.responsePrimitive); - f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, v_request.primitive.requestPrimitive.resourceType, vc_remoteCseIndex); - } - [] mccPortIn.receive{ - tc_ac.stop; - setverdict(fail, __SCOPE__ & ":ERROR: Unexpected message received"); - } - [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ":ERROR: No announcement received"); - } - } - - f_checkCseSimuStatus(); - - } //end f_cse_resourceAnnouncementHandler - - /** - * @desc Message exchange for the announcement of resources - * @param p_resourceType ResourceType of the resource to be announced - * @param p_requestPrimitive CREATE request to be used for the announcement - * @verdict - */ - //TODO To finalize this function - function f_cse_announceResource(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create) runs on CseSimu return integer { - // Local variables - var RequestPrimitive v_request; - var ResponsePrimitive v_responsePrimitive; - var integer v_resourceIndex := -1; - - v_request := f_getCreateRequestPrimitive(f_getAnnouncedResourceType(p_resourceType), p_requestPrimitive, vc_remoteCseIndex); - - mccPort.send(m_request(v_request)); - tc_ac.start; - alt { - [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { - tc_ac.stop; - setverdict(pass, __SCOPE__&":INFO: Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly"); - f_checkAttributesToBeSaved(p_resourceType, v_request, vc_response.primitive.responsePrimitive); - v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, f_getAnnouncedResourceType(p_resourceType), vc_remoteCseIndex); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) { - tc_ac.stop; - setverdict(inconc, __SCOPE__&":INFO: Error while creating resource type " & int2str(enum2int(p_resourceType))); - } - [] mccPort.receive { - tc_ac.stop; - setverdict(inconc, __SCOPE__&":INFO: Unexpected message received"); - } - [] tc_ac.timeout { - setverdict(inconc, __SCOPE__&":INFO: No answer while creating resource type " & int2str(enum2int(p_resourceType))); - } - } - - f_checkCseSimuStatus(); - - return v_resourceIndex; - - } //end f_cse_announceResource + /** * @desc Checking of returned important attributed (in response) in order to save properly internally @@ -1360,6 +1289,25 @@ module OneM2M_Functions { } //end f_compareURIs + /** + * @desc Sending a request primitive on mcaPort on AeSimu + * @param p_resourceType Resource type of the resource to be created + * @param p_requestPrimitive CREATE request primitive for the resource to be created + * @param p_parentIndex Internal resource index which indicates the parent of the resource to be created + * @return Internal resource index of the created resource + * @verdict + */ + function f_cse_sendCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create, integer p_parentIndex := -1) runs on AeSimu{ + + var RequestPrimitive v_request; + var integer v_resourceIndex := -1; + + v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, p_parentIndex); + + mcaPort.send(m_request(v_request)); + + } + }//end group AeSimu group CseSimuFunctions { @@ -1375,7 +1323,10 @@ module OneM2M_Functions { // Local variables var ResponsePrimitive v_responsePrimitive; var template Notification v_notificationRequest := mw_contentNotificationVerification; - + + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + //Preparation of expected Notification verification //TODO To add checks for creator and subscription reference //v_notificationRequest.creator := p_creator; TODO To check what address format is to be expected @@ -1427,6 +1378,9 @@ module OneM2M_Functions { // Local variables var ResponsePrimitive v_responsePrimitive; + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + tc_ac.start; alt { [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request { @@ -1462,7 +1416,10 @@ module OneM2M_Functions { // Local variables var ResponsePrimitive v_responsePrimitive; var integer v_notificationsReceived := 0; - + + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + tc_ac.start; alt { [] mcaPortIn.receive(mw_request(mw_notifyAggregatedNotification)) -> value vc_request { @@ -1519,6 +1476,10 @@ module OneM2M_Functions { */ function f_cse_notifyProcedure_subscriptionDeletionHandler( template Notification p_notification) runs on AeSimu { var ResponsePrimitive v_responsePrimitive; + + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + tc_ac.start; alt { [] mcaPortIn.receive(mw_request(mw_notifyNotification(p_notification))) -> value vc_request { @@ -1547,7 +1508,10 @@ module OneM2M_Functions { */ function f_cse_notifyProcedure_noNotificationHandler() runs on AeSimu { // Local variables - + + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + tc_ac.start(10.0); alt { [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request { @@ -1617,16 +1581,108 @@ module OneM2M_Functions { } //end f_check_notificationContent + }// end of group NotificationFunctions + + group AnnouncementFunctions { + + /** + * @desc Handling of announcement of resources + * @param p_from Expected originator of the request primitive + * @param p_to Expected receiver of the request primitive + * @verdict + */ + //TODO To finalize this function + function f_cse_announcementProcedure_createHandler(template RequestPrimitive p_requestprimitive := ?) runs on CseSimu { + // Local variables + var MsgIn v_request; + var integer v_parentIndex := vc_localRemoteCseIndex; + var integer v_announcedResourceIndex; + var ResponsePrimitive v_responsePrimitive; + var PrimitiveContent v_announcedResource; + + //Activate defaults when running on a PTC + f_cse_activateDefaults_cse1(); + + tc_ac.start; + alt { + [] mccPortIn.receive(mw_request(p_requestprimitive)) -> value v_request { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ":INFO: Announcement received"); + //TODO Save resource and generate required attributes + v_announcedResource:= f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentIndex,v_request.primitive.requestPrimitive.resourceType); + v_announcedResourceIndex := f_setLocalResource(v_announcedResource, v_request.primitive.requestPrimitive.resourceType, v_parentIndex); + + v_responsePrimitive := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier)); + v_responsePrimitive.from_ := PX_CSE1_ID; + v_responsePrimitive.to_ := v_request.primitive.requestPrimitive.from_; + v_responsePrimitive.primitiveContent := vc_localResourcesList[v_announcedResourceIndex].resource; + mccPortIn.send(m_response(v_responsePrimitive)); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ":ERROR: No announcement received"); + } + } + + f_checkCseSimuStatus(); + + } //end f_cse_resourceAnnouncementHandler + + /** + * @desc Message exchange for the announcement of resources + * @param p_resourceType ResourceType of the resource to be announced + * @param p_requestPrimitive CREATE request to be used for the announcement + * @verdict + */ + //TODO To finalize this function + function f_cse_announcementProcedure_announceResource(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create) runs on CseSimu return integer { + // Local variables + var RequestPrimitive v_request; + var ResponsePrimitive v_responsePrimitive; + var integer v_resourceIndex := -1; + + v_request := f_getCreateRequestPrimitive(f_getAnnouncedResourceType(p_resourceType), p_requestPrimitive, vc_remoteCseIndex); + + mccPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(pass, __SCOPE__&":INFO: Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly"); + f_checkAttributesToBeSaved(p_resourceType, v_request, vc_response.primitive.responsePrimitive); + v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, f_getAnnouncedResourceType(p_resourceType), vc_remoteCseIndex); + } + [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(inconc, __SCOPE__&":INFO: Error while creating resource type " & int2str(enum2int(p_resourceType))); + } + [] mccPort.receive { + tc_ac.stop; + setverdict(inconc, __SCOPE__&":INFO: Unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, __SCOPE__&":INFO: No answer while creating resource type " & int2str(enum2int(p_resourceType))); + } + } + + f_checkCseSimuStatus(); + + return v_resourceIndex; + + } //end f_cse_announceResource + /** * @desc Handling message exchange for the AE Annc update * @verdict */ //TODO TO BE FINALIZED - function f_cse_notifyProcedure_updateHandler() runs on CseSimu { + function f_cse_announcementProcedure_updateHandler() runs on CseSimu { // Local variables var ResponsePrimitive v_responsePrimitive; var template Notification v_notificationRequest := mw_contentNotification_any; + //Activate defaults when running on a PTC + f_cse_activateDefaults_cse1(); + //Preparation of Notification response to be sent v_responsePrimitive := valueof(m_responseNotification(int2004, omit)); @@ -1657,7 +1713,7 @@ module OneM2M_Functions { } //end f_cse_notifyProcedure_updateHandler - }// end of group NotificationFunctions + }//end of group AnnouncementFunctions /** * @desc Check that a resource is present in the IUT (resourceId is known) @@ -1736,6 +1792,9 @@ module OneM2M_Functions { var MsgIn v_response; var RequestPrimitive v_request; var PrimitiveContent v_remoteCSEResource; + + //Activate defaults when running on a PTC + f_cse_activateDefaults_cse1(); v_request := f_getCreateRequestPrimitive(int16, p_requestPrimitive, -1); @@ -1782,9 +1841,17 @@ module OneM2M_Functions { var integer v_resourceIndex := -1; var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE; var charstring v_action := "Please, send a CSE registration request"; + var integer v_parentIndex := vc_localRemoteCseIndex; + var ResponsePrimitive v_responsePrimitive; + var PrimitiveContent v_announcedResource; + var boolean v_remoteCSERegistered:=false; + var integer v_ResourceIndex := -1; + + //Activate defaults when running on a PTC + f_cse_activateDefaults_cse1(); //send triggering primitive to SUT - f_sendUtPrimitive(v_utRequest,v_action); + f_sendUtPrimitive(v_utRequest,v_action); tc_ac.start; alt { @@ -1801,20 +1868,18 @@ module OneM2M_Functions { mccPortIn.send(m_response(v_response)); v_resourceIndex := f_setResource(valueof(m_primitiveContentRemoteCSE(m_contentMyRemoteCSEResource)), int16, -1); - } - [] mccPortIn.receive { - tc_ac.stop; - setverdict(inconc, __SCOPE__&":INFO: Unexpected message received"); + v_remoteCSERegistered:=true; + tc_ac.start; + repeat; } [] tc_ac.timeout { - setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type remoteCSE"); + if(not (v_remoteCSERegistered)){ + setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type remoteCSE"); + } } - } + } f_checkCseSimuStatus(); - - //In order for the IUT to perform some actions - f_sleep(10.0); return v_resourceIndex; @@ -1825,12 +1890,19 @@ module OneM2M_Functions { * @param p_requestPrimitive Expected CREATE request primitive */ function f_cse_receiveCreateRequest(in template RequestPrimitive p_requestPrimitive := ?) runs on CseSimu { + var ResponsePrimitive v_responsePrimitive; + //Activate defaults when running on a PTC + f_cse_activateDefaults_cse1(); + tc_ac.start; alt { [] mccPortIn.receive(mw_request(p_requestPrimitive)) -> value vc_request { tc_ac.stop; setverdict(pass, __SCOPE__&":INFO: CREATE Request received successfuly"); + v_responsePrimitive := f_getCreateResponsePrimitive(vc_request.primitive.requestPrimitive.resourceType, vc_request.primitive.requestPrimitive); + v_responsePrimitive.responseStatusCode := int2001; + mccPortIn.send(m_response(v_responsePrimitive)); } [] mccPortIn.receive(mw_request(?)) { tc_ac.stop; @@ -1863,9 +1935,9 @@ module OneM2M_Functions { // TODO To review the code (use of indexes, generation of value for certain attributes, etc..) if(p_resourceType == int5) { //CSEBase - v_myResource.cSEBase.resourceName := "CSEBase" & int2str(v_resourceIndex); + v_myResource.cSEBase.resourceName := PX_CSE1_NAME; v_myResource.cSEBase.resourceType := p_resourceType; - v_myResource.cSEBase.resourceID := "CSEBase" & int2str(v_resourceIndex); + v_myResource.cSEBase.resourceID := PX_CSE1_ID; v_myResource.cSEBase.parentID := omit; //Following TS-0001, it must be NULL v_myResource.cSEBase.creationTime := fx_generateTimestamp(); v_myResource.cSEBase.creationTime := "20171231T012345"; @@ -1887,7 +1959,7 @@ module OneM2M_Functions { v_myResource.remoteCSE.resourceName := "remoteCSE" & int2str(v_resourceIndex); } v_myResource.remoteCSE.resourceType := p_resourceType; - v_myResource.remoteCSE.resourceID := "remoteCSE" & int2str(v_resourceIndex); + v_myResource.remoteCSE.resourceID := f_resourceIdCleaner(v_myResource.remoteCSE.cSE_ID); v_myResource.remoteCSE.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource); v_myResource.remoteCSE.creationTime := fx_generateTimestamp(); v_myResource.remoteCSE.creationTime := "20171231T012345"; @@ -1909,11 +1981,81 @@ module OneM2M_Functions { v_myResource.remoteCSE.nodeLink := omit; } + } else if (p_resourceType == int10002 and ispresent (p_resource)) { //AE Annc + if(ischosen(p_resource.aEAnnc)) { + v_myResource.aEAnnc.expirationTime := p_resource.aEAnnc.expirationTime; + v_myResource.aEAnnc.accessControlPolicyIDs := p_resource.aEAnnc.accessControlPolicyIDs; + v_myResource.aEAnnc.labels := p_resource.aEAnnc.labels; + } + } else if (p_resourceType == int10001 and ispresent (p_resource)) { //Acp Annc + if(ischosen(p_resource.accessControlPolicyAnnc)) { + v_myResource.accessControlPolicyAnnc.expirationTime := p_resource.accessControlPolicyAnnc.expirationTime; + v_myResource.accessControlPolicyAnnc.labels := p_resource.accessControlPolicyAnnc.labels; + v_myResource.accessControlPolicyAnnc.privileges := p_resource.accessControlPolicyAnnc.privileges; + v_myResource.accessControlPolicyAnnc.selfPrivileges := p_resource.accessControlPolicyAnnc.selfPrivileges; + } + } else if (p_resourceType == int10003 and ispresent (p_resource)) { //Container Annc + if(ischosen(p_resource.containerAnnc)) { + v_myResource.containerAnnc.expirationTime := p_resource.containerAnnc.expirationTime; + v_myResource.containerAnnc.accessControlPolicyIDs := p_resource.containerAnnc.accessControlPolicyIDs; + v_myResource.containerAnnc.labels := p_resource.containerAnnc.labels; + } + } else if (p_resourceType == int10009 and ispresent (p_resource)) { //Group Annc + if(ischosen(p_resource.groupAnnc)) { + v_myResource.groupAnnc.expirationTime := p_resource.groupAnnc.expirationTime; + v_myResource.groupAnnc.accessControlPolicyIDs := p_resource.groupAnnc.accessControlPolicyIDs; + v_myResource.groupAnnc.labels := p_resource.groupAnnc.labels; + } + } else if (p_resourceType == int10014 and ispresent (p_resource)) { //ContentInstance Annc + if(ischosen(p_resource.contentInstanceAnnc)) { + v_myResource.contentInstanceAnnc.expirationTime := p_resource.contentInstanceAnnc.expirationTime; + v_myResource.contentInstanceAnnc.labels := p_resource.contentInstanceAnnc.labels; + } + } else if (p_resourceType == int1 and ispresent (p_resource)) { //Acp Resource + if(ischosen (p_resource.accessControlPolicy)){ + v_myResource.accessControlPolicy := valueof(p_resource.accessControlPolicy); + + if(not(ispresent(p_resource.accessControlPolicy.resourceName))) { + v_myResource.accessControlPolicy.resourceName := "accessControlPolicy" & int2str(v_resourceIndex); + } + + v_myResource.accessControlPolicy.resourceType := p_resourceType; + v_myResource.accessControlPolicy.resourceID := "accessControlPolicy" & int2str(v_resourceIndex); + v_myResource.accessControlPolicy.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource); + v_myResource.accessControlPolicy.labels := p_resource.accessControlPolicy.labels; + v_myResource.accessControlPolicy.creationTime := fx_generateTimestamp(); + if(not(ispresent(p_resource.accessControlPolicy.expirationTime))) { + v_myResource.accessControlPolicy.expirationTime := "20301231T012345"; + } + v_myResource.accessControlPolicy.lastModifiedTime := v_myResource.accessControlPolicy.creationTime; + v_myResource.accessControlPolicy.announceTo := omit; + v_myResource.accessControlPolicy.announcedAttribute := omit; + + } } return v_myResource; }//End of function + /** + * @desc Sending of a request primitive over mca port + * @param p_resourceType Resource type of the resource to be created + * @param p_requestPrimitive CREATE request primitive for the resource to be created + * @param p_parentIndex Internal resource index which indicates the parent of the resource to be created + * @return Internal resource index of the created resource + * @verdict + */ + function f_cse_sendCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create, integer p_parentIndex := -1) runs on AeSimu { + + var RequestPrimitive v_request; + var integer v_resourceIndex := -1; + + v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, p_parentIndex); + + mcaPort.send(m_request(v_request)); + + } + }//end group CseSimuFunctions @@ -1923,21 +2065,13 @@ module OneM2M_Functions { * @desc Cse altstep for config 01 */ altstep a_cse_cf01() runs on AeSimu { - + var MsgIn v_request; + var ResponsePrimitive v_responsePrimitive; + [] mcaPort.receive { log(__SCOPE__&": WARNING: Unexpected message received"); repeat; } - } - - /** - * @desc Cse altstep for config 01 for AE2 - */ - altstep a_cse_cf01_ae2() runs on AeSimu { - - var MsgIn v_request; - var ResponsePrimitive v_responsePrimitive; - [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value v_request { //Send response v_responsePrimitive := valueof(m_responseNotification(int2001, omit)); @@ -1953,23 +2087,71 @@ module OneM2M_Functions { */ altstep a_cse_cf02_cse1() runs on CseSimu { + var PrimitiveContent v_localResource; + var integer vc_localResourceIndex := -1; var MsgIn v_request; var ResponsePrimitive v_response; - var PrimitiveContent v_remoteResource; //localresource - var integer v_localResourceIndex; - var integer v_resourceIndex; + var integer v_localResourceIndex := -1; + + [] mccPortIn.receive(mw_request(mw_create())) -> value v_request { + log(__SCOPE__&": WARNING: Unexpected CREATE message received"); + tc_ac.stop; + v_localResource := f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, vc_cSEBaseIndex, v_request.primitive.requestPrimitive.resourceType);//TODO Get index from v_request.primitive.requestPrimitive.to_ + vc_localResourceIndex := f_setLocalResource(v_localResource, v_request.primitive.requestPrimitive.resourceType, vc_cSEBaseIndex); - [] mccPortIn.receive(mw_request(mw_create)) -> value v_request { - v_remoteResource := f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, f_getResourceIndex(v_request.primitive.requestPrimitive.to_), v_request.primitive.requestPrimitive.resourceType); - v_localResourceIndex := f_setLocalResource(v_remoteResource, v_request.primitive.requestPrimitive.resourceType, f_getResourceIndex(v_request.primitive.requestPrimitive.to_)); - v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier)); v_response.from_ := PX_CSE1_ID; v_response.to_ := v_request.primitive.requestPrimitive.from_; - v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource; + v_response.primitiveContent := vc_localResourcesList[vc_localResourceIndex].resource; mccPortIn.send(m_response(v_response)); + tc_ac.start; + repeat; } - [] mccPortIn.receive { + [] mccPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request { + tc_ac.stop; + log(__SCOPE__&": WARNING: Unexpected RETRIEVE message received"); + + v_localResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_); + if(v_localResourceIndex == -1) + { + log(__SCOPE__&": ERROR: Resource Index not valid"); + v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier)); + v_response.from_ := PX_CSE1_ID; + v_response.to_ := v_request.primitive.requestPrimitive.from_; + mccPortIn.send(m_response(v_response)); + } else { + v_response := valueof(m_responsePrimitive(int2000,v_request.primitive.requestPrimitive.requestIdentifier)); + v_response.from_ := PX_CSE1_ID; + v_response.to_ := v_request.primitive.requestPrimitive.from_; + v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource; + mccPortIn.send(m_response(v_response)); + } + tc_ac.start; + repeat; + } + [] mccPortIn.receive(mw_request(mw_update())) -> value v_request { + tc_ac.stop; + log(__SCOPE__&": WARNING: Unexpected UPDATE message received"); + + v_localResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_); + if(v_localResourceIndex == -1) + { + log(__SCOPE__&": ERROR: Resource Index not valid"); + v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier)); + v_response.from_ := PX_CSE1_ID; + v_response.to_ := v_request.primitive.requestPrimitive.from_; + mccPortIn.send(m_response(v_response)); + } else { + v_response := valueof(m_responsePrimitive(int2004,v_request.primitive.requestPrimitive.requestIdentifier)); + v_response.from_ := PX_CSE1_ID; + v_response.to_ := v_request.primitive.requestPrimitive.from_; + v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource; + mccPortIn.send(m_response(v_response)); + } + tc_ac.start; + repeat; + } + [] mccPortIn.receive (mw_request(?)){ log(__SCOPE__&": WARNING: Unexpected message received"); repeat; } @@ -2001,7 +2183,33 @@ module OneM2M_Functions { } } - }//end group altstepFunctions + }//end group altstepFunctions + + function f_cse_activateDefaults_cse1() runs on CseSimu { + if(not(self == mtc)) { + activate(a_default()); + if(vc_config == e_cf02) { + activate(a_cse_cf02_cse1()); + log(__SCOPE__&": INFO: Default cf02_cse1 activated"); + } else if(vc_config == e_cf04) { + activate(a_cse_cf04()); + log(__SCOPE__&": INFO: Default cf04 activated"); + } + } + } + + function f_cse_activateDefaults_ae() runs on AeSimu { + if(not(self == mtc)) { + activate(a_default()); + if(vc_config == e_cf01) { + activate(a_cse_cf01()); + log(__SCOPE__&": INFO: Default cf01 and cf01_ae2 activated"); + } else if(vc_config == e_cf02CseSimuMaster) { + activate(a_cse_cf02_ae1()); + log(__SCOPE__&": INFO: Default cf02_ae1 activated"); + } + } + } }//end cseFunctions @@ -2060,7 +2268,7 @@ module OneM2M_Functions { }//end function f_ae_preamble_register - /** + /** * @desc Waits for Container create request and process it * @param p_utRequest UpperTester request primitive to be sent to the IUT * @return Internal resource index of Container or -1 in case of failure @@ -2108,7 +2316,7 @@ module OneM2M_Functions { f_checkCseSimuStatus(); return v_resourceIndex; - } //end function f_ae_preamble_createContainer + } //end function f_ae_preamble_createContainer } // end preambleFunctions @@ -2208,16 +2416,16 @@ module OneM2M_Functions { var integer v_resourceIndex, v_parentIndex; var RequestPrimitive v_rp; - [] mcaPort.receive(mw_request(mw_create)) -> value v_request { + [] mcaPortIn.receive(mw_request(mw_create)) -> value v_request { v_rp := v_request.primitive.requestPrimitive; v_parentIndex := f_getResourceIndex(v_rp.to_); v_modifiedResource := f_ae_generateLocalResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType); v_resourceIndex := f_setLocalResource(v_modifiedResource, v_rp.resourceType, v_parentIndex); if(v_resourceIndex != -1) { - mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource))); + mcaPortIn.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource))); } else { - mcaPort.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier))); + mcaPortIn.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier))); } repeat; } @@ -2227,6 +2435,16 @@ module OneM2M_Functions { }//end group altstepFunctions + function f_ae_activateDefaults() runs on CseSimu { + if(not(self == mtc)) { + activate(a_default()); + if(vc_config == e_cf03) { + activate(a_ae_cf03()); + log(__SCOPE__&": INFO: Default cf03 activated"); + } + } + } + }//end of aeFunctions @@ -2463,16 +2681,16 @@ module OneM2M_Functions { return f_resourceIdCleaner(p_contentResource.cSEBase.resourceID); } if(ischosen(p_contentResource.m2mServiceSubscriptionProfile)) { - return p_contentResource.m2mServiceSubscriptionProfile.resourceName; + return f_resourceIdCleaner(p_contentResource.m2mServiceSubscriptionProfile.resourceID); } if(ischosen(p_contentResource.node)) { - return p_contentResource.node.resourceName; + return f_resourceIdCleaner(p_contentResource.node.resourceID); } if(ischosen(p_contentResource.statsConfig)) { - return p_contentResource.statsConfig.resourceName; + return f_resourceIdCleaner(p_contentResource.statsConfig.resourceID); } if(ischosen(p_contentResource.statsCollect)) { - return p_contentResource.statsCollect.resourceName; + return f_resourceIdCleaner(p_contentResource.statsCollect.resourceID); } log(__SCOPE__&":WARNING: Primitive Content Kind not implemented"); @@ -2640,8 +2858,42 @@ module OneM2M_Functions { * @param p_address Resource URI (can be structured/unstructured cseRelative/spRelative/absolute) * @return Internal resource index of the given resource or -1 in case of error */ - function f_getResourceIndex(in XSD.AnyURI p_address) runs on CseSimu return integer { - return vc_cSEBaseIndex; //TODO + function f_getResourceIndex(in XSD.ID p_receivedURI) runs on CseSimu return integer { + var integer v_resourceIndex := -1; + var integer i; + var XSD.ID v_cleanedURI; + + v_cleanedURI := f_resourceIdCleaner(p_receivedURI); + + if (f_isHierarchical(p_receivedURI)) { + + log("Hierarchical method: " & v_cleanedURI); + for(i:=0; i < lengthof(vc_localResourcesList); i := i+1){ + + if(match(f_getResourceName(vc_localResourcesList[i].resource), v_cleanedURI)){ + v_resourceIndex := i; + break; + } + } + + } else { + + log("Non Hierarchical method: " & v_cleanedURI); + for(i:=0; i < lengthof(vc_localResourcesList); i := i+1){ + if(match(f_getResourceId(vc_localResourcesList[i].resource), v_cleanedURI)){ + v_resourceIndex := i; + break; + } + } + } + log("Resource index found: " & int2str(v_resourceIndex)); + //Try CSEBase + if(v_resourceIndex == -1) { + if(match(f_getResourceName(vc_localResourcesList[vc_cSEBaseIndex].resource), v_cleanedURI)) { + v_resourceIndex := vc_cSEBaseIndex; + } + } + return v_resourceIndex; } /** @@ -2739,7 +2991,7 @@ module OneM2M_Functions { if(p_targetResourceIndex == -1) { return PX_CSE1_ID & "/" & PX_CSE1_RESOURCE_ID; } else { - v_resourceAddress := PX_CSE_ID & "/" & f_getResourceId(vc_localResourcesList[p_targetResourceIndex].resource); + v_resourceAddress := PX_CSE1_ID & "/" & f_getResourceId(vc_localResourcesList[p_targetResourceIndex].resource); return v_resourceAddress; } } else { @@ -2772,6 +3024,7 @@ module OneM2M_Functions { } + /** * @desc Saving of a resource and its parent index in the internal resource list * @param p_resource Resource to be saved @@ -3018,11 +3271,11 @@ module OneM2M_Functions { f_cse_postamble_deleteResources(); // Tear down if(vc_config == e_cf01) { - f_cf01Down(); + f_cf01Down(); } else if (vc_config ==e_cf02) { - vc_cse1.start(f_cse_postamble_deleteResourcesCSE()); - vc_cse1.done; - f_cf02Down(); + vc_cse1.start(f_cse_postamble_deleteResourcesCSE()); + vc_cse1.done; + f_cf02Down(); } stop; } diff --git a/LibOneM2M/OneM2M_TestSystem.ttcn b/LibOneM2M/OneM2M_TestSystem.ttcn index 51a4ccd3372bae68a3b3e2e7af4270c3351ed8f1..223b9fdd45942755553b26b571304448b9b0d3de 100644 --- a/LibOneM2M/OneM2M_TestSystem.ttcn +++ b/LibOneM2M/OneM2M_TestSystem.ttcn @@ -62,9 +62,9 @@ module OneM2M_TestSystem { //global variables var MyResourcesList vc_localResourcesList := {}; var AeSimu vc_ae1;//For CF02 when CseSimu is master - var integer vc_remoteCseIndex; - var integer vc_localRemoteCseIndex; - var integer vc_cSEBaseIndex; //Index of the CSEBase resource of the Tester inside vc_localResourcesList + var integer vc_remoteCseIndex := -1; + var integer vc_localRemoteCseIndex := -1; + var integer vc_cSEBaseIndex := -1; //Index of the CSEBase resource of the Tester inside vc_localResourcesList }; type component InCseSimu extends CseSimu {} @@ -77,6 +77,7 @@ module OneM2M_TestSystem { port OneM2MPort mccPort; port OneM2MPort mccPortIn; port AdapterControlPort acPort; + port UpperTesterPort utPort; } type component AeSystem { diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index 20f6c6f357efe2be81f46e1b8e7abd7c7ce2fee2..1580cbf0e53222ba1c609063e74b95ba0e271b21 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -2041,13 +2041,14 @@ module OneM2M_PermutationFunctions { v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); - if(p_resourceType == int23){ - //vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler()); - } - v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex); + v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body v_request.requestIdentifier := "Existing resource"; + + if(p_resourceType == int23){ + vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler()); + } mcaPort.send(m_request(v_request)); tc_ac.start; @@ -2672,7 +2673,7 @@ module OneM2M_PermutationFunctions { } vc_cse1.done; - vc_cse1.start(f_cse_resourceAnnouncementHandler()); + vc_cse1.start(f_cse_announcementProcedure_createHandler()); v_resourceIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, omit)); vc_cse1.done; @@ -4323,60 +4324,6 @@ module OneM2M_PermutationFunctions { }//end f_CSE_DMR_UPD_004 - function f_CSE_DMR_UPD_005(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu { - - // Local variables - var MsgIn v_response; - var RequestPrimitive v_request; - var integer v_aeIndex := -1; - var integer v_ae2Index := -1; - var integer v_resourceIndex := -1; - - // Test control - - // Test component configuration - f_cf01Up(true); - - // Test adapter configuration - - // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - - f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType); - - v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive , v_aeIndex); - - // Test Body - v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive); - - mcaPort.send(m_request(v_request)); - tc_ac.start; - alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Resource " & c_defaultResourceName & " of type " & int2str(enum2int(p_resourceType)) & " not found"); - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Wrong response status code"); - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while updating an unexisting resource type " & int2str(enum2int(p_resourceType))); - } - [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType))); - } - } - - // Postamble - f_cse_postamble_deleteResources(); - - // Tear down - f_cf01Down(); - - }//end f_CSE_DMR_UPD_005 - function f_CSE_DMR_UPD_006(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu { // Local variables @@ -4552,38 +4499,39 @@ module OneM2M_PermutationFunctions { }//end f_CSE_DMR_UPD_008 - function f_CSE_DMR_UPD_009(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive, template (omit) AttributeAux_list p_nullFields := omit) runs on AeSimu { + function f_CSE_DMR_UPD_009(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu { // Local variables var MsgIn v_response; var RequestPrimitive v_request; var integer v_aeIndex := -1; - var integer v_resourceIndex := -1; var integer v_ae2Index := -1; - + var integer v_resourceIndex := -1; + // Test control - + // Test component configuration f_cf01Up(true); - + // Test adapter configuration - + // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - + f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType); - - v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); - + + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive , v_aeIndex); + // Test Body v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive); - + mcaPort.send(m_request(v_request)); + tc_ac.start; alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int4102))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response { tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Operation not allowed. Attribute not updated with an unacceptable value"); + setverdict(pass, __SCOPE__ & ": It is not possible to update an unexisting attribute of resource type " & int2str(enum2int(p_resourceType))); } [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; @@ -4591,21 +4539,19 @@ module OneM2M_PermutationFunctions { } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Attribute has been updated with an unacceptable value"); + setverdict(fail, __SCOPE__ & ": Error while updating an unexisting resource type " & int2str(enum2int(p_resourceType))); } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType))); } } - - vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex); - + // Postamble f_cse_postamble_deleteResources(); - + // Tear down f_cf01Down(); - + }//end f_CSE_DMR_UPD_009 function f_CSE_DMR_UPD_014(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu { @@ -4771,7 +4717,7 @@ module OneM2M_PermutationFunctions { // Preamble if(p_resourceType != int2) { - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + v_aeIndex := f_cse_preamble_registerAe(-, {f_getAnnouncementTargetPoA("HTTP", PX_AE1_ADDRESS, "")});//c_CRUDNDi); } if(p_resourceType != int1) { @@ -4796,7 +4742,16 @@ module OneM2M_PermutationFunctions { //Test Body v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive); - mcaPort.send(m_request(v_request)); //CSEBase + if(p_resourceType == int23) { //Subscription + v_request.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_aeIndex)}; + } + + mcaPort.send(m_request(v_request)); + + if(p_resourceType == int23) { //Subscription + f_cse_notifyProcedure_subscriptionVerificationHandler(); + } + tc_ac.start; alt { [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { @@ -6365,6 +6320,77 @@ module OneM2M_PermutationFunctions { }//end group AccessControlPolicy }//end group Security + + group Annoucement { + + group Basic { + + function f_CSE_ANNC_001(ResourceType p_resourceType, template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit, in template RequestPrimitive p_requestUpdatePrimitive := omit) runs on AeSimu { + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_parentIndex := -1; + var integer v_aeIndex := -1; + var integer v_resourceIndex; + var ResponsePrimitive v_responsePrimitive; + var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit); + v_create.primitiveContent.aE.announceTo := {PX_CSE_ID}; + + // Test control + + // Test component configuration + f_cf02Up(); + + // Test adapter configuration + + //Register the CSE + vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE)); + vc_cse1.done; + + //Preamble + vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -))); + v_aeIndex := f_cse_createResource(int2,v_create); + vc_cse1.done; + + // Test Body + if (ispresent (p_requestUpdatePrimitive)) { + v_resourceIndex := f_cse_createResource(p_resourceType,p_requestCreatePrimitive); + v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_requestUpdatePrimitive); + v_responsePrimitive.responseStatusCode := int2004; + } else { + v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestCreatePrimitive, v_parentIndex); + v_responsePrimitive.responseStatusCode := int2001; + } + vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc)); + mcaPort.send(m_request(v_request)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(v_responsePrimitive.responseStatusCode))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__, ": Operation for resource " & int2str(enum2int(p_resourceType)) & " performed successfully"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__, ": Wrong response status code"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__, ": No answer while updating resource type " & int2str(enum2int(p_resourceType))); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf02Down(); + + }//end f_CSE_ANNC_001 + + }//end group Basic + + }// end group Announcement }//end group CSE diff --git a/OneM2M_TestControl_IN_profile.ttcn b/OneM2M_TestControl_IN_profile.ttcn index e1074f54b54c04ee5d55b6b8412e60f19b0dd2f7..be9f03b3b4b9c72cb4cb510f40e4882e31090b49 100644 --- a/OneM2M_TestControl_IN_profile.ttcn +++ b/OneM2M_TestControl_IN_profile.ttcn @@ -126,10 +126,10 @@ module OneM2M_TestControl_IN_profile { if(PICS_CNT_LBL) {execute (TC_CSE_DMR_UPD_002_CNT_LBL());} if(PICS_CNT_LBL) {execute (TC_CSE_DMR_UPD_003_CNT_LBL());} if(PICS_CNT_MNI and PICS_CNT_LBL) {execute (TC_CSE_DMR_UPD_004_CNT_ET_MNI_LBL());} - if(true) {execute (TC_CSE_DMR_UPD_005_CNT_EXC());} + if(true) {execute (TC_CSE_DMR_UPD_005());} if(true) {execute (TC_CSE_DMR_UPD_007_CNT_CT());} if(true) {execute (TC_CSE_DMR_UPD_008_CNT_ET());} - if(true) {execute (TC_CSE_DMR_UPD_009_CNT_ET());} + if(true) {execute (TC_CSE_DMR_UPD_009_CNT_EXC());} if(true) {execute (TC_CSE_DMR_UPD_010 ());} if(true) {execute (TC_CSE_DMR_UPD_016_CNT_ET());} if(true) {execute (TC_CSE_DMR_DEL_001_CNT());} @@ -185,10 +185,9 @@ module OneM2M_TestControl_IN_profile { if(PICS_SUB_LBL) {execute (TC_CSE_DMR_UPD_002_SUB_LBL());} if(PICS_SUB_LBL) {execute (TC_CSE_DMR_UPD_003_SUB_LBL());} if(PICS_SUB_LBL and PICS_SUB_EXC) {execute (TC_CSE_DMR_UPD_004_SUB_ET_LBL_EXC());} - if(true) {execute (TC_CSE_DMR_UPD_005_SUB_MNI());} if(true) {execute (TC_CSE_DMR_UPD_007_SUB_CT());} if(true) {execute (TC_CSE_DMR_UPD_008_SUB_ET());} - if(true) {execute (TC_CSE_DMR_UPD_009_SUB_ET());} + if(true) {execute (TC_CSE_DMR_UPD_009_SUB_MNI());} if(true) {execute (TC_CSE_DMR_UPD_016_SUB_ET());} if(true) {execute (TC_CSE_DMR_UPD_016_SUB_NU());} if(true) {execute (TC_CSE_DMR_UPD_016_SUB_NCT());} @@ -218,10 +217,9 @@ module OneM2M_TestControl_IN_profile { if(PICS_ACP_LBL) {execute (TC_CSE_DMR_UPD_002_ACP_LBL());} if(PICS_ACP_LBL) {execute (TC_CSE_DMR_UPD_003_ACP_LBL());} if(PICS_ACP_AT and PICS_ACP_LBL) {execute (TC_CSE_DMR_UPD_004_ACP_PV_AT_LBL());} - if(true) {execute (TC_CSE_DMR_UPD_005_ACP_EXC());} if(true) {execute (TC_CSE_DMR_UPD_007_ACP_CT());} if(true) {execute (TC_CSE_DMR_UPD_008_ACP_ET());} - if(true) {execute (TC_CSE_DMR_UPD_009_ACP_ET());} + if(true) {execute (TC_CSE_DMR_UPD_009_ACP_EXC());} if(true) {execute (TC_CSE_DMR_UPD_016_ACP_ET());} if(true) {execute (TC_CSE_DMR_UPD_016_ACP_PV());} if(true) {execute (TC_CSE_DMR_UPD_016_ACP_PVS());} @@ -336,11 +334,10 @@ module OneM2M_TestControl_IN_profile { if(PICS_GRP_LBL) {execute (TC_CSE_DMR_UPD_002_GRP_LBL());} if(PICS_GRP_LBL) {execute (TC_CSE_DMR_UPD_003_GRP_LBL());} if(PICS_GRP_GN and PICS_GRP_LBL) {execute (TC_CSE_DMR_UPD_004_GRP_ET_GN_LBL());} - if(true) {execute (TC_CSE_DMR_UPD_005_GRP_EXC());} if(PICS_ACP_SUPPORT) {execute (TC_CSE_DMR_UPD_006_GRP_LBL());} if(true) {execute (TC_CSE_DMR_UPD_007_GRP_CT());} if(true) {execute (TC_CSE_DMR_UPD_008_GRP_ET());} - if(true) {execute (TC_CSE_DMR_UPD_009_GRP_ET());} + if(true) {execute (TC_CSE_DMR_UPD_009_GRP_EXC());} if(true) {execute (TC_CSE_DMR_UPD_016_GRP_ET());} if(true) {execute (TC_CSE_DMR_UPD_016_GRP_MNM());} if(true) {execute (TC_CSE_DMR_UPD_016_GRP_MID());} diff --git a/OneM2M_TestControl_MN_profile.ttcn b/OneM2M_TestControl_MN_profile.ttcn index fe328d7629437cacc845f8a82e71e639935b27dc..4516fc0e594446a45ef0c05fdacc8aeba7bc3fc0 100644 --- a/OneM2M_TestControl_MN_profile.ttcn +++ b/OneM2M_TestControl_MN_profile.ttcn @@ -149,10 +149,10 @@ module OneM2M_TestControl_MN_profile { if(PICS_CNT_LBL) {execute (TC_CSE_DMR_UPD_002_CNT_LBL());} if(PICS_CNT_LBL) {execute (TC_CSE_DMR_UPD_003_CNT_LBL());} if(PICS_CNT_MNI and PICS_CNT_LBL) {execute (TC_CSE_DMR_UPD_004_CNT_ET_MNI_LBL());} - if(true) {execute (TC_CSE_DMR_UPD_005_CNT_EXC());} + if(true) {execute (TC_CSE_DMR_UPD_005());} if(true) {execute (TC_CSE_DMR_UPD_007_CNT_CT());} if(true) {execute (TC_CSE_DMR_UPD_008_CNT_ET());} - if(true) {execute (TC_CSE_DMR_UPD_009_CNT_ET());} + if(true) {execute (TC_CSE_DMR_UPD_009_CNT_EXC());} if(true) {execute (TC_CSE_DMR_UPD_010());} if(true) {execute (TC_CSE_DMR_UPD_016_CNT_ET());} if(true) {execute (TC_CSE_DMR_DEL_001_CNT());} @@ -208,10 +208,9 @@ module OneM2M_TestControl_MN_profile { if(PICS_SUB_LBL) {execute (TC_CSE_DMR_UPD_002_SUB_LBL());} if(PICS_SUB_LBL) {execute (TC_CSE_DMR_UPD_003_SUB_LBL());} if(true) {execute (TC_CSE_DMR_UPD_004_SUB_ET_LBL_EXC());} - if(true) {execute (TC_CSE_DMR_UPD_005_SUB_MNI());} if(true) {execute (TC_CSE_DMR_UPD_007_SUB_CT());} if(true) {execute (TC_CSE_DMR_UPD_008_SUB_ET());} - if(true) {execute (TC_CSE_DMR_UPD_009_SUB_ET());} + if(true) {execute (TC_CSE_DMR_UPD_009_SUB_MNI());} if(true) {execute (TC_CSE_DMR_UPD_016_SUB_ET());} if(true) {execute (TC_CSE_DMR_UPD_016_SUB_NU());} if(true) {execute (TC_CSE_DMR_UPD_016_SUB_NCT());} @@ -241,10 +240,9 @@ module OneM2M_TestControl_MN_profile { if(PICS_ACP_LBL) {execute (TC_CSE_DMR_UPD_002_ACP_LBL());} if(PICS_ACP_LBL) {execute (TC_CSE_DMR_UPD_003_ACP_LBL());} if(true) {execute (TC_CSE_DMR_UPD_004_ACP_PV_AT_LBL());} - if(true) {execute (TC_CSE_DMR_UPD_005_ACP_EXC());} if(true) {execute (TC_CSE_DMR_UPD_007_ACP_CT());} if(true) {execute (TC_CSE_DMR_UPD_008_ACP_ET());} - if(true) {execute (TC_CSE_DMR_UPD_009_ACP_ET());} + if(true) {execute (TC_CSE_DMR_UPD_009_ACP_EXC());} if(true) {execute (TC_CSE_DMR_UPD_016_ACP_ET());} if(true) {execute (TC_CSE_DMR_UPD_016_ACP_PV());} if(true) {execute (TC_CSE_DMR_UPD_016_ACP_PVS());} @@ -358,11 +356,10 @@ module OneM2M_TestControl_MN_profile { if(PICS_GRP_LBL) {execute (TC_CSE_DMR_UPD_002_GRP_LBL());} if(PICS_GRP_LBL) {execute (TC_CSE_DMR_UPD_003_GRP_LBL());} if(true) {execute (TC_CSE_DMR_UPD_004_GRP_ET_GN_LBL());} - if(true) {execute (TC_CSE_DMR_UPD_005_GRP_EXC());} if(PICS_ACP_SUPPORT) {execute (TC_CSE_DMR_UPD_006_GRP_LBL());} if(true) {execute (TC_CSE_DMR_UPD_007_GRP_CT());} if(true) {execute (TC_CSE_DMR_UPD_008_GRP_ET());} - if(true) {execute (TC_CSE_DMR_UPD_009_GRP_ET());} + if(true) {execute (TC_CSE_DMR_UPD_009_GRP_EXC());} if(true) {execute (TC_CSE_DMR_UPD_016_GRP_ET());} if(true) {execute (TC_CSE_DMR_UPD_016_GRP_MNM());} if(true) {execute (TC_CSE_DMR_UPD_016_GRP_MID());} diff --git a/OneM2M_Testcases_CSE_Release_1.ttcn b/OneM2M_Testcases_CSE_Release_1.ttcn index 8c84d226ce3d86507e9bbe129b7028430064f1fe..dc06935c148d21d095d7ba70534e27fef135f626 100644 --- a/OneM2M_Testcases_CSE_Release_1.ttcn +++ b/OneM2M_Testcases_CSE_Release_1.ttcn @@ -450,7 +450,7 @@ module OneM2M_Testcases_CSE_Release_1 { // Test component configuration f_cf01Up(); - //Preambule + //Preamble //Test Body v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM")); @@ -520,7 +520,7 @@ module OneM2M_Testcases_CSE_Release_1 { // Test component configuration f_cf01Up(); - //Preambule + //Preamble //vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE); //TODO: create serviceSubscribedProfile, Node, and serviceSubscribedAppRule //v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile({"C*"}); //c_CRUDNDi); @@ -571,26 +571,23 @@ module OneM2M_Testcases_CSE_Release_1 { // Test component configuration f_cf02UpCseSimuMaster(); - //Preambule + //Preamble vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE); //Test Body - vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, "S", omit))); + vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, -, "S", omit))); + vc_ae1.done; tc_ac.start; alt{ - [] mccPortIn.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", "CSE_ID", -))){ + [] mccPortIn.receive(mw_request(mw_createAEAnnc(PX_CSE_ID, f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", -))){ tc_ac.stop; setverdict(pass, __SCOPE__ & ": AE creation redirected."); } - [] mccPortIn.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", "CSE_ID", -))){ + [] mccPortIn.receive(mw_request(mw_createAEAnnc(PX_CSE_ID, f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", -))){ tc_ac.stop; setverdict(pass, __SCOPE__ & ": AE creation redirected."); } - [] mccPortIn.receive { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while creating AE"); - } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating AE"); } @@ -626,11 +623,11 @@ module OneM2M_Testcases_CSE_Release_1 { // Test component configuration f_cf02UpCseSimuMaster(); - //Preambule + //Preamble vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE); //Test Body - vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S"))); + vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S"))); vc_ae1.done; tc_ac.start; @@ -640,10 +637,6 @@ module OneM2M_Testcases_CSE_Release_1 { tc_ac.stop; setverdict(pass, __SCOPE__ & ": AE creation redirected."); } - [] mccPortIn.receive { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while creating AE"); - } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating AE"); } @@ -676,11 +669,11 @@ module OneM2M_Testcases_CSE_Release_1 { // Test component configuration f_cf02Up(); - //Preambule + //Preamble vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE)); vc_cse1.done; - - v_aeIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")); + + mcaPort.send(m_request(f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S"),-1))); vc_cse1.start(f_cse_resourceAnnouncementHandler()); vc_cse1.done; @@ -689,7 +682,7 @@ module OneM2M_Testcases_CSE_Release_1 { tc_ac.start; alt { - [] mcaPortIn.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { tc_ac.stop; //continue to test the content if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){ @@ -702,10 +695,6 @@ module OneM2M_Testcases_CSE_Release_1 { setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist"); } } - [] mcaPortIn.receive { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while creating AE"); - } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating AE"); } @@ -738,7 +727,7 @@ module OneM2M_Testcases_CSE_Release_1 { // Test component configuration f_cf02UpCseSimuMaster(); - //Preambule + //Preamble vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE); vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S"))); @@ -799,7 +788,7 @@ module OneM2M_Testcases_CSE_Release_1 { // Test component configuration f_cf04Up(); - //Preambule + //Preamble vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); @@ -866,7 +855,7 @@ module OneM2M_Testcases_CSE_Release_1 { // Test component configuration f_cf02Up(); - //Preambule + //Preamble vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE)); vc_cse1.done; @@ -883,7 +872,7 @@ module OneM2M_Testcases_CSE_Release_1 { //Test Body f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, f_getResourceId(vc_resourcesList[v_aeIndex].resource))); - vc_cse1.start(f_cse_resourceAnnouncementHandler(PX_CSE_ID, f_getResourceAddress(v_aeIndex, e_nonHierarchical, e_spRelative))); + vc_cse1.start(f_cse_resourceAnnouncementHandler(mw_createAEAnnc(PX_CSE_ID, -, -, -))); vc_cse1.done; tc_ac.start; @@ -1278,7 +1267,7 @@ module OneM2M_Testcases_CSE_Release_1 { // Test component configuration f_cf02Up(); - //Preambule + //Preamble vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE)); vc_cse1.done; @@ -3356,12 +3345,14 @@ module OneM2M_Testcases_CSE_Release_1 { */ testcase TC_CSE_DMR_CRE_007() runs on AeSimu system CseSystem { // Local variables - var template RequestPrimitive v_createRequest := m_createContainerBase; + var template RequestPrimitive v_createRequestContainer := m_createContainerBase; + var template RequestPrimitive v_createRequestContentInstance := m_createContentInstanceBase; var MsgIn v_response; var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_containerIndex := -1; - const integer c_maxNumberOfInstances := 0; + var integer v_contentInstanceIndex := -1; + const integer c_maxNumberOfInstances := 1; // Test control // Test component configuration @@ -3372,41 +3363,45 @@ module OneM2M_Testcases_CSE_Release_1 { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - v_createRequest.primitiveContent.container.maxNrOfInstances := c_maxNumberOfInstances; + v_createRequestContainer.primitiveContent.container.maxNrOfInstances := c_maxNumberOfInstances; - v_containerIndex := f_cse_createResource(int3, v_createRequest, v_aeIndex); + v_containerIndex := f_cse_createResource(int3, v_createRequestContainer, v_aeIndex); //Container + + v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex); //ContentInstance // Test Body - v_request := f_getCreateRequestPrimitive(int4, m_createContentInstance(f_getResourceAddress(v_containerIndex), "MyValue"), v_containerIndex); + + v_createRequestContentInstance.primitiveContent.contentInstance.resourceName := c_defaultContentInstanceResourceName & "2"; //ContentInstance 2 + v_request := f_getCreateRequestPrimitive(int4, v_createRequestContentInstance, v_containerIndex); mcaPort.send(m_request(v_request)); tc_ac.start; alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int5207))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Maximun number of instances exceeded"); + setverdict(pass, __SCOPE__ & ": ContentInstance created"); } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Bad responseStatusCode in response"); + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); } - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Accepted creation of contentInstance exceding maximum number of instances"); + setverdict(fail, __SCOPE__ & ": Error while creating resource type contentInstance"); } [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while creating resource type 4"); + setverdict(fail, __SCOPE__ & ": No answer while creating resource type contentInstance"); } } f_checkAeSimuStatus(); //Check to see if the resource is NOT present - if(f_isResourceNotPresent(v_containerIndex, f_getResourceName(v_request.primitiveContent))){ - setverdict(pass, __SCOPE__ & ":INFO: Resource not created"); + if(f_isResourceNotPresent(v_containerIndex, c_defaultContentInstanceResourceName)){ + setverdict(pass, __SCOPE__ & ":INFO: Oldest contentInstance has been removed to allow the creation of the new contentInstance"); } else { - setverdict(fail, __SCOPE__ & ":ERROR: Resource created"); + setverdict(fail, __SCOPE__ & ":ERROR: Oldest contentInstance has not been removed to allow the creation of the new contentInstance"); } // Postamble @@ -3426,64 +3421,72 @@ module OneM2M_Testcases_CSE_Release_1 { * */ testcase TC_CSE_DMR_CRE_008() runs on AeSimu system CseSystem { - // Local variables - var template RequestPrimitive v_createRequest := m_createContainerBase; + //Local variables + var template RequestPrimitive v_createRequestContainer := m_createContainerBase; + var template RequestPrimitive v_createRequestContentInstance := m_createContentInstanceBase; var MsgIn v_response; var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_containerIndex := -1; - const integer c_maxByteSize := 0; + var integer v_contentInstanceIndex := -1; + const integer c_maxByteSize := 10; + const XSD.String c_primitiveContent1 := "Content1"; + const XSD.String c_primitiveContent2 := "Content2"; // Test control - + // Test component configuration f_cf01Up(); - + // Test adapter configuration - + // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - - v_createRequest.primitiveContent.container.maxByteSize := c_maxByteSize; - - v_containerIndex := f_cse_createResource(int3, v_createRequest, v_aeIndex); - + + v_createRequestContainer.primitiveContent.container.maxByteSize := c_maxByteSize; + + v_containerIndex := f_cse_createResource(int3, v_createRequestContainer, v_aeIndex); //Container + + v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstance(f_getResourceAddress(v_containerIndex), c_primitiveContent1), v_containerIndex);//ContentInstance + // Test Body - v_request := f_getCreateRequestPrimitive(int4, m_createContentInstanceBase, v_containerIndex); - + + v_createRequestContentInstance.primitiveContent.contentInstance.content := c_primitiveContent2; //ContentInstance 2 + v_createRequestContentInstance.primitiveContent.contentInstance.resourceName := c_defaultContentInstanceResourceName & "2"; + v_request := f_getCreateRequestPrimitive(int4, v_createRequestContentInstance, v_containerIndex); + mcaPort.send(m_request(v_request)); tc_ac.start; alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int5207))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Maximun byte size exceeded"); + setverdict(pass, __SCOPE__ & ": ContentInstance created"); } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Bad responseStatusCode in response"); + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); } - - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Accepted creation of contentInstance exceding maximum byte size"); - + setverdict(fail, __SCOPE__ & ": Error while creating resource type contentInstance"); + } [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while creating resource type 4"); + setverdict(fail, __SCOPE__ & ": No answer while creating resource type contentInstance"); } } - + f_checkAeSimuStatus(); - - //Check to see if the resource is present or not - if(f_isResourceNotPresent(v_containerIndex, f_getResourceName(v_request.primitiveContent))){ - setverdict(pass, __SCOPE__ & ":INFO: Resource created"); + + //Check to see if the resource is NOT present + if(f_isResourceNotPresent(v_containerIndex, c_defaultContentInstanceResourceName)){ + setverdict(pass, __SCOPE__ & ":INFO: Oldest contentInstance has been removed to allow the creation of the new contentInstance"); } else { - setverdict(fail, __SCOPE__ & ":ERROR: Resource not created"); + setverdict(fail, __SCOPE__ & ":ERROR: Oldest contentInstance has not been removed to allow the creation of the new contentInstance"); } - + // Postamble f_cse_postamble_deleteResources(); - + // Tear down f_cf01Down(); @@ -5126,75 +5129,73 @@ module OneM2M_Testcases_CSE_Release_1 { } } - } // end g_CSE_DMR_UPD_004 - - group g_CSE_DMR_UPD_005{ + } // end g_CSE_DMR_UPD_004 - /** - * @desc Check that the IUT responds with an error when the AE tries to update an attribute of a TARGET_RESOURCE_ADDRESS resource which does not exist - * - */ - testcase TC_CSE_DMR_UPD_005_CNT_EXC() runs on Tester system CseSystem { - // Local variables - var AeSimu v_ae1 := AeSimu.create("AE1") alive; - var XSD.PositiveInteger v_expirationCounter := 1; - var template RequestPrimitive v_createRequest := m_createContainerBase; - var template RequestPrimitive v_updateRequest := m_updateContainerBase; - - v_updateRequest.primitiveContent := {container_update_invalid := m_contentUpdateContainer_invalid}; - - v_updateRequest.primitiveContent.container_update_invalid.expirationCounter := v_expirationCounter; - - v_ae1.start(f_CSE_DMR_UPD_005(int3, v_createRequest, v_updateRequest));//Container - v_ae1.done; - } - - testcase TC_CSE_DMR_UPD_005_GRP_EXC() runs on Tester system CseSystem { - // Local variables - var AeSimu v_ae1 := AeSimu.create("AE1") alive; - var XSD.PositiveInteger v_expirationCounter := 1; - var template RequestPrimitive v_createRequest := m_createGroupBase; - var template RequestPrimitive v_updateRequest := m_updateGroupBase; - - v_updateRequest.primitiveContent := {group_update_invalid := m_contentUpdateGroup_invalid}; - - v_updateRequest.primitiveContent.group_update_invalid.expirationCounter := v_expirationCounter; - - v_ae1.start(f_CSE_DMR_UPD_005(int9, v_createRequest, v_updateRequest));//Group - v_ae1.done; - } + /** + * @desc Check that the IUT responds with an error when the AE tries to update an attribute of a TARGET_RESOURCE_ADDRESS resource when the resource does not exist + * + */ + testcase TC_CSE_DMR_UPD_005() runs on AeSimu system CseSystem { + //Local variables + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var ResourceType v_resourceType := int3; //container + var template RequestPrimitive v_updateRequest := m_updateContainerBase; + var XSD.ID v_resourceId := "nonExistingId"; + var XSD.ID v_resourceName := "nonExistingName"; + var XSD.ID v_targetResourceAddress; + + // Test control - testcase TC_CSE_DMR_UPD_005_ACP_EXC() runs on Tester system CseSystem { - // Local variables - var AeSimu v_ae1 := AeSimu.create("AE1") alive; - var XSD.PositiveInteger v_expirationCounter := 1; - var template RequestPrimitive v_createRequest := m_createAcpBase; - var template RequestPrimitive v_updateRequest := m_updateAcpBase; - - v_updateRequest.primitiveContent := {aCP_update_invalid := m_contentUpdateAcp_invalid}; - - v_updateRequest.primitiveContent.aCP_update_invalid.expirationCounter := v_expirationCounter; - - v_ae1.start(f_CSE_DMR_UPD_005(int1, v_createRequest, v_updateRequest));//AccessControlPolicy - v_ae1.done; + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + // Test Body + if((PX_ADDRESSING_METHOD == e_nonHierarchical) and (PX_PRIMITIVE_SCOPE == e_cseRelative)) { + v_targetResourceAddress := v_resourceId; + } else if (PX_ADDRESSING_METHOD == e_nonHierarchical) { + v_targetResourceAddress := f_getResourceAddress() & "/" & v_resourceId; + } else { + v_targetResourceAddress := f_getResourceAddress(v_aeIndex) & "/" & v_resourceName; } - - testcase TC_CSE_DMR_UPD_005_SUB_MNI() runs on Tester system CseSystem { - // Local variables - var AeSimu v_ae1 := AeSimu.create("AE1") alive; - var XSD.NonNegativeInteger v_maxNrOfInstances := 5; - var template RequestPrimitive v_createRequest := m_createSubscriptionBase; - var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase; - - v_updateRequest.primitiveContent := {subscription_update_invalid := m_contentUpdateSubscription_invalid}; - - v_updateRequest.primitiveContent.subscription_update_invalid.maxNrOfInstances := v_maxNrOfInstances; + + v_request := f_getUpdateRequestPrimitive(v_resourceType, v_aeIndex, v_updateRequest); + v_request.to_ := v_targetResourceAddress; + + mcaPort.send(m_request(v_request)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))){ + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Operation not allowed because resource does not exist"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)){ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Attribute has been updated in a non existing resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(v_resourceType))); + } + } - v_ae1.start(f_CSE_DMR_UPD_005(int23, v_createRequest, v_updateRequest));//Subscription - v_ae1.done; - } + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); - } // end g_CSE_DMR_UPD_005 + // Tear down + f_cf01Down(); + } group g_CSE_DMR_UPD_006{ @@ -5521,96 +5522,64 @@ module OneM2M_Testcases_CSE_Release_1 { * @desc Check that the IUT responds with an error when the AE tries to update a RW attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS resource with an UNACCEPTABLE_VALUE * */ - testcase TC_CSE_DMR_UPD_009_CNT_ET() runs on Tester system CseSystem { + testcase TC_CSE_DMR_UPD_009_CNT_EXC() runs on Tester system CseSystem { // Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; - var Timestamp v_expirationTime := "20001231T012345"; + var XSD.PositiveInteger v_expirationCounter := 1; + var template RequestPrimitive v_createRequest := m_createContainerBase; var template RequestPrimitive v_updateRequest := m_updateContainerBase; - var PrimitiveContent v_primitiveContentRetrieveResource; + + v_updateRequest.primitiveContent := {container_update_invalid := m_contentUpdateContainer_invalid}; - v_updateRequest.primitiveContent.container.expirationTime := v_expirationTime; - - v_ae1.start(f_CSE_DMR_UPD_009(int3, m_createContainerBase, v_updateRequest));//Container + v_updateRequest.primitiveContent.container_update_invalid.expirationCounter := v_expirationCounter; + + v_ae1.start(f_CSE_DMR_UPD_009(int3, v_createRequest, v_updateRequest));//Container v_ae1.done; - - if(getverdict == pass){ - v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1); - //Check that the resource has NOT been udpated - if(ischosen(v_primitiveContentRetrieveResource.container)) { - if(v_primitiveContentRetrieveResource.container.expirationTime == v_expirationTime){ - setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute updated") - } - } - } } - - testcase TC_CSE_DMR_UPD_009_ACP_ET() runs on Tester system CseSystem { + + testcase TC_CSE_DMR_UPD_009_GRP_EXC() runs on Tester system CseSystem { // Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; - var Timestamp v_expirationTime := "20001231T012345"; - var template RequestPrimitive v_updateRequest := m_updateAcpBase; - var PrimitiveContent v_primitiveContentRetrieveResource; - - v_updateRequest.primitiveContent.accessControlPolicy.expirationTime := v_expirationTime; - - v_ae1.start(f_CSE_DMR_UPD_009(int1, m_createAcpBase, v_updateRequest));//AccessControlPolicy + var XSD.PositiveInteger v_expirationCounter := 1; + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + + v_updateRequest.primitiveContent := {group_update_invalid := m_contentUpdateGroup_invalid}; + + v_updateRequest.primitiveContent.group_update_invalid.expirationCounter := v_expirationCounter; + + v_ae1.start(f_CSE_DMR_UPD_009(int9, v_createRequest, v_updateRequest));//Group v_ae1.done; - - if(getverdict == pass){ - v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1); - //Check that the resource has NOT been udpated - if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) { - if(v_primitiveContentRetrieveResource.accessControlPolicy.expirationTime == v_expirationTime){ - setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute updated") - } - } - } } - - testcase TC_CSE_DMR_UPD_009_SUB_ET() runs on Tester system CseSystem { + + testcase TC_CSE_DMR_UPD_009_ACP_EXC() runs on Tester system CseSystem { // Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; - var Timestamp v_expirationTime := "20001231T012345"; - var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase; - var PrimitiveContent v_primitiveContentRetrieveResource; + var XSD.PositiveInteger v_expirationCounter := 1; + var template RequestPrimitive v_createRequest := m_createAcpBase; + var template RequestPrimitive v_updateRequest := m_updateAcpBase; - v_updateRequest.primitiveContent.subscription.expirationTime := v_expirationTime; + v_updateRequest.primitiveContent := {aCP_update_invalid := m_contentUpdateAcp_invalid}; + + v_updateRequest.primitiveContent.aCP_update_invalid.expirationCounter := v_expirationCounter; - v_ae1.start(f_CSE_DMR_UPD_009(int23, m_createSubscriptionBase, v_updateRequest));//Subscription + v_ae1.start(f_CSE_DMR_UPD_009(int1, v_createRequest, v_updateRequest));//AccessControlPolicy v_ae1.done; - - if(getverdict == pass){ - v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1); - //Check that the resource has NOT been udpated - if(ischosen(v_primitiveContentRetrieveResource.subscription)) { - if(v_primitiveContentRetrieveResource.subscription.expirationTime == v_expirationTime){ - setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute updated") - } - } - } } - - testcase TC_CSE_DMR_UPD_009_GRP_ET() runs on Tester system CseSystem { + + testcase TC_CSE_DMR_UPD_009_SUB_MNI() runs on Tester system CseSystem { // Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; - var Timestamp v_expirationTime := "20001231T012345"; - var template RequestPrimitive v_updateRequest := m_updateGroupBase; - var PrimitiveContent v_primitiveContentRetrieveResource; - - v_updateRequest.primitiveContent.group_.expirationTime := v_expirationTime; - - v_ae1.start(f_CSE_DMR_UPD_009(int9, m_createGroupBase, v_updateRequest));//Group + var XSD.NonNegativeInteger v_maxNrOfInstances := 5; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase; + + v_updateRequest.primitiveContent := {subscription_update_invalid := m_contentUpdateSubscription_invalid}; + + v_updateRequest.primitiveContent.subscription_update_invalid.maxNrOfInstances := v_maxNrOfInstances; + + v_ae1.start(f_CSE_DMR_UPD_009(int23, v_createRequest, v_updateRequest));//Subscription v_ae1.done; - - if(getverdict == pass){ - v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1); - //Check that the resource has NOT been udpated - if(ischosen(v_primitiveContentRetrieveResource.group_)) { - if(v_primitiveContentRetrieveResource.group_.expirationTime == v_expirationTime){ - setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute updated") - } - } - } } } // end g_CSE_DMR_UPD_009 diff --git a/OneM2M_Testcases_CSE_Release_2.ttcn b/OneM2M_Testcases_CSE_Release_2.ttcn index e6aefee39b5853e24768552c1534686716781f48..80ff4cc619d6b080f8092d71de1962e2bd69ee39 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -6776,6 +6776,101 @@ module OneM2M_Testcases_CSE_Release_2 { }//end group AccessControlPolicy }//end group Security + + group Announcement { + + group Basic { + + group g_CSE_ANNC_001 { + + testcase TC_CSE_ANNC_001_ACP_UPD() runs on Tester system CseSystem { + // Local variables + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_updateRequest := m_updateAcpBase; + var template RequestPrimitive v_createRequestAnnc := mw_createAccessControlPolicyAnnc; + + v_updateRequest.primitiveContent.accessControlPolicy.announceTo := {f_getAnnouncementTargetPoA()}; + + v_ae1.start(f_CSE_ANNC_001(int1, v_createRequestAnnc, omit, v_updateRequest));//AccessControlPolicy + v_ae1.done; + } + + testcase TC_CSE_ANNC_001_ACP_CRE() runs on Tester system CseSystem { + // Local variables + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_createRequest := m_createAcpBase; + var template RequestPrimitive v_createRequestAnnc := mw_createAccessControlPolicyAnnc; + + v_createRequest.primitiveContent.accessControlPolicy.announceTo := {f_getAnnouncementTargetPoA()}; + + v_ae1.start(f_CSE_ANNC_001(int1, v_createRequestAnnc, v_createRequest, omit));//AccessControlPolicy + v_ae1.done; + } + + testcase TC_CSE_ANNC_001_CNT_UPD() runs on Tester system CseSystem { + // Local variables + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_updateRequest := m_updateContainerBase; + var template RequestPrimitive v_createRequestAnnc := mw_createContainerAnncBase; + + v_updateRequest.primitiveContent.container.announceTo := {f_getAnnouncementTargetPoA()}; + + v_ae1.start(f_CSE_ANNC_001(int3, v_createRequestAnnc, omit, v_updateRequest));//Container + v_ae1.done; + } + + testcase TC_CSE_ANNC_001_CNT_CRE() runs on Tester system CseSystem { + // Local variables + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_createRequest := m_createContainerBase; + var template RequestPrimitive v_createRequestAnnc := mw_createContainerAnncBase; + + v_createRequest.primitiveContent.container.announceTo := {f_getAnnouncementTargetPoA()}; + + v_ae1.start(f_CSE_ANNC_001(int3, v_createRequestAnnc, v_createRequest, omit));//Container + v_ae1.done; + } + + testcase TC_CSE_ANNC_001_GRP_UPD() runs on Tester system CseSystem { + // Local variables + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + var template RequestPrimitive v_createRequestAnnc := mw_createGroupAnncBase; + + v_updateRequest.primitiveContent.group_.announceTo := {f_getAnnouncementTargetPoA()}; + + v_ae1.start(f_CSE_ANNC_001(int9, v_createRequestAnnc, omit, v_updateRequest));//Group + v_ae1.done; + } + + testcase TC_CSE_ANNC_001_GRP_CRE() runs on Tester system CseSystem { + // Local variables + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_createRequestAnnc := mw_createGroupAnncBase; + + v_createRequest.primitiveContent.group_.announceTo := {f_getAnnouncementTargetPoA()}; + + v_ae1.start(f_CSE_ANNC_001(int9, v_createRequestAnnc, v_createRequest, omit));//Group + v_ae1.done; + } + + testcase TC_CSE_ANNC_001_CIN_CRE() runs on Tester system CseSystem { + // Local variables + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_createRequest := m_createContentInstanceBase; + var template RequestPrimitive v_createRequestAnnc := mw_createContentInstanceAnncBase; + + v_createRequest.primitiveContent.contentInstance.announceTo := {f_getAnnouncementTargetPoA()}; + + v_ae1.start(f_CSE_ANNC_001(int4, v_createRequestAnnc, v_createRequest, omit));//ContentInstance + v_ae1.done; + } + + }// end group g_CSE_ANNC_001 + + }//end group Basic + }//end group Announcement }//end group CSE