TST-2016-0082-TS-0019_TTCN-3_Test_cases

parent c574a0f5
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Functions.ttcn $
* $Id: OneM2M_Functions.ttcn 43 2016-04-13 12:16:12Z reinaortega $
* $Id: OneM2M_Functions.ttcn 76 2016-04-29 14:15:01Z berge $
* @desc Module containing functions for oneM2M
*
*/
......@@ -33,6 +33,7 @@ module OneM2M_Functions {
// Map
map(self:mcaPort, system:mcaPort);
map(self:acPort, system:acPort);
activate(a_default());
// Connect
......@@ -52,7 +53,7 @@ module OneM2M_Functions {
var XSD.ID v_acpId;
v_acpId := f_createAccessControlPolicyAux(p_allowedOperations);
v_acpId := f_createAccessControlPolicyAux(p_allowedOperations := p_allowedOperations);
mcaPort.send(m_request(m_createAeAux(p_name, {v_acpId})));
tc_ac.start;
......@@ -62,6 +63,7 @@ module OneM2M_Functions {
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);
}
}
[] mcaPort.receive(mw_responseKO) {
......@@ -91,7 +93,7 @@ module OneM2M_Functions {
var M2MResponsePrimitive v_response;
if (PX_RUN_POSTAMBLE) {
mcaPort.send(m_request(m_deleteAe("/" & PX_CSE_NAME & "/" & valueof(p_aeName))));
mcaPort.send(m_request(m_deleteAe(PX_URI_CSE & PX_CSE_NAME & "/" & valueof(p_aeName))));
tc_ac.start;
alt {
[] mcaPort.receive(mw_responseOK) {
......@@ -107,7 +109,7 @@ module OneM2M_Functions {
}
}
mcaPort.send(m_request(m_deleteAcp("/" & PX_CSE_NAME & "/MyAcp")));
mcaPort.send(m_request(m_deleteAcp(PX_URI_CSE & PX_CSE_NAME & "/MyAcp")));
tc_ac.start;
alt {
[] mcaPort.receive(mw_responseOK) {
......@@ -122,6 +124,8 @@ module OneM2M_Functions {
log("Postamble: No answer while deleting resource");
}
}
}
f_postamble_default();
......@@ -130,7 +134,8 @@ module OneM2M_Functions {
function f_postamble_default() runs on M2M {
unmap(self:mcaPort, system:mcaPort);
stop;
unmap(self:acPort, system:acPort);
//stop;
}
}//end group postambleFunctions
......@@ -164,9 +169,6 @@ module OneM2M_Functions {
if (p_resourceType == int1) {//AccessControlPolicy
if(isvalue(p_allowedOperations)){
p_request.primitiveContent.any_1[0].ACP_create := valueof(m_contentCreateAcp (c_defaultResourceName, p_allowedOperations));
}
}
if (p_resourceType == int9) {//group
p_request.primitiveContent.any_1[0].Group_create := m_contentCreateGroup (1, {"/" & PX_CSE_NAME & "/" & vc_ae.resourceID}, omit);
......@@ -218,12 +220,25 @@ module OneM2M_Functions {
return "1";
}
function f_getAttribute(in MyAttributeList p_attributeList, in XSD.NCName p_attributeName) return Attribute {
var integer i;
var Attribute v_attribute := {-, -};
for (i:=0; i < lengthof(p_attributeList); i := i + 1){
if(p_attributeList[i].name == p_attributeName){
}
}
return v_attribute;
}
}//end group getSetFunctions
group helpingFunctions {
function f_createResource(in ResourceType p_resourceType, XSD.ID p_parentResourceAddress, template RequestPrimitive p_requestPrimitive) runs on M2M {
function f_createResource(in ResourceType p_resourceType, XSD.ID p_parentResourceAddress, template RequestPrimitive p_requestPrimitive) runs on M2M return RequestPrimitive {
var M2MResponsePrimitive v_response;
var RequestPrimitive v_request;
......@@ -249,39 +264,100 @@ module OneM2M_Functions {
setverdict(inconc, "f_createResource: No answer while creating resource type " & int2str(enum2int(p_resourceType)));
}
}
return v_request;
}
function f_createAccessControlPolicyAux(in template (value) AccessControlOperations p_allowedOperations) runs on M2M return XSD.ID{
function f_createAccessControlPolicyAux(in template (value) XSD.String p_acpName := "MyAcp", in template (value) AccessControlOperations p_allowedOperations := int63) runs on M2M return XSD.ID{
var M2MResponsePrimitive v_response;
var XSD.ID v_acpId;
mcaPort.send(m_request(m_createAcpAux(p_acpName := p_acpName, p_allowedOperations := p_allowedOperations)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_responseOK) -> value v_response {
tc_ac.stop;
setverdict(pass, "f_createAccessControlPolicy: Resource type " & int2str(1) & " created successfuly");
v_acpId := f_getResourceId(v_response.responsePrimitive_.primitiveContent);
return v_acpId;
}
[] mcaPort.receive(mw_responseKO) {
tc_ac.stop;
setverdict(inconc, "f_createAccessControlPolicy: Error while creating resource type " & int2str(1));
}
[] mcaPort.receive {
tc_ac.stop;
setverdict(inconc, "f_createAccessControlPolicy: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, "f_createAccessControlPolicy: No answer while creating resource type " & int2str(1));
}
}
var M2MResponsePrimitive v_response;
var XSD.ID v_acpId;
return "0";
}
mcaPort.send(m_request(m_createAcpAux(p_allowedOperations)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_responseOK) -> value v_response {
tc_ac.stop;
setverdict(pass, "f_createAccessControlPolicy: Resource type " & int2str(1) & " created successfuly");
v_acpId := f_getResourceId(v_response.responsePrimitive_.primitiveContent);
return v_acpId;
}
[] mcaPort.receive(mw_responseKO) {
tc_ac.stop;
setverdict(inconc, "f_createAccessControlPolicy: Error while creating resource type " & int2str(1));
}
[] mcaPort.receive {
tc_ac.stop;
setverdict(inconc, "f_createAccessControlPolicy: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, "f_createAccessControlPolicy: No answer while creating resource type " & int2str(1));
}
}
return "0";
function f_createContainerResourceAux (XSD.ID p_parentResourceAddress) runs on M2M return RequestPrimitive {
var M2MResponsePrimitive v_response;
var RequestPrimitive v_request;
var XSD.ID v_acpId;
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";
f_createResource(int3, p_parentResourceAddress, v_request );
return v_request;
}
}
function f_updateAcpAuxResource (XSD.ID p_acpAddress, in template (value) AccessControlOperations p_allowedOperations) runs on M2M {
var RequestPrimitive v_request;
v_request := valueof(m_updateAcpBase);
v_request.to_ := p_acpAddress;
v_request.primitiveContent.any_1[0].ACP_update.privileges.accessControlRule_list := {
{
accessControlOriginators := {"admin:admin"},
accessControlOperations := p_allowedOperations,
accessControlContexts_list := omit
}
};
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] 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;
setverdict(fail, "f_updateAcpAuxResource: Error while updating " & p_acpAddress & " resource");
}
[] tc_ac.timeout {
setverdict(inconc, "f_updateAcpAuxResource: No answer while updating " & p_acpAddress & " resource" );
}
}
}
function f_sendAcPrimitive(in charstring event, in charstring data) runs on M2M {
var charstring v_data := "" & data; // clear encoding rules (ttwb issue ?)
acPort.send(AcRequestPrimitive:{event, {charstring := v_data}});
}
}//end group helpingFunctions
......
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Pixits.ttcn $
* $Id: OneM2M_Pixits.ttcn 39 2016-04-08 12:34:02Z berge $
* $Id: OneM2M_Pixits.ttcn 49 2016-04-25 08:29:23Z reinaortega $
* @desc Module containing Pixits for oneM2M
*
*/
......@@ -35,7 +35,7 @@ module OneM2M_Pixits {
modulepar boolean PX_RUN_POSTAMBLE := true;
modulepar charstring PX_SERIALIZATION := "XML";
modulepar charstring PX_SERIALIZATION := "JSON";
modulepar charstring PX_PROTOCOL_BINDING := "HTTP";
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_TestSystem.ttcn $
* $Id: OneM2M_TestSystem.ttcn 23 2016-03-17 10:02:44Z reinaortega $
* $Id: OneM2M_TestSystem.ttcn 76 2016-04-29 14:15:01Z berge $
* @desc Test System module for oneM2M
*
*/
......@@ -24,11 +24,19 @@ module OneM2M_TestSystem {
out
M2MRequestPrimitive, M2MResponsePrimitive;
}
type port AdapterControlPort message {
in
AcResponsePrimitive;
out
AcRequestPrimitive;
}
/* Components */
type component M2M {
port OneM2MPort mcaPort;
//port OneM2MPort mccPort;
port AdapterControlPort acPort;
//timers
timer tc_ac := PX_TAC;
timer tc_wait;
......@@ -41,6 +49,7 @@ module OneM2M_TestSystem {
type component M2MSystem {
port OneM2MPort mcaPort;
//port OneM2MPort mccPort;
port AdapterControlPort acPort;
}
/* Primitives */
......@@ -49,11 +58,28 @@ module OneM2M_TestSystem {
charstring host,
charstring xmlNamespace,
charstring protocolBinding optional,
charstring serialization optional
charstring serialization optional,
AttributeList_1 nullFields optional
}
type record M2MResponsePrimitive {
ResponsePrimitive responsePrimitive_
}
type record AcRequestPrimitive {
charstring event,
anytype data
}
with {
encode "adapter";
}
type record AcResponsePrimitive {
charstring event,
anytype data
}
with {
encode "adapter";
}
}// end of module
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Types.ttcn $
* $Id: OneM2M_Types.ttcn 43 2016-04-13 12:16:12Z reinaortega $
* $Id: OneM2M_Types.ttcn 69 2016-04-28 07:49:58Z reinaortega $
* @desc Test System module for oneM2M
*
*/
......@@ -877,7 +877,6 @@ module OneM2M_Types {
variant "name as uncapitalized";
};
type union AbsRelTimestamp
{
Timestamp alt_,
......@@ -972,7 +971,7 @@ module OneM2M_Types {
};
type XSD.String ScheduleEntry (pattern "(([*]|[1-5]#(0,1)\d([,\-][1-5]#(0,1)\d)*)[\q{0,0,0,20}\q{0,0,0,10}\t\r]+)#(2)([*]|((1#(0,1)\d|2[0-3])([,\-](1#(0,1)\d|2[0-3]))*))[\q{0,0,0,20}\q{0,0,0,10}\t\r]+([*]|(([1-9]|1\d|2\d|3[01])([,\-]([1-9]|1\d|2\d|3[01]))*))[\q{0,0,0,20}\q{0,0,0,10}\t\r]+([*]|(([1-9]|1[0-2])([,\-]([1-9]|1[0-2]))*))[\q{0,0,0,20}\q{0,0,0,10}\t\r]+([*]|([0-6]([,\-][0-6])*))")
type XSD.String ScheduleEntry //FIXME To be added (pattern "(([*]|[1-5]#(0,1)\d([,\-][1-5]#(0,1)\d)*)[\q{0,0,0,20}\q{0,0,0,10}\t\r]+)#(2)([*]|((1#(0,1)\d|2[0-3])([,\-](1#(0,1)\d|2[0-3]))*))[\q{0,0,0,20}\q{0,0,0,10}\t\r]+([*]|(([1-9]|1\d|2\d|3[01])([,\-]([1-9]|1\d|2\d|3[01]))*))[\q{0,0,0,20}\q{0,0,0,10}\t\r]+([*]|(([1-9]|1[0-2])([,\-]([1-9]|1[0-2]))*))[\q{0,0,0,20}\q{0,0,0,10}\t\r]+([*]|([0-6]([,\-][0-6])*))")
with {
variant "name as uncapitalized";
};
......@@ -4016,6 +4015,9 @@ group contentCreateTypes {
XSD.AnyURI ontologyRef optional,
XSD.Boolean requestReachability
}
with {
variant (resourceName) "attribute";
};
type record ACP_create {
XSD.NCName resourceName optional,
......@@ -4026,6 +4028,9 @@ group contentCreateTypes {
SetOfAcrs privileges,
SetOfAcrs selfPrivileges
}
with {
variant (resourceName) "attribute";
};
type record ContentInstance_create {
XSD.NCName resourceName optional,
......@@ -4036,6 +4041,9 @@ group contentCreateTypes {
XSD.AnyURI ontologyRef optional,
XSD.AnyType content_
}
with {
variant (resourceName) "attribute";
};
type record Container_create {
XSD.NCName resourceName optional,
......@@ -4051,6 +4059,9 @@ group contentCreateTypes {
XSD.AnyURI locationID optional,
XSD.AnyURI ontologyRef optional
}
with {
variant (resourceName) "attribute";
};
type record Group_create {
XSD.NCName resourceName optional,
......@@ -4067,6 +4078,9 @@ group contentCreateTypes {
ConsistencyStrategy consistencyStrategy optional,
XSD.String groupName optional
}
with {
variant (resourceName) "attribute";
};
type record PollingChannel_create {
XSD.NCName resourceName optional,
......@@ -4075,6 +4089,9 @@ group contentCreateTypes {
Timestamp expirationTime optional,
XSD.AnyURI pollingChannelURI optional //TODO: To be double checked
}
with {
variant (resourceName) "attribute";
};
type record Schedule_create {
XSD.NCName resourceName optional,
......@@ -4084,6 +4101,9 @@ group contentCreateTypes {
record of XSD.Token announcedAttribute optional,
ScheduleEntries scheduleElement
}
with {
variant (resourceName) "attribute";
};
type record Subscription_create {
XSD.NCName resourceName optional,
......@@ -4106,6 +4126,9 @@ group contentCreateTypes {
XSD.ID creator optional,
XSD.AnyURI subscriberURI optional
}
with {
variant (resourceName) "attribute";
};
//End Partial content for creation
}//end group contentCreateTypes
......@@ -4201,17 +4224,127 @@ group contentUpdateTypes {
NotificationContentType notificationContentType optional,
EventCat notificationEventCat optional
}
type record AE_update_invalid {
Labels labels optional,
AcpType accessControlPolicyIDs optional,
Timestamp creationTime optional,//Invalid field to be used for BI tests
Timestamp expirationTime optional,
ListOfURIs announceTo optional,
record of XSD.Token announcedAttribute optional,
XSD.String appName optional,
PoaList pointOfAccess optional,
XSD.AnyURI ontologyRef optional,
XSD.Boolean requestReachability optional
};
type record ACP_update_invalid {
Labels labels optional,
Timestamp expirationTime optional,
Timestamp creationTime optional,//Invalid field to be used for BI tests
XSD.PositiveInteger expirationCounter optional,//Invalid field, non existing for ACP
ListOfURIs announceTo optional,
record of XSD.Token announcedAttribute optional,
SetOfAcrs privileges optional,
SetOfAcrs selfPrivileges optional
}
type record Container_update_invalid {
Labels labels optional,
AcpType accessControlPolicyIDs optional,
Timestamp creationTime optional,//Invalid field to be used for BI tests (RO attributes)
XSD.PositiveInteger expirationCounter optional,//Invalid field, non existing for Container
Timestamp expirationTime optional,
ListOfURIs announceTo optional,
record of XSD.Token announcedAttribute optional,
XSD.NonNegativeInteger maxNrOfInstances optional,
XSD.NonNegativeInteger maxByteSize optional,
XSD.NonNegativeInteger maxInstanceAge optional,
XSD.AnyURI locationID optional,
XSD.AnyURI ontologyRef optional
}
//TODO To double check
type record ContentInstance_update_invalid {
Labels labels optional,
Timestamp creationTime optional,//Invalid field to be used for BI tests
ListOfURIs announceTo optional,
ContentInfo contentInfo optional,
XSD.NonNegativeInteger contentSize optional,
XSD.AnyURI ontologyRef optional,
XSD.AnyType content_ optional
}
type record Group_update_invalid {
Labels labels optional,
AcpType accessControlPolicyIDs optional,
Timestamp creationTime optional,//Invalid field to be used for BI tests
XSD.PositiveInteger expirationCounter optional,//Invalid field, non existing for Group
Timestamp expirationTime optional,
ListOfURIs announceTo optional,
record of XSD.Token announcedAttribute optional,
XSD.NonNegativeInteger maxNrOfMembers optional,
ListOfURIs memberIDs optional,
ListOfURIs membersAccessControlPolicyIDs optional,
XSD.String groupName optional
}
type record PollingChannel_update_invalid {
Labels labels optional,
AcpType accessControlPolicyIDs optional,
Timestamp creationTime optional,//Invalid field to be used for BI tests
XSD.PositiveInteger expirationCounter optional,//Invalid field, non existing for PollingChannel
Timestamp expirationTime optional,
XSD.AnyURI pollingChannelURI optional //TODO: To be double checked
}
type record Schedule_update_invalid {
Labels labels optional,
Timestamp creationTime optional,//Invalid field to be used for BI tests
XSD.PositiveInteger expirationCounter optional,//Invalid field, non existing for Schedule
Timestamp expirationTime optional,
ListOfURIs announceTo optional,
record of XSD.Token announcedAttribute optional,
ScheduleEntries scheduleElement optional
}
type record Subscription_update_invalid {
Labels labels optional,
AcpType accessControlPolicyIDs optional,
Timestamp creationTime optional,//Invalid field to be used for BI tests
XSD.NonNegativeInteger maxNrOfInstances optional,//Invalid field, non existing for Subscription
Timestamp expirationTime optional,
EventNotificationCriteria eventNotificationCriteria optional,
XSD.PositiveInteger expirationCounter optional,
ListOfURIs notificationURI optional,
XSD.AnyURI groupID optional,
XSD.AnyURI notificationForwardingURI optional,
BatchNotify batchNotify optional,
RateLimit rateLimit optional,
PendingNotification pendingNotification optional,
XSD.PositiveInteger notificationStoragePriority optional,
XSD.Boolean latestNotify optional,
NotificationContentType notificationContentType optional,
EventCat notificationEventCat optional
}
//End Partial content for update
}//end group contentUpdateTypes
type NhURI ParentID;
group otherTypes {
type NhURI ParentID;
//FIXME Must match the type of the response content when retrieving specific attributes
type record of Attribute MyAttributeList;
}
}
with {
encode "XML";
variant "namespace as 'http://www.onem2m.org/xml/protocols' prefix 'm2m'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
extension "anytype AttributeList, AE, AccessControlPolicy, ACP_create, ACP_update, AE_create, AE_update, Container_create, Container_update, ContentInstance_create, ContentInstance_update, Group_create, Group_update, Schedule_create, Schedule_update, Subscription_create, Subscription_update, PollingChannel_create, PollingChannel_update"
extension "anytype AttributeList, AE, AccessControlPolicy, ACP_create, ACP_update, ACP_update_invalid, AE_create, AE_update_invalid, AE_update_invalid,Container_create, Container_update, Container_update_invalid, ContentInstance_create, ContentInstance_update, ContentInstance_update_invalid, Group_create, Group_update, Group_update_invalid, Schedule_create, Schedule_update, Schedule_update_invalid, Subscription_create, Subscription_update, Subscription_update_invalid, PollingChannel_create, PollingChannel_update, PollingChannel_update_invalid"
}
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_TypesAndValues.ttcn $
* $Id: OneM2M_TypesAndValues.ttcn 43 2016-04-13 12:16:12Z reinaortega $
* $Id: OneM2M_TypesAndValues.ttcn 69 2016-04-28 07:49:58Z reinaortega $
* @desc Module containing types and values for oneM2M
*
*/
......@@ -19,7 +19,8 @@ module OneM2M_TypesAndValues {
/* Constants */
const charstring c_uri_cse := "/~/in-cse/";
const charstring c_cse_name := "in-cse";
const XSD.String c_defaultResourceName;
const XSD.String c_defaultResourceName := "MyResource";
const XSD.String c_acpAuxName := "MyAcp";
//AccessControlOperations
const XSD.Integer c_C := 1;
......
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