Skip to content
Snippets Groups Projects
Commit de314ae7 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Code documentation (part 1)

parent c51b21e4
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@ module OneM2M_Functions {
group configFunctions {
/**
@desc
@desc Ports mapping and default behaviour activation for Config 1
*/
function f_cf01Up() runs on M2M {
......@@ -46,6 +46,12 @@ module OneM2M_Functions {
group preambleFunctions {
/**
* @desc Creation of auxiliar resources ACP and AE for correct execution of the test case
* @param p_allowedOperations Allowed operations for the auxiliar AE resource
* @return Internal AE resource index
* @verdict
*/
function f_preamble_registerAe(in template (value) AccessControlOperations p_allowedOperations := int63) runs on M2M return integer{//c_CRUDNDi
var RequestPrimitive v_request;
......@@ -55,11 +61,12 @@ module OneM2M_Functions {
if(PX_ACP_SUPPORT){
v_acpAuxIndex := f_createAccessControlPolicyAux(p_allowedOperations := p_allowedOperations);
vc_acpAuxIndex := v_acpAuxIndex;
}
if(v_acpAuxIndex != -1) {
vc_resourcesIndexToBeDeleted := {v_acpAuxIndex};
v_request := valueof(m_createAeAux({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}));
v_request := valueof(m_createAeAux(p_accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}));
//TODO Test, to be removed
v_request.to_ := f_addPrefix(f_getResourceAddress());
......@@ -111,6 +118,10 @@ module OneM2M_Functions {
group postambleFunctions {
/**
* @desc Deletion of all resources created during the test case execution. IUT gets clean and ready for next execution
* @verdict
*/
function f_postamble_deleteResources() runs on M2M {
var integer i;
var XSD.ID v_resourceAddress;
......@@ -154,6 +165,10 @@ module OneM2M_Functions {
f_postamble_default();
}
/**
* @desc Ports unmapping
* @verdict
*/
function f_postamble_default() runs on M2M {
unmap(self:mcaPort, system:mcaPort);
......@@ -185,7 +200,15 @@ module OneM2M_Functions {
group getSetFunctions {
function f_getCreateRequestPrimitive(in ResourceType p_resourceType, in template (omit) AccessControlOperations p_allowedOperations, template RequestPrimitive p_request, integer p_parentIndex) runs on M2M return RequestPrimitive {
/**
* @desc Creation of a CREATE request primitive from a template request primitive
* @param p_resourceType Type of resource to be created
* @param p_request Template request primitive
* @param p_parentIndex Internal resource index which indicates the parent of the resource to be created
* @return Created CREATE request primitive
* @verdict
*/
function f_getCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_request, integer p_parentIndex) runs on M2M return RequestPrimitive {
p_request.from_ := f_getOriginator(p_parentIndex);
......@@ -221,6 +244,14 @@ module OneM2M_Functions {
return valueof(p_request);
}
/**
* @desc Creation of an UPDATE request primitive from a template request primitive
* @param p_resourceType Type of resource to be created
* @param p_resourceIndex Internal resource index which indicates the resource to be updated
* @param p_request Template request primitive
* @return Created UPDATE request primitive
* @verdict
*/
function f_getUpdateRequestPrimitive(in ResourceType p_resourceType, integer p_resourceIndex, template RequestPrimitive p_request) runs on M2M return RequestPrimitive {
p_request.from_ := f_getOriginator(p_resourceIndex);
......@@ -255,6 +286,12 @@ module OneM2M_Functions {
return valueof(p_request);
}
/**
* @desc Extraction from a primitiveContent field the resourceID attribute
* @param p_contentResource primitiveContent field
* @return resourceID attribute
* @verdict
*/
function f_getResourceId(PrimitiveContent p_contentResource) return XSD.ID {
if(ischosen(p_contentResource.any_1[0].AccessControlPolicy_optional)) {
......@@ -282,6 +319,12 @@ module OneM2M_Functions {
}
/**
* @desc Extraction from a primitiveContent field the resourceName attribute
* @param p_contentResource primitiveContent field
* @return resourceName attribute
* @verdict
*/
function f_getResourceName(PrimitiveContent p_contentResource) return XSD.ID {
if(ischosen(p_contentResource.any_1[0].AccessControlPolicy_optional)) {
......@@ -310,6 +353,12 @@ module OneM2M_Functions {
}
/**
* @desc Resolution of the originator field (from) for a given resource
* @param p_targetResourceIndex Internal resource index of the given resource
* @return Originator for a given resource
* @verdict
*/
function f_getOriginator(integer p_targetResourceIndex := -1) runs on M2M return XSD.AnyURI {
if(p_targetResourceIndex == -1) {
......@@ -327,6 +376,13 @@ module OneM2M_Functions {
}
}
/**
* @desc Return of a index of a specific attribute from an attributeList by attributeName
* @param p_attributeList Target attributeList
* @param p_attributeName attributeName to be searched
* @return Index of the attribute in the attributeList
* @verdict
*/
function f_getAttribute(in AttributeList p_attributeList, in XSD.NCName p_attributeName) return integer {
var integer i;
var Attribute v_attribute := {-, -};
......@@ -341,6 +397,12 @@ module OneM2M_Functions {
}
/**
* @desc Resolution of the resource address field (to) for a given resource depending on addressing and hierarchical format
* @param p_targetResourceIndex Internal resource index of the given resource
* @return Resource address for the given resource
* @verdict
*/
function f_getResourceAddress(integer p_targetResourceIndex := -1) runs on M2M return XSD.ID {
var XSD.ID v_resourceAddress;
......@@ -396,6 +458,13 @@ module OneM2M_Functions {
}
}
/**
* @desc Saving of a resource and its parent index in the internal resource list
* @param p_resource Resource to be saved
* @param p_parentIndex Parent index of resource to be saved
* @return Internal resource index of the saved resource
* @verdict
*/
function f_setResource(PrimitiveContent p_resource, integer p_parentIndex := -1) runs on M2M return integer {
if(isbound(vc_resourcesList)) {
......@@ -411,6 +480,14 @@ module OneM2M_Functions {
group helpingFunctions {
/**
* @desc Creation of a resource
* @param p_resourceType Resource type of the resource to be created
* @param p_requestPrimitive Template request primitive
* @param p_parentIndex Internal resource index which indicates the parent of the resource to be created
* @return Internal resource index of the created resource
* @verdict
*/
function f_createResource(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, integer p_parentIndex := -1) runs on M2M return integer {
var M2MResponsePrimitive v_response;
......@@ -418,7 +495,7 @@ module OneM2M_Functions {
var XSD.ID v_resourceId;
var integer v_resourceIndex := -1;
v_request := f_getCreateRequestPrimitive(p_resourceType, omit, p_requestPrimitive, p_parentIndex);
v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, p_parentIndex);
mcaPort.send(m_request(v_request));
tc_ac.start;
......@@ -445,7 +522,14 @@ module OneM2M_Functions {
}
function f_createAccessControlPolicyAux(in template (value) XSD.String p_acpName := "MyAcp", in template (value) AccessControlOperations p_allowedOperations := int63) runs on M2M return integer{
/**
* @desc Creation of the auxiliar ACP resource
* @param p_acpName ACP name
* @param p_allowedOperations Allowed operations
* @return Internal resource index of the created auxiliar ACP resource
* @verdict
*/
function f_createAccessControlPolicyAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) AccessControlOperations p_allowedOperations := int63) runs on M2M return integer{
var RequestPrimitive v_request;
var M2MResponsePrimitive v_response;
var integer v_acpAuxIndex := -1;
......@@ -481,7 +565,13 @@ module OneM2M_Functions {
}
function f_createContainerResourceAux (XSD.ID p_parentResourceAddress, integer p_parentIndex := -1) runs on M2M return integer {
/**
* @desc Creation of the auxiliar Container resource
* @param p_parentIndex Internal resource index which indicates the parent of the Container resource to be created
* @return Internal resource index of the created Container resource
* @verdict
*/
function f_createContainerResourceAux (integer p_parentIndex := -1) runs on M2M return integer {
var M2MResponsePrimitive v_response;
var RequestPrimitive v_request;
......@@ -500,12 +590,17 @@ module OneM2M_Functions {
}
function f_updateAcpAuxResource (XSD.ID p_acpAddress, in template (value) AccessControlOperations p_allowedOperations) runs on M2M {
/**
* @desc Update of the auxiliar ACP resource
* @param p_allowedOperations New allowed operations
* @verdict
*/
function f_updateAcpAuxResource (in template (value) AccessControlOperations p_allowedOperations) runs on M2M {
var RequestPrimitive v_request;
v_request := valueof(m_updateAcpBase);
v_request.to_ := f_addPrefix(p_acpAddress);
v_request.to_ := f_addPrefix(f_getResourceAddress(vc_acpAuxIndex));
v_request.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges.accessControlRule_list := {
{
accessControlOriginators := PX_ACOR, //{"admin:admin"}
......@@ -519,18 +614,24 @@ module OneM2M_Functions {
alt {
[] mcaPort.receive(mw_responseOK) {
tc_ac.stop;
setverdict(pass, "f_updateAcpAuxResource: " & p_acpAddress & " resource updated successfuly");
setverdict(pass, "f_updateAcpAuxResource: " & v_request.to_ & " resource updated successfuly");
}
[] mcaPort.receive(mw_responseKO) {
tc_ac.stop;
setverdict(fail, "f_updateAcpAuxResource: Error while updating " & p_acpAddress & " resource");
setverdict(fail, "f_updateAcpAuxResource: Error while updating " & v_request.to_ & " resource");
}
[] tc_ac.timeout {
setverdict(inconc, "f_updateAcpAuxResource: No answer while updating " & p_acpAddress & " resource" );
setverdict(inconc, "f_updateAcpAuxResource: No answer while updating " & v_request.to_ & " resource" );
}
}
}
/**
* @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_sendAcPrimitive(in charstring event, in charstring data) runs on M2M {
var charstring v_data := "" & data; // clear encoding rules (ttwb issue ?)
......
......@@ -22,6 +22,13 @@ module OneM2M_Templates {
import from OneM2M_Functions all;
/**
* @desc Get a converted to string random number
* @param p_lower Lower limit
* @param p_upper Upper limit
* @return Random number converted to string
* @verdict
*/
function f_rnd(in integer p_lower, in integer p_upper) return charstring {
return int2str(float2int(rnd() * int2float(p_upper - p_lower + 1)) + p_lower);
......@@ -30,7 +37,7 @@ module OneM2M_Templates {
/* Templates */
/**
* @desc
* @desc Base template for request sending operations
* @param p_requestPrimitive
*/
template (value) M2MRequestPrimitive m_request(in template (value) RequestPrimitive p_requestPrimitive, in template (omit) AttributeList_1 p_nullFields := omit ) := {
......@@ -71,11 +78,16 @@ module OneM2M_Templates {
filterCriteria := omit,
discoveryResultType := omit
};
template (value) RequestPrimitive m_retrieveResource(XSD.ID p_targetResourceAddress) := {
/**
* @desc Base RETRIEVE request primitive
* @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) := {
operation := int2,
to_ := f_addPrefix(p_targetResourceAddress),
from_ := PX_AE_ID_STEM,
from_ := p_originator,
requestIdentifier := "m_retrieveResource" & f_rnd(1, 1000000),
resourceType := omit,
primitiveContent := omit,
......@@ -94,10 +106,15 @@ module OneM2M_Templates {
discoveryResultType := omit
};
template (value) RequestPrimitive m_retrieveResourceAttributeToOption(XSD.ID p_targetResourceAddress) := {
/**
* @desc RETRIEVE request primitive for a single attribute in To field ("targetResourceAddress#AttributeName")
* @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) := {
operation := int2,
to_ := f_addPrefix(p_targetResourceAddress),
from_ := PX_AE_ID_STEM,
from_ := p_originator,
requestIdentifier := "m_retrieveResourceAttributeOptionTo" & f_rnd(1, 1000000),
resourceType := omit,
primitiveContent := omit,
......@@ -116,10 +133,16 @@ module OneM2M_Templates {
discoveryResultType := omit
};
template (value) RequestPrimitive m_retrieveResourceAttributeContentOption(XSD.ID p_targetResourceAddress, in template (value) AttributeList_1 p_attributeList) := {
/**
* @desc RETRIEVE request primtive containing the target attributes in the primitiveContent field
* @param p_targetResourceAddress Target resource address
* @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 ) := {
operation := int2,
to_ := f_addPrefix(p_targetResourceAddress),
from_ := PX_AE_ID_STEM,
from_ := p_originator,
requestIdentifier := "m_retrieveResourceAttributeContentOption" & f_rnd(1, 1000000),
resourceType := omit,
primitiveContent := {
......@@ -142,30 +165,10 @@ module OneM2M_Templates {
}//end group Retrieve
group Update {
template (value) RequestPrimitive m_updateContentInstance(XSD.ID p_targetResourceAddress, XSD.String p_primitiveContent) := {
operation := int3,
to_ := p_targetResourceAddress,
from_ := "admin:admin",
requestIdentifier := "m_updateContentInstance" & f_rnd(1, 1000000),
resourceType := omit,
primitiveContent := {
any_1 := {{ContentInstance_optional := m_contentUpdateContentInstance(p_primitiveContent)}}
},
role := omit,
originatingTimestamp := omit,
requestExpirationTimestamp := omit,
resultExpirationTimestamp := omit,
operationExecutionTime := omit,
responseType := omit,
resultPersistence := omit,
resultContent := omit,
eventCategory := omit,
deliveryAggregation := omit,
groupRequestIdentifier := omit,
filterCriteria := omit,
discoveryResultType := omit
};
/**
* @desc Base UPDATE request primitive for Container resource
*/
template (value) RequestPrimitive m_updateContainerBase := {
operation := int3,
to_ := "NotInitialized",
......@@ -189,32 +192,10 @@ module OneM2M_Templates {
filterCriteria := omit,
discoveryResultType := omit
};
template (value) RequestPrimitive m_updateContainer(XSD.ID p_targetResourceAddress, in template (omit) XSD.String p_resourceName) := {
operation := int3,
to_ := f_addPrefix(p_targetResourceAddress),
from_ := PX_AE_ID_STEM,
requestIdentifier := "m_updateContainer" & f_rnd(1, 1000000),
resourceType := omit,
primitiveContent:= {
any_1 := {{Container_optional := m_contentUpdateContainer}}
},
role := omit,
originatingTimestamp := omit,
requestExpirationTimestamp := omit,
resultExpirationTimestamp := omit,
operationExecutionTime := omit,
responseType := omit,
resultPersistence := omit,
resultContent := omit,
eventCategory := omit,
deliveryAggregation := omit,
groupRequestIdentifier := omit,
filterCriteria := omit,
discoveryResultType := omit
};
/**
* @desc Base UPDATE request primitive for AccessControlPolicy resource
*/
template (value) RequestPrimitive m_updateAcpBase := {
operation := int3,
to_ := "NotInitialized",
......@@ -240,6 +221,9 @@ module OneM2M_Templates {
};
/**
* @desc Base UPDATE request primitive for Group resource
*/
template (value) RequestPrimitive m_updateGroupBase := {
operation := int3,
to_ := "NotInitialized",
......@@ -265,6 +249,9 @@ module OneM2M_Templates {
};
/**
* @desc Base UPDATE request primitive for Schedule resource
*/
template (value) RequestPrimitive m_updateScheduleBase := {
operation := int3,
to_ := "NotInitialized",
......@@ -290,6 +277,9 @@ module OneM2M_Templates {
};
/**
* @desc Base UPDATE request primitive for PollingChannel resource
*/
template (value) RequestPrimitive m_updatePollingChannelBase := {
operation := int3,
to_ := "NotInitialized",
......@@ -315,6 +305,9 @@ module OneM2M_Templates {
};
/**
* @desc Base UPDATE request primitive for Subscription resource
*/
template (value) RequestPrimitive m_updateSubscriptionBase := {
operation := int3,
to_ := "NotInitialized",
......@@ -342,37 +335,10 @@ module OneM2M_Templates {
}//end group Update
group Create {
/*template (value) requestPrimitive m_createContainer_noName(XSD.ID p_resourceId) := {
operation := int1,
to_ := p_resourceId,
from_ := "admin:admin",
requestIdentifier := "m_createContainer",
resourceType := int3,
name := omit,
primitiveContent := {
{
m_contentContainer
}
},
discoveryResultType := omit
};*/
/*template (value) requestPrimitive m_createResource_noName(XSD.ID p_resourceId, ResourceType p_resourceType, template (value) primitiveContent p_primitiveContent) := {
operation := int1,
to_ := p_resourceId,
from_ := PX_AE_ID_STEM,
requestIdentifier := "m_createResource",
resourceType := p_resourceType,
name := omit,
primitiveContent := {
{
p_primitiveContent
}
},
discoveryResultType := omit
};*/
/**
* @desc Base CREATE request primitive for AE resource (AUX)
*/
template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIDs := omit ) := {
operation := int1,
to_ := "Not Initialized",
......@@ -380,7 +346,7 @@ module OneM2M_Templates {
requestIdentifier := "m_createAe" & f_rnd(1, 1000000),
resourceType := int2,
primitiveContent := {
any_1 := {{AE_optional := m_contentCreateAe(c_aeAuxName, p_accessControlPolicyIDs)}}
any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName)}}
},
role := omit,
originatingTimestamp := omit,
......@@ -398,10 +364,13 @@ module OneM2M_Templates {
};
/**
* @desc Base CREATE request primitive for AccessControlPolicy resource
*/
template (value) RequestPrimitive m_createAcpBase := {
operation := int1,
to_ := "NotInitialized",
from_ := PX_AE_ID_STEM,
from_ := "NotInitialized",
requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
resourceType := int1,
primitiveContent := {
......@@ -448,11 +417,15 @@ module OneM2M_Templates {
};
/**
* @desc Base CREATE request primitive for AccessControlPolicy resource (AUX)
*/
template (value) RequestPrimitive m_createAcpAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) ListOfURIs p_acor := PX_ACOR, in template (value) AccessControlOperations p_allowedOperations := int63 ) := {
operation := int1,
to_ := "Not Initialized",
from_ := PX_AE_ID_STEM,
requestIdentifier := "m_createAcp" & f_rnd(1, 1000000),
requestIdentifier := "m_createAcpAux" & f_rnd(1, 1000000),
resourceType := int1,
primitiveContent := {
any_1 := {{AccessControlPolicy_optional := m_contentCreateAcp (p_acpName, p_acor, p_allowedOperations)}}
......@@ -473,10 +446,14 @@ module OneM2M_Templates {
};
/**
* @desc Base CREATE request primitive for Container resource
*/
template (value) RequestPrimitive m_createContainerBase := {
operation := int1,
to_ := "NotInitialized",
from_ := PX_AE_ID_STEM,
from_ := "NotInitialized",
requestIdentifier := "m_createContainer" & f_rnd(1, 1000000),
resourceType := int3,
primitiveContent := {
......@@ -549,10 +526,14 @@ module OneM2M_Templates {
};
/**
* @desc Base CREATE request primitive for Group resource
*/
template (value) RequestPrimitive m_createGroupBase := {
operation := int1,
to_ := "NotInitialized",
from_ := PX_AE_ID_STEM,
from_ := "NotInitialized",
requestIdentifier := "m_createGroup" & f_rnd(1, 1000000),
resourceType := int9,
primitiveContent := {
......@@ -599,10 +580,14 @@ module OneM2M_Templates {
};
/**
* @desc Base CREATE request primitive for PollingChannel resource
*/
template (value) RequestPrimitive m_createPollingChannelBase := {
operation := int1,
to_ := "NotInitialized",
from_ := PX_AE_ID_STEM,
from_ := "NotInitialized",
requestIdentifier := "m_createPollingChannel" & f_rnd(1, 1000000),
resourceType := int15,
primitiveContent := {
......@@ -649,12 +634,13 @@ module OneM2M_Templates {
};
/**
* @desc Base CREATE request primitive for Schedule resource
*/
template (value) RequestPrimitive m_createScheduleBase := {
operation := int1,
to_ := "NotInitialized",
from_ := PX_AE_ID_STEM,
from_ := "NotInitialized",
requestIdentifier := "m_createSchedule" & f_rnd(1, 1000000),
resourceType := int18,
primitiveContent := {
......@@ -701,10 +687,14 @@ module OneM2M_Templates {
};
/**
* @desc Base CREATE request primitive for Subscription resource
*/
template (value) RequestPrimitive m_createSubscriptionBase := {
operation := int1,
to_ := "NotInitialized",
from_ := PX_AE_ID_STEM,
from_ := "NotInitialized",
requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000),
resourceType := int23,
primitiveContent := {
......@@ -805,7 +795,12 @@ module OneM2M_Templates {
group ContentCreate {
template (value) AE_optional m_contentCreateAe (in template (omit) XSD.String p_name, in template (omit) AcpType p_accessControlPolicyIDs) := {
/**
* @desc Base primitiveContent for CREATE operation for AE resource
* @param p_name Resource name
* @param p_accessControlPolicyIDs ACP IDs for the AE
*/
template (value) AE_optional m_contentCreateAe (in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.String p_name := c_defaultResourceName) := {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
......@@ -820,7 +815,7 @@ module OneM2M_Templates {
appName := omit,//O
app_ID := PX_APP_ID,//M
aE_ID := omit,//NP
pointOfAccess := {"http://127.0.0.1:1400/monitor"},//O //{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
pointOfAccess := omit, //O {"http://127.0.0.1:1400/monitor"},//{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
ontologyRef := omit,//O
nodeLink := omit,//NP
requestReachability := true,//M
......@@ -828,6 +823,12 @@ module OneM2M_Templates {
choice := omit//NP
};
/**
* @desc Base primitiveContent for CREATE operation for AccessControlPolicy resource
* @param p_name Resource name
* @param p_acor Allowed originators
* @param p_allowedOperations Allowed operations
*/
template (value) AccessControlPolicy_optional m_contentCreateAcp (in template (omit) XSD.String p_name := c_defaultResourceName, in template (value) ListOfURIs p_acor := PX_ACOR, in template (value) AccessControlOperations p_allowedOperations := int63 ) := {
resourceName := p_name,//O
resourceType := omit,//NP
......@@ -860,10 +861,18 @@ module OneM2M_Templates {
choice := omit //NP
};
/**
* @desc Base primitiveContent for CREATE operation for Group resource
* @param p_maxNrOfMembers Max number of members
* @param p_memberIds Member IDs
* @param p_accessControlPolicyIDs ACP IDs for the Group
* @param p_name Resource name
*/
template (value) Group_optional m_contentCreateGroup ( in template (value) XSD.NonNegativeInteger p_maxNrOfMembers,
in template (value) ListOfURIs p_memberIds,
in template (omit) AcpType p_accessControlPolicyIDs) := {
resourceName := c_defaultResourceName,//O
in template (value) ListOfURIs p_memberIds,
in template (omit) AcpType p_accessControlPolicyIDs,
in template (omit) XSD.String p_name := c_defaultResourceName) := {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
......@@ -887,8 +896,14 @@ module OneM2M_Templates {
choice := omit//NP
};
template (value) PollingChannel_optional m_contentCreatePollingChannel ( in template (omit) AcpType p_accessControlPolicyIDs) := {
resourceName := c_defaultResourceName,//O
/**
* @desc Base primitiveContent for CREATE operation for PollingChannel resource
* @param p_accessControlPolicyIDs ACP IDs for the PollingChannel
* @param p_name Resource name
*/
template (value) PollingChannel_optional m_contentCreatePollingChannel (in template (omit) AcpType p_accessControlPolicyIDs,
in template (omit) XSD.String p_name := c_defaultResourceName) := {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
......@@ -900,8 +915,14 @@ module OneM2M_Templates {
pollingChannelURI := omit//NP
};
template (value) Schedule_optional m_contentCreateSchedule (in template (value) ScheduleEntries p_scheduleElement) := {
resourceName := c_defaultResourceName,//O
/**
* @desc Base primitiveContent for CREATE operation for Schedule resource
* @param p_scheduleElement Schedule
* @param p_name Resource name
*/
template (value) Schedule_optional m_contentCreateSchedule (in template (value) ScheduleEntries p_scheduleElement,
in template (omit) XSD.String p_name := c_defaultResourceName) := {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
......@@ -915,7 +936,13 @@ module OneM2M_Templates {
choice := omit//NP
};
template (value) Subscription_optional m_contentCreateSubscription (in template (value) ListOfURIs p_notificationURI) := {
/**
* @desc Base primitiveContent for CREATE operation for Subscription resource
* @param p_notificationURI Notification URI
* @param p_name Resource name
*/
template (value) Subscription_optional m_contentCreateSubscription (in template (value) ListOfURIs p_notificationURI,
in template (omit) XSD.String p_name := c_defaultResourceName) := {
resourceName := c_defaultResourceName,//O
resourceType := omit,//NP
resourceID := omit,//NP
......@@ -943,6 +970,10 @@ module OneM2M_Templates {
choice := omit//NP
};
/**
* @desc Base primitiveContent for CREATE operation for ContentInstance resource
* @param p_primitiveContent Content for the ContentInstance
*/
template (value) ContentInstance_optional m_contentCreateContentInstance(XSD.String p_primitiveContent) := {
resourceName := c_defaultResourceName,//O
resourceType := omit,//NP
......@@ -966,8 +997,12 @@ module OneM2M_Templates {
}//M
};
template (value) Container_optional m_contentCreateContainer := {
resourceName := c_defaultResourceName,//O
/**
* @desc Base primitiveContent for CREATE operation for Container resource
* @param p_name Resource name
*/
template (value) Container_optional m_contentCreateContainer (in template (omit) XSD.String p_name := c_defaultResourceName):= {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
......@@ -996,6 +1031,9 @@ module OneM2M_Templates {
group ContentUpdate {
/**
* @desc Base primitiveContent for UPDATE operation for AE resource
*/
template (value) AE_optional m_contentUpdateAe := {
resourceName := omit,//NP
resourceType := omit,//NP
......@@ -1019,6 +1057,9 @@ module OneM2M_Templates {
choice := omit//NP
};
/**
* @desc Base primitiveContent for UPDATE operation for AccessControlPolicy resource
*/
template (value) AccessControlPolicy_optional m_contentUpdateAcp := {
resourceName := omit,//NP
resourceType := omit,//NP
......@@ -1035,6 +1076,9 @@ module OneM2M_Templates {
choice := omit //NP
};
/**
* @desc Base primitiveContent for UPDATE operation for Group resource
*/
template (value) Group_optional m_contentUpdateGroup := {
resourceName := omit,//NP
resourceType := omit,//NP
......@@ -1061,6 +1105,9 @@ module OneM2M_Templates {
};
/**
* @desc Base primitiveContent for UPDATE operation for PollingChannel resource
*/
template (value) PollingChannel_optional m_contentUpdatePollingChannel := {
resourceName := omit,//NP
resourceType := omit,//NP
......@@ -1074,6 +1121,9 @@ module OneM2M_Templates {
pollingChannelURI := omit//NP
};
/**
* @desc Base primitiveContent for UPDATE operation for Schedule resource
*/
template (value) Schedule_optional m_contentUpdateSchedule := {
resourceName := omit,//NP
resourceType := omit,//NP
......@@ -1089,6 +1139,9 @@ module OneM2M_Templates {
choice := omit//NP
};
/**
* @desc Base primitiveContent for UPDATE operation for Subscription resource
*/
template (value) Subscription_optional m_contentUpdateSubscription := {
resourceName := omit,//NP
resourceType := omit,//NP
......@@ -1117,6 +1170,9 @@ module OneM2M_Templates {
choice := omit//NP
};
/**
* @desc Base primitiveContent for UPDATE operation for AE resource
*/
template (value) ContentInstance_optional m_contentUpdateContentInstance(XSD.String p_primitiveContent) := {
resourceName := omit,//NP
resourceType := omit,//NP
......@@ -1140,6 +1196,9 @@ module OneM2M_Templates {
}//O
};
/**
* @desc Base primitiveContent for UPDATE operation for Container resource
*/
template (value) Container_optional m_contentUpdateContainer := {
resourceName := omit,//NP
resourceType := omit,//NP
......@@ -1830,6 +1889,12 @@ module OneM2M_Templates {
};
}//end group ResponsePrimitives
/**
* @desc Get the prefix depending on the addressing format and binding (Temporal funciton as this should be done by TA)
* @param v_address Actual address
* @return Address with prefix
* @verdict
*/
function f_addPrefix(XSD.ID v_address) return XSD.ID {
//TODO Test, to be removed
if(PX_ADDRESSING_FORMAT == e_cseRelative) {
......
......@@ -19,6 +19,9 @@ module OneM2M_TestSystem {
import from XSD all;
/* Ports */
/**
* @desc Port to transport oneM2M primitives
*/
type port OneM2MPort message {
in
M2MRequestPrimitive, M2MResponsePrimitive;
......@@ -26,6 +29,9 @@ module OneM2M_TestSystem {
M2MRequestPrimitive, M2MResponsePrimitive;
}
/**
* @desc Port to transport Adaptor Control primitives
*/
type port AdapterControlPort message {
in
AcResponsePrimitive;
......@@ -44,6 +50,7 @@ module OneM2M_TestSystem {
//global variables
var AE_optional vc_aeAux;//TODO To be removed
var AccessControlPolicy_optional vc_acpAux;
var integer vc_acpAuxIndex := -1;
var MyResourcesList vc_resourcesList;
var IntegerList vc_resourcesIndexToBeDeleted;
}
......@@ -55,6 +62,15 @@ module OneM2M_TestSystem {
}
/* Primitives */
/**
* @desc Type for the oneM2M primitives exchange
* @member requestPrimitive_ oneM2M primitive
* @member host IP Address of the destination
* @member xmlNamespace XML Namespace to be used
* @member protocolBinding Protocol binding to be used
* @member serialization Serialization to be used
* @member nullFields Fields that are to be included in the oneM2M primitive but empty, i.e. <labels></labels>
*/
type record M2MRequestPrimitive {
RequestPrimitive requestPrimitive_,
charstring host,
......
......@@ -960,7 +960,7 @@ module OneM2M_Testcases {
// Test Body
v_request := f_getCreateRequestPrimitive(p_resourceType, omit, p_requestPrimitive, v_aeIndex);
v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
mcaPort.send(m_request(v_request));
tc_ac.start;
......@@ -1110,7 +1110,7 @@ module OneM2M_Testcases {
v_aeIndex := f_preamble_registerAe();//c_CRUDNDi);
// Test Body
v_request := f_getCreateRequestPrimitive(p_resourceType, omit, p_requestPrimitive, v_aeIndex);
v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
mcaPort.send(m_request(v_request));
tc_ac.start;
......@@ -1197,7 +1197,7 @@ module OneM2M_Testcases {
v_resourceIndex := f_createResource(p_resourceType, p_requestPrimitive, v_aeIndex);
v_request := f_getCreateRequestPrimitive(p_resourceType, omit, p_requestPrimitive, v_aeIndex);
v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
// Test Body
v_request.requestIdentifier := "Existing resource";
......@@ -1293,7 +1293,7 @@ module OneM2M_Testcases {
if(p_resourceType == int15) {
v_request := valueof(m_createPollingChannel(f_getResourceAddress(v_aeIndex), PX_AE_ID_STEM, omit));
} else {
v_request := f_getCreateRequestPrimitive(p_resourceType, omit, p_requestPrimitive, v_aeIndex);
v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
}
mcaPort.send(m_request(v_request));
......@@ -1569,7 +1569,7 @@ module OneM2M_Testcases {
v_resourceIndex := f_createResource(p_resourceType, p_requestPrimitive, v_aeIndex);
f_updateAcpAuxResource(f_getResourceAddress(0), int61); //c_CUDNDi
f_updateAcpAuxResource(int61); //c_CUDNDi
// Test Body
mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex))));
......@@ -2543,8 +2543,10 @@ module OneM2M_Testcases {
//Check attribute 1
if(ispresent(v_responsePrimitive.primitiveContent)) {
if(ischosen(v_responsePrimitive.primitiveContent.any_1[0].Container_optional)) {
if(ispresent(v_responsePrimitive.primitiveContent.any_1[0].Container_optional.labels)){ // FIXME: CHECK: labels set to empty
setverdict(fail, testcasename() & ": Error: Labels attribute not deleted correctly")
if(ispresent(v_responsePrimitive.primitiveContent.any_1[0].Container_optional.labels)){
if(v_responsePrimitive.primitiveContent.any_1[0].Container_optional.labels != {""}) {
setverdict(fail, testcasename() & ": Error: Labels attribute not deleted correctly");
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment