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

Output from oneM2M Plugtests#2

parent 819d9632
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Functions.ttcn $
* $Id: OneM2M_Functions.ttcn 76 2016-04-29 14:15:01Z berge $
* $Id: OneM2M_Functions.ttcn 97 2016-06-01 15:38:10Z reinaortega $
* @desc Module containing functions for oneM2M
*
*/
......@@ -46,24 +46,34 @@ module OneM2M_Functions {
group preambleFunctions {
function f_preamble_registerAe(in template (value) XSD.String p_name, in template (value) AccessControlOperations p_allowedOperations) runs on M2M {
function f_preamble_registerAe(in template (value) AccessControlOperations p_allowedOperations := int63) runs on M2M {//c_CRUDNDi
var RequestPrimitive v_request;
var M2MResponsePrimitive v_response;
var XSD.ID v_acpId;
var XSD.ID v_acpId := "0";
v_acpId := f_createAccessControlPolicyAux(p_allowedOperations := p_allowedOperations);
if(PX_ACP_SUPPORT){
v_acpId := f_createAccessControlPolicyAux(p_allowedOperations := p_allowedOperations);
}
mcaPort.send(m_request(m_createAeAux(p_name, {v_acpId})));
if(v_acpId != "0") {
mcaPort.send(m_request(m_createAeAux({v_acpId})));
//mcaPort.send(m_request(m_createAeAux(p_name, {PX_URI_CSE & PX_CSE_NAME & "/" & c_acpAuxName})));
} else {
mcaPort.send(m_request(m_createAeAux()));
}
tc_ac.start;
alt {
[] mcaPort.receive(mw_responseOK) -> value v_response {
tc_ac.stop;
log("Preamble: Application registered successfuly");
if(ischosen(v_response.responsePrimitive_.primitiveContent.any_1[0].AE)) {
vc_ae := v_response.responsePrimitive_.primitiveContent.any_1[0].AE;
f_sendAcPrimitive("AE-ID_changed", vc_ae.aE_ID);
vc_aeAux := v_response.responsePrimitive_.primitiveContent.any_1[0].AE;
if(ispresent(vc_aeAux.aE_ID)){
f_sendAcPrimitive("AE-ID_changed", vc_aeAux.aE_ID);
} else {
f_sendAcPrimitive("AE-ID_changed", "0");
}
}
}
[] mcaPort.receive(mw_responseKO) {
......@@ -88,12 +98,20 @@ module OneM2M_Functions {
group postambleFunctions {
function f_postamble_deleteResources(in template (value) XSD.String p_aeName) runs on M2M {
function f_postamble_deleteResources() runs on M2M {
var M2MResponsePrimitive v_response;
var RequestPrimitive v_request;
if (PX_RUN_POSTAMBLE) {
mcaPort.send(m_request(m_deleteAe(PX_URI_CSE & PX_CSE_NAME & "/" & valueof(p_aeName))));
if(PX_UNSTRUCTURED)
{
v_request := m_deleteAe("/" & vc_aeAux.aE_ID);
v_request.from_ := vc_aeAux.aE_ID;
mcaPort.send(m_request(v_request));
} else {
mcaPort.send(m_request(m_deleteAe(PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName)));
}
tc_ac.start;
alt {
[] mcaPort.receive(mw_responseOK) {
......@@ -108,23 +126,32 @@ module OneM2M_Functions {
log("Postamble: No answer while deleting resource");
}
}
mcaPort.send(m_request(m_deleteAcp(PX_URI_CSE & PX_CSE_NAME & "/MyAcp")));
tc_ac.start;
alt {
[] mcaPort.receive(mw_responseOK) {
tc_ac.stop;
log("Postamble: ACP Resource deleted");
}
[] mcaPort.receive(mw_responseKO) {
tc_ac.stop;
log("Postamble: Error while deleting resource");
}
[] tc_ac.timeout {
log("Postamble: No answer while deleting resource");
}
}
if(PX_ACP_SUPPORT){
if(PX_UNSTRUCTURED)
{
v_request := m_deleteAcp("/" & vc_acpAux.resourceID);
v_request.from_ := PX_AE_ID_STEM;
mcaPort.send(m_request(v_request));
} else {
mcaPort.send(m_request(m_deleteAcp(PX_URI_CSE & PX_CSE_NAME & "/" & c_acpAuxName)));
}
tc_ac.start;
alt {
[] mcaPort.receive(mw_responseOK) {
tc_ac.stop;
log("Postamble: ACP Resource deleted");
}
[] mcaPort.receive(mw_responseKO) {
tc_ac.stop;
log("Postamble: Error while deleting resource");
}
[] tc_ac.timeout {
log("Postamble: No answer while deleting resource");
}
}
}
}
......@@ -171,12 +198,28 @@ module OneM2M_Functions {
}
if (p_resourceType == int9) {//group
p_request.primitiveContent.any_1[0].Group_create := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & vc_ae.resourceID}, omit);
if(PX_UNSTRUCTURED) {
p_request.primitiveContent.any_1[0].Group_optional := m_contentCreateGroup (1, {"/" & vc_aeAux.resourceID}, omit);
} else {
p_request.primitiveContent.any_1[0].Group_optional.memberIDs := {PX_CSE_ID & "/" & PX_CSE_NAME & "/" & c_aeAuxName};//vc_aeAux.resourceID
}
}
if (p_resourceType == int15) {//pollingChannel
p_request.from_ := vc_ae.aE_ID;
p_request.from_ := vc_aeAux.aE_ID;
}
if (p_resourceType == int23) {//subscription
if(PX_FROM_IS_AE_ID) {
if(PX_UNSTRUCTURED){
p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {vc_aeAux.aE_ID};
} else {
p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {PX_CSE_ID & "/" & vc_aeAux.aE_ID};
}
} else {
p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {"/" & PX_CSE_NAME & "/" & c_aeAuxName};
}
}
return valueof(p_request);
}
......@@ -214,8 +257,23 @@ module OneM2M_Functions {
function f_getResourceId(PrimitiveContent p_contentResource) return XSD.ID {
if(ischosen(p_contentResource.any_1[0].AccessControlPolicy)) {
return p_contentResource.any_1[0].AccessControlPolicy.resourceID;
if(ischosen(p_contentResource.any_1[0].AccessControlPolicy_optional)) {
return p_contentResource.any_1[0].AccessControlPolicy_optional.resourceID;
}
if(ischosen(p_contentResource.any_1[0].Container_optional)) {
return p_contentResource.any_1[0].Container_optional.resourceID;
}
if(ischosen(p_contentResource.any_1[0].Schedule_optional)) {
return p_contentResource.any_1[0].Schedule_optional.resourceID;
}
if(ischosen(p_contentResource.any_1[0].PollingChannel_optional)) {
return p_contentResource.any_1[0].PollingChannel_optional.resourceID;
}
if(ischosen(p_contentResource.any_1[0].Subscription_optional)) {
return p_contentResource.any_1[0].Subscription_optional.resourceID;
}
if(ischosen(p_contentResource.any_1[0].Group_optional)) {
return p_contentResource.any_1[0].Group_optional.resourceID;
}
return "1";
......@@ -242,6 +300,7 @@ module OneM2M_Functions {
var M2MResponsePrimitive v_response;
var RequestPrimitive v_request;
var XSD.ID v_resourceId;
v_request := f_getCreateRequestPrimitive(p_resourceType,p_parentResourceAddress, omit, p_requestPrimitive);
......@@ -251,6 +310,7 @@ module OneM2M_Functions {
[] mcaPort.receive(mw_responseOK) -> value v_response {
tc_ac.stop;
setverdict(pass, "f_createResource: Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly");
vc_resourceId := f_getResourceId(v_response.responsePrimitive_.primitiveContent);
}
[] mcaPort.receive(mw_responseKO) {
tc_ac.stop;
......@@ -281,6 +341,7 @@ module OneM2M_Functions {
tc_ac.stop;
setverdict(pass, "f_createAccessControlPolicy: Resource type " & int2str(1) & " created successfuly");
v_acpId := f_getResourceId(v_response.responsePrimitive_.primitiveContent);
vc_acpAux := v_response.responsePrimitive_.primitiveContent.any_1[0].AccessControlPolicy_optional;
return v_acpId;
}
[] mcaPort.receive(mw_responseKO) {
......@@ -310,8 +371,8 @@ module OneM2M_Functions {
v_acpId := f_createAccessControlPolicyAux(p_acpName := "MyAcp_2");
v_request := valueof(m_createContainerBase);
v_request.primitiveContent.any_1[0].Container_create.accessControlPolicyIDs := {v_acpId};
v_request.primitiveContent.any_1[0].Container_create.resourceName := "MyContainerAux";
v_request.primitiveContent.any_1[0].Container_optional.accessControlPolicyIDs := {v_acpId};
v_request.primitiveContent.any_1[0].Container_optional.resourceName := "MyContainerAux";
f_createResource(int3, p_parentResourceAddress, v_request );
......@@ -325,9 +386,9 @@ module OneM2M_Functions {
v_request := valueof(m_updateAcpBase);
v_request.to_ := p_acpAddress;
v_request.primitiveContent.any_1[0].ACP_update.privileges.accessControlRule_list := {
v_request.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges.accessControlRule_list := {
{
accessControlOriginators := {"admin:admin"},
accessControlOriginators := {"*"}, //{"admin:admin"}
accessControlOperations := p_allowedOperations,
accessControlContexts_list := omit
}
......@@ -339,7 +400,6 @@ module OneM2M_Functions {
[] mcaPort.receive(mw_responseOK) {
tc_ac.stop;
setverdict(pass, "f_updateAcpAuxResource: " & p_acpAddress & " resource updated successfuly");
//TODO: Check that name attribute is provided
}
[] mcaPort.receive(mw_responseKO) {
tc_ac.stop;
......@@ -358,7 +418,6 @@ module OneM2M_Functions {
}
}//end group helpingFunctions
......
......@@ -7,13 +7,14 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Pixits.ttcn $
* $Id: OneM2M_Pixits.ttcn 49 2016-04-25 08:29:23Z reinaortega $
* $Id: OneM2M_Pixits.ttcn 97 2016-06-01 15:38:10Z reinaortega $
* @desc Module containing Pixits for oneM2M
*
*/
module OneM2M_Pixits {
import from XSD all;
import from OneM2M_Types all;
modulepar boolean PX_DELETE_CREATED_RESOURCES := true;
......@@ -27,7 +28,9 @@ module OneM2M_Pixits {
modulepar charstring PX_CSE_NAME := "in-cse";
modulepar charstring PX_URI_CSE := "/~/in-cse/";
modulepar charstring PX_URI_CSE := "/~/in-cse";
modulepar boolean PX_UNSTRUCTURED := false;
modulepar charstring PX_AE_ID_STEM := "admin:admin";
......@@ -35,8 +38,16 @@ module OneM2M_Pixits {
modulepar boolean PX_RUN_POSTAMBLE := true;
modulepar ListOfURIs PX_ACOR := {"*"};
modulepar charstring PX_SERIALIZATION := "JSON";
modulepar charstring PX_PROTOCOL_BINDING := "HTTP";
modulepar boolean PX_ACP_SUPPORT := true;
modulepar charstring PX_CSE_ID := "/in-cse";
modulepar boolean PX_FROM_IS_AE_ID := false;
} // end of module
This diff is collapsed.
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_TestControl.ttcn $
* $Id: OneM2M_TestControl.ttcn 23 2016-03-17 10:02:44Z reinaortega $
* $Id: OneM2M_TestControl.ttcn 97 2016-06-01 15:38:10Z reinaortega $
* @desc Test control module for oneM2M
*
*/
......@@ -17,9 +17,7 @@ module OneM2M_TestControl {
import from OneM2M_Testcases all;
control {
execute(TC_RETRIEVE_CSEBASE());
execute(TC_REGISTER_AE());
execute(TC_UPDATE_CONTENT());
}
} // end of module
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_TestSystem.ttcn $
* $Id: OneM2M_TestSystem.ttcn 76 2016-04-29 14:15:01Z berge $
* $Id: OneM2M_TestSystem.ttcn 97 2016-06-01 15:38:10Z reinaortega $
* @desc Test System module for oneM2M
*
*/
......@@ -16,6 +16,7 @@ module OneM2M_TestSystem {
import from OneM2M_Types all;
import from OneM2M_TypesAndValues all;
import from LibCommon_Time {modulepar all};
import from XSD all;
/* Ports */
type port OneM2MPort message {
......@@ -41,9 +42,9 @@ module OneM2M_TestSystem {
timer tc_ac := PX_TAC;
timer tc_wait;
//global variables
var AE vc_ae;
var anytype vc_contentCreate;
var anytype vc_contentUpdate;
var AE vc_aeAux;
var AccessControlPolicy_optional vc_acpAux;
var XSD.ID vc_resourceId := "0";//TODO Clean it, I put it here cause the function f_createResource was already returning another value
}
type component M2MSystem {
......
This diff is collapsed.
This diff is collapsed.
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_TypesAndValues.ttcn $
* $Id: OneM2M_TypesAndValues.ttcn 69 2016-04-28 07:49:58Z reinaortega $
* $Id: OneM2M_TypesAndValues.ttcn 97 2016-06-01 15:38:10Z reinaortega $
* @desc Module containing types and values for oneM2M
*
*/
......@@ -20,6 +20,7 @@ module OneM2M_TypesAndValues {
const charstring c_uri_cse := "/~/in-cse/";
const charstring c_cse_name := "in-cse";
const XSD.String c_defaultResourceName := "MyResource";
const charstring c_aeAuxName := "MyAe";
const XSD.String c_acpAuxName := "MyAcp";
//AccessControlOperations
......
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