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

First test case for timeSeries TC_CSE_DMR_TS_001 added


Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent f3752674
......@@ -1269,6 +1269,13 @@ module OneM2M_Functions {
log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.group_.resourceName)
}
}
case (int29) {
if (isvalue(p_response.primitiveContent.timeSeries) and
not(ispresent(p_response.primitiveContent.timeSeries.resourceName))) {
p_response.primitiveContent.timeSeries.resourceName := p_request.primitiveContent.timeSeries.resourceName;
log(__SCOPE__ & ":INFO: resourceName not returned. Using the one provided in the request: " & p_request.primitiveContent.timeSeries.resourceName)
}
}
case else {
log(__SCOPE__&":WARNING: Resource Type "&int2str(enum2int(p_resourceType))&" not implemented");
}
......@@ -1334,6 +1341,32 @@ module OneM2M_Functions {
}
function f_cse_generateMissingDataPoint(in integer p_timeSeriesResourceIndex) runs on AeSimu{
var RequestPrimitive v_request;
var integer v_resourceIndex := -1;
var integer i;
var XSD.NonNegativeInteger v_periodicInterval := vc_resourcesList[p_timeSeriesResourceIndex].resource.timeSeries.periodicInterval;
var XSD.NonNegativeInteger v_missingDataDetectTimer := vc_resourcesList[p_timeSeriesResourceIndex].resource.timeSeries.missingDataDetectTimer;
timer t_noAction;
//Activate defaults when running on a PTC
f_cse_activateDefaults_ae();
i := 0;
while (i < 3) {
v_request := f_getCreateRequestPrimitive(int30, m_createTimeSeriesInstanceBase, p_timeSeriesResourceIndex);
v_request.primitiveContent.timeSeriesInstance.resourceName := "MyTimeSeriesInstance" & int2str(i);
v_resourceIndex := f_cse_createResource(int30, v_request, p_timeSeriesResourceIndex);
i := i + 1;
t_noAction.start(int2float(v_periodicInterval));
}
//After missingDataTimerDetect, a missing data point should have been detected
t_noAction.start(int2float(v_missingDataDetectTimer));
}
}//end group AeSimu
group CseSimuFunctions {
......
......@@ -18,7 +18,7 @@ module OneM2M_Templates {
import from OneM2M_TypesAndValues all;
//import from OneM2M_AdditionalTypes all;
import from OneM2M_Pixits all;
//import from OneM2M_Functions all;
import from OneM2M_Functions all;
/**
......@@ -1173,6 +1173,54 @@ module OneM2M_Templates {
primitiveContent := {m2mServiceSubscriptionProfile := m_contentCreatem2mServiceSubscriptionProfileBase}
};
/**
* @desc Base CREATE request primitive for timeSeries resource
*/
template (value) RequestPrimitive m_createTimeSeriesBase modifies m_create := {
requestIdentifier := testcasename() & "-m_createTimeSeries",
resourceType := int29,
primitiveContent := {timeSeries := m_contentCreateTimeSeries ()}
};
template (value) RequestPrimitive m_createTimeSeries(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_name := c_defaultTimeSeriesResourceName) modifies m_create := {
to_ := p_parentResourceAddress,
requestIdentifier := testcasename() & "-m_createTimeSeries",
resourceType := int29,
primitiveContent := {timeSeries := m_contentCreateTimeSeries (p_name)}
};
/**
* @desc Reception template for CREATE timeSeries
*/
template RequestPrimitive mw_createTimeSeries(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_create := {
resourceType := int29,
primitiveContent := {timeSeries := ?}
};
/**
* @desc Base CREATE request primitive for timeSeriesInstance resource
*/
template (value) RequestPrimitive m_createTimeSeriesInstanceBase modifies m_create := {
requestIdentifier := testcasename() & "-m_createTimeSeriesInstance",
resourceType := int30,
primitiveContent := {timeSeriesInstance := m_contentCreateTimeSeriesInstance()}
};
template (value) RequestPrimitive m_createTimeSeriesInstance(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_name := c_defaultTimeSeriesInstanceResourceName) modifies m_create := {
to_ := p_parentResourceAddress,
requestIdentifier := testcasename() & "-m_createTimeSeriesInstance",
resourceType := int30,
primitiveContent := {timeSeriesInstance := m_contentCreateTimeSeriesInstance (p_name)}
};
/**
* @desc Reception template for CREATE timeSeriesInstance
*/
template RequestPrimitive mw_createTimeSeriesInstance(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_create := {
resourceType := int30,
primitiveContent := {timeSeriesInstance := ?}
};
}//end group Create
group Delete {
......@@ -2352,6 +2400,96 @@ module OneM2M_Templates {
choice := omit //O
};
/**
* @desc Base primitiveContent for CREATE operation for timeSeries resource
* @param p_name Resource name
*/
template (value) TimeSeries_optional m_contentCreateTimeSeries (in template (omit) XSD.String p_name := c_defaultTimeSeriesResourceName):= {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
creationTime := omit,//NP
lastModifiedTime := omit,//NP
labels := omit,//O
accessControlPolicyIDs := omit,//O
expirationTime := omit,//O
dynamicAuthorizationConsultationIDs := omit, //O
announceTo := omit,//O
announcedAttribute := omit,//O
stateTag := omit,//NP
creator := omit,//O
maxNrOfInstances := omit,//O
maxByteSize := omit,//O
maxInstanceAge := omit,//O
currentNrOfInstances := omit,//NP
currentByteSize := omit,//NP
periodicInterval := omit,//O
missingDataDetect := omit,//O
missingDataMaxNr := omit,//O
missingDataList := omit,//NP
missingDataCurrentNr := omit,//NP
missingDataDetectTimer := omit,//O
ontologyRef := omit,//O
choice := omit//NP
};
/**
* @desc Base primitiveContent for invalid CREATE operation for timeSeries resource (using Container_update_invalid)
* @param p_name Resource name
*/
template (value) TimeSeries_update_invalid m_contentCreateTimeSeriesInvalid (in template (omit) XSD.String p_name := c_defaultTimeSeriesResourceName):= {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
creationTime := omit,//NP
lastModifiedTime := omit,//NP
expirationCounter := omit,//Field not existing in container resource
labels := omit,//O
accessControlPolicyIDs := omit,//O
expirationTime := omit,//O
dynamicAuthorizationConsultationIDs := omit, //O
announceTo := omit,//O
announcedAttribute := omit,//O
stateTag := omit,//NP
creator := omit,//O
maxNrOfInstances := omit,//O
maxByteSize := omit,//O
maxInstanceAge := omit,//O
currentNrOfInstances := omit,//NP
currentByteSize := omit,//NP
periodicInterval := omit,//O
missingDataDetect := omit,//O
missingDataMaxNr := omit,//O
missingDataList := omit,//NP
missingDataCurrentNr := omit,//NP
missingDataDetectTimer := omit,//O
ontologyRef := omit,//O
choice := omit//NP
};
/**
* @desc Base primitiveContent for CREATE operation for Container resource
* @param p_name Resource name
*/
template (value) TimeSeriesInstance_optional m_contentCreateTimeSeriesInstance (in template (omit) XSD.String p_name := c_defaultTimeSeriesInstanceResourceName):= {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
creationTime := omit,//NP
lastModifiedTime := omit,//NP
labels := omit,//O
expirationTime := omit,//O
announceTo := omit,//O
announcedAttribute := omit,//O
dataGenerationTime := {alt_ := fx_generateTimestamp()},//M
content := "Value",//M
sequenceNr := omit,//O
contentSize := omit//NP
};
}//end group ContentCreate
group ContentUpdate {
......
......@@ -1715,6 +1715,8 @@ type union PrimitiveContent {
ServiceSubscribedAppRule_optional serviceSubscribedAppRule,
Subscription_optional subscription,
SemanticDescriptor_optional semanticDescriptor,
TimeSeries_optional timeSeries,
TimeSeriesInstance_optional timeSeriesInstance,
GenericInterworkingOperationInstance_optional genericInterworkingOperationInstance,
//SecurityInfo
SecurityInfo securityInfo,
......@@ -7803,7 +7805,9 @@ group OptionalResourceTypes {
ListOfURIs relatedSemantics optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of Subscription subscription_list
record length(1 .. infinity) of union {
Subscription_optional subscription
} choice_list
} choice optional
}
with {
......@@ -7814,8 +7818,44 @@ group OptionalResourceTypes {
variant (choice) "untagged";
variant (choice.childResource_list) "untagged";
variant (choice.childResource_list[-]) "name as 'childResource'";
variant (choice.subscription_list) "untagged";
variant (choice.subscription_list[-]) "name as 'subscription'";
variant (choice.choice_list) "untagged";
variant (choice.choice_list[-]) "untagged";
};
type record SemanticDescriptorAnnc_optional
{
ResourceName resourceName optional,
ResourceType resourceType optional,
XSD.ID resourceID optional,
NhURI parentID optional,
Timestamp creationTime optional,
Timestamp lastModifiedTime optional,
Labels labels optional,
AcpType accessControlPolicyIDs optional,
Timestamp expirationTime optional,
XSD.AnyURI link optional,
ListOfURIs dynamicAuthorizationConsultationIDs optional,
DescriptorRepresentation descriptorRepresentation optional,
Sparql semanticOpExec optional,
XSD.Base64Binary descriptor optional,
XSD.AnyURI ontologyRef optional,
ListOfURIs relatedSemantics optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of union {
Subscription_optional subscription
} choice_list
} choice optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (resourceName) "attribute";
variant (choice) "untagged";
variant (choice.childResource_list) "untagged";
variant (choice.childResource_list[-]) "name as 'childResource'";
variant (choice.choice_list) "untagged";
variant (choice.choice_list[-]) "untagged";
};
type record ServiceSubscribedAppRule_optional
......@@ -7836,7 +7876,9 @@ group OptionalResourceTypes {
record length(1 .. infinity) of RoleID allowedRole_IDs optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of Subscription subscription_list
record length(1 .. infinity) of union {
Subscription_optional subscription
} choice_list
} choice optional
}
with {
......@@ -7849,8 +7891,8 @@ group OptionalResourceTypes {
variant (choice) "untagged";
variant (choice.childResource_list) "untagged";
variant (choice.childResource_list[-]) "name as 'childResource'";
variant (choice.subscription_list) "untagged";
variant (choice.subscription_list[-]) "name as 'subscription'";
variant (choice.choice_list) "untagged";
variant (choice.choice_list[-]) "untagged";
};
type record ServiceSubscribedNode_optional
......@@ -7871,7 +7913,9 @@ group OptionalResourceTypes {
ListOfURIs ruleLinks optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of Subscription subscription_list
record length(1 .. infinity) of union {
Subscription_optional subscription
} choice_list
} choice optional
}
with {
......@@ -7883,8 +7927,8 @@ group OptionalResourceTypes {
variant (choice) "untagged";
variant (choice.childResource_list) "untagged";
variant (choice.childResource_list[-]) "name as 'childResource'";
variant (choice.subscription_list) "untagged";
variant (choice.subscription_list[-]) "name as 'subscription'";
variant (choice.choice_list) "untagged";
variant (choice.choice_list[-]) "untagged";
};
type record StatsCollect_optional
......@@ -7909,7 +7953,9 @@ group OptionalResourceTypes {
XSD.String eventID optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of Subscription subscription_list
record length(1 .. infinity) of union {
Subscription_optional subscription
} choice_list
} choice optional
}
with {
......@@ -7919,8 +7965,8 @@ group OptionalResourceTypes {
variant (choice) "untagged";
variant (choice.childResource_list) "untagged";
variant (choice.childResource_list[-]) "name as 'childResource'";
variant (choice.subscription_list) "untagged";
variant (choice.subscription_list[-]) "name as 'subscription'";
variant (choice.choice_list) "untagged";
variant (choice.choice_list[-]) "untagged";
};
type record StatsConfig_optional
......@@ -8002,6 +8048,155 @@ group OptionalResourceTypes {
variant (choice.choice_list) "untagged";
variant (choice.choice_list[-]) "untagged";
};
type record TimeSeries_optional
{
ResourceName resourceName optional,
ResourceType resourceType optional,
XSD.ID resourceID optional,
NhURI parentID optional,
Timestamp creationTime optional,
Timestamp lastModifiedTime optional,
Labels labels optional,
AcpType accessControlPolicyIDs optional,
Timestamp expirationTime optional,
ListOfURIs dynamicAuthorizationConsultationIDs optional,
ListOfURIs announceTo optional,
record length(1 .. infinity) of XSD.NCName announcedAttribute optional,
XSD.NonNegativeInteger stateTag optional,
XSD.ID creator optional,
XSD.NonNegativeInteger maxNrOfInstances optional,
XSD.NonNegativeInteger maxByteSize optional,
XSD.NonNegativeInteger maxInstanceAge optional,
XSD.NonNegativeInteger currentNrOfInstances optional,
XSD.NonNegativeInteger currentByteSize optional,
XSD.NonNegativeInteger periodicInterval optional,
XSD.Boolean missingDataDetect optional,
XSD.NonNegativeInteger missingDataMaxNr optional,
MissingDataList missingDataList optional,
XSD.NonNegativeInteger missingDataCurrentNr optional,
XSD.NonNegativeInteger missingDataDetectTimer optional,
XSD.AnyURI ontologyRef optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of union {
TimeSeriesInstance_optional timeSeriesInstance,
Subscription_optional subscription,
SemanticDescriptor_optional semanticDescriptor
} choice_list
} choice optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (resourceName) "attribute";
variant (announcedAttribute) "list";
//variant (missingDataDetect) "text 'true' as '1'";
//variant (missingDataDetect) "text 'false' as '0'";
variant (choice) "untagged";
variant (choice.childResource_list) "untagged";
variant (choice.childResource_list[-]) "name as 'childResource'";
variant (choice.choice_list) "untagged";
variant (choice.choice_list[-]) "untagged";
};
type record TimeSeriesAnnc_optional
{
ResourceName resourceName optional,
ResourceType resourceType optional,
XSD.ID resourceID optional,
NhURI parentID optional,
Timestamp creationTime optional,
Timestamp lastModifiedTime optional,
Labels labels optional,
AcpType accessControlPolicyIDs optional,
Timestamp expirationTime optional,
XSD.AnyURI link optional,
ListOfURIs dynamicAuthorizationConsultationIDs optional,
XSD.NonNegativeInteger stateTag optional,
XSD.NonNegativeInteger maxNrOfInstances optional,
XSD.NonNegativeInteger maxByteSize optional,
XSD.NonNegativeInteger maxInstanceAge optional,
XSD.NonNegativeInteger currentNrOfInstances optional,
XSD.NonNegativeInteger currentByteSize optional,
XSD.NonNegativeInteger periodicInterval optional,
XSD.Boolean missingDataDetect optional,
MissingDataList missingDataList optional,
XSD.NonNegativeInteger missingDataCurrentNr optional,
XSD.NonNegativeInteger missingDataDetectTimer optional,
XSD.AnyURI ontologyRef optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of union {
TimeSeriesInstance_optional timeSeriesInstance,
TimeSeriesInstanceAnnc_optional timeSeriesInstanceAnnc,
Subscription_optional subscription,
SemanticDescriptor_optional semanticDescriptor,
SemanticDescriptorAnnc_optional semanticDescriptorAnnc
} choice_list
} choice optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (resourceName) "attribute";
//variant (missingDataDetect) "text 'true' as '1'";
//variant (missingDataDetect) "text 'false' as '0'";
variant (choice) "untagged";
variant (choice.childResource_list) "untagged";
variant (choice.childResource_list[-]) "name as 'childResource'";
variant (choice.choice_list) "untagged";
variant (choice.choice_list[-]) "untagged";
};
type record TimeSeriesInstance_optional
{
ResourceName resourceName optional,
ResourceType resourceType optional,
XSD.ID resourceID optional,
NhURI parentID optional,
Timestamp creationTime optional,
Timestamp lastModifiedTime optional,
Labels labels optional,
Timestamp expirationTime optional,
ListOfURIs announceTo optional,
record length(1 .. infinity) of XSD.NCName announcedAttribute optional,
AbsRelTimestamp dataGenerationTime optional,
XSD.AnySimpleType content optional,
XSD.NonNegativeInteger sequenceNr optional,
XSD.NonNegativeInteger contentSize optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (resourceName) "attribute";
variant (announcedAttribute) "list";
};
type record TimeSeriesInstanceAnnc_optional
{
ResourceName resourceName optional,
ResourceType resourceType optional,
XSD.ID resourceID optional,
NhURI parentID optional,
Timestamp creationTime optional,
Timestamp lastModifiedTime optional,
Labels labels optional,
Timestamp expirationTime optional,
XSD.AnyURI link optional,
AbsRelTimestamp dataGenerationTime optional,
XSD.AnySimpleType content optional,
XSD.NonNegativeInteger sequenceNr optional,
XSD.NonNegativeInteger contentSize optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (resourceName) "attribute";
};
}//end group OptionalResourceTypes
......@@ -8289,6 +8484,59 @@ group InvalidTypes {
variant (choice.choice_list) "untagged";
variant (choice.choice_list[-]) "untagged";
};
type record TimeSeries_update_invalid
{
ResourceName resourceName optional,
ResourceType resourceType optional,
XSD.ID resourceID optional,
NhURI parentID optional,
Timestamp creationTime optional,
Timestamp lastModifiedTime optional,
XSD.PositiveInteger expirationCounter optional,//Invalid field, non existing for Container
Labels labels optional,
AcpType accessControlPolicyIDs optional,
Timestamp expirationTime optional,
ListOfURIs dynamicAuthorizationConsultationIDs optional,
ListOfURIs announceTo optional,
record length(1 .. infinity) of XSD.NCName announcedAttribute optional,
XSD.NonNegativeInteger stateTag optional,
XSD.ID creator optional,
XSD.NonNegativeInteger maxNrOfInstances optional,
XSD.NonNegativeInteger maxByteSize optional,
XSD.NonNegativeInteger maxInstanceAge optional,
XSD.NonNegativeInteger currentNrOfInstances optional,
XSD.NonNegativeInteger currentByteSize optional,
XSD.NonNegativeInteger periodicInterval optional,
XSD.Boolean missingDataDetect optional,
XSD.NonNegativeInteger missingDataMaxNr optional,
MissingDataList missingDataList optional,
XSD.NonNegativeInteger missingDataCurrentNr optional,
XSD.NonNegativeInteger missingDataDetectTimer optional,
XSD.AnyURI ontologyRef optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of union {
TimeSeriesInstance_optional timeSeriesInstance,
Subscription_optional subscription,
SemanticDescriptor_optional semanticDescriptor
} choice_list
} choice optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (resourceName) "attribute";
variant (announcedAttribute) "list";
//variant (missingDataDetect) "text 'true' as '1'";
//variant (missingDataDetect) "text 'false' as '0'";
variant (choice) "untagged";
variant (choice.childResource_list) "untagged";
variant (choice.childResource_list[-]) "name as 'childResource'";
variant (choice.choice_list) "untagged";
variant (choice.choice_list[-]) "untagged";
};
type record LocationPolicy_update_invalid {
......
......@@ -37,6 +37,8 @@ module OneM2M_TypesAndValues {
const XSD.String c_defaultStatsCollectResourceName := "MyStatsCollectResource";
const XSD.String c_defaultm2mServiceSubscriptionProfileResourceName := "Mym2mServiceSubscriptionProfileResource";
const XSD.String c_defaultServiceSubscribedAppRuleResourceName := "MyServiceSubscribedAppRuleResource";
const XSD.String c_defaultTimeSeriesResourceName := "MyTimeSeriesResource";
const XSD.String c_defaultTimeSeriesInstanceResourceName := "MyTimeSeriesResource";
const XSD.ID c_aeAuxName := "MyAe";
const XSD.String c_defaultAE2Name := "MyAe2";
const XSD.String c_acpAuxName := "MyAcp";
......
......@@ -7196,6 +7196,89 @@ module OneM2M_Testcases_CSE_Release_2 {
}//end group Basic
}//end group Announcement
group dataManagement {
group timeSeries {
testcase TC_CSE_DMR_TS_001() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_DMR_TS_001());
v_ae1.done;
}
function f_CSE_DMR_TS_001() runs on AeSimu return ResponsePrimitive {
// Local variables
var MsgIn v_response;
var RequestPrimitive v_request;
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe();
v_resourceIndex := f_cse_createResource(int29, m_createTimeSeriesBase, v_aeIndex);
//Create data points and force a missingDataPoint
f_cse_generateMissingDataPoint(v_resourceIndex);
// Test Body
mcaPort.send(