Loading ttcn/LibSmartAppliances/SmartAppliances_Functions.ttcn +131 −119 Original line number Diff line number Diff line Loading @@ -24,86 +24,53 @@ module SmartAppliances_Functions { group aeFunctions { function f_getResourceIndex(in XSD.AnyURI p_address) return integer { return -1; //TODO } group preambleFunctions { /** * @desc Creates specified resource * @param p_resource Resource to be created * @param p_parentIndex Parent index of resource to be saved * @param p_resourceType Type of the resource to be created * @param p_modifiedResource Assigned and/or modified fields * @return Internal resource index of the saved resource or -1 * @verdict */ function f_createResource(in PrimitiveContent p_resource, in integer p_parentIndex, in ResourceType p_resourceType, out anytype p_modifiedResource) runs on AeTester return integer { var integer v_resourceIndex; // AE if(p_resourceType == int2 and ischosen(p_resource.any_1[0].AE_optional)) { var AE_optional v_ae := p_resource.any_1[0].AE_optional; var AE_optional v_aeModified; v_resourceIndex := lengthof(vc_resourcesList) - 1; v_ae.resourceType := p_resourceType; v_ae.parentID := int2str(p_parentIndex); v_ae.creationTime := fx_generateTimestamp(); v_ae.lastModifiedTime := v_ae.creationTime; v_ae.resourceID := "ae" & int2char(v_resourceIndex); v_ae.aE_ID := "ae" & int2char(v_resourceIndex); v_ae.resourceName := "ae" & int2char(v_resourceIndex); v_aeModified.parentID := v_ae.parentID; v_aeModified.creationTime := v_ae.creationTime; v_aeModified.lastModifiedTime := v_ae.lastModifiedTime; v_aeModified.resourceID := v_ae.resourceID; v_aeModified.aE_ID := v_ae.aE_ID; v_aeModified.resourceName := v_ae.resourceName; p_resource.any_1[0].AE_optional := v_ae; p_modifiedResource.AE_optional := v_aeModified; return f_setResource(p_resource, p_parentIndex); } // Error return -1; } /** * @desc Waits for CREATE request, stores resource and replies to request * @desc Waits for Container CREATE request and process it * @return Internal resource index of container or -1 in case of failure * @verdict inconc if no container CREATE request is received */ altstep a_ae_default_sap() runs on AeTester { function f_ae_preamble_createContainer() runs on AeTester return integer { var MsgIn v_request; var anytype v_modifiedResource; var integer v_resourceIndex, v_parentIndex; var RequestPrimitive v_rp; [] mcaPort.receive(mw_request(mw_create)) -> value v_request { tc_ac.start; alt { [] mcaPort.receive(mw_request(mw_createContainer)) -> value v_request { tc_ac.stop; v_rp := v_request.primitive.requestPrimitive; v_parentIndex := f_getResourceIndex(v_rp.to_); v_resourceIndex := f_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); if(v_resourceIndex != -1) { mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, {any_1 := {v_modifiedResource}}))); log("Preamble: Container created successfuly"); } else { mcaPort.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier))); setverdict(inconc, testcasename() & ": Container creation failed"); } } [] tc_ac.timeout { setverdict(inconc, testcasename() & ": CREATE Container request not received"); stop; } repeat; } return v_resourceIndex; } /** * @desc Waits for AE registration request and process it * @return Internal resource index of AE or -1 in case of failure * @verdict inconc if no AE registration request is received * @desc Waits for FlexContainer CREATE request and process it * @return Internal resource index of container or -1 in case of failure * @verdict inconc if no container CREATE request is received */ function f_ae_preamble_registerAe() runs on AeTester return integer { function f_ae_preamble_createFlexContainer() runs on AeTester return integer { var MsgIn v_request; var anytype v_modifiedResource; Loading @@ -112,24 +79,24 @@ module SmartAppliances_Functions { tc_ac.start; alt { [] mcaPort.receive(mw_request(mw_createAe)) -> value v_request { [] mcaPort.receive(mw_request(mw_createFlexContainer)) -> value v_request { tc_ac.stop; v_rp := v_request.primitive.requestPrimitive; v_parentIndex := f_getResourceIndex(v_rp.to_); v_resourceIndex := f_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); if(v_resourceIndex != -1) { mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, {any_1 := {v_modifiedResource}}))); log("Preamble: Application registered successfuly"); log("Preamble: FlexContainer created successfuly"); } else { mcaPort.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier))); setverdict(inconc, testcasename() & ": AE registration failed"); setverdict(inconc, testcasename() & ": FlexContainer creation failed"); } } [] tc_ac.timeout { setverdict(inconc, testcasename() & ": AE registration request not received"); setverdict(inconc, testcasename() & ": CREATE FlexContainer request not received"); stop; } } Loading @@ -137,36 +104,6 @@ module SmartAppliances_Functions { return v_resourceIndex; } /** * @desc Waits for Container CREATE request and process it * @return Internal resource index of container or -1 in case of failure * @verdict inconc if no container CREATE request is received */ function f_ae_preamble_createContainer() runs on AeTester return integer { var integer v_ret := -1; // TODO log("not implemented"); return v_ret; } /** * @desc Waits for FlexContainer CREATE request and process it * @return Internal resource index of container or -1 in case of failure * @verdict inconc if no container CREATE request is received */ function f_ae_preamble_createFlexContainer() runs on AeTester return integer { var integer v_ret := -1; // TODO log("not implemented"); return v_ret; } /** * @desc Waits for GenericInterworkingOperationInstance CREATE request and process it * @return Internal resource index of GenericInterworkingOperationInstance or -1 in case of failure Loading @@ -174,12 +111,36 @@ module SmartAppliances_Functions { */ function f_ae_preamble_createGenericIwkOpInstance() runs on AeTester return integer { var integer v_ret := -1; var MsgIn v_request; var anytype v_modifiedResource; var integer v_resourceIndex, v_parentIndex; var RequestPrimitive v_rp; tc_ac.start; alt { [] mcaPort.receive(mw_request(mw_createGenericIwkOpInstance)) -> value v_request { tc_ac.stop; // TODO log("not implemented"); v_rp := v_request.primitive.requestPrimitive; v_parentIndex := f_getResourceIndex(v_rp.to_); v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); if(v_resourceIndex != -1) { mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, {any_1 := {v_modifiedResource}}))); log("Preamble: GenericIwkOpInstance created successfuly"); } else { mcaPort.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier))); setverdict(inconc, testcasename() & ": GenericIwkOpInstance creation failed"); } } return v_ret; [] tc_ac.timeout { setverdict(inconc, testcasename() & ": CREATE GenericIwkOpInstance request not received"); stop; } } return v_resourceIndex; } } // end preambleFunctions Loading @@ -200,6 +161,13 @@ module SmartAppliances_Functions { group rdfFunctions { /** * @desc Converts and decodes a base64-encoded SemanticDescriptor into a RDF document * @param p_receivedDescriptor base64-encoded SemanticDescriptor * @param p_decodedDescriptor RDF document representing the decoded SemanticDescriptor * @param p_verdictMsg Status message * @return Verdicttype pass if decoding is successful or inconc if decoding fails */ function f_rdfParseDescriptor(in XSD.Base64Binary p_receivedDescriptor, out RdfDocument p_decodedDescriptor, out charstring p_verdictMsg) return verdicttype { var bitstring v_encodedDescriptor; Loading @@ -215,6 +183,13 @@ module SmartAppliances_Functions { } } /** * @desc Verifies that a SemanticDescriptor matches expectations * @param p_decodedDescriptor RDF Document to be verified * @param p_expectedRdfDescriptor Expected RDF document template * @param p_verdictMsg Status message * @return Verdicttype pass if decoded SemanticDescriptor matches expectation or fail otherwise */ function f_rdfCheckDescriptor(in RdfDocument p_decodedDescriptor, in template RdfDocument p_expectedRdfDescriptor, out charstring p_verdictMsg) return verdicttype { if(match(p_decodedDescriptor, p_expectedRdfDescriptor)) { Loading @@ -227,23 +202,60 @@ module SmartAppliances_Functions { } } function f_rdfFindTriple(in RdfDocument p_rdfDocument, in template RdfTriple p_search, out RdfTriple p_found) return boolean { /** * @desc Finds a specific RDF triple in a RDF document * @param p_rdfDocument RDF document in which the triple is searched * @param p_search RDF triple to be searched (template) * @param p_found RDF triple of the document that matched. Only valid if function result is true * @return true if the searched triple has been found, false otherwise */ function f_rdfFindOneTriple(in RdfDocument p_rdfDocument, in template RdfTriple p_search, out RdfTriple p_found) return boolean { var integer i; //TODO log("Not implemented"); for(i:=0; i < lengthof(p_rdfDocument); i:=i+1) { if(match(p_rdfDocument[i], p_search)) { p_found := p_rdfDocument[i]; return true; } } return false; } /** * @desc Finds all matching RDF triples in a RDF document * @param p_rdfDocument RDF document in which the triple is searched * @param p_search RDF triple to be searched (template) * @param p_found RDF document containing all the triple that that matched. * @return true if the searched triple has been found, false otherwise */ function f_rdfFindAllTriples(in RdfDocument p_rdfDocument, in template RdfTriple p_search, out RdfDocument p_found) return boolean { var integer i; var boolean v_ret := false; p_found := {}; for(i:=0; i < lengthof(p_rdfDocument); i:=i+1) { if(match(p_rdfDocument[i], p_search)) { p_found[lengthof(p_found)] := p_rdfDocument[i]; v_ret := true; } } return v_ret; } } // end refFunctions group externalFunctions { /** * @desc Generates a oneM2M timestamp based on current time. * Format shall be YYYYMMDDTHHMMSS * @desc Converts a base64-encoded blob into bitstring * @param p_base64 Base64-encoded blob to be converted * @return bitstring corresponding to the de-encoded version of the base64 blob */ external function fx_generateTimestamp() return charstring; external function fx_base64ToBitstring(in XSD.Base64Binary p_base64) return bitstring; } Loading ttcn/SmartAppliances_TestControl.ttcn +0 −8 Original line number Diff line number Diff line Loading @@ -306,14 +306,6 @@ module SmartAppliances_TestControl { } } if(PICS_SAP_OBJECT_PROPERTY == true) { // execute(TC_SAP_SAREF_BV_026_XX()); // Not implemented } if(PICS_SAP_DATA_PROPERTY == true) { // execute(TC_SAP_SAREF_BV_027_XX()); // Not implemented } if(PICS_SAP_DEVICE == true) { if(PICS_SAP_DATA_PROPERTY == true) { Loading ttcn/SmartAppliances_Testcases.ttcn +90 −144 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
ttcn/LibSmartAppliances/SmartAppliances_Functions.ttcn +131 −119 Original line number Diff line number Diff line Loading @@ -24,86 +24,53 @@ module SmartAppliances_Functions { group aeFunctions { function f_getResourceIndex(in XSD.AnyURI p_address) return integer { return -1; //TODO } group preambleFunctions { /** * @desc Creates specified resource * @param p_resource Resource to be created * @param p_parentIndex Parent index of resource to be saved * @param p_resourceType Type of the resource to be created * @param p_modifiedResource Assigned and/or modified fields * @return Internal resource index of the saved resource or -1 * @verdict */ function f_createResource(in PrimitiveContent p_resource, in integer p_parentIndex, in ResourceType p_resourceType, out anytype p_modifiedResource) runs on AeTester return integer { var integer v_resourceIndex; // AE if(p_resourceType == int2 and ischosen(p_resource.any_1[0].AE_optional)) { var AE_optional v_ae := p_resource.any_1[0].AE_optional; var AE_optional v_aeModified; v_resourceIndex := lengthof(vc_resourcesList) - 1; v_ae.resourceType := p_resourceType; v_ae.parentID := int2str(p_parentIndex); v_ae.creationTime := fx_generateTimestamp(); v_ae.lastModifiedTime := v_ae.creationTime; v_ae.resourceID := "ae" & int2char(v_resourceIndex); v_ae.aE_ID := "ae" & int2char(v_resourceIndex); v_ae.resourceName := "ae" & int2char(v_resourceIndex); v_aeModified.parentID := v_ae.parentID; v_aeModified.creationTime := v_ae.creationTime; v_aeModified.lastModifiedTime := v_ae.lastModifiedTime; v_aeModified.resourceID := v_ae.resourceID; v_aeModified.aE_ID := v_ae.aE_ID; v_aeModified.resourceName := v_ae.resourceName; p_resource.any_1[0].AE_optional := v_ae; p_modifiedResource.AE_optional := v_aeModified; return f_setResource(p_resource, p_parentIndex); } // Error return -1; } /** * @desc Waits for CREATE request, stores resource and replies to request * @desc Waits for Container CREATE request and process it * @return Internal resource index of container or -1 in case of failure * @verdict inconc if no container CREATE request is received */ altstep a_ae_default_sap() runs on AeTester { function f_ae_preamble_createContainer() runs on AeTester return integer { var MsgIn v_request; var anytype v_modifiedResource; var integer v_resourceIndex, v_parentIndex; var RequestPrimitive v_rp; [] mcaPort.receive(mw_request(mw_create)) -> value v_request { tc_ac.start; alt { [] mcaPort.receive(mw_request(mw_createContainer)) -> value v_request { tc_ac.stop; v_rp := v_request.primitive.requestPrimitive; v_parentIndex := f_getResourceIndex(v_rp.to_); v_resourceIndex := f_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); if(v_resourceIndex != -1) { mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, {any_1 := {v_modifiedResource}}))); log("Preamble: Container created successfuly"); } else { mcaPort.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier))); setverdict(inconc, testcasename() & ": Container creation failed"); } } [] tc_ac.timeout { setverdict(inconc, testcasename() & ": CREATE Container request not received"); stop; } repeat; } return v_resourceIndex; } /** * @desc Waits for AE registration request and process it * @return Internal resource index of AE or -1 in case of failure * @verdict inconc if no AE registration request is received * @desc Waits for FlexContainer CREATE request and process it * @return Internal resource index of container or -1 in case of failure * @verdict inconc if no container CREATE request is received */ function f_ae_preamble_registerAe() runs on AeTester return integer { function f_ae_preamble_createFlexContainer() runs on AeTester return integer { var MsgIn v_request; var anytype v_modifiedResource; Loading @@ -112,24 +79,24 @@ module SmartAppliances_Functions { tc_ac.start; alt { [] mcaPort.receive(mw_request(mw_createAe)) -> value v_request { [] mcaPort.receive(mw_request(mw_createFlexContainer)) -> value v_request { tc_ac.stop; v_rp := v_request.primitive.requestPrimitive; v_parentIndex := f_getResourceIndex(v_rp.to_); v_resourceIndex := f_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); if(v_resourceIndex != -1) { mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, {any_1 := {v_modifiedResource}}))); log("Preamble: Application registered successfuly"); log("Preamble: FlexContainer created successfuly"); } else { mcaPort.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier))); setverdict(inconc, testcasename() & ": AE registration failed"); setverdict(inconc, testcasename() & ": FlexContainer creation failed"); } } [] tc_ac.timeout { setverdict(inconc, testcasename() & ": AE registration request not received"); setverdict(inconc, testcasename() & ": CREATE FlexContainer request not received"); stop; } } Loading @@ -137,36 +104,6 @@ module SmartAppliances_Functions { return v_resourceIndex; } /** * @desc Waits for Container CREATE request and process it * @return Internal resource index of container or -1 in case of failure * @verdict inconc if no container CREATE request is received */ function f_ae_preamble_createContainer() runs on AeTester return integer { var integer v_ret := -1; // TODO log("not implemented"); return v_ret; } /** * @desc Waits for FlexContainer CREATE request and process it * @return Internal resource index of container or -1 in case of failure * @verdict inconc if no container CREATE request is received */ function f_ae_preamble_createFlexContainer() runs on AeTester return integer { var integer v_ret := -1; // TODO log("not implemented"); return v_ret; } /** * @desc Waits for GenericInterworkingOperationInstance CREATE request and process it * @return Internal resource index of GenericInterworkingOperationInstance or -1 in case of failure Loading @@ -174,12 +111,36 @@ module SmartAppliances_Functions { */ function f_ae_preamble_createGenericIwkOpInstance() runs on AeTester return integer { var integer v_ret := -1; var MsgIn v_request; var anytype v_modifiedResource; var integer v_resourceIndex, v_parentIndex; var RequestPrimitive v_rp; tc_ac.start; alt { [] mcaPort.receive(mw_request(mw_createGenericIwkOpInstance)) -> value v_request { tc_ac.stop; // TODO log("not implemented"); v_rp := v_request.primitive.requestPrimitive; v_parentIndex := f_getResourceIndex(v_rp.to_); v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); if(v_resourceIndex != -1) { mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, {any_1 := {v_modifiedResource}}))); log("Preamble: GenericIwkOpInstance created successfuly"); } else { mcaPort.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier))); setverdict(inconc, testcasename() & ": GenericIwkOpInstance creation failed"); } } return v_ret; [] tc_ac.timeout { setverdict(inconc, testcasename() & ": CREATE GenericIwkOpInstance request not received"); stop; } } return v_resourceIndex; } } // end preambleFunctions Loading @@ -200,6 +161,13 @@ module SmartAppliances_Functions { group rdfFunctions { /** * @desc Converts and decodes a base64-encoded SemanticDescriptor into a RDF document * @param p_receivedDescriptor base64-encoded SemanticDescriptor * @param p_decodedDescriptor RDF document representing the decoded SemanticDescriptor * @param p_verdictMsg Status message * @return Verdicttype pass if decoding is successful or inconc if decoding fails */ function f_rdfParseDescriptor(in XSD.Base64Binary p_receivedDescriptor, out RdfDocument p_decodedDescriptor, out charstring p_verdictMsg) return verdicttype { var bitstring v_encodedDescriptor; Loading @@ -215,6 +183,13 @@ module SmartAppliances_Functions { } } /** * @desc Verifies that a SemanticDescriptor matches expectations * @param p_decodedDescriptor RDF Document to be verified * @param p_expectedRdfDescriptor Expected RDF document template * @param p_verdictMsg Status message * @return Verdicttype pass if decoded SemanticDescriptor matches expectation or fail otherwise */ function f_rdfCheckDescriptor(in RdfDocument p_decodedDescriptor, in template RdfDocument p_expectedRdfDescriptor, out charstring p_verdictMsg) return verdicttype { if(match(p_decodedDescriptor, p_expectedRdfDescriptor)) { Loading @@ -227,23 +202,60 @@ module SmartAppliances_Functions { } } function f_rdfFindTriple(in RdfDocument p_rdfDocument, in template RdfTriple p_search, out RdfTriple p_found) return boolean { /** * @desc Finds a specific RDF triple in a RDF document * @param p_rdfDocument RDF document in which the triple is searched * @param p_search RDF triple to be searched (template) * @param p_found RDF triple of the document that matched. Only valid if function result is true * @return true if the searched triple has been found, false otherwise */ function f_rdfFindOneTriple(in RdfDocument p_rdfDocument, in template RdfTriple p_search, out RdfTriple p_found) return boolean { var integer i; //TODO log("Not implemented"); for(i:=0; i < lengthof(p_rdfDocument); i:=i+1) { if(match(p_rdfDocument[i], p_search)) { p_found := p_rdfDocument[i]; return true; } } return false; } /** * @desc Finds all matching RDF triples in a RDF document * @param p_rdfDocument RDF document in which the triple is searched * @param p_search RDF triple to be searched (template) * @param p_found RDF document containing all the triple that that matched. * @return true if the searched triple has been found, false otherwise */ function f_rdfFindAllTriples(in RdfDocument p_rdfDocument, in template RdfTriple p_search, out RdfDocument p_found) return boolean { var integer i; var boolean v_ret := false; p_found := {}; for(i:=0; i < lengthof(p_rdfDocument); i:=i+1) { if(match(p_rdfDocument[i], p_search)) { p_found[lengthof(p_found)] := p_rdfDocument[i]; v_ret := true; } } return v_ret; } } // end refFunctions group externalFunctions { /** * @desc Generates a oneM2M timestamp based on current time. * Format shall be YYYYMMDDTHHMMSS * @desc Converts a base64-encoded blob into bitstring * @param p_base64 Base64-encoded blob to be converted * @return bitstring corresponding to the de-encoded version of the base64 blob */ external function fx_generateTimestamp() return charstring; external function fx_base64ToBitstring(in XSD.Base64Binary p_base64) return bitstring; } Loading
ttcn/SmartAppliances_TestControl.ttcn +0 −8 Original line number Diff line number Diff line Loading @@ -306,14 +306,6 @@ module SmartAppliances_TestControl { } } if(PICS_SAP_OBJECT_PROPERTY == true) { // execute(TC_SAP_SAREF_BV_026_XX()); // Not implemented } if(PICS_SAP_DATA_PROPERTY == true) { // execute(TC_SAP_SAREF_BV_027_XX()); // Not implemented } if(PICS_SAP_DEVICE == true) { if(PICS_SAP_DATA_PROPERTY == true) { Loading
ttcn/SmartAppliances_Testcases.ttcn +90 −144 File changed.Preview size limit exceeded, changes collapsed. Show changes