Commit b145efad authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Added a PTC to handle subscription verification. Updated all TCs that need to...


Added a PTC to handle subscription verification. Updated all TCs that need to integrate subscription verification.
Signed-off-by: Miguel Angel Reina Ortega's avatarMiguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
parent ef812156
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Functions.ttcn $
* $Id: OneM2M_Functions.ttcn 155 2016-10-28 12:08:48Z reinaortega $
* $Id: OneM2M_Functions.ttcn 163 2016-11-10 08:50:50Z carres $
* @desc Module containing functions for oneM2M
*
*/
......@@ -181,6 +181,18 @@ module OneM2M_Functions {
return v_serviceSubscribedAppRuleIndex;
}
function f_cse_preamble_subscriptionVerification(out CseTester p_notifyHandler,in integer p_aeIndex, inout integer p_ae2Index, inout template RequestPrimitive p_createRequestPrimitive,in ResourceType p_resourceType ) runs on CseTester {
if(p_resourceType == int23){
p_notifyHandler := CseTester.create("NotifyHandler") alive;
p_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE_ID_STEM, "MyAe2", {"http://" & PX_TESTER_ADDRESS & "/"}), -1); // AE2 is registred
vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {p_ae2Index};
if(ischosen(p_createRequestPrimitive.primitiveContent.any_1[0].Subscription_optional)){ //this condition is necessary for Subscription TCs where notification URI is set in m_createSubscriptionAdvanced
p_createRequestPrimitive.primitiveContent.any_1[0].Subscription_optional.notificationURI := {f_getResourceAddress(p_ae2Index)};
}
p_notifyHandler.start(f_subscription_Handler(f_getResourceAddress(p_aeIndex)));
}
}
}//end group preambleFunctions
......@@ -205,8 +217,8 @@ module OneM2M_Functions {
v_request := valueof(m_deleteRequest(v_resourceAddress));
if(PX_FROM_IS_AE_ID){
if(not(ischosen(vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.any_1[0].AccessControlPolicy_optional))) {
v_request.from_ := vc_aeAux.aE_ID;
if(ischosen(vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.any_1[0].AE_optional)) {
v_request.from_ := vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.any_1[0].AE_optional.aE_ID;
}
}
mcaPort.send(m_request(v_request));
......@@ -457,7 +469,8 @@ module OneM2M_Functions {
*/
function f_getCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_request := m_create, integer p_parentIndex) runs on CseTester return RequestPrimitive {
var integer p_locresourceIndex := p_parentIndex;
var template ListOfURIs v_notificationURI := {"Not Initialized"};
p_request.from_ := f_getOriginator(p_parentIndex);
p_request.to_ := f_getResourceAddress(p_parentIndex);
......@@ -476,16 +489,19 @@ module OneM2M_Functions {
}
if (p_resourceType == int15) {//pollingChannel
p_request.from_ := vc_aeAux.aE_ID;
if(ischosen(vc_resourcesList[p_parentIndex].resource.any_1[0].AE_optional)) {
p_request.from_ := vc_resourcesList[p_parentIndex].resource.any_1[0].AE_optional.aE_ID;
}
}
if (p_resourceType == int18) {//schedule
}
if (p_resourceType == int23) {//subscription
p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {f_getResourceAddress(p_parentIndex)};
/*if(PX_FROM_IS_AE_ID) {
if(match(valueof(p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI), v_notificationURI )){
p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {f_getResourceAddress(p_parentIndex)};
}
/*if(PX_FROM_IS_AE_ID) {
if(PX_UNSTRUCTURED){
p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {vc_aeAux.aE_ID};
} else {
......@@ -798,13 +814,173 @@ module OneM2M_Functions {
}//end of commonFunctions
group Sylvain {
function f_subscription_Handler(in XSD.ID p_creator, in ResponseStatusCode v_responseStatusCode := int2001) runs on CseTester {
// Local variables
var MsgIn v_response;
var ResponsePrimitive v_responsePrimitive;
var template Notification v_notificationRequest := mw_contentNotificationBase;
var PrimitiveContent v_notificationResponse; // TODO Need to see if this parameter is required however there is a problem if it s omitted during the verification
map(self:mcaPort, system:mcaPort);
map(self:acPort, system:acPort);
v_notificationResponse.any_1 := {{Notification := valueof(mw_contentNotificationAllOmit)}};
v_notificationRequest.verificationRequest := true;
v_notificationRequest.creator := p_creator;
//v_notificationRequest.subscriptionReference := "I Don't know which URI is expected"; // TODO mandatory parameter
v_responsePrimitive := valueof(m_responseNotification(v_responseStatusCode,v_notificationResponse));//TODO No PrimitiveContent is expected
if(v_responseStatusCode != int2001){
v_responsePrimitive.primitiveContent := omit;
}
tc_ac.start;
alt {
[] mcaPort.receive(mw_request(mw_notify(v_notificationRequest))) -> value v_response {
tc_ac.stop;
setverdict(pass, testcasename() & ": Notification received");
//mcaPort.send(m_response(p_responsePrimitive));
}
[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Notification received but verificationRequest isn't set to TRUE");
}
[] mcaPort.receive{
tc_ac.stop;
setverdict(fail, testcasename() & ": Error, unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No notification received");
}
}
mcaPort.send(m_response(v_responsePrimitive)); // TODO have to be deleted
unmap(self:mcaPort, system:mcaPort);
unmap(self:acPort, system:acPort);
} //end f_subscription_Handler
function f_match_contentNotificationRequest(in RequestPrimitive p_requestPrimitive, template PrimitiveContent p_primitiveContent) runs on CseTester return boolean{
// Local variables
var boolean v_matchResult := false;
var integer i;
var integer v_numberOfAggregatedNotification;
if (ischosen(p_primitiveContent.any_1[0].AE_optional)){
if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) {
v_matchResult := match(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, p_primitiveContent.any_1[0].AE_optional)
}
else if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) {
v_matchResult :=match(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, p_primitiveContent.any_1[0].AE_optional)
}
else if (ischosen(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification)) {
v_matchResult := true;
v_numberOfAggregatedNotification := lengthof(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list);
for(i := 0; i< v_numberOfAggregatedNotification; i := i + 1){
if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource)) {
if(not (match(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource.AE_optional, p_primitiveContent.any_1[0].AE_optional))){
v_matchResult := false;
}
}
else if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive)) {
if(not (match(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, p_primitiveContent.any_1[0].AE_optional))){
v_matchResult := false;
}
}
}
if (i == 0){
v_matchResult := false;
}
}
}
if (ischosen(p_primitiveContent.any_1[0].Container_optional)){
if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) {
v_matchResult := match(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.Container_optional, p_primitiveContent.any_1[0].Container_optional)
}
else if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) {
v_matchResult := match(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].Container_optional, p_primitiveContent.any_1[0].Container_optional)
}
}
return v_matchResult;
} //end f_match_contentNotificationRequest
function f_update_attribute_request(in RequestPrimitive p_requestPrimitive) runs on CseTester {
var MsgIn v_response;
mcaPort.send(m_request(p_requestPrimitive));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)");
}
[] mcaPort.receive{
tc_ac.stop;
setverdict(fail, testcasename() & ": Error, unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received");
}
}
}// end f_update_attribute_request
function f_match_notification_primitive(template PrimitiveContent p_primitiveContent) runs on CseTester {
// Local variables
var MsgIn v_response;
map(self:mcaPort, system:mcaPort);
map(self:acPort, system:acPort);
tc_ac.start;
alt {
[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_response {
tc_ac.stop;
if(f_match_contentNotificationRequest(v_response.primitive.requestPrimitive, p_primitiveContent)){
setverdict(pass, testcasename() & ": Notification received");
}
else{
setverdict(fail, testcasename() & ": Notification received but the content doesn't match");
}
}
[] mcaPort.receive{
tc_ac.stop;
setverdict(fail, testcasename() & ": Error, unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No notification received");
}
}
mcaPort.send(m_response(valueof(m_responseNotification(int2001))));
unmap(self:mcaPort, system:mcaPort);
unmap(self:acPort, system:acPort);
} //end f_match_notification_primitive
function f_is_component_done(in CseTester p_notifyHandler) runs on CseTester {
tc_ac.start(10.0);
alt {
[] p_notifyHandler.done {
tc_ac.stop;
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae)");
}
}
} //end f_is_component_done
}
......
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Pixits.ttcn $
* $Id: OneM2M_Pixits.ttcn 155 2016-10-28 12:08:48Z reinaortega $
* $Id: OneM2M_Pixits.ttcn 156 2016-11-02 13:35:44Z carres $
* @desc Module containing Pixits for oneM2M
*
*/
......@@ -26,7 +26,7 @@ module OneM2M_Pixits {
modulepar charstring PX_SUT_ADDRESS := "127.0.0.1:8080";
modulepar charstring PX_TESTER_ADDRESS := "127.0.0.1:1400";
modulepar charstring PX_TESTER_ADDRESS := "127.0.0.1:3131";
modulepar charstring PX_XML_NAMESPACE := "om2m=""http://www.onem2m.org/xml/protocols""";
......
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Templates.ttcn $
* $Id: OneM2M_Templates.ttcn 155 2016-10-28 12:08:48Z reinaortega $
* $Id: OneM2M_Templates.ttcn 162 2016-11-09 09:09:44Z carres $
* @desc Module containing templates for oneM2M
*
*/
......@@ -116,7 +116,7 @@ module OneM2M_Templates {
* @param p_targetResourceAddress Target resource address
* @param p_originator Originator (from)
*/
template (value) RequestPrimitive m_retrieveResource(XSD.ID p_targetResourceAddress, in XSD.ID p_originator := PX_AE_ID_STEM) := {
template (value) RequestPrimitive m_retrieveResource(XSD.ID p_targetResourceAddress, in XSD.ID p_originator) := {
operation := int2,
to_ := p_targetResourceAddress,
from_ := p_originator,
......@@ -147,7 +147,7 @@ module OneM2M_Templates {
* @param p_targetResourceAddress Target resource address (including "#AttributeName")
* @param p_originator Originator (from)
*/
template (value) RequestPrimitive m_retrieveResourceAttributeToOption(XSD.ID p_targetResourceAddress, in XSD.ID p_originator := PX_AE_ID_STEM) := {
template (value) RequestPrimitive m_retrieveResourceAttributeToOption(XSD.ID p_targetResourceAddress, in XSD.ID p_originator) := {
operation := int2,
to_ := p_targetResourceAddress,
from_ := p_originator,
......@@ -179,7 +179,7 @@ module OneM2M_Templates {
* @param p_attributeList Target attribute list
* @param p_originator Originator (from)
*/
template (value) RequestPrimitive m_retrieveResourceAttributeContentOption(XSD.ID p_targetResourceAddress, in template (value) AttributeList_1 p_attributeList, in XSD.ID p_originator := PX_AE_ID_STEM ) := {
template (value) RequestPrimitive m_retrieveResourceAttributeContentOption(XSD.ID p_targetResourceAddress, in template (value) AttributeList_1 p_attributeList, in XSD.ID p_originator) := {
operation := int2,
to_ := p_targetResourceAddress,
from_ := p_originator,
......@@ -736,13 +736,8 @@ module OneM2M_Templates {
/**
* @desc Base NOTIFY request primitive
*/
template RequestPrimitive mw_notify(in template Representation p_representation) modifies mw_notifyBase := {
primitiveContent := {
any_1 := {{ Notification := mw_contentNotification(p_representation) }}
}
};
template RequestPrimitive mw_notify_2(in template Notification p_notification) modifies mw_notifyBase := {
template RequestPrimitive mw_notify(in template Notification p_notification) modifies mw_notifyBase := {
primitiveContent := {
any_1 := {{ Notification := p_notification}}
}
......@@ -1909,10 +1904,7 @@ module OneM2M_Templates {
template Notification mw_contentNotification (in template Representation p_representation) modifies mw_contentNotificationBase := {
notificationEvent := {
representation := p_representation,
operationMonitor := {
operation := ?,
originator:= ?
},
operationMonitor := *,
notificationEventType := ?
}
};
......@@ -2085,10 +2077,10 @@ module OneM2M_Templates {
group Notify{
template ResponsePrimitive m_responseNotification(ResponseStatusCode p_statusCode, in template(omit) Notification p_notification := omit) := {
template ResponsePrimitive m_responseNotification(ResponseStatusCode p_statusCode, in template(omit) PrimitiveContent p_notification := omit) := {
responseStatusCode := p_statusCode,
requestIdentifier := "m_responseNotification" & f_rnd(1, 1000000),
primitiveContent := {any_1 := {{Notification := p_notification}}},
primitiveContent := p_notification,
to_ := omit,
from_ := omit,
originatingTimestamp := omit,
......
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_TestControl.ttcn $
* $Id: OneM2M_TestControl.ttcn 97 2016-06-01 15:38:10Z reinaortega $
* $Id: OneM2M_TestControl.ttcn 162 2016-11-09 09:09:44Z carres $
* @desc Test control module for oneM2M
*
*/
......@@ -17,7 +17,6 @@ module OneM2M_TestControl {
import from OneM2M_Testcases all;
control {
}
} // end of module
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment