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

First FLXC (FlexContainer) test cases implemented


Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent c170c6e4
......@@ -986,7 +986,16 @@ module OneM2M_Templates {
resourceType := int28,
primitiveContent := {flexContainer := ?}
};
/**
* @desc Base CREATE request primitive for GenericInterworkingService resource
*/
template (value) RequestPrimitive m_createGenericInterworkingServiceBase modifies m_create := {
requestIdentifier := testcasename() & "-m_createGenericInterworkingService",
resourceType := int28,
primitiveContent := {genericInterworkingService := m_contentCreateGenericInterworkingService()}
};
/**
* @desc Reception template for CREATE GenericInterworkingOperationInstance
*/
......@@ -1907,8 +1916,39 @@ module OneM2M_Templates {
aggregatedRequest := omit,//O
choice := omit//NP
};
};
/**
* @desc Base primitiveContent for CREATE operation for GenericInterworkingService resource
* @param p_accessControlPolicyIds ACP IDs for the PollingChannel
* @param p_name Resource name
*/
template (value) GenericInterworkingService_optional m_contentCreateGenericInterworkingService (in template (omit) XSD.String p_name := c_defaultGenericInterworkingServiceResourceName,
in template (omit) AcpType p_accessControlPolicyIds := omit) := {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
creationTime := omit,//NP
lastModifiedTime := omit,//NP
labels := omit,//O
accessControlPolicyIDs := p_accessControlPolicyIds,//O
expirationTime := omit,//O
dynamicAuthorizationConsultationIDs := omit,//O
announceTo := omit,//O
announcedAttribute := omit,//O
stateTag := omit,//NP
creator := omit,//O
containerDefinition := "org.onem2m.genericInterworkingService",//M
ontologyRef := omit,//O
serviceName := "MyService",//M??
inputDataPointLinks := omit,//O
outputDataPointLinks := omit,//O
choice := omit//NP
};
/**
* @desc Base primitiveContent for CREATE operation for Group resource
* @param p_maxNrOfMembers Max number of members
......@@ -4911,6 +4951,38 @@ module OneM2M_Templates {
choice := *//O
};
/**
* @desc Base primitiveContent for CREATE operation for GenericInterworkingService resource
* @param p_accessControlPolicyIds ACP IDs for the PollingChannel
* @param p_name Resource name
*/
template (value) GenericInterworkingService_invalid m_contentCreateGenericInterworkingService_invalid (in template (omit) XSD.String p_name := c_defaultGenericInterworkingServiceResourceName,
in template (omit) AcpType p_accessControlPolicyIds := omit) := {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
creationTime := omit,//NP
lastModifiedTime := omit,//NP
expirationCounter := 1,//Invalid attribute
labels := omit,//O
accessControlPolicyIDs := p_accessControlPolicyIds,//O
expirationTime := omit,//O
dynamicAuthorizationConsultationIDs := omit,//O
announceTo := omit,//O
announcedAttribute := omit,//O
stateTag := omit,//NP
creator := omit,//O
containerDefinition := "org.onem2m.genericInterworkingService",//M
ontologyRef := omit,//O
serviceName := "MyService",//M??
inputDataPointLinks := omit,//O
outputDataPointLinks := omit,//O
choice := omit//NP
};
template (value) AE_update_invalid m_contentUpdateAe_invalid := {
resourceName := omit,//M
resourceType := omit,//M
......
......@@ -1720,6 +1720,7 @@ type union PrimitiveContent {
TimeSeriesInstance_optional timeSeriesInstance,
TimeSeriesAnnc_optional timeSeriesAnnc,
TimeSeriesInstanceAnnc_optional timeSeriesInstanceAnnc,
GenericInterworkingService_optional genericInterworkingService,
GenericInterworkingOperationInstance_optional genericInterworkingOperationInstance,
//SecurityInfo
SecurityInfo securityInfo,
......@@ -1740,6 +1741,7 @@ type union PrimitiveContent {
AE_update_invalid aE_update_invalid,
ACP_update_invalid aCP_update_invalid,
Container_update_invalid container_update_invalid,
GenericInterworkingService_invalid genericInterworkingService_invalid,
Group_update_invalid group_update_invalid,
PollingChannel_update_invalid pollingChannel_update_invalid,
Schedule_update_invalid schedule_update_invalid,
......@@ -7220,6 +7222,48 @@ group OptionalResourceTypes {
variant (choice.choice_list[-]) "untagged";
};
type record GenericInterworkingService_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,
ListOfNCNames announcedAttribute optional,
XSD.NonNegativeInteger stateTag optional,
XSD.ID creator optional,
XSD.AnyURI containerDefinition optional,
XSD.AnyURI ontologyRef optional,
XSD.String serviceName optional,
ListOfDataLinks inputDataPointLinks optional,
ListOfDataLinks outputDataPointLinks optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record of union {
GenericInterworkingService genericInterworkingService,
GenericInterworkingOperationInstance genericInterworkingOperationInstance,
SemanticDescriptor semanticDescriptor,
Subscription 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 GenericInterworkingOperationInstance_optional
{
ResourceName resourceName optional,
......@@ -8343,6 +8387,49 @@ group InvalidTypes {
variant (choice.choice_list[-]) "untagged";
};
type record GenericInterworkingService_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,
ListOfNCNames announcedAttribute optional,
XSD.NonNegativeInteger stateTag optional,
XSD.ID creator optional,
XSD.AnyURI containerDefinition optional,
XSD.AnyURI ontologyRef optional,
XSD.String serviceName optional,
ListOfDataLinks inputDataPointLinks optional,
ListOfDataLinks outputDataPointLinks optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record of union {
GenericInterworkingService genericInterworkingService,
GenericInterworkingOperationInstance genericInterworkingOperationInstance,
SemanticDescriptor semanticDescriptor,
Subscription 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 Group_update_invalid {
ResourceName resourceName optional,
ResourceType resourceType optional,
......
......@@ -43,6 +43,7 @@ module OneM2M_TypesAndValues {
const XSD.String c_defaultTimeSeriesResourceName := "MyTimeSeriesResource";
const XSD.String c_defaultTimeSeriesAnncResourceName := "MyTimeSeriesAnncResource";
const XSD.String c_defaultTimeSeriesInstanceResourceName := "MyTimeSeriesInstanceResource";
const XSD.String c_defaultGenericInterworkingServiceResourceName := "MyGenericInterworkingServiceResource"; //<genericInterworkingService>
const XSD.ID c_aeAuxName := "MyAe";
const XSD.String c_defaultAE2Name := "MyAe2";
const XSD.String c_acpAuxName := "MyAcp";
......
......@@ -1032,6 +1032,27 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
testcase TC_CSE_DMR_CRE_002_FLXC() runs on Tester system CseSystem {
// Local variables
var ResponsePrimitive v_responsePrimitive;
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
v_ae1.done;
v_ae1.start(f_CSE_DMR_CRE_002(int28, m_createGenericInterworkingServiceBase));//Specialization of FlexContainer
v_ae1.done;
if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
if(not ispresent(v_responsePrimitive.primitiveContent.genericInterworkingService.resourceName)){
setverdict(fail, __SCOPE__, ": Error, resourceName attribute not provided");
} else {
if(v_responsePrimitive.primitiveContent.flexContainer.resourceName != c_defaultGenericInterworkingServiceResourceName){
setverdict(fail, __SCOPE__, ": Error, resourceName attribute not correct");
}
}
}
}
}// end group g_CSE_DMR_CRE_002
group g_CSE_DMR_CRE_003 {
......@@ -13896,6 +13917,357 @@ module OneM2M_Testcases_CSE_Release_2 {
}//end group timeSeries
}//end group dataManagement
group FlexContainer {
group Create {
/**
* @desc Check that the IUT rejects the creation of the <flexContainer> resource when the resource representation does not comply with the schema definition.
*
*/
testcase TC_CSE_FLXC_CRE_001() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
v_ae1.done;
v_ae1.start(f_CSE_FLXC_CRE_001());
v_ae1.done;
}
function f_CSE_FLXC_CRE_001() runs on AeSimu {
// Local variables
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
var RequestPrimitive v_request := m_create;
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe(-, -);//AE1 is registred;
v_request.primitiveContent := { genericInterworkingService_invalid := m_contentCreateGenericInterworkingService_invalid };
v_request := f_getCreateRequestPrimitive(int28, v_request, v_aeIndex);
mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Creation of resource type 28 rejected correctly");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Creating resource type 28 with invalid representation");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource type 28");
}
}
//Check to see if the resource is NOT present
if(f_cse_isResourceNotPresent(v_aeIndex, f_getResourceName(v_request.primitiveContent))){
setverdict(pass, __SCOPE__ & ":INFO: Resource not created");
} else {
setverdict(fail, __SCOPE__ & ":ERROR: Resource created");
}
// Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf01Down();
} // end TC_CSE_FLXC_CRE_001
/**
* @desc Check that the IUT rejects the creation of the <flexContainer> resource when the IUT does not have the schema definition.
*
*/
testcase TC_CSE_FLXC_CRE_002() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
v_ae1.done;
v_ae1.start(f_CSE_FLXC_CRE_002());
v_ae1.done;
}
function f_CSE_FLXC_CRE_002() runs on AeSimu {
// Local variables
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
var RequestPrimitive v_request;
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe(-, -);//AE1 is registred;
v_request := m_createGenericInterworkingServiceBase;
v_request.primitiveContent.genericInterworkingService.containerDefinition := "org.onem2m.nonExistingDefinition";
v_request := f_getCreateRequestPrimitive(int28, v_request, v_aeIndex);
mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Creation of resource type 28 rejected correctly");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Creating resource type 28 with invalid representation");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource type 28");
}
}
//Check to see if the resource is NOT present
if(f_cse_isResourceNotPresent(v_aeIndex, f_getResourceName(v_request.primitiveContent))){
setverdict(pass, __SCOPE__ & ":INFO: Resource not created");
} else {
setverdict(fail, __SCOPE__ & ":ERROR: Resource created");
}
// Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf01Down();
} // end TC_CSE_FLXC_CRE_002
/**
* @desc Check that the IUT increments the field value of attribute stateTag in the parent <flexContainer> resource when a resource is created as the direct child of the parent <flexContainer>
*
*/
testcase TC_CSE_FLXC_CRE_003() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
v_ae1.done;
v_ae1.start(f_CSE_FLXC_CRE_003());
v_ae1.done;
}
function f_CSE_FLXC_CRE_003() runs on AeSimu {
//Local variables
var integer v_aeIndex, v_acpAuxIndex := -1;
var integer v_resourceIndex := -1;
var RequestPrimitive v_req1;
var RequestPrimitive v_req2;
var RequestPrimitive v_req3;
var MsgIn v_resp1, v_resp3;
var ResponsePrimitive v_resp2;//Response to a Notify Request
// Test control
// Test component configuration
f_cf02Up();
// Test adapter configuration
// Preamble
vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));
vc_cse1.done;
v_acpAuxIndex := f_cse_preamble_createAcpAux();
v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);//AE1 is registred;
v_resourceIndex := f_cse_createResource(int15, m_createPollingChannelBase, v_aeIndex);
v_req1 := valueof(m_retrievePollingRequest(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
mcaPort.send(f_getMsgOutPrimitive(m_request(v_req1)));
//v_req2 := valueof(m_notifyNotification(f_getResourceAddress(v_aeIndex), m_contentNotification_subscriptionVerification));
v_req2 := valueof(m_notify(f_getResourceAddress(v_aeIndex)));
v_req2.requestExpirationTimestamp := {alt_1 := 15000};
vc_cse1.start(f_cse_notifyProcedure_notify(v_req2));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePollingResponse(v_req2))) -> value v_resp1 {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Polling response received");
}
[] mcaPort.receive(mw_response(mw_responsePollingResponse)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Content not carrying request targeting AE1");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
}
}
f_checkAeSimuStatus();
//Send response in any case
v_resp2 := valueof(m_responseNotification(int2000, omit));
v_resp2.requestIdentifier := v_resp1.primitive.responsePrimitive.primitiveContent.requestPrimitive.requestIdentifier;
v_req3 := valueof(m_notifyResponsePrimitive(f_getResourceAddress(v_resourceIndex) & "/" & c_resourceShortNamePollingChannelUri, v_resp2));
v_req3.from_ := f_getOriginator(v_aeIndex);
mcaPort.send(f_getMsgOutPrimitive(m_request(v_req3)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responseNotify(int2000))) -> value v_resp3 {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Polling response received");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(fail, __SCOPE__&":INFO: Error while performing notification");
}
[] mcaPort.receive {
tc_ac.stop;
setverdict(fail, __SCOPE__&":INFO: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__&":INFO: No answer while performing notification");
}
}
f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
//Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf02Down();
}
}//end of group Create
group Update {
/**
* @desc Check that the IUT rejects the update of the <flexContainer> resource when the resource representation does not comply with the schema definition.
*
*/
testcase TC_CSE_FLXC_UPD_001() runs on Tester system CseSystem {
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
v_cse1.done;
v_cse1.start(f_CSE_FLXC_UPD_001());
v_cse1.done;
}
function f_CSE_FLXC_UPD_001() runs on CseSimu {
//Local variables
var integer v_localResourceIndex := -1;
var MsgIn v_request_req1, v_request_req3;
var RequestPrimitive v_request_req2;
var ResponsePrimitive v_response_rsp1;
var template UtTriggerPrimitive v_utRequest1 := m_utCreatePollingChannel;
var template UtTriggerPrimitive v_utRequest2;
var charstring v_action1 := "Please, send a Polling Channel CREATE request";
var charstring v_action2 := "Please, send a Polling request (Retrieve PollingChannelURI request)";
var RequestPrimitive v_requestNotify;
//Test control
// Test component configuration
f_cf02UpCseSimuMaster();
// Test adapter configuration
// Preamble
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
//send triggering primitive to SUT
v_localResourceIndex := f_cse_createLocalResource(v_utRequest1,v_action1);
//Check that the created resource is a PollingChannel
if(not(vc_localResourcesList[v_localResourceIndex].resourceType == int15)) {
setverdict(inconc, __SCOPE__&":INFO: Polling Channel resource not creaded");
f_checkCseSimuStatus();
}
//Trigger IUT for sending a polling request (req1)
v_utRequest2 := valueof(m_utRetrievePollingChannelUri(f_getLocalResourceAddress(v_localResourceIndex) & "/" & c_resourceShortNamePollingChannelUri));
f_sendUtPrimitive(v_utRequest2,v_action2);
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(mw_retrieve(f_getResourceAddress(v_localResourceIndex) & "/" & c_resourceShortNamePollingChannelUri))) -> value v_request_req1 {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Polling request received successfuly");
v_response_rsp1 := valueof(m_responsePrimitive(int2000,v_request_req1.primitive.requestPrimitive.requestIdentifier));
v_response_rsp1.from_ := PX_CSE1_ID;
v_response_rsp1.to_ := v_request_req1.primitive.requestPrimitive.from_;
//Put in the primitiveContent a Notify request (req2) (simulated) from another node CSE
v_request_req2 := valueof(m_notify(f_getResourceAddress(vc_remoteCseIndex)));
v_response_rsp1.primitiveContent := { requestPrimitive := v_request_req2 };
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response_rsp1)));
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type Polling Channel");
}
}
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value v_request_req3 {
tc_ac.stop;
//Check that primitiveContent carries the response to req2 (resp2)
if(v_request_req3.primitive.requestPrimitive.primitiveContent.responsePrimitive.requestIdentifier == v_request_req2.requestIdentifier) {
setverdict(pass, __SCOPE__ & ": NOTIFY request received carrying response (rsp2) to the Notify request (req2)");
} else {
setverdict(fail, __SCOPE__ & ": NOTIFY request received not carryng the expected response (rsp2) to the Notify request (req2)");
}
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No message while expecting NOTIFY request");
}
}
//Postamble
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf02DownCseSimuMaster();
}
}//end of group Update
}//end group FlexContainer
}//end group CSE
......
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