diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 7f7a224288979a1f92bb59a2c684857c74acaa13..544fa3244733a7c6ff641808c72b1c6f5a49124b 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -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; } } diff --git a/LibOneM2M/OneM2M_Pixits.ttcn b/LibOneM2M/OneM2M_Pixits.ttcn index 5894bba22f5489b287254c64b1bcf91eca44e4fb..fc3d68deadccd60e72978c20fb9ac03095db7c2c 100644 --- a/LibOneM2M/OneM2M_Pixits.ttcn +++ b/LibOneM2M/OneM2M_Pixits.ttcn @@ -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 diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 910646c09deadbb5b6f962f4d86bd2ca5b286d8a..003b3fcc8184e220d80c0b9f8dd292c394738bc9 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -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 diff --git a/LibOneM2M/OneM2M_TestSystem.ttcn b/LibOneM2M/OneM2M_TestSystem.ttcn index 7a49c824d08697e0a6cafe5b216ea6528c7d32ee..d42b37b27cb2757c22086283daf8dccc094ce060 100644 --- a/LibOneM2M/OneM2M_TestSystem.ttcn +++ b/LibOneM2M/OneM2M_TestSystem.ttcn @@ -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 { diff --git a/LibOneM2M/OneM2M_Types.ttcn b/LibOneM2M/OneM2M_Types.ttcn index 87dec8482a52efb82d80da3e38a3ba5359856e95..f01fc996211cbd3ec4357d16a972cd588143be02 100644 --- a/LibOneM2M/OneM2M_Types.ttcn +++ b/LibOneM2M/OneM2M_Types.ttcn @@ -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" } diff --git a/LibOneM2M/OneM2M_TypesAndValues.ttcn b/LibOneM2M/OneM2M_TypesAndValues.ttcn index 31b408e376f867275df6d31ba9d191063137bf57..fa733f7b304bec7177d9f3a58464f0dd0cf42914 100644 --- a/LibOneM2M/OneM2M_TypesAndValues.ttcn +++ b/LibOneM2M/OneM2M_TypesAndValues.ttcn @@ -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 * */ diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index f95bf242fef7f9ac1e4cbf551a1e2c65062efd4f..28ab9d219498afa9c4c4bc6af451bc033a19d20b 100644 --- a/OneM2M_Testcases.ttcn +++ b/OneM2M_Testcases.ttcn @@ -7,7 +7,7 @@ * * @author ETSI * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Testcases.ttcn $ - * $Id: OneM2M_Testcases.ttcn 118 2016-09-16 13:02:32Z reinaortega $ + * $Id: OneM2M_Testcases.ttcn 132 2016-10-10 12:20:14Z reinaortega $ * @desc Module containing test cases for oneM2M * */ @@ -24,6 +24,7 @@ module OneM2M_Testcases { import from LibCommon_Time {modulepar all}; import from XSD all; + //Demos used for validation purposes group oneM2M_demos { @@ -97,10 +98,8 @@ module OneM2M_Testcases { unmap(self:mcaPort, system:mcaPort); stop; } - } - - - + + }//end group helpingTestCases }//end group oneM2M_demos @@ -1565,6 +1564,9 @@ module OneM2M_Testcases { // Postamble f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); }//end f_CSE_DMR_CRE_BV_004 @@ -2821,7 +2823,7 @@ module OneM2M_Testcases { if(ispresent(v_responsePrimitive.primitiveContent)) { if(ischosen(v_responsePrimitive.primitiveContent.any_1[0].Container_optional)) { if(ispresent(v_responsePrimitive.primitiveContent.any_1[0].Container_optional.labels)){ - if(v_responsePrimitive.primitiveContent.any_1[0].Container_optional.labels != {""}) { + if(not(match(v_responsePrimitive.primitiveContent.any_1[0].Container_optional.labels,{""}))) { setverdict(fail, testcasename() & ": Error: Labels attribute not deleted correctly"); } } @@ -3830,6 +3832,444 @@ module OneM2M_Testcases { }//end group Update + group Delete { + + group CSE_DMR_DEL_BV_001{ + + testcase TC_CSE_DMR_DEL_BV_001_01() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_001(int3, m_createContainerBase);//Container + + if(getverdict == pass){ + //check whether "MyRessource" container resource isn't present in the IUT (for exemple attempt to update the resource) + }; + }; + + testcase TC_CSE_DMR_DEL_BV_001_02() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_001(int9, m_createGroupBase);//Group + }; + + testcase TC_CSE_DMR_DEL_BV_001_03() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_001(int1, m_createAcpBase);//AccessControlPolicy + }; + + testcase TC_CSE_DMR_DEL_BV_001_04() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_001(int18, m_createScheduleBase);//Schedule + }; + + testcase TC_CSE_DMR_DEL_BV_001_05() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_001(int15, m_createPollingChannelBase);//PollingChannel + }; + + testcase TC_CSE_DMR_DEL_BV_001_06() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_001(int23, m_createSubscriptionBase);//Subscription + }; + + + + function f_CSE_DMR_DEL_BV_001(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive) runs on CseTester { + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); + + // Test Body + v_request := valueof(m_deleteRequest(f_getResourceAddress(v_resourceIndex))); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Resource" & int2str(enum2int(p_resourceType)) & " deleted successfuly"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while deleting resource type " & int2str(enum2int(p_resourceType))); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource type " & int2str(enum2int(p_resourceType))); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + };//end f_CSE_DMR_DEL_BV_001 + + }; + + group CSE_DMR_DEL_BV_002{ + + testcase TC_CSE_DMR_DEL_BV_002_01() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_002(int3, m_createContainerBase);//Container + }; + + testcase TC_CSE_DMR_DEL_BV_002_02() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_002(int9, m_createGroupBase);//Group + }; + + testcase TC_CSE_DMR_DEL_BV_002_03() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_002(int1, m_createAcpBase);//AccessControlPolicy + }; + + testcase TC_CSE_DMR_DEL_BV_002_04() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_002(int18, m_createScheduleBase);//Schedule + }; + + testcase TC_CSE_DMR_DEL_BV_002_05() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_002(int15, m_createPollingChannelBase);//PollingChannel + }; + + testcase TC_CSE_DMR_DEL_BV_002_06() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_002(int23, m_createSubscriptionBase);//Subscription + }; + + + function f_CSE_DMR_DEL_BV_002(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive) runs on CseTester { + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(int55);//c_CRUNDi); + + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); + + // Test Body + v_request := valueof(m_deleteRequest(f_getResourceAddress(v_resourceIndex))); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Access denied to delete the resource " & int2str(enum2int(p_resourceType))); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error resource deleted without having privileges"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while deleting a resource "); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource type " & int2str(enum2int(p_resourceType))); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + };//end f_CSE_DMR_DEL_BV_002 + + }; + + group CSE_DMR_DEL_BV_003{ + + testcase TC_CSE_DMR_DEL_BV_003_01() runs on CseTester system CseSystem { + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var charstring c_falseAdressResource := "NoExistingResource"; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + // Test Body + v_request := valueof(m_deleteRequest(f_getResourceAddress(v_aeIndex) & "/" & c_falseAdressResource)); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Unexisting resource cannot be deleted"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while deleting non existing resource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while deleting non existing resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + };//end f_CSE_DMR_DEL_BV_003 + }; + + group CSE_DMR_DEL_BV_004{ + + testcase TC_CSE_DMR_DEL_BV_004_01() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_004(int3, m_createContainerBase, int23, m_createSubscriptionBase);//Container + }; + + testcase TC_CSE_DMR_DEL_BV_004_02() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_004(int9, m_createGroupBase, int23, m_createSubscriptionBase);//Group + }; + + testcase TC_CSE_DMR_DEL_BV_004_03() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_004(int1, m_createAcpBase, int23, m_createSubscriptionBase);//AccessControlPolicy + }; + + testcase TC_CSE_DMR_DEL_BV_004_04() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_004(int18, m_createScheduleBase, int23, m_createSubscriptionBase);//Schedule + }; + + testcase TC_CSE_DMR_DEL_BV_004_05() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_004(int15, m_createPollingChannelBase, int23, m_createSubscriptionBase);//PollingChannel TODO ResourceType needed is PollingChannelURI + }; + + testcase TC_CSE_DMR_DEL_BV_004_06() runs on CseTester system CseSystem { + // Local variables + + f_CSE_DMR_DEL_BV_004(int23, m_createSubscriptionBase, int18, m_createScheduleBase);//Subscription + }; + + + function f_CSE_DMR_DEL_BV_004(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, ResourceType p_childResourceType, template RequestPrimitive p_createRequestPrimitiveChildResource) runs on CseTester { + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var integer v_childResourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); + + v_childResourceIndex := f_cse_createResource(p_childResourceType, p_createRequestPrimitiveChildResource, v_resourceIndex); + + // Test Body + v_request := valueof(m_deleteRequest(f_getResourceAddress(v_resourceIndex))); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ":Resource type " & int2str(enum2int(p_resourceType)) & " delete successfuly"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while deleting resource type " & int2str(enum2int(p_resourceType))); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource type " & int2str(enum2int(p_resourceType))); + } + } + + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_childResourceIndex)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Error while retrieving non existing resource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving non existing resource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving non existing resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + };//end f_CSE_DMR_DEL_BV_004 + }; + + group g_CSE_DMR_DEL_BV_005{ + + testcase TC_CSE_DMR_DEL_BV_005_01() runs on CseTester system CseSystem { + // Local variables + f_CSE_DMR_DEL_BV_005(int3, m_createContainerBase, int23, m_createSubscriptionBase);//Container + } + + function f_CSE_DMR_DEL_BV_005(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, ResourceType p_childResourceType, template RequestPrimitive p_createRequestPrimitiveChildResource) runs on CseTester { + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var integer v_childResourceIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); + + if(ispresent(vc_resourcesList[v_resourceIndex].resource.any_1[0].Container_optional.stateTag)) { + + v_childResourceIndex := f_cse_createResource(p_childResourceType, p_createRequestPrimitiveChildResource, v_resourceIndex); + + // Test Body + v_request := valueof(m_deleteRequest(f_getResourceAddress(v_childResourceIndex))); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Resource type " & int2str(enum2int(p_resourceType)) & " delete successfuly"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while deleting resource type " & int2str(enum2int(p_resourceType))); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource type " & int2str(enum2int(p_resourceType))); + } + } + + + + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Container_optional.stateTag > vc_resourcesList[v_resourceIndex].resource.any_1[0].Container_optional.stateTag) { // Not good comparison (Create before Delete) + setverdict(pass, testcasename() & ": The stateTag attribute is incremented"); + } + else{ + setverdict(fail, testcasename() & ": Error the stateTag attribute is not incremented"); + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource attributes"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource attributes"); + } + } + + }//end if + else{ + setverdict(fail, testcasename() & ": Error the stateTag attribute is empty"); + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end f_CSE_DMR_DEL_BV_005 + } // end group g_CSE_DMR_DEL_BV_005 + + }//end group Delete + }//end group Data_Management_and_Repository //@Martin @@ -4250,7 +4690,8 @@ module OneM2M_Testcases { testcase TC_CSE_GMG_BV_005() runs on CseTester system CseSystem { - // TODO: use right values for c_RessourceType1 + // TODO: use right values for c_fanoutPointAddress and c_RessourceType1 + var XSD.AnyURI c_fanoutPointAddress := "FANOUTPOINT_ADDRESS"; var ResourceType c_RessourceType1 := int1; // Local variables @@ -4262,6 +4703,8 @@ module OneM2M_Testcases { var template RequestPrimitive v_createRequest := m_createGroupBase; + + //v_createRequest.primitiveContent.any_1[0].Group_optional.fanOutPoint := c_fanoutPointAddress; TODO <--------------------------------------- v_createRequest.primitiveContent.any_1[0].Group_optional.resourceType := c_RessourceType1; @@ -4278,7 +4721,7 @@ module OneM2M_Testcases { // Test Body - mcaPort.send(m_request(v_request)); + mcaPort.send(m_request(v_createRequest)); tc_ac.start; alt { [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { @@ -4317,7 +4760,8 @@ module OneM2M_Testcases { - // TODO: use right values for c_RessourceType1 + // TODO: use right values for c_fanoutPointAddress and c_RessourceType1 + var XSD.AnyURI c_fanoutPointAddress := "FANOUTPOINT_ADDRESS"; var ResourceType c_RessourceType1 := int1; // Local variables @@ -4329,6 +4773,7 @@ module OneM2M_Testcases { v_request := valueof(m_retrieveResource(f_getResourceAddress(-2) & "/" & v_resourceId)); + //v_request.primitiveContent.any_1[0].Group_optional.fanOutPoint := c_fanoutPointAddress; TODO <--------------------------------------- // Test control @@ -4380,7 +4825,8 @@ module OneM2M_Testcases { testcase TC_CSE_GMG_BV_007() runs on CseTester system CseSystem { - // TODO: use right values for c_RessourceType1 + // TODO: use right values for c_fanoutPointAddress and c_RessourceType1 + var XSD.AnyURI c_fanoutPointAddress := "FANOUTPOINT_ADDRESS"; // Local variables var MsgIn v_response; @@ -4391,6 +4837,9 @@ module OneM2M_Testcases { var template RequestPrimitive v_createRequest := m_createGroupBase; var template RequestPrimitive v_updateRequest := m_updateGroupBase; + //v_updateRequest.primitiveContent.any_1[0].Group_optional.fanOutPoint := c_fanoutPointAddress;TODO <--------------------------------------- + + // Test control // Test component configuration @@ -4442,7 +4891,8 @@ module OneM2M_Testcases { testcase TC_CSE_GMG_BV_008_1() runs on CseTester system CseSystem { - // TODO: use right values for c_deleteAddress + // TODO: use right values for c_fanoutPointAddress and c_deleteAddress + var XSD.AnyURI c_fanoutPointAddress := "FANOUTPOINT_ADDRESS"; var XSD.ID c_deleteAddress := "DELETE"; //Local variables @@ -4456,6 +4906,9 @@ module OneM2M_Testcases { var template RequestPrimitive v_deleteRequest := m_deleteRequest(c_deleteAddress); + //v_deleteRequest.primitiveContent.any_1[0].Group_optional.fanOutPoint := c_fanoutPointAddress; TODO <--------------------------------------- + + // Test control // Test component configuration @@ -4742,7 +5195,6 @@ module OneM2M_Testcases { var integer v_aeIndex := -1; var integer v_resourceIndex := -1; var template RequestPrimitive v_createRequest := m_createGroupBase; - var ResponsePrimitive.primitiveContent v_responsePrimitive; // Test control @@ -4766,18 +5218,18 @@ module OneM2M_Testcases { setverdict(pass, testcasename() & ": Resource created successfuly"); // check for memberTypeValidated - if(not ispresent(v_responsePrimitive.any_1[0].Group_optional.memberTypeValidated)){ + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberTypeValidated)){ setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not provided"); } else { - if(v_responsePrimitive.any_1[0].Group_optional.memberTypeValidated == false){ + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberTypeValidated == false){ setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not correct"); } } // check for membersId - if(not ispresent(v_responsePrimitive.any_1[0].Group_optional.memberIDs)){ + if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs)){ setverdict(fail, testcasename(), ": Error, memberIDs attribute not provided"); } else { - if(v_responsePrimitive.any_1[0].Group_optional.memberIDs[0] != c_memberRessourceAddress1){ + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Group_optional.memberIDs[0] != c_memberRessourceAddress1){ setverdict(fail, testcasename(), ": Error, memberTypeValidated attribute not correct"); } } @@ -4868,6 +5320,1756 @@ module OneM2M_Testcases { } // end group g_CSE_GMG_BV_012 } // end group Group_Managment + + group Subscription_And_Notification { + + group g_CSE_SUB_BV_001{ + testcase TC_CSE_SUB_BV_001_01() runs on CseTester system CseSystem { + // Local variables + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var RequestPrimitive v_request; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + + v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_resourceIndex); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int5203))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": <Subscription> Resource not subscribable"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while subscribing a ressource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Subsciption successful whereas <Subscription> resource is not subscribable"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_001_01 + + testcase TC_CSE_SUB_BV_001_02() runs on CseTester system CseSystem { + // Local variables + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_containerResourceIndex := -1; + var integer v_contentInstanceResourceIndex := -1; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var RequestPrimitive v_request; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_containerResourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);//Container + + v_contentInstanceResourceIndex := f_cse_createResource(int4, m_createContentInstance(f_getResourceAddress(v_aeIndex), "Random Value"), v_aeIndex);//ContentInstance + + v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_contentInstanceResourceIndex); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int5203))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": <Subscription> Resource not subscribable"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while subscribing a ressource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Subsciption successful whereas <Subscription> resource is not subscribable"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_001_02 + + }//end group g_CSE_SUB_BV_001 + + group g_CSE_SUB_BV_002 { + + testcase TC_CSE_SUB_BV_002() runs on CseTester system CseSystem { + // Local variables + var MsgIn v_response; + var integer v_aeIndex := -1; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var RequestPrimitive v_request; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(int61);//c_CUDNDi); + + v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int5105))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": No privilege for subscribing to the resource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while subscribing a ressource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Subsciption successful whereas it doesn't have privilege"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_002 + + }//end group g_CSE_SUB_BV_002 + + group g_CSE_SUB_BV_003 { + + testcase TC_CSE_SUB_BV_003() runs on CseTester system CseSystem { + // Local variables + var MsgIn v_response; + var integer v_aeIndex := -1; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var RequestPrimitive v_request; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CUDNDi); + + v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription + v_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {"Not Initialized"}; + //Can the CSE not send the notify request if the URI is false ? + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int5204))) -> value v_response { //SUBSCRIPTION_VERIFICATION_INITIATION_FAILED + tc_ac.stop; + setverdict(pass, testcasename() & ": OK : Subscription verification initiation failed"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while subscribing a ressource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Subsciption successful whereas subsciption verification failed"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_003 + + }//end group g_CSE_SUB_BV_003 + + group g_CSE_SUB_BV_004 { + + testcase TC_CSE_SUB_BV_004() runs on CseTester system CseSystem { + // Local variables + var MsgIn v_response; + var integer v_aeIndex := -1; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var RequestPrimitive v_request; + var ResponsePrimitive v_responsePrimitive; + var template PrimitiveContent v_contentResponse; + var template Notification v_notificationRequest := mw_contentNotificationBase; + var Notification v_notificationResponse := valueof(mw_contentNotificationAllOmit); + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CUDNDi); + + //TODO verify if it is a AE or a CSE who receives the notification request see 7.5.1.2.3 TS0004 + v_notificationRequest.verificationRequest := true; + v_notificationResponse.creator := f_getResourceAddress(v_aeIndex); + v_notificationResponse.subscriptionReference := "I Don't know which URI is expected"; // TODO set it attribute to the correct value + v_responsePrimitive := valueof(m_responseNotification(int4101, v_notificationResponse)); + + v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription + v_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {"Not Initialized"};// TODO set notificationURI to AE2 URI + + mcaPort.send(m_request(v_request)); + + alt { + [] mcaPort.receive(mw_request(mw_notify_2(valueof(v_notificationRequest)))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Notification received"); + } + [] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Notification received but verificationRequest isn't set to TRUE"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); + } + } + + mcaPort.send(m_response(v_responsePrimitive)); // AE2 shall send a response to CSE with responseStatusCode = SUBSCRIPTION_CREATOR_HAS_NO_PRIVILEGE + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4101))) -> value v_response { //SUBSCRIPTION_CREATOR_HAS_NO_PRIVILEGE + tc_ac.stop; + setverdict(pass, testcasename() & ": OK : Subscription creator has no privilege"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while subscribing a ressource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Subsciption successful whereas subsciption creator has no privilege"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_004 + + }//end group g_CSE_SUB_BV_004 + + group g_CSE_SUB_BV_005 { + + testcase TC_CSE_SUB_BV_005() runs on CseTester system CseSystem { + // Local variables + var MsgIn v_response; + var integer v_aeIndex := -1; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var RequestPrimitive v_request; + var ResponsePrimitive v_responsePrimitive; + var template PrimitiveContent v_contentResponse; + var template Notification v_notificationRequest := mw_contentNotificationBase; + var Notification v_notificationResponse := valueof(mw_contentNotificationAllOmit); + + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CUDNDi); + + v_notificationRequest.verificationRequest := true; + v_notificationResponse.creator := f_getResourceAddress(v_aeIndex); + v_notificationResponse.subscriptionReference := "I Don't know which URI is expected"; // TODO set it attribute to the correct value + v_responsePrimitive := valueof(m_responseNotification(int5205, v_notificationResponse)); + + v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription + v_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {"Not Initialized"};// TODO set notificationURI to AE2 URI + + mcaPort.send(m_request(v_request)); + + alt { + [] mcaPort.receive(mw_request(mw_notify_2(valueof(v_notificationRequest)))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Notification received"); + } + [] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Notification received but verificationRequest isn't set to TRUE"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); + } + } + + mcaPort.send(m_response(v_responsePrimitive)); // AE2 shall send a response to CSE with responseStatusCode = SUBSCRIPTION_HOST_HAS_NO_PRIVILEGE + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int5205))) -> value v_response { //SUBSCRIPTION_HOST_HAS_NO_PRIVILEGE + tc_ac.stop; + setverdict(pass, testcasename() & ": OK : Subscription creator has no privilege"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while subscribing a ressource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Subsciption successful whereas subsciption creator has no privilege"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_005 + + }//end group g_CSE_SUB_BV_005 + + group g_CSE_SUB_BV_006 { + + testcase TC_CSE_SUB_BV_006() runs on CseTester system CseSystem { + // Local variables + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var Labels v_labels_1:= {"VALUE_1"}; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + //TODO Add a notification recepient in order to be able to create a subscription resource + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Notification not received"); + } + + v_boolNotification := true; + if(not v_boolResponse){repeat;} + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_006 + + }//end group g_CSE_SUB_BV_006 + + group g_CSE_SUB_BV_007{ + + testcase TC_CSE_SUB_BV_007() runs on CseTester system CseSystem { + + // Local variables + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var template RequestPrimitive v_createRequest; + var template PrimitiveContent v_contentResponse; + var RequestPrimitive v_request; + + + v_contentResponse.any_1[0].Container_optional := mw_contentContainer_rc1; // all attributes expected + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, m_eventNotificationCriteria(int3)); // TODO to field is initialised 2 time with parent adress resource (here and in f_cse_createResource) + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + + v_request:= f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Container resource created successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.Container_optional, v_contentResponse.any_1[0].Container_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].Container_optional, v_contentResponse.any_1[0].Container_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Notification not received"); + } + + v_boolNotification := true; + if(not v_boolResponse){repeat;} + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while creating resource type int3 (Container)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource type int3 (Container) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_007 + }//end group g_CSE_SUB_BV_007 + + group g_CSE_SUB_BV_008 { + + testcase TC_CSE_SUB_BV_008() runs on CseTester system CseSystem { + // Local variables + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_containerResourceIndex := -1; + var integer v_subscriptionResourceIndex := -1; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var template RequestPrimitive v_createRequest; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_deleteRequest; + var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa + + v_contentResponse.any_1[0].Container_optional := mw_contentContainer_rc1; // all attributes expected + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + //TODO Add a notification recepient in order to be able to create a subscription resource + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); + + v_containerResourceIndex := f_cse_createResource(int3, m_createContainerBase,v_aeIndex); // Container + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_containerResourceIndex), -, v_notificationURI, m_eventNotificationCriteria(int2)); // + + v_subscriptionResourceIndex := f_cse_createResource(int23, v_createRequest, v_containerResourceIndex );//Subscription (Container's child resource) + + v_deleteRequest:= valueof(m_deleteRequest(f_getResourceAddress(v_containerResourceIndex))); // Container delete request + + mcaPort.send(m_request(v_deleteRequest)); + tc_ac.start; + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int3 (Container) deleted successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.Container_optional, v_contentResponse.any_1[0].Container_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].Container_optional, v_contentResponse.any_1[0].Container_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Notification not received"); + } + + v_boolNotification := true; + if(not v_boolResponse){repeat;} + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while deleting resource type int3 (Container)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_008 + + }//end group g_CSE_SUB_BV_008 + + group g_CSE_SUB_BV_009 { + + testcase TC_CSE_SUB_BV_009() runs on CseTester system CseSystem { + // Local variables + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_subscriptionResourceIndex := -1; + var integer v_containerResourceIndex := -1; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var template RequestPrimitive v_createRequest; + var RequestPrimitive v_deleteRequest; + var template PrimitiveContent v_contentResponse; + + v_contentResponse.any_1[0].Container_optional := mw_contentContainer_rc1; // all attributes expected in notification + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi; + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, m_eventNotificationCriteria(int4)); + + v_containerResourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);//Container + + v_subscriptionResourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription (with name attribute omitted) + + v_deleteRequest := valueof(m_deleteRequest(f_getResourceAddress(v_containerResourceIndex)));// Container deletion request + + mcaPort.send(m_request(v_deleteRequest)); + tc_ac.start; + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Container resource deleted successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.Container_optional, v_contentResponse.any_1[0].Container_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].Container_optional, v_contentResponse.any_1[0].Container_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Notification not received"); + } + + v_boolNotification := true; + if(not v_boolResponse){repeat;} + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while deleting resource type int3 (Container)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_009 + + }//end group g_CSE_SUB_BV_009 + + group g_CSE_SUB_BV_010 { + + testcase TC_CSE_SUB_BV_010() runs on CseTester system CseSystem { + // Local variables + var MsgIn v_response; + var integer v_aeIndex := -1; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var RequestPrimitive v_request; + var ResponsePrimitive v_responsePrimitive; + var template PrimitiveContent v_contentResponse; + var template Notification v_notification := mw_contentNotificationBase; + + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CUDNDi); + + v_notification.creator := f_getResourceAddress(v_aeIndex); // Creator ID is required (AE1 in this case) + v_notification.verificationRequest := true; + + v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription with Notification URI != Originator + v_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {"Not Initialized"};// TODO set notificationURI to AE2 URI + + mcaPort.send(m_request(v_request)); + + alt { + [] mcaPort.receive(mw_request(mw_notify_2(valueof(v_notification)))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Notification received"); + } + [] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Notification received but verificationRequest isn't set to TRUE"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_010 + + }//end group g_CSE_SUB_BV_010 + + group g_CSE_SUB_BV_011 { + + testcase TC_CSE_SUB_BV_011() runs on CseTester system CseSystem { + // Local variables + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var Labels v_labels_1:= {"VALUE_1"}; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_createRequest; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + v_contentResponse.any_1[0].AE_optional := mw_contentAe_allOmit; // only modified attribute expected + v_contentResponse.any_1[0].AE_optional.labels := ?; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, omit, omit, omit, omit, omit, int2); //notificationContentType ="modified attributes" + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex); //Subscription + + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Notification not received"); + } + + v_boolNotification := true; + if(not v_boolResponse){repeat;} + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_011 + }//end group g_CSE_SUB_BV_011 + + group g_CSE_SUB_BV_012 { + + testcase TC_CSE_SUB_BV_012() runs on CseTester system CseSystem { + // Local variables + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var Labels v_labels_1:= {"VALUE_1"}; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var template RequestPrimitive v_createRequest; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + v_contentResponse.any_1[0].AE_optional := mw_contentAe_allOmit; // only modified attribute expected + v_contentResponse.any_1[0].AE_optional.resourceID := ?; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, omit, omit, omit, omit, omit, int3); // notificationContentType ="ResourceID" + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Notification not received"); + } + + v_boolNotification := true; + if(not v_boolResponse){repeat;} + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_012 + }//end group g_CSE_SUB_BV_012 + + group g_CSE_SUB_BV_013 { + testcase TC_CSE_SUB_BV_013() runs on CseTester system CseSystem { + // Local variables + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var Labels v_labels_1:= {"VALUE_1"}; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_createRequest; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + var template PrimitiveContent v_retrieveContentResponse; + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected + v_retrieveContentResponse.any_1[0].Subscription_optional := mw_contentSubscription_rc1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, omit, 3); //expirationCounter set to 3 + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex); // Subscription + + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // AE update request + + f_CSE_SUB_BV_013_AND_014(v_request,v_contentResponse); // AE update and notification receipt + + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_retrieveContentResponse))) -> value v_response { + tc_ac.stop; + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Subscription_optional.expirationCounter == 2 ){ + setverdict(pass, testcasename() & ": expirationCounter has been successfully decreased by one"); + } + else{ + setverdict(fail, testcasename() & ": Error expirationCounter hasn't been decreased by one"); + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, resource elements provided not matching expected resource elements"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_013 + }//end group g_CSE_SUB_BV_013 + + group g_CSE_SUB_BV_014 { + + testcase TC_CSE_SUB_BV_014() runs on CseTester system CseSystem { + // Local variables + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var Labels v_labels_1:= {"VALUE_1"}; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_createRequest; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, omit, 1); //expirationCounter set to 1 + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);// Subscription + + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // AE update request + + f_CSE_SUB_BV_013_AND_014(v_request,v_contentResponse); // AE update and notification receipt + + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Subscription Resource have been successfully deleted"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while retrieving Subscription Resource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error Subscription Resource has not been deleted"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while retrieving Subscription Resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_014 + + }//end of group g_CSE_SUB_BV_014 + + function f_CSE_SUB_BV_013_AND_014(in RequestPrimitive p_requestPrimitive, template PrimitiveContent p_reponsePrimitive) runs on CseTester { + var MsgIn v_response; + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + + mcaPort.send(m_request(p_requestPrimitive)); + tc_ac.start; + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, p_reponsePrimitive.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, p_reponsePrimitive.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Notification not received"); + } + + v_boolNotification := true; + if(not v_boolResponse){repeat;} + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + }// end f_CSE_SUB_BV_013_AND_014 + + group g_CSE_SUB_BV_015 { + + testcase TC_CSE_SUB_BV_015() runs on CseTester system CseSystem { + // Local variables + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var Labels v_labels_1:= {"VALUE_1"}; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var Attribute v_attribute := {"labels",{omit,omit,{"VALUE_1"}}}; // TODO normaly value isn't expected + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var template RequestPrimitive v_createRequest; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + //TODO Add a notification recepient in order to be able to create a subscription resource + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, m_eventNotificationCriteria(int1, {v_attribute})); + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Wrong Notification received"); + } + + v_boolNotification := true; + if(not v_boolResponse){repeat;} + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_015 + + }//end group g_CSE_SUB_BV_015 + + group g_CSE_SUB_BV_016 { + + testcase TC_CSE_SUB_BV_016() runs on CseTester system CseSystem { + // Local variables + var boolean v_boolResponse := false; + var MsgIn v_response; + var Labels v_labels_1:= {"VALUE_1"}; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var Attribute v_attribute := {"appName",{omit,omit,{"VALUE_1"}}}; // TODO normaly value isn't expected + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var template RequestPrimitive v_createRequest; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + //TODO Add a notification recepient in order to be able to create a subscription resource + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, m_eventNotificationCriteria(int1, {v_attribute})); + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request + + mcaPort.send(m_request(v_request)); + tc_ac.start(5.0); + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); + v_boolResponse := true; + repeat; + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received, In this case an unexpected notification might have been sent"); + } + [] tc_ac.timeout { + if(v_boolResponse){ + setverdict(pass, testcasename() & ": No notification has been sent"); + } + else{ + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_016 + + }//end group g_CSE_SUB_BV_016 + + group g_CSE_SUB_BV_017{ + testcase TC_CSE_SUB_BV_017() runs on CseTester system CseSystem { + // Local variables + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var template RequestPrimitive v_createSubscriptionRequest; + var RequestPrimitive v_request; + var template Notification v_notification := mw_contentNotificationBase; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_createSubscriptionRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, omit, omit, omit, omit,f_getResourceAddress(v_aeIndex)); // SubscriberURI ="ResourceID" + v_notification.subscriptionDeletion := true; + v_notification.subscriptionReference := f_getResourceAddress(v_aeIndex);// shall be set to the same value than subscriberURI + + v_resourceIndex := f_cse_createResource(int23, v_createSubscriptionRequest, v_aeIndex); // Subsciption + + v_request := valueof(m_deleteRequest(f_getResourceAddress(v_resourceIndex))); // Subscription resource deletion request + + mcaPort.send(m_request(v_request)); + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Container resource deleted successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify_2(valueof(v_notification)))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Notification received"); + v_boolNotification := true; + if(not v_boolResponse){repeat;} + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while deleting resource type int3 (Container)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_017 + }//end group g_CSE_SUB_BV_017 + + group g_CSE_SUB_BV_018 { + + testcase TC_CSE_SUB_BV_018() runs on CseTester system CseSystem { + // Local variables + const integer numberOfAggregatedNotification := 3; + var integer i; + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var Labels v_labels_1:= {"VALUE_1"}; + var Labels v_labels_2:= {"VALUE_2"}; + var Labels v_labels_3:= {"VALUE_3"}; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var template RequestPrimitive v_createRequest; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa + + v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + //TODO Add a notification recepient in order to be able to create a subscription resource + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI,omit,omit,m_batchNotifyNumber3Duration1(numberOfAggregatedNotification));// TODO fix the duration + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1 + f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_2; + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 2 + f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_3; + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 3 + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response { + tc_ac.stop; + if(sizeof(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list) == numberOfAggregatedNotification){ + for(i := 0; i<numberOfAggregatedNotification; i := i + 1){ + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Notification not received"); + } + } + + v_boolNotification := true; + if(not v_boolResponse){repeat;} + } + else { + setverdict(fail, testcasename() & ": Aggregated Notification is not composed of 3 notifications"); + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_018 + + }//end group g_CSE_SUB_BV_018 + + group g_CSE_SUB_BV_019 { + + testcase TC_CSE_SUB_BV_019() runs on CseTester system CseSystem { + // Local variables + const integer numberOfAggregatedNotification := 3; + var integer i; + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var Labels v_labels_1:= {"VALUE_1"}; + var Labels v_labels_2:= {"VALUE_2"}; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var template RequestPrimitive v_createRequest; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa + + v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + //TODO Add a notification recepient in order to be able to create a subscription resource + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI,omit,omit,m_batchNotifyNumber3Duration1(numberOfAggregatedNotification));// TODO fix the duration to 3* 5s + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1 + f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_2; + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 2 + f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response { + tc_ac.stop; + if(sizeof(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list) == 2){ + for(i := 0; i<2; i := i + 1){ + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Notification not received"); + } + } + } + else { + setverdict(fail, testcasename() & ": Aggregated Notification is not composed of 3 notifications"); + } + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_019 + + }//end group g_CSE_SUB_BV_019 + + group g_CSE_SUB_BV_020 { + + testcase TC_CSE_SUB_BV_020() runs on CseTester system CseSystem { + // Local variables + const integer numberOfAggregatedNotification := 3; + var integer i; + var boolean v_boolNotification := false; + var boolean v_boolResponse := false; + var MsgIn v_response; + var Labels v_labels_1:= {"VALUE_1"}; + var Labels v_labels_2:= {"VALUE_2"}; + var Labels v_labels_3:= {"VALUE_3"}; + var ListOfURIs v_notificationURI := {"Not Initialized"}; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var template RequestPrimitive v_createRequest; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa + + v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + //TODO Add a notification recepient in order to be able to create a subscription resource + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI,omit,omit,m_batchNotifyNumber3Duration1(numberOfAggregatedNotification), true);// TODO fix the duration + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1 + f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_2; + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 2 + f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_3; + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 3 + + mcaPort.send(m_request(v_request)); + tc_ac.start; + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); + v_boolResponse := true; + if(not v_boolNotification){repeat;} + } + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + tc_ac.stop; + if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } else { + setverdict(fail, testcasename() & ": Wrong Notification received"); + } + v_boolNotification := true; + if(not v_boolResponse){repeat;} + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); + } + [] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error Aggregated notification is not expected"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_BV_020 + + }//end group g_CSE_SUB_BV_020 + + function f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(in RequestPrimitive p_requestPrimitive) runs on CseTester { + var MsgIn v_response; + var boolean v_boolResponse := false; + + mcaPort.send(m_request(p_requestPrimitive)); + tc_ac.start(5.0); + alt { + [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); + v_boolResponse := true; + repeat; + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received, In this case an unexpected notification might have been sent"); + } + [] tc_ac.timeout { + if(v_boolResponse){ + setverdict(pass, testcasename() & ": No notification has been sent"); + } + else{ + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + } + }// end f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY + + }//end group Subscription_And_Notification }//end group CSE