From 3caff1e23a846190b64da78d54003c3335e94034 Mon Sep 17 00:00:00 2001 From: Abbas Ahmad Date: Tue, 19 Mar 2019 11:44:33 +0100 Subject: [PATCH] Workflows added --- .../CreateNSInstanceWorkflow.robot | 4 +- .../DeleteNSInstanceWorkflow.robot | 18 ++++++++ .../HealNSTaskWorkflow.robot | 31 +++++++++++++ .../InstanciateNSTaskWorkflow.robot | 29 ++++++++++++ .../NSLCMOperationKeywords.robot | 45 ++++++++++++++++++- .../ScaleNSTaskWorkflow.robot | 31 +++++++++++++ .../TerminateNSTaskWorkflow.robot | 31 +++++++++++++ .../UpdateNSTaskWorkflow.robot | 31 +++++++++++++ 8 files changed, 217 insertions(+), 3 deletions(-) create mode 100644 SOL005/NSLifecycleManagement-API/DeleteNSInstanceWorkflow.robot create mode 100644 SOL005/NSLifecycleManagement-API/HealNSTaskWorkflow.robot create mode 100644 SOL005/NSLifecycleManagement-API/InstanciateNSTaskWorkflow.robot create mode 100644 SOL005/NSLifecycleManagement-API/ScaleNSTaskWorkflow.robot create mode 100644 SOL005/NSLifecycleManagement-API/TerminateNSTaskWorkflow.robot create mode 100644 SOL005/NSLifecycleManagement-API/UpdateNSTaskWorkflow.robot diff --git a/SOL005/NSLifecycleManagement-API/CreateNSInstanceWorkflow.robot b/SOL005/NSLifecycleManagement-API/CreateNSInstanceWorkflow.robot index b9112bdf..20c1c631 100644 --- a/SOL005/NSLifecycleManagement-API/CreateNSInstanceWorkflow.robot +++ b/SOL005/NSLifecycleManagement-API/CreateNSInstanceWorkflow.robot @@ -5,14 +5,14 @@ Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} Library OperatingSystem Library JSONLibrary Library JSONSchemaLibrary schemas/ -Suite Setup Check resource existance + *** Test Cases *** NS Instance Creation Do POST New nsInstance Check HTTP Response Status Code Is 201 Check HTTP Response Header Contains Location - Check HTTP Response Body Json Schema Is NsIdentifierCreationNotification.shema.json + Check HTTP Response Body Json Schema Is NsIdentifierCreationNotification.schema.json Check resource not_instantiated \ No newline at end of file diff --git a/SOL005/NSLifecycleManagement-API/DeleteNSInstanceWorkflow.robot b/SOL005/NSLifecycleManagement-API/DeleteNSInstanceWorkflow.robot new file mode 100644 index 00000000..46f84477 --- /dev/null +++ b/SOL005/NSLifecycleManagement-API/DeleteNSInstanceWorkflow.robot @@ -0,0 +1,18 @@ +*** Settings *** +Resource environment/variables.txt +Resource NSLCMOperationKeywords.robot +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ +Suite Setup Check resource existance + +*** Test Cases *** +NS Instance Deletion + Check resource not_instantiated + Do DELETE IndividualNSInstance + Check HTTP Response Status Code Is 204 + Check HTTP Response Body Json Schema Is NsIdentifierDeletionNotification.schema.json + + + \ No newline at end of file diff --git a/SOL005/NSLifecycleManagement-API/HealNSTaskWorkflow.robot b/SOL005/NSLifecycleManagement-API/HealNSTaskWorkflow.robot new file mode 100644 index 00000000..15cf7065 --- /dev/null +++ b/SOL005/NSLifecycleManagement-API/HealNSTaskWorkflow.robot @@ -0,0 +1,31 @@ +*** Settings *** +Resource environment/variables.txt +Resource NSLCMOperationKeywords.robot +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ +Suite Setup Check resource existance +Suite Setup Initialize System +Suite Teardown Terminate All Processes kill=true + +*** Test Cases *** +Heal Flow of NS lifecycle management operations + Check resource instantiated + Do POST Heal NSInstance + Check HTTP Response Status Code Is 202 + Check Operation Occurrence Id + Check Operation Notification Status is START + Check Operation Notification Status is RESULT + Check resource instantiated + + + + + + + + + + + \ No newline at end of file diff --git a/SOL005/NSLifecycleManagement-API/InstanciateNSTaskWorkflow.robot b/SOL005/NSLifecycleManagement-API/InstanciateNSTaskWorkflow.robot new file mode 100644 index 00000000..2cbcf60e --- /dev/null +++ b/SOL005/NSLifecycleManagement-API/InstanciateNSTaskWorkflow.robot @@ -0,0 +1,29 @@ +*** Settings *** +Resource environment/variables.txt +Resource NSLCMOperationKeywords.robot +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ +Suite Setup Check resource existance +Suite Setup Initialize System +Suite Teardown Terminate All Processes kill=true + +*** Test Cases *** +Instantiate Flow of NS lifecycle management operations + Check resource not_instantiated + Do POST Instatiate nsInstance + Check HTTP Response Status Code Is 202 + Check Operation Occurrence Id + Check Operation Notification Status is START + Check Operation Notification Status is RESULT + Check resource instantiated + + + + + + + + + \ No newline at end of file diff --git a/SOL005/NSLifecycleManagement-API/NSLCMOperationKeywords.robot b/SOL005/NSLifecycleManagement-API/NSLCMOperationKeywords.robot index df017a18..d512df61 100644 --- a/SOL005/NSLifecycleManagement-API/NSLCMOperationKeywords.robot +++ b/SOL005/NSLifecycleManagement-API/NSLCMOperationKeywords.robot @@ -8,6 +8,16 @@ Library OperatingSystem Library MockServerLibrary *** Keywords *** +Initialize System + Start Process java -jar ${MOCK_SERVER_JAR} -serverPort ${callback_port} alias=mockInstance + Wait For Process handle=mockInstance timeout=5s on_timeout=continue + Create Mock Session ${callback_uri}:${callback_port} + +Check Operation Occurrence Id + ${occid}= Get Value From Json ${response[0]['headers']['Location']} + Set Global Variable @{nsLcmOpOccId} ${occid} + Should Not Be Empty ${nsLcmOpOccId} + Create Sessions Start Process java -jar ../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar -serverPort ${callback_port} alias=mockInstance Wait For Process handle=mockInstance timeout=5s on_timeout=continue @@ -20,7 +30,6 @@ Check subscription existance Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} Integer response status 200 - Check Fail not supported Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} Get ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId} @@ -50,6 +59,40 @@ Check resource FAILED_TEMP Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} Get ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId} String response body operationState FAILED_TEMP + +Check Operation Notification Status is + [Arguments] ${status} + Check Operation Notification NsLcmOperationOccurrenceNotification ${status} + +Check Operation Notification + [Arguments] ${element} ${status}="" + ${json}= Get File schemas/${element}.schema.json + Configure Notification Forward ${element} ${callback_endpoint} ${callback_endpoint_fwd} + Configure Notification Status Handler ${callback_endpoint_fwd} ${status} + Wait Until Keyword Succeeds 2 min 10 sec Verify Mock Expectation ${notification_request} + Clear Requests ${callback_endpoint} + Clear Requests ${callback_endpoint_fwd} + +Configure Notification Forward + [Arguments] ${element} ${endpoint} ${endpoint_fwd} + ${BODY}= evaluate json.loads('''${json}''') json + Log Creating mock HTTP forward to handle ${element} + &{notification_tmp}= Create Mock Request Matcher POST ${endpoint} body_type="JSON_SCHEMA" body=${BODY} + &{notification_fwd}= Create Mock Http Forward ${endpoint_fwd} + Create Mock Expectation With Http Forward ${notification_tmp} ${notification_fwd} + +Configure Notification Status Handler + [Arguments] ${endpoint} ${status}="" + Run Keyword If ${status}!="" set to dictionary ${json["notificationStatus"]} dp=${status} + ${BODY}= evaluate json.dumps(${json}) json + Log Creating mock request and response to handle ${element} + &{notification_request}= Create Mock Request Matcher POST ${endpoint} body_type="JSON" body=${BODY} + &{notification_response}= Create Mock Response headers="Content-Type: application/json" status_code=204 + Create Mock Expectation ${notification_request} ${notification_response} + +Check resource operationState is + [Arguments] ${state} + String ${response[0]['body']['operationState']} ${state} Check resource instantiated Set Headers {"Accept":"${ACCEPT}"} diff --git a/SOL005/NSLifecycleManagement-API/ScaleNSTaskWorkflow.robot b/SOL005/NSLifecycleManagement-API/ScaleNSTaskWorkflow.robot new file mode 100644 index 00000000..d427d6ca --- /dev/null +++ b/SOL005/NSLifecycleManagement-API/ScaleNSTaskWorkflow.robot @@ -0,0 +1,31 @@ +*** Settings *** +Resource environment/variables.txt +Resource NSLCMOperationKeywords.robot +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ +Suite Setup Check resource existance +Suite Setup Initialize System +Suite Teardown Terminate All Processes kill=true + +*** Test Cases *** +Scale Flow of NS lifecycle management operations + Check resource instantiated + Do POST scale nsInstance + Check HTTP Response Status Code Is 202 + Check Operation Occurrence Id + Check Operation Notification Status is START + Check Operation Notification Status is RESULT + Check resource instantiated + + + + + + + + + + + \ No newline at end of file diff --git a/SOL005/NSLifecycleManagement-API/TerminateNSTaskWorkflow.robot b/SOL005/NSLifecycleManagement-API/TerminateNSTaskWorkflow.robot new file mode 100644 index 00000000..1324aa75 --- /dev/null +++ b/SOL005/NSLifecycleManagement-API/TerminateNSTaskWorkflow.robot @@ -0,0 +1,31 @@ +*** Settings *** +Resource environment/variables.txt +Resource NSLCMOperationKeywords.robot +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ +Suite Setup Check resource existance +Suite Setup Initialize System +Suite Teardown Terminate All Processes kill=true + +*** Test Cases *** +Terminate Flow of NS lifecycle management operations + Check resource instantiated + Do POST Terminate NSInstance + Check HTTP Response Status Code Is 202 + Check Operation Occurrence Id + Check Operation Notification Status is START + Check Operation Notification Status is RESULT + Check resource not_instantiated + + + + + + + + + + + \ No newline at end of file diff --git a/SOL005/NSLifecycleManagement-API/UpdateNSTaskWorkflow.robot b/SOL005/NSLifecycleManagement-API/UpdateNSTaskWorkflow.robot new file mode 100644 index 00000000..ed420629 --- /dev/null +++ b/SOL005/NSLifecycleManagement-API/UpdateNSTaskWorkflow.robot @@ -0,0 +1,31 @@ +*** Settings *** +Resource environment/variables.txt +Resource NSLCMOperationKeywords.robot +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ +Suite Setup Check resource existance +Suite Setup Initialize System +Suite Teardown Terminate All Processes kill=true + +*** Test Cases *** +Update Flow of NS lifecycle management operations + Check resource instantiated + Do POST Update NSInstance + Check HTTP Response Status Code Is 202 + Check Operation Occurrence Id + Check Operation Notification Status is START + Check Operation Notification Status is RESULT + Check resource instantiated + + + + + + + + + + + \ No newline at end of file -- GitLab