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

New DEL and SUB (notification) test cases

parent da7392e6
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Functions.ttcn $
* $Id: OneM2M_Functions.ttcn 116 2016-09-14 07:10:05Z reinaortega $
* $Id: OneM2M_Functions.ttcn 127 2016-10-10 08:36:57Z reinaortega $
* @desc Module containing functions for oneM2M
*
*/
......@@ -91,7 +91,7 @@ module OneM2M_Functions {
* @return Internal AE resource index
* @verdict
*/
function f_cse_preamble_registerAe(in template (value) AccessControlOperations p_allowedOperations := int63) runs on CseTester return integer {//c_CRUDNDi
function f_cse_preamble_registerAe(in template (value) AccessControlOperations p_allowedOperations := int63, in template (omit) PoaList p_poaList := omit) runs on CseTester return integer {//c_CRUDNDi
var RequestPrimitive v_request;
var MsgIn v_response;
......@@ -105,16 +105,15 @@ module OneM2M_Functions {
if(v_acpAuxIndex != -1) {
vc_resourcesIndexToBeDeleted := {v_acpAuxIndex};
v_request := valueof(m_createAeAux(p_accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}));
//TODO Test, to be removed
v_request.to_ := f_addPrefix(f_getResourceAddress());
mcaPort.send(m_request(v_request));
v_request := valueof(m_createAeAux({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, p_poaList));
//mcaPort.send(m_request(m_createAeAux(p_name, {PX_URI_CSE & PX_CSE_NAME & "/" & PX_ACPAUX_NAME})));
} else {
mcaPort.send(m_request(m_createAeAux()));
v_request := valueof(m_createAeAux(-, p_poaList));
}
v_request.to_ := f_addPrefix(f_getResourceAddress());
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
......@@ -131,7 +130,7 @@ module OneM2M_Functions {
} else {
f_sendAcPrimitive("AE-ID_changed", "0");
}
}
};
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
......@@ -189,11 +188,9 @@ module OneM2M_Functions {
v_request := valueof(m_deleteRequest(v_resourceAddress));
if(PX_FROM_IS_AE_ID){
if(ischosen(vc_resourcesList[i].resource.any_1[0].AccessControlPolicy_optional)) {
v_request.from_ := PX_AE_ID_STEM;
} else {
v_request.from_ := vc_aeAux.aE_ID;
}
if(not(ischosen(vc_resourcesList[lengthof(vc_resourcesIndexToBeDeleted)-1 - i].resource.any_1[0].AccessControlPolicy_optional))) {
v_request.from_ := vc_aeAux.aE_ID;
}
}
mcaPort.send(m_request(v_request));
......@@ -590,7 +587,7 @@ module OneM2M_Functions {
function f_getOriginator(integer p_targetResourceIndex := -1) runs on CseTester return XSD.AnyURI {
if(p_targetResourceIndex == -1) {
return PX_AE_ID_STEM;
return PX_SUPER_USER;
}
if(PX_FROM_IS_AE_ID) {
......@@ -600,7 +597,7 @@ module OneM2M_Functions {
return f_getOriginator(vc_resourcesList[p_targetResourceIndex].parentIndex);
}
} else {
return PX_AE_ID_STEM;
return PX_SUPER_USER;
}
}
......
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Pixits.ttcn $
* $Id: OneM2M_Pixits.ttcn 121 2016-09-27 08:36:54Z reinaortega $
* $Id: OneM2M_Pixits.ttcn 127 2016-10-10 08:36:57Z reinaortega $
* @desc Module containing Pixits for oneM2M
*
*/
......@@ -24,6 +24,8 @@ module OneM2M_Pixits {
modulepar charstring PX_HOST_ADDRESS := "127.0.0.1:8080";
modulepar charstring PX_TESTER_ADDRESS := "127.0.0.1:1400";
modulepar charstring PX_XML_NAMESPACE := "om2m=""http://www.onem2m.org/xml/protocols""";
modulepar XSD.ID PX_CSE_NAME := "in-cse";
......@@ -32,7 +34,9 @@ module OneM2M_Pixits {
modulepar boolean PX_UNSTRUCTURED := false;
modulepar XSD.ID PX_AE_ID_STEM := "admin:admin";
modulepar XSD.ID PX_AE_ID_STEM := "";
modulepar XSD.ID PX_SUPER_USER := "admin:admin";
modulepar XSD.ID PX_APP_ID := "myAppId";
......@@ -50,7 +54,7 @@ module OneM2M_Pixits {
modulepar XSD.ID PX_CSE_ID := "in-cse";
modulepar boolean PX_FROM_IS_AE_ID := false;
modulepar boolean PX_FROM_IS_AE_ID := true;
//@Martin
//constant parameters for LOC
......
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Templates.ttcn $
* $Id: OneM2M_Templates.ttcn 121 2016-09-27 08:36:54Z reinaortega $
* $Id: OneM2M_Templates.ttcn 131 2016-10-10 11:54:46Z reinaortega $
* @desc Module containing templates for oneM2M
*
*/
......@@ -247,6 +247,17 @@ module OneM2M_Templates {
}
};
/**
* @desc Base UPDATE request primitive for AE resource
*/
template (value) RequestPrimitive m_updateAeBase modifies m_update:= {
from_ := PX_AE_ID_STEM,
requestIdentifier := "m_updateAe" & f_rnd(1, 1000000),
primitiveContent:= {
any_1 := {{AE_optional := m_contentUpdateAe}}
}
};
/**
* @desc Base UPDATE request primitive for AccessControlPolicy resource
*/
......@@ -381,16 +392,16 @@ module OneM2M_Templates {
requestIdentifier := "m_createAe" & f_rnd(1, 1000000),
resourceType := int2,
primitiveContent := {
any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName, p_appId)}}
any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName, p_appId, omit)}}
}
};
template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIDs := omit ) modifies m_create := {
template (value) RequestPrimitive m_createAeAux(template (omit) AcpType p_accessControlPolicyIDs := omit, in template (omit) PoaList p_poaList) modifies m_create := {
from_ := PX_AE_ID_STEM,//TODO We should use omit, "s", or "c"//@Martin
requestIdentifier := "m_createAe" & f_rnd(1, 1000000),
resourceType := int2,
primitiveContent := {
any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName)}}
any_1 := {{AE_optional := m_contentCreateAe(p_accessControlPolicyIDs, c_aeAuxName, -, p_poaList)}}
}
};
......@@ -420,7 +431,7 @@ module OneM2M_Templates {
* @desc Base CREATE request primitive for AccessControlPolicy resource (AUX)
*/
template (value) RequestPrimitive m_createAcpAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) ListOfURIs p_acor := PX_ACOR, in template (value) AccessControlOperations p_allowedOperations := int63 ) modifies m_create := {
from_ := PX_AE_ID_STEM,
from_ := PX_SUPER_USER,
requestIdentifier := "m_createAcpAux" & f_rnd(1, 1000000),
resourceType := int1,
primitiveContent := {
......@@ -558,16 +569,30 @@ module OneM2M_Templates {
}
};
template (value) RequestPrimitive m_createSubscription(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_name, in template (value) ListOfURIs p_notificationURI ) modifies m_create := {
template (value) RequestPrimitive m_createSubscription(XSD.ID p_parentResourceAddress, in template (omit) XSD.String p_name := omit, in template (value) ListOfURIs p_notificationURI ) modifies m_create := {
to_ := f_addPrefix(p_parentResourceAddress),
from_ := PX_AE_ID_STEM,
requestIdentifier := "m_createSubscription" & f_rnd(1, 1000000),
resourceType := int23,
primitiveContent := {
any_1 := {{Subscription_optional := m_contentCreateSubscription (p_notificationURI)}}
any_1 := {{Subscription_optional := m_contentCreateSubscription (p_notificationURI, p_name)}}
}
};
template (value) RequestPrimitive m_createSubscriptionAdvanced( XSD.ID p_parentResourceAddress,
in template (omit) XSD.String p_name := omit,
in template (value) ListOfURIs p_notificationURI,
in template (omit) EventNotificationCriteria p_eventNotificationCriteria := omit,
in template (omit) XSD.PositiveInteger p_expirationCounter := omit,
in template (omit) BatchNotify p_batchNotify := omit,
in template (omit) XSD.Boolean p_latestNotify := omit,
in template (omit) XSD.AnyURI p_subscriberURI := omit,
in template (omit) NotificationContentType p_notificationContentType := int1) modifies m_createSubscription := {
primitiveContent := {
any_1 := {{Subscription_optional := m_contentCreateSubscriptionAdvanced (p_notificationURI, p_name, p_eventNotificationCriteria, p_expirationCounter, p_batchNotify, p_latestNotify, p_subscriberURI, p_notificationContentType)}}
}
};
//@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) modifies m_create := {
to_ := p_parentResourceAddress,
......@@ -587,7 +612,7 @@ module OneM2M_Templates {
template (value) RequestPrimitive m_deleteRequest(XSD.ID p_resourceAddress) := {
operation := int4,
to_ := f_addPrefix(p_resourceAddress),
from_ := PX_AE_ID_STEM,
from_ := PX_SUPER_USER,
requestIdentifier := "m_deleteAe" & f_rnd(1, 1000000),
resourceType := omit,
primitiveContent := omit,
......@@ -639,6 +664,86 @@ module OneM2M_Templates {
};
}//end group Delete
group Notify {
/**
* @desc Base NOTIFY request primitive
*/
template RequestPrimitive mw_notifyBase := {
operation := int5,
to_ := ?,
from_ := *,
requestIdentifier := ?,
resourceType := *,
primitiveContent := { any_1 := {{ Notification := mw_contentNotificationBase}} },
roleIDs := ?,
originatingTimestamp := *,
requestExpirationTimestamp := *,
resultExpirationTimestamp := *,
operationExecutionTime := *,
responseType := *,
resultPersistence := *,
resultContent := *,
eventCategory := *,
deliveryAggregation := *,
groupRequestIdentifier := *,
filterCriteria := *,
discoveryResultType := *,
tokens := *,
tokenIDs := *,
localTokenIDs := ?,
tokenReqIndicator := *
};
/**
* @desc Base NOTIFY request primitive
*/
template RequestPrimitive mw_aggregatedNotifyBase := {
operation := int5,
to_ := ?,
from_ := *,
requestIdentifier := ?,
resourceType := *,
primitiveContent := { any_1 := {{ AggregatedNotification := ?}} },
roleIDs :=?,
originatingTimestamp := *,
requestExpirationTimestamp := *,
resultExpirationTimestamp := *,
operationExecutionTime := *,
responseType := *,
resultPersistence := *,
resultContent := *,
eventCategory := *,
deliveryAggregation := *,
groupRequestIdentifier := *,
filterCriteria := *,
discoveryResultType := *,
tokens := *,
tokenIDs := *,
localTokenIDs := ?,
tokenReqIndicator := *
};
/**
* @desc Base NOTIFY request primitive
*/
template RequestPrimitive mw_notify(in template Representation p_representation) modifies mw_notifyBase := {
primitiveContent := {
any_1 := {{ Notification := mw_contentNotification(p_representation) }}
}
};
template RequestPrimitive mw_notify_2(in template(value) Notification p_notification) modifies mw_notifyBase := {
primitiveContent := {
any_1 := {{ Notification := p_notification}}
}
};
}//end of group Notify
}//end group RequestPrimitives
group ContentCreate {
......@@ -673,7 +778,7 @@ module OneM2M_Templates {
* @param p_name Resource name
* @param p_accessControlPolicyIDs ACP IDs for the AE
*/
template (value) AE_optional m_contentCreateAe (in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.String p_name := c_defaultResourceName, in template (omit) XSD.ID p_appId := PX_APP_ID) := {
template (value) AE_optional m_contentCreateAe (in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.String p_name := c_defaultResourceName, in template (omit) XSD.ID p_appId := PX_APP_ID, in template (omit) PoaList p_poaList) := {
resourceName := p_name,//O
resourceType := omit,//NP
......@@ -690,7 +795,7 @@ module OneM2M_Templates {
appName := omit,//O
app_ID := p_appId,//M
aE_ID := omit,//NP
pointOfAccess := omit, //O {"http://127.0.0.1:1400/monitor"},//{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
pointOfAccess := p_poaList, //O {"http://127.0.0.1:1400/monitor"},//{"http://192.168.1.92:18080/notifications/AE"}, // TODO: Check this => AE PoA
ontologyRef := omit,//O
nodeLink := omit,//NP
requestReachability := true,//M
......@@ -859,7 +964,7 @@ module OneM2M_Templates {
*/
template (value) Subscription_optional m_contentCreateSubscription (in template (value) ListOfURIs p_notificationURI,
in template (omit) XSD.String p_name := c_defaultResourceName) := {
resourceName := c_defaultResourceName,//O
resourceName := p_name,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
......@@ -885,7 +990,24 @@ module OneM2M_Templates {
notificationEventCat := omit,//O
subscriberURI := omit,//O
choice := omit//NP
};
};
template (value) Subscription_optional m_contentCreateSubscriptionAdvanced (in template (value) ListOfURIs p_notificationURI,
in template (omit) XSD.String p_name := c_defaultResourceName,
in template (omit) EventNotificationCriteria p_eventNotificationCriteria,
in template (omit) XSD.PositiveInteger p_expirationCounter,
in template (omit) BatchNotify p_batchNotify,
in template (omit) XSD.Boolean p_latestNotify,
in template (omit) XSD.AnyURI p_subscriberURI,
in template (omit) NotificationContentType p_notificationContentType) modifies m_contentCreateSubscription := {
eventNotificationCriteria := p_eventNotificationCriteria,//O
expirationCounter := p_expirationCounter,//O
batchNotify := p_batchNotify,//O
latestNotify := p_latestNotify,//O
notificationContentType := p_notificationContentType, //TODO Set to omit once xsd is fixed,//O
subscriberURI := p_subscriberURI//O
};
/**
* @desc Base primitiveContent for CREATE operation for ContentInstance resource
......@@ -1196,6 +1318,31 @@ module OneM2M_Templates {
e2eSecInfo:= *, //O
choice := *//O
};
template AE_optional mw_contentAe_allOmit := {
resourceName := omit,//M
resourceType := omit,//M
resourceID := omit,//M
parentID := omit,//M
creationTime := omit,//M
lastModifiedTime := omit,//M
labels := omit,//O
accessControlPolicyIDs := omit,//O
expirationTime := omit,//M
dynamicAuthorizationConsultationIDs := omit, //O
announceTo := omit,//O
announcedAttribute := omit,//M
appName := omit,//O
app_ID := omit,//M
aE_ID := omit,//M
pointOfAccess := omit,//O
ontologyRef := omit,//O
nodeLink := omit,//O
requestReachability := omit,//M
contentSerialization := omit,//O
e2eSecInfo:= omit, //O
choice := omit//O
};
template AccessControlPolicy_optional mw_contentAcpBase := {
resourceName := ?,//M
......@@ -1683,6 +1830,40 @@ module OneM2M_Templates {
template Container_optional mw_contentContainer_rc7 modifies mw_contentContainerBase := {
}
template Notification mw_contentNotificationAllOmit := {
notificationEvent := omit,
verificationRequest := omit,
subscriptionDeletion := omit,
subscriptionReference := omit,
creator := omit,
notificationForwardingURI := omit,
iPEDiscoveryRequest := omit
};
template Notification mw_contentNotificationBase := {
notificationEvent := *,//O
verificationRequest := *,//O
subscriptionDeletion := *,//O
subscriptionReference := ?,//M
creator := *,//O
notificationForwardingURI := *,//O
iPEDiscoveryRequest := *//O
};
template Notification mw_contentNotification (in template Representation p_representation) modifies mw_contentNotificationBase := {
notificationEvent := {
representation := p_representation,
operationMonitor := {
operation := ?,
originator:= ?
},
notificationEventType := ?
}
};
}//end group responseContent
group SpecialContents {
......@@ -1847,6 +2028,26 @@ module OneM2M_Templates {
assignedTokenIdentifiers := *,
tokenReqInfo := *
};
group Notify{
template ResponsePrimitive m_responseNotification(ResponseStatusCode p_statusCode, in template(omit) Notification p_notification := omit) := {
responseStatusCode := p_statusCode,
requestIdentifier := "m_responseNotification" & f_rnd(1, 1000000),
primitiveContent := {any_1 := {{Notification := p_notification}}},
to_ := omit,
from_ := omit,
originatingTimestamp := omit,
resultExpirationTimestamp := omit,
eventCategory := omit,
contentStatus := omit,
contentOffset := omit,
assignedTokenIdentifiers := omit,
tokenReqInfo := omit
};
}
}//end group ResponsePrimitives
/**
......@@ -1869,6 +2070,34 @@ module OneM2M_Templates {
}
group sylvain {
template (value) EventNotificationCriteria m_eventNotificationCriteria ( in NotificationEventType p_notificationEventType, in EventNotificationCriteria.attribute_list p_attribute_list := {}) := { //the parameter should be a list of NotificationEventTypeEventType
createdBefore := omit,
createdAfter := omit,
modifiedSince := omit,
unmodifiedSince := omit,
stateTagSmaller := omit,
stateTagBigger := omit,
expireBefore := omit,
expireAfter := omit,
sizeAbove := omit,
sizeBelow := omit,
operationMonitor_list := {},
attribute_list := p_attribute_list, // TODO this list should be able to be omited see 9.6.8
notificationEventType_list := {p_notificationEventType},// TODO this list should be able to be omited see 9.6.8 (TS0001)
missingData := omit
};
template (value) BatchNotify m_batchNotifyNumber3Duration1 (in XSD.NonNegativeInteger p_number) := {
number := p_number,
duration := "PT1S" //TODO duration has to be set to 1s and match to the Duration regex
};
//normaly duration can be omited
}
} // end of module
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_TestSystem.ttcn $
* $Id: OneM2M_TestSystem.ttcn 105 2016-08-31 13:01:46Z reinaortega $
* $Id: OneM2M_TestSystem.ttcn 127 2016-10-10 08:36:57Z reinaortega $
* @desc Test System module for oneM2M
*
*/
......@@ -47,7 +47,7 @@ module OneM2M_TestSystem {
timer tc_wait;
//global variables
var MyResourcesList vc_resourcesList;
var IntegerList vc_resourcesIndexToBeDeleted;
var IntegerList vc_resourcesIndexToBeDeleted := {};
}
type component CseTester extends Tester {
......
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Types.ttcn $
* $Id: OneM2M_Types.ttcn 119 2016-09-20 13:40:03Z reinaortega $
* $Id: OneM2M_Types.ttcn 131 2016-10-10 11:54:46Z reinaortega $
* @desc Test System module for oneM2M
*
*/
......@@ -4877,11 +4877,16 @@ with {
variant (notification_list[-]) "name as 'notification'";
};
type union Representation {
anytype resource,
ResponsePrimitive responsePrimitive
};
type record Notification_1
{
record {
XSD.AnyType representation optional,
//XSD.AnyType representation optional,
Representation representation optional,
record {
Operation operation optional,
XSD.ID originator optional
......@@ -6482,7 +6487,7 @@ group optionalResourceTypes {
// long->short conversion XML
variant "name as 'ae'";
variant (resourceName) "name as 'rn'";
//variant (resourceName) "name as 'rn'";
variant (resourceType) "name as 'ty'";
variant (resourceID) "name as 'ri'";
variant (parentID) "name as 'pi'";
......@@ -6512,7 +6517,7 @@ group optionalResourceTypes {
variant (choice.choice_list[-].schedule) "name as 'sch'";
// long->short conversion JSON
variant (resourceName) "JSON:name as rn";
//variant (resourceName) "JSON:name as rn";
variant (resourceType) "JSON:name as ty";
variant (resourceID) "JSON:name as ri";
variant (parentID) "JSON:name as pi";
......@@ -7073,6 +7078,6 @@ 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 ServiceSubscribedAppRule_optional, 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, 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"
extension "anytype Notification, AggregatedNotification, ServiceSubscribedAppRule_optional, 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, 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"
}
......@@ -7,7 +7,7 @@
*
* @author ETSI
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_TypesAndValues.ttcn $
* $Id: OneM2M_TypesAndValues.ttcn 121 2016-09-27 08:36:54Z reinaortega $
* $Id: OneM2M_TypesAndValues.ttcn 131 2016-10-10 11:54:46Z reinaortega $
* @desc Module containing types and values for oneM2M
*
*/
......
This diff is collapsed.
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