diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index 1ac77322c8a9bd760868867e9162ca7f0f60b28c..33581eb9440009030a16af061ffbd4ec552b5617 100644 --- a/OneM2M_Testcases.ttcn +++ b/OneM2M_Testcases.ttcn @@ -5021,21 +5021,869 @@ module OneM2M_Testcases { // Check that the IUT detects the presence of duplicate member IDs during the creation of the // group resource and removes the duplicate member IDs prior to updating of the group resource. group g_CSE_GMG_BV_014 { + testcase TC_CSE_GMG_BV_014() runs on CseTester system CseSystem + { + //Local constants + const ResourceType c_ResourceTypeGroup := int9; // "group": TS-0004, Table 6.3.4.2.1-1 + const ResourceType c_ResourceType1 := int4; // "contentInstance": TS-0004, Table 6.3.4.2.1-1 + const XSD.String c_primitiveContent := "any content instance value"; // embedded value of a contentInstance + const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS"; // resource type can be <CSEBase>, <AE>, <remoteCSE> + const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; // any resource type + const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; // any resource type + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; // initialization with dummy value + var integer v_groupIndex := -1; // initialization with dummy value + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + var template RequestPrimitive v_createMember; + + // Test control + + // Test component configuration + f_cf01Up(); - testcase TC_CSE_GMG_BV_014() runs on CseTester system CseSystem - { + // Test adapter configuration - // TODO - // Postamble - f_cse_postamble_deleteResources(); + // Preamble + + // and the IUT having registered the AE + v_aeIndex := f_cse_preamble_registerAe(); // create auxiliar AE + + // and the IUT having a resource at TARGET_RESOURCE_ADDRESS of type <group> + // containing memberIDs attribute + // set to MEMBER_RESOURCE_ADDRESS_1 + // and the AE having privileges to perform UPDATE operation on the TARGET_RESOURCE_ADDRESS + v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex); // build request primitive + v_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(1, {c_memberResourceAddress1}, omit); + v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex); // create resource + + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_1 + // having resourceType attribute RESOURCE_TYPE_1 + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_2 + // having resourceType attribute RESOURCE_TYPE_1 + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1"); // build request primitive + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); // request new member + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_2"); // build request primitive + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); // request new member + + + //Test Body + v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest); + v_request.to_ := c_targetResourceAddress; + v_request.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(2, {c_memberResourceAddress2, c_memberResourceAddress2}, omit); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": update successful"); + + + // check for membersId + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs)){ + setverdict(fail, testcasename(), ": Error, memberIDs attribute not provided"); + } else { + + if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs) != 1) { + setverdict(fail, testcasename() & ": Error, wrong number of memberIDs attribute"); + } + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs[0] != c_memberResourceAddress2){ + setverdict(fail, testcasename(), ": Error, memberIDs attribute not correct"); + } + } + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + //Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + } // end group g_CSE_GMG_BV_014 + + /** + * @desc Check that the IUT validates the resource type during an UPDATE of the <group> resource when memberType attribute is not ‘mixed’. + */ + group g_CSE_GMG_BV_015 { + testcase TC_CSE_GMG_BV_015() runs on CseTester system CseSystem + { + //Local constants + const ResourceType c_ResourceTypeGroup := int9; + const ResourceType c_ResourceType1 := int4; + const MemberType c_memberType1 := int4; // should be set same type as c_ResourceType1 + const XSD.String c_primitiveContent := "any content instance value"; // embedded value of a contentInstance + const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS"; + const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; + const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_groupIndex := -1; + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + var template RequestPrimitive v_createMember; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi + + // and the IUT having a resource at TARGET_RESOURCE_ADDRESS of type <group> + // containing + // memberIDs attribute set to MEMBER_RESOURCE_ADDRESS_1 + // memberType attribute set to RESOURCE_TYPE_1 + // and the AE having privileges to perform UPDATE operation on the TARGET_RESOURCE_ADDRESS + v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + v_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(1, {c_memberResourceAddress1}, omit); + v_createRequest.primitiveContent.any_1[0].Group_optional.memberType := c_memberType1; + v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + + + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_1 + // having resourceType attribute RESOURCE_TYPE_1 + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_2 + // having resourceType attribute RESOURCE_TYPE_1 + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_2"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + + + //Test Body + v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest); + v_request.to_ := c_targetResourceAddress; + v_request.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(1, {c_memberResourceAddress2}, omit); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": update successful"); + + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberTypeValidated)) { + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not provided"); + } else { + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberTypeValidated == false) { + setverdict(fail, testcasename(), ": Error, memberTypeValidated wrong value"); + } + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + // Tear down f_cf01Down(); - } + } // end group g_CSE_GMG_BV_015 - } // end group g_CSE_GMG_BV_014 + group g_CSE_GMG_BV_016 { + // Check that the IUT handles unsuccessful validation of the resource type during an UPDATE of the <group> resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is SET_MIXED. + testcase TC_CSE_GMG_BV_016() runs on CseTester system CseSystem + { + //Local constants + const ResourceType c_ResourceTypeGroup := int9; + const ResourceType c_ResourceType1 := int4; + const ResourceType c_ResourceType2 := int5; + const MemberType c_memberType1 := int4; // should be set same type as c_ResourceType1 + const MemberType c_memberType2 := int5; // should be set same type as c_ResourceType2 + const MemberType c_memberType_MIXED := int0; // "mixed": TS-0004, Table 6.3.4.2.11-1 + const XSD.String c_primitiveContent := "any embedded primitive_content"; + const ConsistencyStrategy c_consistentcyStrategy := int3; // "SET_MIXED": TS-0004, Table 6.3.4.2.12-1 + const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS"; + const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; + const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_groupIndex := -1; + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + var template RequestPrimitive v_createMember; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi + + // and the IUT having a resource at TARGET_RESOURCE_ADDRESS of type <group> + // containing + // memberIDs attribute set to MEMBER_RESOURCE_ADDRESS_1 + // memberType attribute set to RESOURCE_TYPE_1 + // memberTypeValidated attribute set to TRUE + // consistencyStrategy attribute set to SET_MIXED + // and the AE having privileges to perform UPDATE operation on the TARGET_RESOURCE_ADDRESS + v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + v_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(1, {c_memberResourceAddress1}, omit); + v_createRequest.primitiveContent.any_1[0].Group_optional.memberType := c_memberType1; + v_createRequest.primitiveContent.any_1[0].Group_optional.memberTypeValidated := true; + v_createRequest.primitiveContent.any_1[0].Group_optional.consistencyStrategy := c_consistentcyStrategy; + v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_1 + // having resourceType attribute RESOURCE_TYPE_1 + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_2 + // having resourceType attribute RESOURCE_TYPE_2 + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_2"); + f_cse_createResource(c_ResourceType2, v_createMember, v_aeIndex); + + + //Test Body + + // the IUT receives an valid UPDATE request from AE containing + // To set to TARGET_RESOURCE_ADDRESS and + // From set to AE-ID and + // Content set to <group> resource containing + // memberIDs attribute set to + // MEMBER_RESOURCE_ADDRESS_1, + // MEMBER_RESOURCE_ADDRESS_2 + v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest); + v_request.to_ := c_targetResourceAddress; + v_request.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(2, {c_memberResourceAddress1, c_memberResourceAddress2}, omit); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": update successful"); + + //memberTypeValidated attribute set to FALSE + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberTypeValidated)) { + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not provided"); + } else { + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberTypeValidated != false) { + setverdict(fail, testcasename(), ": Error, memberTypeValidated must be FALSE"); + }} + + //memberType attribute set to MIXED + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberType)) { + setverdict(fail, testcasename(), ": Error, memberType attribute not provided"); + } else { + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberType != c_memberType_MIXED) { + setverdict(fail, testcasename(), ": Error, memberType was not set to MIXED"); + }} + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + } // end group g_CSE_GMG_BV_016 + + group g_CSE_GMG_BV_017 { + // Test objective: Check that the IUT handles unsuccessful validation of the resource type during an UPDATE of the <group> resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is ABANDON_MEMBER. + testcase TC_CSE_GMG_BV_017() runs on CseTester system CseSystem + { + //Local constants + const ResourceType c_ResourceTypeGroup := int9; + const ResourceType c_ResourceType1 := int4; + const ResourceType c_ResourceType2 := int5; + const MemberType c_memberType1 := int4; // should be set same type as c_ResourceType1 + const MemberType c_memberType2 := int5; // should be set same type as c_ResourceType2 + const XSD.String c_primitiveContent := "primitive_content"; + const ConsistencyStrategy c_consistentcyStrategy := int1; // ABANDOND_MEMBER: TS-0004, Table 6.3.4.2.12-1 + const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS"; + const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; + const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_groupIndex := -1; + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + var template RequestPrimitive v_createMember; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi + + // and the IUT having a resource at TARGET_RESOURCE_ADDRESS of type <group> + // containing + // memberIDs attribute set to MEMBER_RESOURCE_ADDRESS_1 + // memberType attribute set to RESOURCE_TYPE_1 + // memberTypeValidated attribute set to TRUE + // consistencyStrategy attribute set to ABANDON_MEMBER + // and the AE having privileges to perform UPDATE operation on the TARGET_RESOURCE_ADDRESS + v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + v_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(1, {c_memberResourceAddress1}, omit); + v_createRequest.primitiveContent.any_1[0].Group_optional.memberType := c_memberType1; + v_createRequest.primitiveContent.any_1[0].Group_optional.memberTypeValidated := true; + v_createRequest.primitiveContent.any_1[0].Group_optional.consistencyStrategy := c_consistentcyStrategy; + v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_1 + // having resourceType attribute RESOURCE_TYPE_1 + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_2 + // having resourceType attribute RESOURCE_TYPE_2 + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_2"); + f_cse_createResource(c_ResourceType2, v_createMember, v_aeIndex); + + + //Test Body + v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest); + v_request.to_ := c_targetResourceAddress; + v_request.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(2, {c_memberResourceAddress1, c_memberResourceAddress2}, omit); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": update successful"); + + //memberTypeValidated attribute set to TRUE + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberTypeValidated)) { + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not provided"); + } else { + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberTypeValidated != true) { + setverdict(fail, testcasename(), ": Error, memberTypeValidated must be TRUE"); + }} + + //memberIDs attribute set to + // MEMBER_RESOURCE_ADDRESS_1 + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs)){ + setverdict(fail, testcasename(), ": Error, memberIDs attribute not provided"); + } else { + if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs) != 1) { + setverdict(fail, testcasename() & ": Error, wrong number of memberIDs attribute"); + } + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs[0] != c_memberResourceAddress1){ + setverdict(fail, testcasename(), ": Error, memberIDs attribute not correct"); + } + } + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + } // end group g_CSE_GMG_BV_017 + + group g_CSE_GMG_BV_018 { + // Test objective: Check that the IUT handles unsuccessful validation of the resource type during the creation of the <group> resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is ABANDON_GROUP. + testcase TC_CSE_GMG_BV_018() runs on CseTester system CseSystem + { + //Local constants + const ResourceType c_ResourceTypeGroup := int9; + const ResourceType c_ResourceType1 := int4; + const ResourceType c_ResourceType2 := int5; + const MemberType c_memberType1 := int4; // should be set same type as c_ResourceType1 + const MemberType c_memberType2 := int5; // should be set same type as c_ResourceType2 + const XSD.String c_primitiveContent := "primitive_contet"; + const ConsistencyStrategy c_consistentcyStrategy := int2; // ABANDOND_GROUP + const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS"; + const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; + const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_groupIndex := -1; + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + var template RequestPrimitive v_createMember; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi + + // and the IUT having a resource at TARGET_RESOURCE_ADDRESS of type <group> + // containing + // memberIDs attribute set to MEMBER_RESOURCE_ADDRESS_1 + // memberType attribute set to RESOURCE_TYPE_1 + // memberTypeValidated attribute set to TRUE + // consistencyStrategy attribute set to # (ABANDON_GROUP) + // and the AE having privileges to perform UPDATE operation on the + // TARGET_RESOURCE_ADDRESS + v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + v_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(1, {c_memberResourceAddress1}, omit); + v_createRequest.primitiveContent.any_1[0].Group_optional.memberType := c_memberType1; + v_createRequest.primitiveContent.any_1[0].Group_optional.memberTypeValidated := true; + v_createRequest.primitiveContent.any_1[0].Group_optional.consistencyStrategy := c_consistentcyStrategy; + v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_1 + // having resourceType attribute RESOURCE_TYPE_1 + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_2 + // having resourceType attribute RESOURCE_TYPE_2 + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_2"); + f_cse_createResource(c_ResourceType2, v_createMember, v_aeIndex); + + + //Test Body + v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest); + v_request.to_ := c_targetResourceAddress; + v_request.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(2, {c_memberResourceAddress1, c_memberResourceAddress2}, omit); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": deleted successful"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + } // end group g_CSE_GMG_BV_018 + + group g_CSE_GMG_BV_019 { + // Test objective: Check that the IUT detects when the number of memberIDs exceeds the limitation of maxNrOfMembers. + testcase TC_CSE_GMG_BV_019() runs on CseTester system CseSystem + { + //Local constants + const ResourceType c_ResourceTypeGroup := int9; + const ResourceType c_ResourceType1 := int4; + const MemberType c_memberType1 := int4; // should be set same type as c_ResourceType1 + const XSD.String c_primitiveContent := "primitive_contet"; + const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS"; + const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; + const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; + const XSD.AnyURI c_memberResourceAddress3 := "MEMBER_RESSOURCE_ADDRESS_3"; + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_groupIndex := -1; + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + var template RequestPrimitive v_createMember; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi + + // and the IUT having a resource at TARGET_RESOURCE_ADDRESS of type <group> + // containing + // memberIDs attribute set to MEMBER_RESOURCE_ADDRESS_1, + // MEMBER_RESOURCE_ADDRESS_2 + // maxNrOfMembers attribute set to 2 + // and the AE having privileges to perform UPDATE operation on the TARGET_RESOURCE_ADDRESS + v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + v_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(2, {c_memberResourceAddress1, c_memberResourceAddress2}, omit); + v_createRequest.primitiveContent.any_1[0].Group_optional.maxNrOfMembers := 2; + v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_1 + // having resourceType attribute RESOURCE_TYPE_1 + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_2 + // having resourceType attribute RESOURCE_TYPE_1 + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_3 + // having resourceType attribute RESOURCE_TYPE_1 + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_2"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_3"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + + + //Test Body + v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest); + v_request.to_ := c_targetResourceAddress; + v_request.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(3, {c_memberResourceAddress1, c_memberResourceAddress2, c_memberResourceAddress3}, omit); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": operation is not allowed"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + } // end group g_CSE_GMG_BV_019 + + group g_CSE_GMG_BV_020 { + // Test objective: Check that the IUT detects when the value provided for maxNrOfMembers attribute is less than the value of the currentNrOfMembers attribute. + testcase TC_CSE_GMG_BV_020() runs on CseTester system CseSystem + { + //Local constants + const ResourceType c_ResourceTypeGroup := int9; + const ResourceType c_ResourceType1 := int4; + const MemberType c_memberType1 := int4; // should be set same type as c_ResourceType1 + const XSD.String c_primitiveContent := "primitive_contet"; + const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS"; + const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; + const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; + const XSD.AnyURI c_memberResourceAddress3 := "MEMBER_RESSOURCE_ADDRESS_3"; + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_groupIndex := -1; + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + var template RequestPrimitive v_createMember; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi + + // and the IUT having a resource at TARGET_RESOURCE_ADDRESS of type <group> + // containing + // memberIDs attribute set to MEMBER_RESOURCE_ADDRESS_1, + // MEMBER_RESOURCE_ADDRESS_2 + // maxNrOfMembers attribute set to 2 + // and the AE having privileges to perform UPDATE operation on the TARGET_RESOURCE_ADDRESS + v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + v_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(3, {c_memberResourceAddress1, c_memberResourceAddress2, c_memberResourceAddress3}, omit); + v_createRequest.primitiveContent.any_1[0].Group_optional.maxNrOfMembers := 3; + v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + + + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_1 + // having resourceType attribute RESOURCE_TYPE_1 + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_2 + // having resourceType attribute RESOURCE_TYPE_1 + // and the IUT having a resource at MEMBER_RESOURCE_ADDRESS_3 + // having resourceType attribute RESOURCE_TYPE_1 + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_2"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_3"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + + + //Test Body + v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest); + v_request.to_ := c_targetResourceAddress; + v_request.primitiveContent.any_1[0].Group_optional.maxNrOfMembers := 2; + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": operation is not allowed"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + } // end group g_CSE_GMG_BV_020 + + group g_CSE_GMG_BV_021 { + // Test objective: Check that the IUT handles validation of the resource type during an UPDATE of the <group> resource when memberIDs contains a sub-group on a temporarily unreachable Hosting CSE. + testcase TC_CSE_GMG_BV_021() runs on CseTester system CseSystem + { + //Local constants + const ResourceType c_ResourceTypeGroup := int9; + const ResourceType c_ResourceType1 := int4; + const MemberType c_memberType1 := int4; // should be set same type as c_ResourceType1 + const XSD.String c_primitiveContent := "primitive_contet"; + const ConsistencyStrategy c_consistentcyStrategy := int1; // ABANDOND_MEMBER + const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS"; + const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; + const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_groupIndex := -1; + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + var template RequestPrimitive v_createMember; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi +// TODO: -> register IUT to the remoteCSE + + v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + v_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(1, {c_memberResourceAddress1}, omit); + v_createRequest.primitiveContent.any_1[0].Group_optional.memberType := c_memberType1; + v_createRequest.primitiveContent.any_1[0].Group_optional.memberTypeValidated := true; + v_createRequest.primitiveContent.any_1[0].Group_optional.consistencyStrategy := c_consistentcyStrategy; + v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + + // TODO: -> do the resources actually need to be created? + // TODO: choose the right template for member resource + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + + // TODO: create resource of type <group> at c_memberResourceAddress2 on remoteCSE + // TODO: set onlineStatus to false on remoteCSE + + + //Test Body + v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest); + v_request.to_ := c_targetResourceAddress; + v_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(2, {c_memberResourceAddress1, c_memberResourceAddress2}, omit); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response { + tc_ac.stop; + + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberTypeValidated)) { + setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not provided"); + } else { + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberTypeValidated == false) { + if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs) != 2) { + setverdict(fail, testcasename() & ": Error, wrong number of memberIDs attribute"); + } else { + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs[0] == c_memberResourceAddress1 and v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs[1] == c_memberResourceAddress2) { + setverdict(pass, testcasename() & ": update successful"); + } else { + setverdict(fail, testcasename(), ": Error, wrong memberIDs"); + } + } + } else { + setverdict(fail, testcasename(), ": Error, memberTypeValidated must be set to FALSE"); + } + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + } // end group g_CSE_GMG_BV_021 + + group g_CSE_GMG_BV_022 { + // Test objective: Check that the IUT handles validation of the resource type during an UPDATE of the <group> resource when memberIDs contains a sub-group on a a previously unreachable Hosting CSE that has become reachable + testcase TC_CSE_GMG_BV_022() runs on CseTester system CseSystem + { + //Local constants + const ResourceType c_ResourceTypeGroup := int9; + const ResourceType c_ResourceType1 := int4; + const MemberType c_memberType1 := int4; // should be set same type as c_ResourceType1 + const XSD.String c_primitiveContent := "primitive_contet"; + const ConsistencyStrategy c_consistentcyStrategy := int1; // ABANDOND_MEMBER + const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS"; + const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1"; + const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2"; + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_remoteCSEIndex := -1; + var integer v_groupIndex := -1; + + var template RequestPrimitive v_createRequest := m_createGroupBase; + var template RequestPrimitive v_updateRequest := m_updateGroupBase; + var template RequestPrimitive v_createMember; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi +// TODO: -> register IUT to the remoteCSE + //v_remoteCSEIndex := ... + + v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + v_createRequest.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup(2, {c_memberResourceAddress1, c_memberResourceAddress2}, omit); + v_createRequest.primitiveContent.any_1[0].Group_optional.memberType := c_memberType1; + v_createRequest.primitiveContent.any_1[0].Group_optional.memberTypeValidated := false; + v_createRequest.primitiveContent.any_1[0].Group_optional.consistencyStrategy := c_consistentcyStrategy; + v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex); + + // TODO: -> the AE having a subscription to c_targetResourceAddress + + // TODO: -> do the resources actually need to be created? + // TODO: choose the right template for member resource + v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1"); + f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex); + + // TODO: create resource of type <group> at c_memberResourceAddress2 on remoteCSE + // TODO: set onlineStatus to false on remoteCSE + + + //Test Body + v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest); + //v_request.from_ := CSE-ID + v_request.to_ := f_getResourceAddress(v_remoteCSEIndex); + //Content set to <remoteCSE> resource containing onlineStatus := false; + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response { + tc_ac.stop; + + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + } // end group g_CSE_GMG_BV_022 } // end group Group_Managment