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

Merge branch 'LOC'

parents 386347ab 29114985
......@@ -88,7 +88,7 @@ module OneM2M_Functions {
v_request.to_ := f_addPrefix(f_getResourceAddress());
mcaPort.send(m_request(v_request));
//mcaPort.send(m_request(m_createAeAux(p_name, {PX_URI_CSE & PX_CSE_NAME & "/" & c_acpAuxName})));
//mcaPort.send(m_request(m_createAeAux(p_name, {PX_URI_CSE & PX_CSE_NAME & "/" & PX_ACPAUX_NAME})));
} else {
mcaPort.send(m_request(m_createAeAux()));
}
......@@ -251,8 +251,6 @@ module OneM2M_Functions {
p_request.to_ := f_addPrefix(f_getResourceAddress(p_parentIndex));
//p_request.name := p_name;
if (p_resourceType == int1) {//AccessControlPolicy
}
......@@ -274,7 +272,7 @@ module OneM2M_Functions {
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};
p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {"/" & PX_CSE_NAME & "/" & PX_AEAUX_NAME};//c_aeAuxName
}*/
}
......@@ -295,8 +293,6 @@ module OneM2M_Functions {
p_request.to_ := f_addPrefix(f_getResourceAddress(p_resourceIndex));
//p_request.name := p_name;
if (p_resourceType == int3) {//Container
//TODO
......@@ -615,7 +611,7 @@ module OneM2M_Functions {
var integer v_acpAuxIndex := -1;
var integer v_containerResourceIndex := -1;
v_acpAuxIndex := f_createAccessControlPolicyAux(p_acpName := "MyAcp_2");
v_acpAuxIndex := f_createAccessControlPolicyAux(p_acpName := c_acpAuxName);//"MyAcp_2"
v_request := valueof(m_createContainerBase);
v_request.primitiveContent.any_1[0].Container_optional.accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)};
......
......@@ -16,40 +16,51 @@ module OneM2M_Pixits {
import from XSD all;
import from OneM2M_Types all;
modulepar boolean PX_DELETE_CREATED_RESOURCES := true;
modulepar boolean PX_DELETE_CREATED_RESOURCES := true;
modulepar charstring PX_RESOURCE_TO_BE_DELETED := "/ae_test";
modulepar charstring PX_RESOURCE_TO_BE_DELETED := "/ae_test";
modulepar XSD.IDREFS PX_RESOURCES_TO_BE_DELETED := {"/ae_test", "/MyAcp"};
modulepar charstring PX_HOST_ADDRESS := "127.0.0.1:8080";
modulepar charstring PX_HOST_ADDRESS := "127.0.0.1:8080";
modulepar charstring PX_XML_NAMESPACE := "om2m=""http://www.onem2m.org/xml/protocols""";
modulepar charstring PX_XML_NAMESPACE := "om2m=""http://www.onem2m.org/xml/protocols""";
modulepar charstring PX_CSE_NAME := "in-cse";
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 boolean PX_UNSTRUCTURED := false;
modulepar charstring PX_AE_ID_STEM := "admin:admin";
modulepar charstring PX_AE_ID_STEM := "admin:admin";
modulepar charstring PX_APP_ID := "myAppId";
modulepar charstring PX_APP_ID := "myAppId";
modulepar boolean PX_RUN_POSTAMBLE := true;
modulepar boolean PX_RUN_POSTAMBLE := true;
modulepar ListOfURIs PX_ACOR := {"*"};
modulepar ListOfURIs PX_ACOR := {"*"};
modulepar AddressingFormat PX_ADDRESSING_FORMAT := e_cseRelative;
modulepar charstring PX_SERIALIZATION := "JSON";
modulepar charstring PX_SERIALIZATION := "JSON";
modulepar charstring PX_PROTOCOL_BINDING := "HTTP";
modulepar boolean PX_ACP_SUPPORT := true;
modulepar charstring PX_PROTOCOL_BINDING := "HTTP";
modulepar charstring PX_CSE_ID := "in-cse";
modulepar boolean PX_ACP_SUPPORT := true;
modulepar boolean PX_FROM_IS_AE_ID := false;
modulepar charstring PX_CSE_ID := "in-cse";
//@Martin
//constant parameters for LOC
modulepar LocationSource PX_LOCATION_SOURCE := int1;//network-defined
modulepar charstring PX_LOCATION_TARGET_ID := "{LOCATION-TARGET-ID}"; //SUPPOSE TO BE RECEIVED FROM LOCATION SERVER
modulepar charstring PX_LOCATION_SERVER_ADDRESS := "{LOCATION-SERVER-ADDRESS}";
modulepar charstring PX_LOCATION_UPDATE_PERIOD := "PT10M10S" ;//10 Minute 10 Seconds
modulepar charstring PX_LOCATION_UPDATE_PERIOD_INVALID := "-PT30M10S" ;//duration set to invalid value (minus value)
modulepar charstring PX_LOCATION_CONTAINER_NAME := "myLoContainer";
modulepar boolean PX_FROM_IS_AE_ID := false;
modulepar Labels LABELS := {"VALUE_1"};
} // end of module
......@@ -67,7 +67,7 @@ module OneM2M_Templates {
*/
template (value) RequestPrimitive m_retrieveCseBase := {
operation := int2,
to_ := c_uri_cse,
to_ := PX_URI_CSE,//c_uri_cse,//@Martin
from_ := "admin:admin",
requestIdentifier := "m_retrieveCseBase" & f_rnd(1, 1000000),
resourceType := omit,
......@@ -340,6 +340,32 @@ module OneM2M_Templates {
discoveryResultType := omit
};
//@Martin
template (value) RequestPrimitive m_updateLocationPolicy(XSD.ID p_locResourceAddress, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod) := {
operation := int3, //create
to_ := p_locResourceAddress,
from_ := PX_AE_ID_STEM, //AE originator id e.g.
requestIdentifier := "m_updateLocationPolicy",
resourceType := omit,//NP
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,//default
eventCategory := omit,
deliveryAggregation := omit,
groupRequestIdentifier := omit,
filterCriteria := omit,
discoveryResultType := omit
};
}//end group Update
group Create {
......@@ -401,7 +427,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 := {
......@@ -851,6 +877,32 @@ module OneM2M_Templates {
discoveryResultType := omit
};
//@Martin
template (value) RequestPrimitive m_createLocationPolicy(XSD.ID p_parentResourceAddress, 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_parentResourceAddress,
from_ := PX_AE_ID_STEM, //AE originator id e.g.
requestIdentifier := "m_createLocationPolicy", //the requestIdentifier is supposed to be set similar as "C190XX7T/001" by prepending the AE-ID-Stem and slash(‘/’) in front of it
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,//default
eventCategory := omit,
deliveryAggregation := omit,
groupRequestIdentifier := omit,
filterCriteria := omit,
discoveryResultType := omit
};
}//end group Create
group Delete {
......@@ -1202,6 +1254,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 := LABELS,//O
accessControlPolicyIDs := p_accessControlPolicyIDs, //O
expirationTime := omit, //O
announceTo := omit, //O
announcedAttribute := omit, //O
locationSource := PX_LOCATION_SOURCE, //M
locationUpdatePeriod := locationUpdatePeriod, //O
locationTargetID := locationTargetID, //O
locationServer := locationServerAddress,//O
locationContainerID := omit, //NP
locationContainerName := PX_LOCATION_CONTAINER_NAME,//O
locationStatus := omit, //NP
choice := omit //NP
};
}//end group ContentCreate
group ContentUpdate {
......@@ -1399,6 +1475,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 := LABELS,//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 := PX_LOCATION_CONTAINER_NAME, //O
locationStatus := omit, //NP
choice := omit //NP
};
}//end group ContentUpdate
group responseContent {
......
......@@ -3737,6 +3737,238 @@ module OneM2M_Testcases {
}//end group Data_Management_and_Repository
//@Martin
group Location {
group g_CSE_LOC_BV_001{
testcase TC_CSE_LOC_BV_001_01() 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();
//Set requestPrimitive
v_request := f_getCreateRequestPrimitive(int10, omit, m_createLocationPolicy(p_aeResourceAddress, omit, omit, omit, omit), v_aeAuxIndex);
//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 with response status code:" & int2str(enum2int(v_response.responsePrimitive_.responseStatusCode)));
}
[] mcaPort.receive(mw_responseOK) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Created a locationPolicy resource for an invalid create request with response status code:" & int2str(enum2int(v_response.responsePrimitive_.responseStatusCode)));
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": Timeout due to no response received from requested server!");
}
}
// Postamble
f_postamble_deleteResources();
}// end testcase TC_CSE_LOC_BV_001_01
testcase TC_CSE_LOC_BV_001_02() 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 := PX_LOCATION_UPDATE_PERIOD;
var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID;
var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS;
var RequestPrimitive v_request;
var M2MResponsePrimitive v_response;
//Test component configuration
f_cf01Up();
//Preamble
v_aeAuxIndex := f_preamble_registerAe();
//Set requestPrimitive
v_request := f_getCreateRequestPrimitive(int10, omit, m_createLocationPolicy(p_aeResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex);
// 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 with response status code: " & int2str(enum2int(v_response.responsePrimitive_.responseStatusCode))&"!");
}
[] mcaPort.receive(mw_responseKO) -> value v_response {
tc_ac.stop;
setverdict(fail, testcasename() & ": Error occurrs with response status code: " & int2str(enum2int(v_response.responsePrimitive_.responseStatusCode)) & "while handling a valid locationPolicy resource create request!");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": Timeout due to no response from requested server!");
}
}
// Postamble
f_postamble_deleteResources();
}// end testcase TC_CSE_LOC_BV_001_02
}//end group g_CSE_LOC_BV_001
group g_CSE_LOC_BO_001{
testcase TC_CSE_LOC_BO_001_01() 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 := PX_LOCATION_UPDATE_PERIOD;
var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID;
var XSD.AnyURI locationServerAddress := PX_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));
//Set requestPrimitive
v_request := f_getCreateRequestPrimitive(int10, omit, m_createLocationPolicy(p_aeResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex);
// 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 occurrs with response status code: " & int2str(enum2int(v_response.responsePrimitive_.responseStatusCode)) & "due to IUT failed to check the access privilege of originator!");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": Timeout due to no response from requested server!");
}
}
// Postamble
f_postamble_deleteResources();
} // end testcase TC_CSE_LOC_BO_001_01
testcase TC_CSE_LOC_BO_001_02() runs on M2M system M2MSystem {
var integer v_aeAuxIndex := -1;
var XSD.ID p_targetResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName & "/" & c_defaultResourceName;
var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD;
var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID;
var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS;
var RequestPrimitive v_request;
var M2MResponsePrimitive v_response;
//Test component configuration
f_cf01Up();
//Preamble
v_aeAuxIndex := f_preamble_registerAe();
//Set requestPrimitive
v_request := f_getCreateRequestPrimitive(int10, omit, m_createLocationPolicy(p_targetResourceAddress, omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex);
// 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 occurrs with response status code: "& int2str(enum2int(v_response.responsePrimitive_.responseStatusCode)) & "due to IUT created a locationPolicy resource under a non-existed parent resource!");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": Timeout due to no response from requested server!");
}
}
// Postamble
f_postamble_deleteResources();
}// end testcase TC_CSE_LOC_BO_001_02
}//end group g_CSE_LOC_BO_001
group g_CSE_LOC_BI_001{
testcase TC_CSE_LOC_BI_001_01() runs on M2M system M2MSystem {//reject a invalid update request with invalid attribtue locationUpdatePeriod
var integer v_aeAuxIndex := -1;
var integer v_locPolicyResourceIndex := -1;
var XSD.ID p_aeResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName;
var XSD.ID p_defaultResourceAddress := PX_URI_CSE & PX_CSE_NAME & "/" & c_aeAuxName & "/" & c_defaultResourceName;
var XSD.Duration locationUpdatePeriod_invalid := PX_LOCATION_UPDATE_PERIOD_INVALID;
var RequestPrimitive v_request;
var RequestPrimitive v_request_preamble;
var M2MResponsePrimitive v_response;
//Test component configuration
f_cf01Up();
//Preamble - register AE
v_aeAuxIndex := f_preamble_registerAe();
//Preamble - create a valid locationPolicy resource for later update use
v_request_preamble := valueof(m_createLocationPolicy(p_aeResourceAddress, omit, PX_LOCATION_UPDATE_PERIOD, PX_LOCATION_TARGET_ID, PX_LOCATION_SERVER_ADDRESS));
v_locPolicyResourceIndex := f_createResource(int10, v_request_preamble, v_aeAuxIndex);
//Set requestPrimitive
v_request := f_getUpdateRequestPrimitive(int10, v_locPolicyResourceIndex, m_updateLocationPolicy(p_defaultResourceAddress, omit, locationUpdatePeriod_invalid));
// 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 occurrs with response status code: "& int2str(enum2int(v_response.responsePrimitive_.responseStatusCode)) & "due to IUT failed to handle an invalid locationPolicy update request");
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": Timeout due to no response from requested server!");
}
}
// Postamble
f_postamble_deleteResources();
}//end testcase TC_CSE_LOC_BI_001_01
}//end group g_CSE_LOC_BI_001
}//end group Location
}//end group CSE
......
......@@ -4422,7 +4422,47 @@ 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";
};
}
group invalidTypes {
......@@ -4531,6 +4571,22 @@ group invalidTypes {
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
group otherTypes {
......
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