Commit 0c24b5cc authored by Pramod Kulkarni's avatar Pramod Kulkarni
Browse files

Merge branch 'Release1' of https://git.onem2m.org/TST/ATS into Release1

parents 4357a3b9 b6701f04
......@@ -376,6 +376,48 @@ module OneM2M_Functions {
f_cse_postamble_default();
}
/**
* @desc Deletion of all resources created during the test case execution. IUT gets clean and ready for next execution
* @verdict
*/
function f_cse_postamble_deleteResourcesCSE() runs on CseTester {
var integer i;
var XSD.ID v_resourceAddress;
var RequestPrimitive v_request;
if (PX_RUN_POSTAMBLE) {
for(i := lengthof(vc_resourcesIndexToBeDeleted) -1; i >=0; i := i - 1) {
v_resourceAddress := f_getResourceAddress(vc_resourcesIndexToBeDeleted[i]);
v_request := valueof(m_delete(v_resourceAddress, f_getOriginator(vc_resourcesIndexToBeDeleted[i],false)));
v_request.from_ := PX_SUPER_CSE_ID;
mccPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
log(__SCOPE__&" INFO: Resource " & v_request.to_ & " deleted");
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
log(__SCOPE__&" INFO: Error while deleting resource " & v_request.to_);
}
[] tc_ac.timeout {
log(__SCOPE__&" INFO: No answer while deleting resource " & v_request.to_);
}
}
}
}
f_cse_postamble_default();
}
/**
* @desc Default postamble
* @verdict
......@@ -1669,6 +1711,9 @@ module OneM2M_Functions {
if(ischosen(p_contentResource.serviceSubscribedAppRule)) {
return p_contentResource.serviceSubscribedAppRule.resourceName;
}
if(ischosen(p_contentResource.remoteCSE)) {
return p_contentResource.remoteCSE.resourceName;
}
log(__SCOPE__&":WARNING: Primitive Content Kind not implemented");
return "resourceNameNotFound";
......
......@@ -204,6 +204,35 @@ module OneM2M_Templates {
}
};
/**
* @desc RETRIEVE request primtive containing the Filter Criteria in the filterCriteria field
* @param p_targetResourceAddress Target resource address
* @param p_originator Originator (from)
* @param p_filterUsage FilterUsage
* @param p_labels Labels
*/
template (value) RequestPrimitive m_retrieveResourceFilterUsageOptionLabel(XSD.ID p_targetResourceAddress, in XSD.ID p_originator, in template (value) FilterUsage p_filterUsage, in Labels p_labels) modifies m_retrieveResource := {
requestIdentifier := "m_retrieveResourceFilterUsageOptionLabel" & f_rnd(1, 1000000),
filterCriteria := {
createdBefore := omit,
createdAfter := omit,
modifiedSince := omit,
unmodifiedSince := omit,
stateTagSmaller := omit,
stateTagBigger := omit,
expireBefore := omit,
expireAfter := omit,
labels := p_labels,
resourceType := omit,
sizeAbove := omit,
sizeBelow := omit,
contentType_list := {},
attribute_list := {},
filterUsage := p_filterUsage,
limit := omit
}
};
/**
* @desc RETRIEVE request primtive containing the Discovery Type in the discoveryResultType field and Filter Criteria in the filterCriteria field
* @param p_targetResourceAddress Target resource address
......@@ -3294,10 +3323,10 @@ module OneM2M_Templates {
eventCategory := *
};
template ResponsePrimitive mw_responseDiscovery := {
template ResponsePrimitive mw_responseDiscovery(template URIList p_uriList := ?) := {
responseStatusCode := int2000,
requestIdentifier := ?,
primitiveContent := {uRIList := ?},
primitiveContent := {uRIList := p_uriList},
to_ := *,
from_ := *,
originatingTimestamp := *,
......
......@@ -43,7 +43,7 @@ module OneM2M_TestControl {
execute(TC_CSE_REG_CRE_018());
execute(TC_CSE_REG_CRE_022());
execute(TC_CSE_REG_CRE_023());
execute(TC_CSE_REG_CRE_024());
execute(TC_CSE_REG_CRE_025());
execute(TC_CSE_REG_CRE_026());
execute(TC_CSE_REG_RET_001());
execute(TC_CSE_REG_RET_005());
......
......@@ -1293,6 +1293,8 @@ module OneM2M_Testcases {
[] mccPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16);
}
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
......@@ -1308,7 +1310,7 @@ module OneM2M_Testcases {
}
// Postamble
f_cse_postamble_deleteResources();
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf04Down();
......@@ -1345,6 +1347,8 @@ module OneM2M_Testcases {
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16);
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
tc_ac.stop;
......@@ -1356,7 +1360,7 @@ module OneM2M_Testcases {
}
// Postamble
f_cse_postamble_deleteResources();
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf04Down();
......@@ -1387,6 +1391,7 @@ module OneM2M_Testcases {
// Test Body
v_request := f_getCreateRequestPrimitive(v_resourceType, m_createCSEBaseBase, -1);
v_request.from_ := f_getOriginator(v_aeIndex);
mcaPort.send(m_request(v_request));
tc_ac.start;
......@@ -15105,25 +15110,22 @@ module OneM2M_Testcases {
testcase TC_CSE_GMG_UPD_009() runs on CseTester system CseSystem
{
//Local constants
const integer c_maxNrOfMembers := 2;
const ResourceType c_ResourceTypeGroup := int9;
const ResourceType c_ResourceType1 := int4;
const MemberType c_memberType1 := int4; // should be set same type as c_ResourceType1
const XSD.String c_primitiveContent := "primitive_contet";
const ConsistencyStrategy c_consistentcyStrategy := int1; // ABANDOND_MEMBER
// const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS";
const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1";
const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2";
// Local variables
var MsgIn v_response;
var RequestPrimitive v_request;
var integer v_aeIndex := -1;
var integer v_groupIndex := -1;
var integer v_contentInstanceIndex := -1;
var integer v_containerIndex_1 := -1;
var integer v_containerIndex_2 := -1;
var XSD.AnyURI v_memberId_1;
var XSD.AnyURI v_memberId_2;
var template RequestPrimitive v_createRequest := m_createGroupBase;
var template RequestPrimitive v_updateRequest := m_updateGroupBase;
var template RequestPrimitive v_createMember;
var PrimitiveContent v_primitiveContentRetrievedResource;
// Test control
......@@ -15135,28 +15137,21 @@ module OneM2M_Testcases {
// Preamble
v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
// TODO: -> register IUT to the remoteCSE
v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex);
v_createRequest.primitiveContent.group_ := m_contentCreateGroup(1, {c_memberResourceAddress1}, omit);
v_createRequest.primitiveContent.group_.memberType := c_memberType1;
v_createRequest.primitiveContent.group_.memberTypeValidated := true;
v_createRequest.primitiveContent.group_.consistencyStrategy := c_consistentcyStrategy;
v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex);
//TODO: -> register IUT to the remoteCSE
//TODO: Create one of the container in a remoteCSE
v_containerIndex_1 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
v_containerIndex_2 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
// TODO: -> do the resources actually need to be created?
// TODO: choose the right template for member resource
v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1");
v_contentInstanceIndex := f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex);
v_memberId_1 := f_getResourceId(vc_resourcesList[v_containerIndex_1].resource);
v_memberId_2 := f_getResourceId(vc_resourcesList[v_containerIndex_2].resource);
// TODO: create resource of type <group> at c_memberResourceAddress2 on remoteCSE
// TODO: set onlineStatus to false on remoteCSE
v_createRequest := valueof(m_createGroup(c_maxNrOfMembers, {v_memberId_1}, omit, int3));
v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex);
//Test Body
v_updateRequest.primitiveContent.group_.memberIDs := {v_memberId_1, v_memberId_2};
v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest);
// v_request.to_ := c_targetResourceAddress;
v_createRequest.primitiveContent.group_ := m_contentCreateGroup(2, {c_memberResourceAddress1, c_memberResourceAddress2}, omit);
mcaPort.send(m_request(v_request));
tc_ac.start;
......@@ -15171,7 +15166,7 @@ module OneM2M_Testcases {
if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs) != 2) {
setverdict(fail, __SCOPE__ & ": Error, wrong number of memberIDs attribute");
} else {
if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs[0] == c_memberResourceAddress1 and v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs[1] == c_memberResourceAddress2) {
if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs[0] == v_memberId_1 and v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs[1] == v_memberId_2) {
setverdict(pass, __SCOPE__ & ": update successful");
} else {
setverdict(fail, __SCOPE__, ": Error, wrong memberIDs");
......@@ -15198,7 +15193,7 @@ module OneM2M_Testcases {
setverdict(fail, __SCOPE__, ": Error, memberTypeValidated attribute not updated");
}
if((v_primitiveContentRetrievedResource.group_.memberIDs[0] != c_memberResourceAddress1) and (v_primitiveContentRetrievedResource.group_.memberIDs[1] != c_memberResourceAddress2)){
if((v_primitiveContentRetrievedResource.group_.memberIDs[0] != v_memberId_1) and (v_primitiveContentRetrievedResource.group_.memberIDs[1] != v_memberId_2)){
setverdict(fail, __SCOPE__, ": Error, memberIDs attribute not correct");
}
}
......@@ -15219,13 +15214,7 @@ module OneM2M_Testcases {
{
//Local constants
const ResourceType c_ResourceTypeGroup := int9;
const ResourceType c_ResourceType1 := int4;
const MemberType c_memberType1 := int4; // should be set same type as c_ResourceType1
const XSD.String c_primitiveContent := "primitive_contet";
const ConsistencyStrategy c_consistentcyStrategy := int1; // ABANDOND_MEMBER
// const XSD.AnyURI c_targetResourceAddress := "TARGET_RESOURCE_ADDRESS";
const XSD.AnyURI c_memberResourceAddress1 := "MEMBER_RESSOURCE_ADDRESS_1";
const XSD.AnyURI c_memberResourceAddress2 := "MEMBER_RESSOURCE_ADDRESS_2";
const integer c_maxNrOfMembers := 2;
// Local variables
var MsgIn v_response;
......@@ -15233,11 +15222,17 @@ module OneM2M_Testcases {
var integer v_aeIndex := -1;
var integer v_remoteCSEIndex := -1;
var integer v_groupIndex := -1;
var integer v_contentInstanceIndex := -1;
var integer v_containerIndex_1 := -1;
var integer v_containerIndex_2 := -1;
var integer v_subscriptionIndex := -1;
var template RequestPrimitive v_createRequest := m_createGroupBase;
var template RequestPrimitive v_updateRequest := m_updateGroupBase;
var template RequestPrimitive v_createMember;
var XSD.AnyURI v_memberId_1;
var XSD.AnyURI v_memberId_2;
var CseTester v_notifyHandler;
// Test control
......@@ -15248,26 +15243,20 @@ module OneM2M_Testcases {
// Preamble
v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
// TODO: -> register IUT to the remoteCSE
//v_remoteCSEIndex := ...
v_createRequest := f_getCreateRequestPrimitive(c_ResourceTypeGroup, v_createRequest, v_aeIndex);
v_createRequest.primitiveContent.group_ := m_contentCreateGroup(2, {c_memberResourceAddress1, c_memberResourceAddress2}, omit);
v_createRequest.primitiveContent.group_.memberType := c_memberType1;
v_createRequest.primitiveContent.group_.memberTypeValidated := false;
v_createRequest.primitiveContent.group_.consistencyStrategy := c_consistentcyStrategy;
v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex);
//TODO: -> register IUT to the remoteCSE
v_containerIndex_1 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
v_containerIndex_2 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
v_memberId_1 := f_getResourceId(vc_resourcesList[v_containerIndex_1].resource);
v_memberId_2 := f_getResourceId(vc_resourcesList[v_containerIndex_2].resource);
// TODO: -> the AE having a subscription to c_targetResourceAddress
v_createRequest := valueof(m_createGroup(c_maxNrOfMembers, {v_memberId_1, v_memberId_2}, omit, int3));
// TODO: -> do the resources actually need to be created?
// TODO: choose the right template for member resource
v_createMember := m_createContentInstance(f_getResourceAddress(v_aeIndex), c_primitiveContent & "_1");
v_contentInstanceIndex := f_cse_createResource(c_ResourceType1, v_createMember, v_aeIndex);
v_groupIndex := f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex);
// TODO: create resource of type <group> at c_memberResourceAddress2 on remoteCSE
// TODO: set onlineStatus to false on remoteCSE
v_subscriptionIndex := f_cse_createResource(int23,m_createSubscriptionBase, v_groupIndex);
v_notifyHandler.start(f_cse_notifyProcedure_subscriptionVerificationHandler(v_aeIndex));
//Test Body
v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest);
......@@ -15280,8 +15269,7 @@ module OneM2M_Testcases {
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": update successful");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
......@@ -15769,6 +15757,7 @@ module OneM2M_Testcases {
var RequestPrimitive v_request;
var integer v_childResourceIndex := -1;
const ResourceType c_containerResourceType := int3;
var Labels v_labels := {"NotFoundLabel"};
// Test control
......@@ -15782,12 +15771,14 @@ module OneM2M_Testcases {
v_resourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_aeIndex);
v_childResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_resourceIndex);
v_request := valueof(m_retrieveResourceFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1));
//v_request := valueof(m_retrieveResourceFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1));
v_request := valueof(m_retrieveResourceFilterUsageOptionLabel(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1, v_labels));
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responseDiscovery)) -> value v_response {
tc_ac.stop;
log("sizeof: " & int2str(sizeof(v_response.primitive.responsePrimitive.primitiveContent.uRIList)));
if(sizeof(v_response.primitive.responsePrimitive.primitiveContent.uRIList) == 0){
setverdict(pass, __SCOPE__ & ": No Content is present");
}
......@@ -15828,6 +15819,7 @@ module OneM2M_Testcases {
var RequestPrimitive v_request;
var integer v_childResourceIndex := -1;
const ResourceType c_containerResourceType := int3;
var integer v_i_cont := 0;
// Test control
......@@ -15847,10 +15839,13 @@ module OneM2M_Testcases {
alt {
[] mcaPort.receive(mw_response(mw_responseDiscovery)) -> value v_response {
tc_ac.stop;
if (f_isNonHierarchical(v_response.primitive.responsePrimitive.primitiveContent.uRIList[0])) {
setverdict(pass, __SCOPE__ & ": Non-hierarchical address form present in URIList element");
while (v_i_cont<sizeof(v_response.primitive.responsePrimitive.primitiveContent.uRIList)){
if (f_isNonHierarchical(v_response.primitive.responsePrimitive.primitiveContent.uRIList[v_i_cont])) {
setverdict(pass, __SCOPE__ & ": Non-hierarchical address form present in URIList[" & int2str(v_i_cont) & "] element");
} else {
setverdict(fail, __SCOPE__ & ": Non-hierarchical address form absent in URIList representation");
setverdict(fail, __SCOPE__ & ": Non-hierarchical address form absent in URIList[" & int2str(v_i_cont) & "] element");
}
v_i_cont := v_i_cont + 1;
}
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
......@@ -16013,7 +16008,9 @@ module OneM2M_Testcases {
v_resourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_aeIndex);
v_childResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_resourceIndex);
v_request := valueof(m_retrieveResourceInvalidFormatOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
v_request := valueof(m_retrieveResourceFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1));
v_request.filterCriteria.expireBefore := "20171231T012345";
v_request.filterCriteria.expireAfter := "20181231T012345";
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
......@@ -17949,6 +17946,10 @@ module OneM2M_Testcases {
}
//Postamble
//We are forced to delete the Ae because the delete request in the postamble_deleteResources is sent by Ae itself, witch doesn't have privileges
if(testcasename() == "TC_CSE_SEC_ACP_001_DEL") {
f_cse_deleteResource(v_aeIndex, m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator()));//Use of PX_SUPER_AE_ID to remove AE
}
f_cse_postamble_deleteResources();
//Tear down
......@@ -18394,6 +18395,10 @@ module OneM2M_Testcases {
}
//Postamble
//We are forced to delete the Ae because the delete request in the postamble_deleteResources is sent by Ae itself, witch doesn't have privileges
if(testcasename() == "TC_CSE_SEC_ACP_012_DEL") {
f_cse_deleteResource(v_aeIndex, m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator()));//Use of PX_SUPER_AE_ID to remove AE
}
f_cse_postamble_deleteResources();
//Tear down
......
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