Commit 637b0de1 authored by Naum Spaseski's avatar Naum Spaseski

First version of REG TPs test cases

parent c51b21e4
......@@ -107,6 +107,50 @@ module OneM2M_Functions {
}
//Added by @Naum
function f_preamble_prepareCSE(in template (value) AccessControlOperations p_allowedOperations := int63, in template ListOfM2MID p_allowedAEs) runs on M2M return integer{//c_CRUDNDi
var integer v_aeAuxIndex := -1;
var integer v_acpAuxIndex := -1;
if(PX_ACP_SUPPORT){
v_acpAuxIndex := f_createAccessControlPolicyAux(p_allowedOperations := p_allowedOperations);
}
if(v_acpAuxIndex != -1) {
//TODO:Discuss this case
} else {
var ServiceSubscribedAppRule v_serviceSubscribedAppRule;
v_serviceSubscribedAppRule.applicableCredIDs := {"None"};
v_serviceSubscribedAppRule.allowedApp_IDs := {"APP-ID"};
v_serviceSubscribedAppRule.allowedAEs := valueof(p_allowedAEs);
mcaPort.send(m_request(m_createCSEBase(v_serviceSubscribedAppRule)));
}
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(int2001)){
tc_ac.stop;
}
[] mcaPort.receive(mw_responseKO) {
tc_ac.stop;
setverdict(inconc, "Preamble: Error while registering application");
stop;
}
[] mcaPort.receive {
tc_ac.stop;
setverdict(inconc, "Preamble: Unexpected message received");
stop;
}
[] tc_ac.timeout {
setverdict(inconc, "Preamble: No answer while registering resource");
stop;
}
}
return v_aeAuxIndex;
}
}//end group preambleFunctions
group postambleFunctions {
......
......@@ -40,7 +40,15 @@ module OneM2M_Templates {
protocolBinding := PX_PROTOCOL_BINDING,
serialization := PX_SERIALIZATION,
nullFields := p_nullFields
};
//Added by @Naum
template M2MRequestPrimitive m_requestReceive(in template RequestPrimitive p_requestPrimitive, in template (omit) AttributeList_1 p_nullFields := omit ) := {
requestPrimitive_ := p_requestPrimitive,
host := *, //how to define address of mcc?
xmlNamespace := PX_XML_NAMESPACE,
protocolBinding := PX_PROTOCOL_BINDING,
serialization := PX_SERIALIZATION,
nullFields := p_nullFields
};
group RequestPrimitives {
......@@ -373,6 +381,57 @@ module OneM2M_Templates {
discoveryResultType := omit
};*/
//Added by @Naum
template RequestPrimitive m_createAEanncReceive(template (omit) AcpType p_accessControlPolicyIDs := omit,template (omit) XSD.ID p_from := omit, XSD.ID p_appId) := {
operation := int1,
to_ := "Not Initialized",
from_ := p_from,//PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"
requestIdentifier := "m_createAEannc" & f_rnd(1, 1000000),
resourceType := int10002,
primitiveContent := {
any_1 := {{AEAnnc_optional := m_contentCreateAEannc(c_aeAuxName, p_accessControlPolicyIDs, p_appId)}}
},
role := *,
originatingTimestamp := *,
requestExpirationTimestamp := *,
resultExpirationTimestamp := *,
operationExecutionTime := *,
responseType := *,
resultPersistence := *,
resultContent := *,
eventCategory := *,
deliveryAggregation := *,
groupRequestIdentifier := *,
filterCriteria := *,
discoveryResultType := *
};
//Added by @Naum
template (value) RequestPrimitive m_createAe(template (omit) AcpType p_accessControlPolicyIDs := omit,template (omit) XSD.ID p_from := omit, XSD.ID p_appId) := {
operation := int1,
to_ := "Not Initialized",
from_ := p_from,//PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"
requestIdentifier := "m_createAe" & f_rnd(1, 1000000),
resourceType := int2,
primitiveContent := {
any_1 := {{AE_optional := m_contentCreateAe(c_aeAuxName, p_accessControlPolicyIDs, p_appId)}}
},
role := omit,
originatingTimestamp := omit,
requestExpirationTimestamp := omit,
resultExpirationTimestamp := omit,
operationExecutionTime := omit,
responseType := omit,
resultPersistence := omit,
resultContent := omit,
eventCategory := omit,
deliveryAggregation := omit,
groupRequestIdentifier := omit,
filterCriteria := omit,
discoveryResultType := omit
};
template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIDs := omit ) := {
operation := int1,
to_ := "Not Initialized",
......@@ -473,6 +532,32 @@ module OneM2M_Templates {
};
//Added by @Naum
template (value) RequestPrimitive m_createCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) := {
operation := int1,
to_ := "NotInitialized",
from_ := PX_AE_ID_STEM,
requestIdentifier := "m_createCSE" & f_rnd(1, 1000000),
resourceType := int1,
primitiveContent := {
any_1 := {{CSEBase_optional := m_contentCreateCSEBase (p_serviceSubscribedAppRule)}}
},
role := omit,
originatingTimestamp := omit,
requestExpirationTimestamp := omit,
resultExpirationTimestamp := omit,
operationExecutionTime := omit,
responseType := omit,
resultPersistence := omit,
resultContent := omit,
eventCategory := omit,
deliveryAggregation := omit,
groupRequestIdentifier := omit,
filterCriteria := omit,
discoveryResultType := omit
};
template (value) RequestPrimitive m_createContainerBase := {
operation := int1,
to_ := "NotInitialized",
......@@ -805,7 +890,29 @@ module OneM2M_Templates {
group ContentCreate {
template (value) AE_optional m_contentCreateAe (in template (omit) XSD.String p_name, in template (omit) AcpType p_accessControlPolicyIDs) := {
template (value) AEAnnc_optional m_contentCreateAEannc (in template (omit) XSD.String p_name, in template (omit) AcpType p_accessControlPolicyIDs, XSD.ID p_appId := PX_APP_ID) := {
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
link := omit,//O
appName := omit,//O
app_ID := p_appId,//M
aE_ID := omit,//NP
pointOfAccess := {"http://127.0.0.1:1400/monitor"},//O //{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
ontologyRef := omit,//O
nodeLink := omit,//NP
requestReachability := true,//M
contentSerialization := omit,//O
choice := omit//NP
};
template (value) AE_optional m_contentCreateAe (in template (omit) XSD.String p_name, in template (omit) AcpType p_accessControlPolicyIDs, XSD.ID p_appId := PX_APP_ID) := {
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
......@@ -818,7 +925,7 @@ module OneM2M_Templates {
announceTo := omit,//O
announcedAttribute := omit,//O
appName := omit,//O
app_ID := PX_APP_ID,//M
app_ID := p_appId,//M
aE_ID := omit,//NP
pointOfAccess := {"http://127.0.0.1:1400/monitor"},//O //{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
ontologyRef := omit,//O
......@@ -860,6 +967,29 @@ module OneM2M_Templates {
choice := omit //NP
};
//added by @Naum
template (value) CSEBase_optional m_contentCreateCSEBase (in ServiceSubscribedAppRule p_serviceSubscribedAppRule) := {
resourceName := omit,
resourceType := omit,
resourceID := omit,
parentID := omit,
creationTime := omit,
lastModifiedTime := omit,
labels := omit,
accessControlPolicyIDs := omit,
cseType := omit,
cSE_ID := omit,
supportedResourceType := omit,
pointOfAccess := omit,
nodeLink := omit,
choice := {
choice_list := {{
serviceSubscribedAppRule := p_serviceSubscribedAppRule
}}
}
}
template (value) Group_optional m_contentCreateGroup ( in template (value) XSD.NonNegativeInteger p_maxNrOfMembers,
in template (value) ListOfURIs p_memberIds,
in template (omit) AcpType p_accessControlPolicyIDs) := {
......@@ -1802,6 +1932,19 @@ module OneM2M_Templates {
}
};
template M2MResponsePrimitive mw_responseInverse(ResponseStatusCode p_statusCode) := {
responsePrimitive_ := {
responseStatusCode := complement(p_statusCode),
requestIdentifier := ?,
primitiveContent := *,
to_ := *,
from_ := *,
originatingTimestamp := *,
resultExpirationTimestamp := *,
eventCategory := *
}
};
template M2MResponsePrimitive mw_responseOK(in template PrimitiveContent p_content := *) := {
responsePrimitive_ := {
responseStatusCode := (int2000, int2001, int2002, int2004),
......
......@@ -36,7 +36,7 @@ module OneM2M_TestSystem {
/* Components */
type component M2M {
port OneM2MPort mcaPort;
//port OneM2MPort mccPort;
port OneM2MPort mccPort;
port AdapterControlPort acPort;
//timers
timer tc_ac := PX_TAC;
......@@ -50,7 +50,7 @@ module OneM2M_TestSystem {
type component M2MSystem {
port OneM2MPort mcaPort;
//port OneM2MPort mccPort;
port OneM2MPort mccPort;
port AdapterControlPort acPort;
}
......@@ -85,3 +85,7 @@ module OneM2M_TestSystem {
}
}// end of module
with {
extension "anytype charstring"
}
......@@ -106,6 +106,219 @@ module OneM2M_Testcases {
group CSE {
group Registration {
testcase TC_CSE_REG_BV_001() runs on M2M system M2MSystem {
var M2MResponsePrimitive v_response;
var RequestPrimitive v_request;
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
var ResourceType v_resourceType := int2;
template RequestPrimitive v_requestPrimitive := m_createAe(omit, "", "APP_ID");
//Preambule
template (value) AccessControlOperations v_allowedOperations := int63;
v_aeIndex := f_preamble_prepareCSE(v_allowedOperations, {"C-AE-ID-STEM"});//c_CRUDNDi);
v_resourceIndex := f_createResource(v_resourceType, v_requestPrimitive, v_aeIndex);
// Test Body
v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex)));
v_request.resultContent := int0;//Nothing
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(int2001)) {
tc_ac.stop;
setverdict(pass, testcasename() & ": AE successfuly created.");
}
[] mcaPort.receive(mw_responseInverse(int2001)) -> value v_response{
tc_ac.stop;
setverdict(fail, testcasename() & ": Error while creating AE with status code " & int2str(enum2int(v_response.responsePrimitive_.responseStatusCode)));
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No answer while creating AE");
}
}
// Postamble
f_postamble_deleteResources();
}
testcase TC_CSE_REG_BV_002() runs on M2M system M2MSystem {
var M2MResponsePrimitive v_response;
var RequestPrimitive v_request;
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
var ResourceType v_resourceType := int2;
template RequestPrimitive v_requestPrimitive := m_createAe(omit, "C-AE-ID-STEM", "APP_ID");
//Preambule
template (value) AccessControlOperations v_allowedOperations := int63;
v_aeIndex := f_preamble_prepareCSE(v_allowedOperations,{"C-AE-ID-STEM"});//c_CRUDNDi);
v_resourceIndex := f_createResource(v_resourceType, v_requestPrimitive, v_aeIndex);
// Test Body
v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex)));
v_request.resultContent := int0;//Nothing
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(int2001)) {
tc_ac.stop;
setverdict(pass, testcasename() & ": AE successfuly created.");
}
[] mcaPort.receive(mw_responseInverse(int2001)) -> value v_response{
tc_ac.stop;
setverdict(fail, testcasename() & ": Error while creating AE with status code " & int2str(enum2int(v_response.responsePrimitive_.responseStatusCode)));
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No answer while creating AE");
}
}
// Postamble
f_postamble_deleteResources();
}
testcase TC_CSE_REG_BV_003() runs on M2M system M2MSystem {
var M2MResponsePrimitive v_response;
var RequestPrimitive v_request;
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
var ResourceType v_resourceType := int2;
template RequestPrimitive v_requestPrimitive := m_createAe(omit, omit, "APP_ID");
//Preambule
template (value) AccessControlOperations v_allowedOperations := int63;
v_aeIndex := f_preamble_prepareCSE(v_allowedOperations, omit);//c_CRUDNDi);
v_resourceIndex := f_createResource(v_resourceType, v_requestPrimitive, v_aeIndex);
// Test Body
v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex)));
v_request.resultContent := int0;//Nothing
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(int4005)) {
tc_ac.stop;
setverdict(pass, testcasename() & ": AE creation rejected.");
}
[] mcaPort.receive(mw_responseInverse(int4005)) -> value v_response{
tc_ac.stop;
setverdict(fail, testcasename() & ": Error while creating AE with status code " & int2str(enum2int(v_response.responsePrimitive_.responseStatusCode)));
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No answer while creating AE");
}
}
// Postamble
f_postamble_deleteResources();
}
testcase TC_CSE_REG_BV_004() runs on M2M system M2MSystem {
var M2MResponsePrimitive v_response;
var RequestPrimitive v_request;
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
var ResourceType v_resourceType := int2;
template RequestPrimitive v_requestPrimitive := m_createAe(omit, "C-AE-ID-STEM", "APP_ID");
//Preambule
template (value) AccessControlOperations v_allowedOperations := int63;
v_aeIndex := f_preamble_prepareCSE(v_allowedOperations, omit);//c_CRUDNDi);
v_resourceIndex := f_createResource(v_resourceType, v_requestPrimitive, v_aeIndex);
// Test Body
v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex)));
v_request.resultContent := int0;//Nothing
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(int4005)) {
tc_ac.stop;
setverdict(pass, testcasename() & ": AE creation rejected.");
}
[] mcaPort.receive(mw_responseInverse(int4005)) -> value v_response{
tc_ac.stop;
setverdict(fail, testcasename() & ": Error while creating AE with status code " & int2str(enum2int(v_response.responsePrimitive_.responseStatusCode)));
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No answer while creating AE");
}
}
// Postamble
f_postamble_deleteResources();
}
testcase TC_CSE_REG_BV_005() runs on M2M system M2MSystem {
var M2MResponsePrimitive v_response;
var RequestPrimitive v_request;
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
var ResourceType v_resourceType := int2;
template RequestPrimitive v_requestPrimitive := m_createAe(omit, "", "APP_ID");
//Preambule
template (value) AccessControlOperations v_allowedOperations := int63;
v_aeIndex := f_preamble_prepareCSE(v_allowedOperations,{"S*"});//c_CRUDNDi);
v_resourceIndex := f_createResource(v_resourceType, v_requestPrimitive, v_aeIndex);
// Test Body
v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex)));
v_request.resultContent := int0;//Nothing
mcaPort.send(m_request(v_request));
tc_ac.start;
template RequestPrimitive v_responsePrimitive := m_createAEanncReceive(omit, "", "APP_ID");
alt {
[] mccPort.receive(m_requestReceive(v_responsePrimitive)) {
tc_ac.stop;
setverdict(pass, testcasename() & ": AE creation redirected.");
}
[] mccPort.receive {
tc_ac.stop;
setverdict(fail, testcasename() & ": Error while creating AE");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No answer while creating AE");
}
}
// Postamble
f_postamble_deleteResources();
}
}//end Registration
group Data_Management_and_Repository {
group g_CSE_DMR_BV_001 {
......
......@@ -4002,6 +4002,56 @@ module OneM2M_Types {
group optionalResourceTypes {
//Added by @Naum
type record AEAnnc_optional
{
XSD.NCName 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,
XSD.String appName optional,
XSD.String app_ID optional,
XSD.ID aE_ID optional,
PoaList pointOfAccess optional,
XSD.AnyURI ontologyRef optional,
XSD.AnyURI nodeLink optional,
XSD.Boolean requestReachability optional,
Serializations contentSerialization optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of union {
Container container,
ContainerAnnc containerAnnc,
Group group_,
GroupAnnc groupAnnc,
AccessControlPolicy accessControlPolicy,
AccessControlPolicyAnnc accessControlPolicyAnnc,
Subscription subscription,
ScheduleAnnc scheduleAnnc
} choice_list
} choice optional
}
with {
variant "element";
variant (resourceName) "attribute";
variant (app_ID) "name as 'App-ID'";
variant (aE_ID) "name as 'AE-ID'";
//variant (requestReachability) "text 'true' as '1'";
//variant (requestReachability) "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";
variant (choice.choice_list[-].group_) "name as 'group'";
};
type record AE_optional
{
XSD.NCName resourceName optional,
......@@ -4153,6 +4203,60 @@ group optionalResourceTypes {
variant (choice.choice_list[-]) "untagged";
};
//added by @Naum
type record CSEBase_optional
{
XSD.NCName resourceName optional,
ResourceType resourceType optional,
XSD.ID resourceID optional,
NhURI parentID optional,
Timestamp creationTime optional,
Timestamp lastModifiedTime optional,
Labels labels optional,
AcpType accessControlPolicyIDs optional,
CseTypeID cseType optional,
XSD.ID cSE_ID optional,
record of ResourceType supportedResourceType optional,
PoaList pointOfAccess optional,
XSD.AnyURI nodeLink optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of union {
RemoteCSE remoteCSE,
Node node,
AE aE,
Container container,
Group group_,
AccessControlPolicy accessControlPolicy,
Subscription subscription,
MgmtCmd mgmtCmd,
LocationPolicy locationPolicy,
StatsConfig statsConfig,
StatsCollect statsCollect,
Request request,
Delivery delivery,
Schedule schedule,
M2mServiceSubscriptionProfile m2mServiceSubscriptionProfile,
ServiceSubscribedAppRule serviceSubscribedAppRule
} choice_list
} choice optional
}
with {
variant "element";
variant (resourceName) "attribute";
variant (cSE_ID) "name as 'CSE-ID'";
variant (supportedResourceType) "list";
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";
variant (choice.choice_list[-].aE) "name as capitalized";
variant (choice.choice_list[-].group_) "name as 'group'";
};
type record Group_optional
{
XSD.NCName resourceName optional,
......@@ -4422,5 +4526,5 @@ 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 charstring, AnyURI, AttributeList, AE, AccessControlPolicy, AccessControlPolicy_optional, ACP_update_invalid, AE_optional, AE_update_invalid,Container_optional, Container_update_invalid, ContentInstance_optional, ContentInstance_update_invalid, Group_optional, Group_update_invalid, Schedule_optional, Schedule_update_invalid, Subscription_optional, Subscription_update_invalid, PollingChannel_optional, PollingChannel_update_invalid"
extension "anytype charstring, AnyURI, AttributeList, AE, AccessControlPolicy, AccessControlPolicy_optional, ACP_update_invalid, AE_optional, AE_update_invalid,AEAnnc_optional, Container_optional, CSEBase_optional, Container_update_invalid, ContentInstance_optional, ContentInstance_update_invalid, Group_optional, Group_update_invalid, Schedule_optional, Schedule_update_invalid, Subscription_optional, Subscription_update_invalid, PollingChannel_optional, PollingChannel_update_invalid"
}
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