diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index e4c593a0be86aff473047a2d9d3281a24bb8e201..900f98cda2e3cf7407920fc800c36fe6bf61fe1a 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -1586,6 +1586,42 @@ module OneM2M_Functions { } //end f_cse_notifyProcedure_noNotification Handler + /** + * @desc Message exchange for notification + * @param p_requestPrimitive Notify request to be used for the notification + * @verdict + */ + function f_cse_notifyProcedure_notify(template RequestPrimitive p_requestPrimitive) runs on CseSimu { + // Local variables + var RequestPrimitive v_request; + var ResponsePrimitive v_responsePrimitive; + var integer v_resourceIndex := -1; + + v_request.from_ := PX_CSE1_ID; + + mccPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mccPort.receive(mw_response(mw_responsePrimitive(int2000, mw_primitiveContentNotification(mw_contentNotification_any)))) -> value vc_response { + tc_ac.stop; + } + [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(inconc, __SCOPE__&":INFO: Error while performing notification"); + } + [] mccPort.receive { + tc_ac.stop; + setverdict(inconc, __SCOPE__&":INFO: Unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, __SCOPE__&":INFO: No answer while performing notification"); + } + } + + f_checkCseSimuStatus(); + + } //end f_cse_notifyProcedure_notify + /** * @desc Checking of notification primitiveContent * @param p_requestPrimitive Received Notification request diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 02ff8ea7a0a74fe678a1423895f5d1c8a6569d52..59019bab06a914bc29755d388e342a9f3d48bf6b 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -376,6 +376,16 @@ module OneM2M_Templates { } }; + /** + * @desc RETRIEVE request primtive for polling request + * @param p_targetResourceAddress Target resource address + * @param p_filterCriteria FilterCriteria + * @param p_originator Originator (from) + */ + template (value) RequestPrimitive m_retrievePollingRequest(XSD.ID p_targetResourceAddress, in XSD.ID p_originator) modifies m_retrieve := { + to_ := p_targetResourceAddress & "/pcu" + }; + /** * @desc FilterCriteria empty template */ @@ -1240,13 +1250,13 @@ module OneM2M_Templates { /** * @desc Base NOTIFY request primitive */ - template RequestPrimitive m_notify := { + template RequestPrimitive m_notify(XSD.ID p_resourceAddress) := { operation := int5, - to_ := "NotInitialized", - from_ := omit, + to_ := p_resourceAddress, + from_ := "NotInitialized", requestIdentifier := testcasename() & "-m_notify" & f_rnd(1, 1000000), resourceType := omit, - primitiveContent := {notification := m_contentCreateNotification_allOmit}, + primitiveContent := {notification := m_contentNotification_allOmit}, roleIDs := omit, originatingTimestamp := omit, requestExpirationTimestamp := omit, @@ -1277,7 +1287,7 @@ module OneM2M_Templates { from_ := omit, requestIdentifier := testcasename() & "-m_notifyAggregatedNotification" & f_rnd(1, 1000000), resourceType := omit, - primitiveContent := {aggregatedNotification := {notification_list := {m_contentCreateNotification_allOmit,m_contentCreateNotification_allOmit}}}, + primitiveContent := {aggregatedNotification := {notification_list := {m_contentNotification_allOmit,m_contentNotification_allOmit}}}, roleIDs := omit, originatingTimestamp := omit, requestExpirationTimestamp := omit, @@ -1374,6 +1384,10 @@ module OneM2M_Templates { } template PrimitiveContent mw_primitiveContent := ?; + + template PrimitiveContent mw_primitiveContentNotification (template Notification p_notification) := { + notification := p_notification + }; /** * @desc Base primitiveContent for CREATE operation for AEAnnc resource @@ -2197,25 +2211,6 @@ module OneM2M_Templates { iPEDiscoveryRequest := omit }; - template (value) Notification m_contentCreateNotification_allOmit := { - notificationEvent := { - representation := omit, - operationMonitor := { - operation := omit, - originator := omit - }, - notificationEventType := omit - }, - verificationRequest := omit, - subscriptionDeletion := omit, - subscriptionReference := omit, - creator := omit, - notificationForwardingURI := omit, - notificationTarget := omit, - targetRemovalRequest := omit, - targetRemovalAllowance := omit, - iPEDiscoveryRequest := omit - }; /** * @desc Base primitiveContent for CREATE operation for SemanticDescriptor resource */ @@ -4072,6 +4067,23 @@ module OneM2M_Templates { vendorInformation := * }; + template ResponsePrimitive mw_responsePollingResponse (template RequestPrimitive p_requestPrimitive := ?) := { + responseStatusCode := int2000, + requestIdentifier := ?, + primitiveContent := {requestPrimitive := p_requestPrimitive}, + to_ := *, + from_ := *, + originatingTimestamp := *, + resultExpirationTimestamp := *, + eventCategory := *, + contentStatus := *, + contentOffset := *, + assignedTokenIdentifiers := *, + tokenRequestInformation := *, + releaseVersionIndicator := ?, + vendorInformation := * + }; + template ResponsePrimitive mw_responseDiscovery (template URIList p_uriList := ?) := { responseStatusCode := int2000, requestIdentifier := ?, @@ -4105,6 +4117,8 @@ module OneM2M_Templates { releaseVersionIndicator := "2a", vendorInformation := omit }; + + group InfoPortTemplates { diff --git a/OneM2M_Testcases_CSE_Release_2.ttcn b/OneM2M_Testcases_CSE_Release_2.ttcn index b0d8d2e1587303841dc8e273c18e1aaa42ed9971..24370a16f4e32e687aacdf4d66ca9f0d213f6b58 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -7196,6 +7196,84 @@ module OneM2M_Testcases_CSE_Release_2 { }//end group Basic }//end group Announcement + + group PollingChannel { + + /** + * @desc Check that the IUT which hosts <pollingChannel> resource forwards a Notify request successfully to a target AE, once the IUT receives a polling request from AE (retrieve request to <pollingChannelURI> resource) + * + */ + testcase TC_CSE_PCH_001() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_PCH_001()); + + v_ae1.done; + + } + + function f_CSE_PCH_001() runs on AeSimu { + // Local variables + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var RequestPrimitive v_request; + var MsgIn v_response; + var RequestPrimitive v_requestNotify; + + // Test control + + // Test component configuration + f_cf02Up(); + + // Test adapter configuration + + // Preamble + vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase)); + vc_cse1.done; + + v_aeIndex := f_cse_preamble_registerAe();//AE1 is registred; + + v_resourceIndex := f_cse_createResource(int15, m_createPollingChannelBase, v_aeIndex); + + v_request := valueof(m_retrievePollingRequest(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); + mcaPort.send(m_request(v_request)); + + v_requestNotify := valueof(m_notify(f_getResourceAddress(v_aeIndex))); + + vc_cse1.start(f_cse_notifyProcedure_notify(v_requestNotify)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePollingResponse(v_requestNotify))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Polling response received"); + } + [] mcaPort.receive(mw_response(mw_responsePollingResponse)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Content not carrying request targeting AE1"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong status code"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } // end TC_CSE_PCH_001 + + }//end group PollingChannel }//end group CSE