Commit 74a28320 authored by oneM2MTester Develop Team's avatar oneM2MTester Develop Team
Browse files

first version of LOC TC

parent c51b21e4
......@@ -106,7 +106,8 @@ module OneM2M_Functions {
return v_aeAuxIndex;
}
}//end group preambleFunctions
group postambleFunctions {
......
......@@ -339,6 +339,32 @@ module OneM2M_Templates {
discoveryResultType := omit
};
//@Martin
template (value) RequestPrimitive m_updateLocationPolicy(XSD.ID p_aeResourceAddress, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod) := {
operation := int3, //create
to_ := p_aeResourceAddress,
from_ := PX_AE_ID_STEM, //AE originator id e.g.
requestIdentifier := "m_updateLocationPolicy",
resourceType := omit,
primitiveContent := {
any_1 := {{ LocationPolicy_optional := m_contentUpdateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod) }}
},
role := omit,
originatingTimestamp := omit,
requestExpirationTimestamp := omit,
resultExpirationTimestamp := omit,
operationExecutionTime := omit,
responseType := omit,
resultPersistence := omit,
resultContent := int1,//omit,
eventCategory := omit,
deliveryAggregation := omit,
groupRequestIdentifier := omit,
filterCriteria := omit,
discoveryResultType := omit
};
}//end group Update
group Create {
......@@ -376,7 +402,7 @@ module OneM2M_Templates {
template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIDs := omit ) := {
operation := int1,
to_ := "Not Initialized",
from_ := omit,//PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"
from_ := PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"//@Martin
requestIdentifier := "m_createAe" & f_rnd(1, 1000000),
resourceType := int2,
primitiveContent := {
......@@ -750,6 +776,32 @@ module OneM2M_Templates {
discoveryResultType := omit
};
//@Martin
template (value) RequestPrimitive m_createLocationPolicy(XSD.ID p_aeResourceAddress, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod, in template (omit) NodeID locationTargetID, in template (omit) XSD.AnyURI locationServerAddress) := {
operation := int1, //create
to_ := p_aeResourceAddress,
from_ := PX_AE_ID_STEM, //AE originator id e.g.
requestIdentifier := "m_createLocationPolicy",
resourceType := int10,
primitiveContent := {
any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod, locationTargetID, locationServerAddress) }}
},
role := omit,
originatingTimestamp := omit,
requestExpirationTimestamp := omit,
resultExpirationTimestamp := omit,
operationExecutionTime := omit,
responseType := omit,
resultPersistence := omit,
resultContent := int1,//omit,
eventCategory := omit,
deliveryAggregation := omit,
groupRequestIdentifier := omit,
filterCriteria := omit,
discoveryResultType := omit
};
}//end group Create
group Delete {
......@@ -992,6 +1044,30 @@ module OneM2M_Templates {
choice := omit//NP
};
//@Martin
template (value) LocationPolicy_optional m_contentCreateLocationPolicy (in template (omit) AcpType p_accessControlPolicyIDs, in template (value) XSD.Duration locationUpdatePeriod, in template (value) NodeID locationTargetID, in template (value) XSD.AnyURI locationServerAddress) := {
resourceName := c_defaultResourceName, //O
resourceType := omit, //NP
resourceID := omit, //NP
parentID := omit, //NP
creationTime := omit, //NP
lastModifiedTime := omit, //NP
labels := {"location_test"}, //O
accessControlPolicyIDs := p_accessControlPolicyIDs, //O
expirationTime := omit, //O
announceTo := omit, //O
announcedAttribute := omit, //O
locationSource := int1, //Network_based //M
locationUpdatePeriod := locationUpdatePeriod, //O
locationTargetID := locationTargetID, //O
locationServer := locationServerAddress,//O
locationContainerID := omit, //NP
locationContainerName := omit, //O
locationStatus := omit, //NP
choice := omit //NP
};
}//end group ContentCreate
group ContentUpdate {
......@@ -1165,6 +1241,30 @@ module OneM2M_Templates {
oldest := omit,//NP
choice := omit//NP
};
//@Martin
template (value) LocationPolicy_optional m_contentUpdateLocationPolicy (in template (omit) AcpType p_accessControlPolicyIDs, in template (value) XSD.Duration locationUpdatePeriod) := {
resourceName := omit,//NP
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
creationTime := omit,//NP
lastModifiedTime := omit,//NP
labels := {"location_test"},//O
accessControlPolicyIDs := p_accessControlPolicyIDs,//O
expirationTime := omit,//O
announceTo := omit,//O
announcedAttribute := omit,//O
locationSource := omit,//NP
locationUpdatePeriod := locationUpdatePeriod, //O
locationTargetID := omit, //NP
locationServer := omit, //NP
locationContainerID := omit, //NP
locationContainerName := omit, //O
locationStatus := omit, //NP
choice := omit //NP
};
}//end group ContentUpdate
group responseContent {
......
......@@ -85,3 +85,6 @@ module OneM2M_TestSystem {
}
}// end of module
with{
extension "anytype charstring"
}
\ No newline at end of file
......@@ -3533,6 +3533,277 @@ module OneM2M_Testcases {
}//end group Data_Management_and_Repository
//@Martin
group Location {
group g_CSE_LOC_BV{
testcase TC_CSE_LOC_BV_001() runs on M2M system M2MSystem {
var integer v_aeAuxIndex := -1;
var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName;
var RequestPrimitive v_request;
var M2MResponsePrimitive v_response;
//Test component configuration
f_cf01Up();
//Preamble
v_aeAuxIndex := f_preamble_registerAe();
//Request target resource address
p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); //v_request.to_
//Set requestPrimitive
v_request := valueof(m_createLocationPolicy(p_aeResourceAddress, omit, omit, omit, omit));
//Set request originator
v_request.from_ := f_getOriginator(v_aeAuxIndex);
//Set returned content type
v_request.resultContent := int1;//Attributes //supposed to be defined by user
//Test Body
mcaPort.send(m_request(v_request));
tc_ac.start;
alt{
[] mcaPort.receive(mw_response(int4000)) -> value v_response { //BAD REQUEST
tc_ac.stop;
setverdict(pass, testcasename() & "Resource <locationPolicy> create request is rejected due to invalid request body message!!");
}
[] mcaPort.receive(mw_responseKO) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Error while handling an invalid locationPolicy resource create request!");
}
[] mcaPort.receive(mw_responseOK) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Created a locationPolicy resource with an invalid create request!");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No answer while creating resource locationPolicy!");
}
}
// Postamble
f_postamble_deleteResources();
}// end testcase TC_CSE_LOC_BV_001
testcase TC_CSE_LOC_BV_002() runs on M2M system M2MSystem {
var integer v_aeAuxIndex := -1;
var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName;
var XSD.Duration locationUpdatePeriod := "PT30M10S" ;//duration set to 30Minute 10 seconds
var XSD.Token locationTargetID := "{LOCATION_TARGET_ID}";
var XSD.AnyURI locationServerAddress := "{LOCATION_SERVER_ADDRESS}";
var RequestPrimitive v_request;
var M2MResponsePrimitive v_response;
//Test component configuration
f_cf01Up();
//Preamble
v_aeAuxIndex := f_preamble_registerAe();
//Request target resource address
p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); //v_request.to_
//Set requestPrimitive
v_request := valueof(m_createLocationPolicy(p_aeResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress));
//Set request originator
v_request.from_ := f_getOriginator(v_aeAuxIndex);
//Set returned content type
v_request.resultContent := int1;//Attributes
// Test Body
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_responseOK) -> value v_response {
tc_ac.stop;
setverdict(pass, testcasename() & ": Resource locationPolicy is created successfuly!");
}
[] mcaPort.receive(mw_responseKO) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Error while creating resource locationPolicy!");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No answer while creating resource locationPolicy!");
}
}
// Postamble
f_postamble_deleteResources();
}// end testcase TC_CSE_LOC_BV_002
}//end group g_CSE_LOC_BV
group g_CSE_LOC_BO{
testcase TC_CSE_LOC_BO_001() runs on M2M system M2MSystem {//no AE_ID presented in the from_ is assigned privilege to do locationPolicy resource create operation!!
var integer v_aeAuxIndex := -1;
var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName;
var XSD.Duration locationUpdatePeriod := "PT30M10S" ;//duration set to 30Minute 10 seconds
var XSD.Token locationTargetID := "{LOCATION_TARGET_ID}";
var XSD.AnyURI locationServerAddress := "{LOCATION_SERVER_ADDRESS}";
var RequestPrimitive v_request;
var M2MResponsePrimitive v_response;
//Test component configuration
f_cf01Up();
//Preamble
v_aeAuxIndex := f_preamble_registerAe(int62);//c_RUDNDi //No resource creation privilege
//Request target resource address
p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); //v_request.to_
//Set requestPrimitive
v_request := valueof(m_createLocationPolicy(p_aeResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress));
//Set request originator
v_request.from_ := f_getOriginator(v_aeAuxIndex);
//Set returned content type
v_request.resultContent := int1;//Attributes
// Test Body
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(int4103)) -> value v_response {
tc_ac.stop;
setverdict(pass, testcasename() & ": Access denied to create a resource including locationPolicy!");
}
[] mcaPort.receive(mw_responseOK) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Error! IUT failed to check the access privilege of originator!");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No response received from IUT!");
}
}
// Postamble
f_postamble_deleteResources();
} // end testcase TC_CSE_LOC_BO_001
testcase TC_CSE_LOC_BO_002() runs on M2M system M2MSystem {
var integer v_aeAuxIndex := -1;
var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName;
var XSD.ID p_targetResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName & "/" & c_defaultResourceName;
var XSD.Duration locationUpdatePeriod := "PT30M10S" ;//duration set to 30Minute 10 seconds
var XSD.Token locationTargetID := "{LOCATION_TARGET_ID}";//format??
var XSD.AnyURI locationServerAddress := "{LOCATION_SERVER_ADDRESS}";//format???
var RequestPrimitive v_request;
var M2MResponsePrimitive v_response;
//Test component configuration
f_cf01Up();
//Preamble
v_aeAuxIndex := f_preamble_registerAe();
//Request target resource address
p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); //v_request.to_
//Set requestPrimitive
v_request := valueof(m_createLocationPolicy(p_targetResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress));
//Set request originator
v_request.from_ := f_getOriginator(v_aeAuxIndex);
//Set returned content type
v_request.resultContent := int1;//Attributes
// Test Body
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(int4000)) -> value v_response {
tc_ac.stop;
setverdict(pass, testcasename() & ": The targeted resource is not found!!");
}
[] mcaPort.receive(mw_responseOK) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Error!! Created a resource under a parent resource that does not exist!!");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No response received from IUT!!");
}
}
// Postamble
f_postamble_deleteResources();
}// end testcase TC_CSE_LOC_BO_00D2
}//end group g_CSE_LOC_BO
group g_CSE_LOC_BI{
testcase TC_CSE_LOC_BI_001() runs on M2M system M2MSystem {//reject a invalid update request with invalid attribtue locationUpdatePeriod
var integer v_aeAuxIndex := -1;
var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName;
var XSD.Duration locationUpdatePeriod := "-PT30M10S" ;//duration set to invalid value (minus value)
var RequestPrimitive v_request;
var M2MResponsePrimitive v_response;
//Test component configuration
f_cf01Up();
//Preamble
v_aeAuxIndex := f_preamble_registerAe();
//Request target resource address
p_aeResourceAddress := f_addPrefix(f_getResourceAddress(v_aeAuxIndex)); //v_request.to_
//Set requestPrimitive
v_request := valueof(m_updateLocationPolicy(p_aeResourceAddress, omit, locationUpdatePeriod));
//Set request originator
v_request.from_ := f_getOriginator(v_aeAuxIndex);
//Set returned content type
v_request.resultContent := int1;//Attributes
// Test Body
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(int4000)) -> value v_response {
tc_ac.stop;
setverdict(pass, testcasename() & ": Update locationPolicy resource is rejected!!");
}
[] mcaPort.receive(mw_responseOK) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Error while updating resource locationPolicy!");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No response received from IUT while updating resource locationPolicy!");
}
}
// Postamble
f_postamble_deleteResources();
}//end testcase TC_CSE_LOC_BI_001
}//end group g_CSE_LOC_BI
}//end group Location
}//end group CSE
......
......@@ -4286,6 +4286,46 @@ group optionalResourceTypes {
variant (choice) "untagged";
};
//@Martin
type record LocationPolicy_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,
ListOfURIs announceTo optional,
record length(1 .. infinity) of XSD.NCName announcedAttribute optional,
LocationSource locationSource optional,
XSD.Duration locationUpdatePeriod optional,
NodeID locationTargetID optional,
XSD.AnyURI locationServer optional,
XSD.AnyURI locationContainerID optional,
XSD.String locationContainerName optional,
XSD.String locationStatus optional,
union {
record length(1 .. infinity) of ChildResourceRef childResource_list,
record length(1 .. infinity) of union {
Subscription subscription
} choice_list
} choice optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (resourceName) "attribute";
variant (announcedAttribute) "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";
};
}
......@@ -4394,6 +4434,22 @@ group invalidTypes {
NotificationContentType notificationContentType optional,
EventCat notificationEventCat optional
}
//@Martin
type record LocationPolicy_update_invalid {
Timestamp creationTime optional,//invalid field to be used for BI tests
Timestamp lastModifiedTime optional,//invalid field to be used for BI tests
Labels labels optional,
AcpType accessControlPolicyIDs optional,
Timestamp expirationTime optional,
LocationSource locationSource optional,//invalid field to be used for BI tests
XSD.Duration locationUpdatePeriod optional,
NodeID locationTargetID optional,//invalid field to be used for BI tests
XSD.AnyURI locationServer optional,//invalid field to be used for BI tests
XSD.AnyURI locationContainerID optional,//invalid field to be used for BI tests
XSD.String locationContainerName optional,
XSD.String locationStatus optional//invalid field to be used for BI tests
}
}//end group invalidTypes
......@@ -4422,5 +4478,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,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, LocationPolicy_optional, LocationPolicy_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