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

Merge remote-tracking branch 'remotes/origin/STF531-REG-CRE' into Release1


Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parents 2ceb7734 5d4fd380
......@@ -103,6 +103,7 @@ module OneM2M_Functions {
function f_cf02UpCse1() runs on CseSimu {
// Variables
var PrimitiveContent v_cSEBaseResource;
vc_config := e_cf02;
vc_testSystemRole := e_cse;
......@@ -114,6 +115,9 @@ module OneM2M_Functions {
activate(a_default());
activate(a_cse_cf02_cse1());
v_cSEBaseResource := f_cse_generateLocalResource(-, -1, int5);
vc_cSEBaseIndex := f_setLocalResource(v_cSEBaseResource, int5, -1);
//Initialze the IUT
} // end f_cf02UpCse1
......@@ -124,7 +128,8 @@ module OneM2M_Functions {
function f_cf02UpCseSimuMaster() runs on CseSimu {
// Variables
vc_config := e_cf02;
var PrimitiveContent v_cSEBaseResource;
vc_config := e_cf02CseSimuMaster;
vc_testSystemRole := e_cse;
vc_ae1 := AeSimu.create("AE1") alive;
......@@ -136,6 +141,9 @@ module OneM2M_Functions {
activate(a_cse_cf02_cse1());
vc_ae1.start(f_cf02UpAe1());
vc_ae1.done;
v_cSEBaseResource := f_cse_generateLocalResource(-, -1, int5);
vc_cSEBaseIndex := f_setLocalResource(v_cSEBaseResource, int5, -1);
// Connect
......@@ -149,7 +157,7 @@ module OneM2M_Functions {
function f_cf02UpAe1() runs on AeSimu {
// Variables
vc_config := e_cf02;
vc_config := e_cf02CseSimuMaster;
vc_testSystemRole := e_ae;
// Map
......@@ -173,7 +181,7 @@ module OneM2M_Functions {
vc_testSystemRole := e_cse;
// Map
map(self:mcaPort, system:mcaPort);//TODO To be consistent, we should use mcaPortIn for AE testing
map(self:mcaPortIn, system:mcaPortIn);//TODO To be consistent, we should use mcaPortIn for AE testing
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
activate(a_default());
......@@ -191,8 +199,10 @@ module OneM2M_Functions {
function f_cf04Up() runs on CseSimu {
// Variables
var PrimitiveContent v_cSEBaseResource;
vc_config := e_cf04;
vc_testSystemRole := e_cse;
vc_testSystemRole := e_cse;
// Map
map(self:mccPort, system:mccPort);
......@@ -200,10 +210,15 @@ module OneM2M_Functions {
map(self:acPort, system:acPort);
activate(a_default());
activate(a_cse_cf04());
//Creation of CSEBase
v_cSEBaseResource := f_cse_generateLocalResource(-, -1, int5);
vc_cSEBaseIndex := f_setLocalResource(v_cSEBaseResource, int5, -1);
// Connect
//Initialze the IUT
//Initialize the IUT
} // end f_cf03Up
......@@ -256,7 +271,7 @@ module OneM2M_Functions {
*/
function f_cf03Down() runs on CseSimu {
unmap(self:mcaPort, system:mcaPort);
unmap(self:mcaPortIn, system:mcaPortIn);
unmap(self:utPort, system:utPort);
unmap(self:acPort, system:acPort);
}
......@@ -1262,10 +1277,10 @@ module OneM2M_Functions {
group NotificationFunctions {
/**
* @desc Handling message exchange for the subscription verification
* @param p_responseStatusCode Response Status Code to be used for the response to the verification request
* @verdict
/**
* @desc Handling message exchange for the subscription verification
* @param p_responseStatusCode Response Status Code to be used for the response to the verification request
* @verdict
*/
function f_cse_notifyProcedure_subscriptionVerificationHandler(in ResponseStatusCode p_responseStatusCode := int2001) runs on AeSimu {
// Local variables
......@@ -1511,7 +1526,49 @@ module OneM2M_Functions {
return v_matchResult;
} //end f_check_notificationContent
} //end f_check_notificationContent
/**
* @desc Handling message exchange for the AE Annc update
* @param p_responseStatusCode Response Status Code to be used for the response to the AE Annc request
* @verdict
*/
//TODO TO BE FINALIZED
function f_cse_notifyProcedure_updateHandler() runs on CseSimu {
// Local variables
var ResponsePrimitive v_responsePrimitive;
var template Notification v_notificationRequest := mw_contentNotification_any;
//Preparation of Notification response to be sent
v_responsePrimitive := valueof(m_responseNotification(int2004, omit));
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(mw_notify(v_notificationRequest))) -> value vc_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
}
[] mccPortIn.receive{
tc_ac.stop;
setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
stop;
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ":ERROR: No notification received");
stop;
}
}
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
if(getverdict == pass) {
mccPortIn.send(m_httpResponse(v_responsePrimitive));
} else {
v_responsePrimitive.responseStatusCode := int4000;
mccPortIn.send(m_httpResponse(v_responsePrimitive));
}
} //end f_cse_notifyProcedure_updateHandler
}// end of group NotificationFunctions
......@@ -1565,22 +1622,22 @@ module OneM2M_Functions {
alt {
[] mccPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type RemoteCSE created successfuly");
setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly");
f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16, -1);
v_remoteCSEResource := f_cse_generateLocalResource(v_response.primitive.responsePrimitive.primitiveContent, 1, int16);
v_localResourceIndex := f_setLocalResource(v_remoteCSEResource, int16, -1);
v_remoteCSEResource := f_cse_generateLocalResource(v_response.primitive.responsePrimitive.primitiveContent, vc_cSEBaseIndex, int16);
v_localResourceIndex := f_setLocalResource(v_remoteCSEResource, int16, vc_cSEBaseIndex);
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while creating resource type RemoteCSE");
setverdict(inconc, __SCOPE__&":INFO: Error while creating resource type remoteCSE");
}
[] mccPort.receive {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while creating resource type RemoteCSE");
setverdict(inconc, __SCOPE__&":INFO: No answer while creating resource type remoteCSE");
}
}
......@@ -1602,29 +1659,34 @@ module OneM2M_Functions {
var PrimitiveContent v_remoteCSEResource;
var integer v_localResourceIndex := -1;
var integer v_resourceIndex := -1;
var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
var charstring v_action := "Please, send a CSE registration request";
//send triggering primitive to SUT
f_sendUtPrimitive(v_utRequest,v_action);
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(p_requestPrimitive)) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type RemoteCSE created successfuly");
v_remoteCSEResource := f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, 1, int16);//TODO Get index from v_request.primitive.requestPrimitive.to_
v_localResourceIndex := f_setLocalResource(v_remoteCSEResource, int16, -1);
setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly");
v_remoteCSEResource := f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, vc_cSEBaseIndex, int16);//TODO Get index from v_request.primitive.requestPrimitive.to_
v_localResourceIndex := f_setLocalResource(v_remoteCSEResource, int16, vc_cSEBaseIndex);
v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
v_response.from_ := PX_CSE1_ID;
v_response.to_ := v_request.primitive.requestPrimitive.from_;
v_response.primitiveContent.remoteCSE := vc_localResourcesList[v_localResourceIndex].resource.remoteCSE;
mccPort.send(m_response(v_response));
mccPortIn.send(m_response(v_response));
v_resourceIndex := f_setResource(v_request.primitive.responsePrimitive.primitiveContent, int16, -1);
v_resourceIndex := f_setResource(v_request.primitive.requestPrimitive.primitiveContent, int16, -1);
}
[] mccPortIn.receive {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type RemoteCSE");
setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
}
}
......@@ -1670,24 +1732,41 @@ module OneM2M_Functions {
* @param p_resourceType Type of the resource to be created
* @return Internal created resource
*/
function f_cse_generateLocalResource(in PrimitiveContent p_resource, in integer p_parentIndex, in ResourceType p_resourceType) runs on CseSimu return PrimitiveContent {
function f_cse_generateLocalResource(in template(omit) PrimitiveContent p_resource := omit, in integer p_parentIndex, in ResourceType p_resourceType) runs on CseSimu return PrimitiveContent {
var integer v_resourceIndex := lengthof(vc_localResourcesList);
var PrimitiveContent v_myResource;
// TODO To review the code (use of indexes, generation of value for certain attributes, etc..)
if(p_resourceType == int16 and ispresent(p_resource)) {
if(p_resourceType == int5) { //CSEBase
v_myResource.cSEBase.resourceName := "CSEBase" & int2str(v_resourceIndex);
v_myResource.cSEBase.resourceType := p_resourceType;
v_myResource.cSEBase.resourceID := "CSEBase" & int2str(v_resourceIndex);
v_myResource.cSEBase.parentID := omit; //Following TS-0001, it must be NULL
//v_myResource.cSEBase.creationTime := fx_generateTimestamp();
v_myResource.cSEBase.creationTime := "20171231T012345";
v_myResource.cSEBase.lastModifiedTime := v_myResource.cSEBase.creationTime;
v_myResource.cSEBase.cSE_ID := PX_CSE1_ID;
v_myResource.cSEBase.supportedResourceType := PX_CSE1_SRT;
v_myResource.cSEBase.pointOfAccess := {f_getAnnouncementTargetPoA(PX_PROTOCOL_BINDING, PX_CSE1_ADDRESS, "")};
if (PX_MN_CSE){
v_myResource.cSEBase.cseType := int1; //Tester is an IN-CSE
}else if (PX_IN_CSE){
v_myResource.cSEBase.cseType := int2; //Tester is a MN-CSE
}
}else if(p_resourceType == int16 and ispresent(p_resource)) { //RemoteCSE
if(ischosen(p_resource.remoteCSE)){
v_myResource.remoteCSE := p_resource.remoteCSE;
v_myResource.remoteCSE := valueof(p_resource.remoteCSE);
if(not(ispresent(p_resource.remoteCSE.resourceName))) {
v_myResource.remoteCSE.resourceName := "remoteCSE" & int2char(v_resourceIndex);
v_myResource.remoteCSE.resourceName := "remoteCSE" & int2str(v_resourceIndex);
}
v_myResource.remoteCSE.resourceType := p_resourceType;
//v_myResource.remoteCSE.resourceID := "remoteCSE" & int2char(v_resourceIndex);
v_myResource.remoteCSE.resourceID := "remoteCSE";
v_myResource.remoteCSE.resourceID := "remoteCSE" & int2str(v_resourceIndex);
v_myResource.remoteCSE.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource);
v_myResource.remoteCSE.creationTime := fx_generateTimestamp();
//v_myResource.remoteCSE.creationTime := fx_generateTimestamp();
v_myResource.remoteCSE.creationTime := "20171231T012345";
if(not(ispresent(p_resource.remoteCSE.expirationTime))) {
v_myResource.remoteCSE.expirationTime := "20301231T012345";
}
......@@ -1699,10 +1778,10 @@ module OneM2M_Functions {
//TODO Create a pollingChannel resource
v_myResource.remoteCSE.pointOfAccess := omit;
}
if(vc_localResourcesList[v_resourceIndex].resourceType == int5) {
/*if(vc_localResourcesList[v_resourceIndex].resourceType == int5) {
v_myResource.remoteCSE.m2M_Ext_ID := omit;
v_myResource.remoteCSE.trigger_Recipient_ID:= omit;
}
}*/
v_myResource.remoteCSE.nodeLink := omit;
}
......@@ -2208,6 +2287,10 @@ module OneM2M_Functions {
if(ischosen(p_contentResource.serviceSubscribedAppRule)) {
return f_resourceIdCleaner(p_contentResource.serviceSubscribedAppRule.resourceID);
}
if(ischosen(p_contentResource.remoteCSE)) {
return f_resourceIdCleaner(p_contentResource.remoteCSE.resourceID);
}
log(__SCOPE__&":WARNING: Primitive Content Kind not implemented");
return "resourceIDNotFound";
......@@ -2720,27 +2803,10 @@ module OneM2M_Functions {
group CommonFunctions {
/**
* @desc Sending of an Adapter Control primitive
* @param event Action to be performed by TA
* @param data Corresponding information for the correct execution of the given action
* @verdict
*/
function f_bool2str(in boolean p_bool) runs on Tester return charstring {
var charstring v_bool;
if (p_bool){
v_bool := "true";
}else{
v_bool := "false";
}
return v_bool;
}
/**
* @desc Sending of an Adapter Control primitive
* @param event Action to be performed by TA
* @param data Corresponding information for the correct execution of the given action
* @desc Boolean to charstring
* @param p_bool
* @verdict
*/
function f_checkAeSimuStatus() runs on AeSimu {
......@@ -2851,7 +2917,7 @@ module OneM2M_Functions {
}else{
action(__SCOPE__ & ":" & p_action);
action(p_action);
}
......@@ -2941,11 +3007,11 @@ module OneM2M_Functions {
}
}
/**
* @desc Removal of an element from a given integer list
* @param p_list Given integer list
* @param p_valueToBeDeleted Element value to be removed
* @verdict
/**
* @desc Removal of an element from a given integer list
* @param p_list Given integer list
* @param p_valueToBeDeleted Element value to be removed
* @verdict
*/
function f_removeElementFromList (inout IntegerList p_list, in integer p_valueToBeDeleted) {
var IntegerList result := {};
......@@ -2958,11 +3024,11 @@ module OneM2M_Functions {
p_list := result;
}
/**
* @desc Build a reception template from the primitiveContent sent in previous request primitive
* @param p_primitiveContent PrimitiveContent from previous request primitive
* @return Built reception template
* @verdict
/**
* @desc Build a reception template from the primitiveContent sent in previous request primitive
* @param p_primitiveContent PrimitiveContent from previous request primitive
* @return Built reception template
* @verdict
*/
function f_getTemplateFromPrimitiveContent (in template PrimitiveContent p_primitiveContent) return template PrimitiveContent{
var template PrimitiveContent v_primitiveContent := omit;
......@@ -3216,11 +3282,11 @@ module OneM2M_Functions {
return v_primitiveContent;
}
/**
* @desc Comparison of two primitiveContent parameters
* @param p_responsePrimitiveContent Received primitiveContent
* @param p_requestPrimitiveContent Sent primitiveContent
* @verdict
/**
* @desc Comparison of two primitiveContent parameters
* @param p_responsePrimitiveContent Received primitiveContent
* @param p_requestPrimitiveContent Sent primitiveContent
* @verdict
*/
function f_match2PrimitiveContent (in PrimitiveContent p_responsePrimitiveContent, in template PrimitiveContent p_requestPrimitiveContent) runs on Tester {
var template PrimitiveContent v_primitiveContent;
......
......@@ -104,6 +104,11 @@ module OneM2M_Pixits {
* @desc Test System CSE1 resource ID with Unstructured-CSE-relative-Resource-ID (relative) format according to TS-0001-7.2-1
*/
modulepar XSD.ID PX_CSE1_RESOURCE_ID := "CSE1_RESOURCE_ID";
/**
* @desc CSE1 Supported resource type
*/
modulepar ResourceTypeList_1 PX_CSE1_SRT := {int1, int2, int3, int16};
/**
* @desc Test System M2M-SP1-ID with M2M-SP-ID format (absolute) according to TS-0001-7.2-1 Unstructured-CSE-relative -Resource-ID
......
......@@ -547,7 +547,6 @@ module OneM2M_Templates {
* @param p_stemId
*/
template (value) RequestPrimitive m_createAEAnnc(template (omit) AcpType p_accessControlPolicyIds := omit, template (omit) XSD.ID p_to := omit, template (omit) XSD.ID p_from := omit, XSD.ID p_appId, XSD.ID p_stemId := "") modifies m_create:= {
to_ := p_to,
from_ := p_from,//PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"
requestIdentifier := testcasename() & "-m_createAEAnnc",
resourceType := int10002,
......@@ -656,11 +655,19 @@ module OneM2M_Templates {
};
/**
* @desc CREATE request primitive for remoteCSE resource
* @desc Reception template for CREATE RemoteCSE
*/
template RequestPrimitive mw_createRemoteCSE(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_create := {
resourceType := int16,
primitiveContent := {remoteCSE := ?} //{remoteCSE := m_contentCreateRemoteCSE(p_resourceName, p_accessControlPolicyIds,p_cSEBase, p_cSE_ID)}
};
/**
* @desc Base reception template for CREATE RemoteCSE
*/
template RequestPrimitive mw_createRemoteCSEBase(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_create := {
resourceType := int16,
primitiveContent := ?//{remoteCSE := m_contentCreateRemoteCSE(p_resourceName, p_accessControlPolicyIds,p_cSEBase, p_cSE_ID)}
primitiveContent := {remoteCSE := mw_contentCreateRemoteCSEBase}
};
/**
......@@ -1821,7 +1828,7 @@ module OneM2M_Templates {
};
/**
* @desc Base primitiveContent for CREATE operation for Container resource
* @desc Base primitiveContent for CREATE operation for RemoteCSE resource
* @param p_name Resource name
*/
template (value) RemoteCSE_optional m_contentCreateRemoteCSE (in template (omit) XSD.String p_name := c_defaultRemoteCSEResourceName, in template (omit) AcpType p_accessControlPolicyIds, in template (omit) XSD.AnyURI p_cSEBase := PX_CSE1_ID, in template (omit) XSD.ID p_cSE_ID := PX_CSE1_ID):= {
......@@ -1846,6 +1853,32 @@ module OneM2M_Templates {
nodeLink := omit,//O
choice := omit//O
};
/**
* @desc Base reception template of primitiveContent for CREATE operation for remoteCSE resource
*/
template RemoteCSE_optional mw_contentCreateRemoteCSEBase := {
resourceName := *,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
creationTime := omit,//NP
lastModifiedTime := omit,//NP
labels := *,//O
accessControlPolicyIDs := *,//O
expirationTime := *,//O
announceTo := *,//O
announcedAttribute := *,//O
cseType := *,//O
pointOfAccess := *,//O
cSEBase := ?,//M
cSE_ID := ?,//M
m2M_Ext_ID := *,//O
trigger_Recipient_ID := *,//O
requestReachability := ?,//M
nodeLink := *,//O
choice := *//O
};
/**
* @desc Base reception template of primitiveContent for CREATE operation for ContainerAnnc resource
......@@ -3721,7 +3754,8 @@ module OneM2M_Templates {
template (value) UtTriggerPrimitive m_utCreateRemoteCSE modifies m_utCreate := {
requestIdentifier := testcasename() & "-m_utCreateRemoteCSE" & f_rnd(1, 1000000),
resourceType := int16
resourceType := int16,
primitiveContent := {remoteCSE := m_contentRemoteCSE_allOmit}
}
template (value) UtTriggerPrimitive m_utRetrieveResource(XSD.ID p_targetResourceAddress, in XSD.ID p_originator) := {
......
......@@ -55,6 +55,7 @@ module OneM2M_TestSystem {
type component CseSimu extends Tester {
port OneM2MPort mcaPort;
port OneM2MPort mcaPortIn;
port OneM2MPort mccPort;
port OneM2MPort mccPortIn;
......@@ -62,6 +63,7 @@ module OneM2M_TestSystem {
var MyResourcesList vc_localResourcesList;
var AeSimu vc_ae1;//For CF02 when CseSimu is master
var integer vc_remoteCseIndex;
var integer vc_cSEBaseIndex; //Index of the CSEBase resource of the Tester inside vc_localResourcesList
};
type component InCseSimu extends CseSimu {}
......
......@@ -5594,6 +5594,7 @@ group OtherTypes {
type enumerated Configurations {
e_cf01,
e_cf02,
e_cf02CseSimuMaster,
e_cf03,
e_cf04
};
......
......@@ -58,6 +58,13 @@ module OneM2M_TestControl_IN_profile {
execute(TC_CSE_REG_CRE_019());
execute(TC_CSE_REG_CRE_021());
execute(TC_CSE_REG_CRE_023());
execute(TC_CSE_REG_CRE_024());
execute(TC_CSE_REG_CRE_025());
execute(TC_CSE_REG_CRE_026_RN());
execute(TC_CSE_REG_CRE_026_ET());
execute(TC_CSE_REG_CRE_026_LBL());
execute(TC_CSE_REG_CRE_026_POA());
execute(TC_CSE_REG_CRE_026_NL());
execute(TC_CSE_REG_CRE_027());
execute(TC_CSE_REG_CRE_028_ET());
execute(TC_CSE_REG_CRE_028_LBL());
......
This diff is collapsed.
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