From e9fe7f3d3261b91e5610efd15c61fb78f34bb02a Mon Sep 17 00:00:00 2001 From: pkulkarni <pkulkarni75@gmail.com> Date: Tue, 5 Sep 2017 09:11:12 +0200 Subject: [PATCH] Discovery fixes --- LibOneM2M/OneM2M_Templates.ttcn | 32 ++++++++++++++++++++++++++++++-- OneM2M_Testcases.ttcn | 24 ++++++++++++++++-------- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 36cfed2..d640f36 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -222,6 +222,34 @@ module OneM2M_Templates { } }; + /** + * @desc RETRIEVE request primtive containing the Filter Criteria in the filterCriteria field + * @param p_targetResourceAddress Target resource address + * @param p_originator Originator (from) + * @param p_filterUsage FilterUsage + * @param p_labels Labels + */ + template (value) RequestPrimitive m_retrieveResourceFilterUsageOptionLabel(XSD.ID p_targetResourceAddress, in XSD.ID p_originator, in template (value) FilterUsage p_filterUsage, in Labels p_labels) modifies m_retrieveResource := { + requestIdentifier := "m_retrieveResourceFilterUsageOptionLabel" & f_rnd(1, 1000000), + filterCriteria := { + createdBefore := omit, + createdAfter := omit, + modifiedSince := omit, + unmodifiedSince := omit, + stateTagSmaller := omit, + stateTagBigger := omit, + expireBefore := omit, + expireAfter := omit, + labels := p_labels, + resourceType := omit, + sizeAbove := omit, + sizeBelow := omit, + contentType_list := {}, + attribute_list := {}, + filterUsage := p_filterUsage, + limit := omit + } + }; /** * @desc RETRIEVE request primtive containing the Discovery Type in the discoveryResultType field and Filter Criteria in the filterCriteria field * @param p_targetResourceAddress Target resource address @@ -3545,10 +3573,10 @@ module OneM2M_Templates { tokenRequestInformation := * }; - template ResponsePrimitive mw_responseDiscovery := { + template ResponsePrimitive mw_responseDiscovery (template URIList p_uriList := ?) := { responseStatusCode := int2000, requestIdentifier := ?, - primitiveContent := {uRIList := ?}, + primitiveContent := {uRIList := p_uriList}, to_ := *, from_ := *, originatingTimestamp := *, diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index 707f9c0..d8fd053 100644 --- a/OneM2M_Testcases.ttcn +++ b/OneM2M_Testcases.ttcn @@ -15770,7 +15770,8 @@ module OneM2M_Testcases { var integer v_resourceIndex := -1; var RequestPrimitive v_request; var integer v_childResourceIndex := -1; - const ResourceType c_containerResourceType := int3; + const ResourceType c_containerResourceType := int3; + var Labels v_labels := {"NotFoundLabel"}; // Test control @@ -15784,7 +15785,8 @@ module OneM2M_Testcases { v_resourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_aeIndex); v_childResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_resourceIndex); - v_request := valueof(m_retrieveResourceFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1)); + //v_request := valueof(m_retrieveResourceFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1)); + v_request := valueof(m_retrieveResourceFilterUsageOptionLabel(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1, v_labels)); mcaPort.send(m_request(v_request)); tc_ac.start; alt { @@ -15829,7 +15831,8 @@ module OneM2M_Testcases { var integer v_resourceIndex := -1; var RequestPrimitive v_request; var integer v_childResourceIndex := -1; - const ResourceType c_containerResourceType := int3; + const ResourceType c_containerResourceType := int3; + var integer v_i_cont := 0; // Test control @@ -15849,10 +15852,13 @@ module OneM2M_Testcases { alt { [] mcaPort.receive(mw_response(mw_responseDiscovery)) -> value v_response { tc_ac.stop; - if (f_isNonHierarchical(v_response.primitive.responsePrimitive.primitiveContent.uRIList[0])) { - setverdict(pass, __SCOPE__ & ": Non-hierarchical address form present in URIList element"); - } else { - setverdict(fail, __SCOPE__ & ": Non-hierarchical address form absent in URIList representation"); + while (v_i_cont<sizeof(v_response.primitive.responsePrimitive.primitiveContent.uRIList)){ + if (f_isNonHierarchical(v_response.primitive.responsePrimitive.primitiveContent.uRIList[v_i_cont])) { + setverdict(pass, __SCOPE__ & ": Non-hierarchical address form present in URIList[" & int2str(v_i_cont) & "] element"); + } else { + setverdict(fail, __SCOPE__ & ": Non-hierarchical address form absent in URIList[" & int2str(v_i_cont) & "] element"); + } + v_i_cont := v_i_cont + 1; } } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { @@ -16015,7 +16021,9 @@ module OneM2M_Testcases { v_resourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_aeIndex); v_childResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_resourceIndex); - v_request := valueof(m_retrieveResourceInvalidFormatOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); + v_request := valueof(m_retrieveResourceFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1)); + v_request.filterCriteria.expireBefore := "20171231T012345"; + v_request.filterCriteria.expireAfter := "20181231T012345"; mcaPort.send(m_request(v_request)); tc_ac.start; alt { -- GitLab