Skip to content
Snippets Groups Projects
Commit 7c9bdf77 authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

Updated SOL003 VNF LCM tests, and added new instantiation task workflow

parent e570639e
No related branches found
No related tags found
No related merge requests found
Showing
with 76 additions and 127 deletions
*** Settings ***
Resource environment/variables.txt
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
Library DependencyLibrary
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Settings ***
Resource environment/configuration.txt
# Suite setup Expect spec SOL003-VNFLifecycleManagement-API.yaml
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Setting ***
Suite Setup Initialize System
Suite Teardown Terminate All Processes kill=true
Resource environment/configuration.txt
Resource environment/variables.txt
Resource VnfLcmMntOperationKeywords.robot
Resource SubscriptionKeywords.robot
Library OperatingSystem
Library MockServerLibrary
Library Process
......@@ -12,13 +15,6 @@ Library JSONSchemaLibrary schemas/
Library JSONLibrary
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
*** Variables ***
${headers}
${vnfLcmOpOccId}
${response}
&{notification_request}
&{notification_response}
${vnfInstanceId}
*** Test Cases ***
VNF Instantiation
......@@ -34,10 +30,10 @@ VNF Instantiation
Check HTTP Response Status Code Is 202
Check HTTP Response Header Contains Location
Check Operation Occurrence Id
Check Operation Notification STARTING
Check Operation Notification PROCESSING
Check Operation Notification COMPLETED
Check Postcondition
Check Operation Notification For Instantiation STARTING
Check Operation Notification For Instantiation PROCESSING
Check Operation Notification For Instantiation COMPLETED
Check Postcondition VNF Status INSTANTIATED
*** Keywords ***
Send VNF Instantiation Request
......@@ -47,85 +43,16 @@ Send VNF Instantiation Request
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
${body}= Get File json/instantiateVnfRequest.json
${response}= Post ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/instantiate ${body}
Check HTTP Response Status Code Is
[Arguments] ${expected_status}
Should Be Equal ${response.status_code} ${expected_status}
Log Status code validated
Check HTTP Response Header Contains
[Arguments] ${CONTENT_TYPE}
Should Contain ${response.headers} ${CONTENT_TYPE}
Log Header is present
Check Operation Occurrence Id
${vnfLcmOpOccId}= Get Value From Json ${response.headers} $..Location
Should Not Be Empty ${vnfLcmOpOccId}
Check HTTP Response Body Json Schema Is
[Arguments] ${schema}
${json}= evaluate json.loads('''${response.body}''') json
Validate Json ${schema} ${json}
${vnfInstanceId}= evaluate ${response.body.id}
Log Json Schema Validation OK
Check VNF Status
[Arguments] ${current} ${expected}
Should Be Equal As Strings ${current} ${expected}
Log VNF Status in the correct status
Check VNF Instance
[Arguments] ${vnfId}
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
${response}= Get ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfId}
Create Sessions
Start Process java -jar ../../bin/mockserver-netty-5.3.0-jar-with-dependencies.jar -serverPort ${callback_port} alias=mockInstance
Wait For Process handle=mockInstance timeout=5s on_timeout=continue
Create Mock Session ${callback_uri}:${callback_port}
Configure Notification Handler
[Arguments] ${element} ${endpoint}
${json}= Get File schemas/${element}.schema.json
${BODY}= evaluate json.loads('''${json}''') json
Log Creating mock request and response to handle ${element}
&{notification_request}= Create Mock Request Matcher POST ${endpoint} body_type="JSON_SCHEMA" body=${BODY}
&{notification_response}= Create Mock Response headers="Content-Type: application/json" status_code=204
Create Mock Expectation ${notification_request} ${notification_response}
Check Operation Notification
Check Operation Notification For Instantiation
[Arguments] ${status}
Configure Notification Handler VnfLcmOperationOccurrenceNotification ${callback_endpoint}
Wait Until Keyword Succeeds 2 min 10 sec Verify Notification ${status}
Get ${vnfLcmOpOccId}
${body}= Output response body
Should Be Equal ${body.operationState} ${status}
Clear Requests ${callback_endpoint}
Verify Notification
[Arguments] ${status}
Verify Mock Expectation ${notification_request}
Create VNF Resource
Log Create VNF instance by POST to ${apiRoot}/${apiName}/${apiVersion}/vnf_instances
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
${body}= Get File json/createVnfRequest.json
${response}= Post ${apiRoot}/${apiName}/${apiVersion}/vnf_instances ${body}
Check Operation Notification VnfLcmOperationOccurrenceNotification ${status}
Initialize System
Create Sessions
Configure Notification Handler VnfIdentifierCreationNotification ${callback_endpoint}
Create VNF Resource
Check HTTP Response Status Code Is 201
Check HTTP Response Header Contains Location
Check HTTP Response Header Contains Content-Type
Check HTTP Response Body Json Schema Is vnfInstance.schema.json
Check Postcondition
Check Postcondition VNF Status
[Arguments] ${status}
Log Retrieve VNF Instance
Check VNF Instance ${vnfInstanceId}
Should Not Be Empty ${response}
......@@ -133,4 +60,4 @@ Check Postcondition
Should Be Equal ${response.body.id} ${vnfInstanceId}
Check HTTP Response Header Contains Content-Type
Check HTTP Response Body Json Schema Is vnfInstance.schema.json
Check VNF Status ${response.body.instantiationState} INSTANTIATED
\ No newline at end of file
Check VNF Status ${response.body.instantiationState} ${status}
\ No newline at end of file
*** Settings ***
Suite Setup Create Sessions
Suite Teardown Terminate All Processes kill=true
Resource environment/configuration.txt
Resource environment/variables.txt
Library MockServerLibrary
Library Process
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST http://${VNFM_HOST}:${VNFM_PORT} spec=SOL003-VNFLifecycleManagement-API.yaml
Library OperatingSystem
......
*** Settings ***
Resource environment/variables.txt
Resource environment/configuration.txt
Resource environment/variables.txt
Resource environment/scaleVariables.txt
Resource VnfLcmMntOperationKeywords.robot
Resource SubscriptionKeywords.robot
......@@ -14,7 +15,7 @@ Suite Teardown Terminate All Processes kill=true
*** Test Cases ***
Scale out a VnFInstance
Scale out a VNF Instance
[Documentation] Test ID: 5.x.y.x
... Test title: Scale out VNF operation
... Test objective: The objective is to test a scale out of an existing VNF instance
......@@ -24,15 +25,15 @@ Scale out a VnFInstance
... Applicability: Scale operation is supported for the VNF (as capability in the VNFD)
... NFVO is not subscribed for
... Post-Conditions: VNF instance still in INSTANTIATED state and VNF was scaled
Send VNFScaleOut request ${vnfInstanceId}
Check Response Status Is 202
Check Scale HTTP Response Header Contains Location
${vnfLcmOpOccId}= Get VnfLcmOpOccId ${scaleOutResponse.headers}
Check Operation Notification STARTING ${notification_ep} ${vnfLcmOpOccId}
Send VNF Scale Out Request
Check HTTP Response Status Code Is 202
Check HTTP Response Header Contains Location
Check Operation Occurrence Id
Check Operation Notification For Scale STARTING
Create a new Grant - Sync - Scale
Check Operation Notification PROCESSING ${notification_ep} ${vnfLcmOpOccId}
Check Operation Notification COMPLETED ${notification_ep} ${vnfLcmOpOccId}
Postcondition Checks
Check Operation Notification For Scale PROCESSING
Check Operation Notification For Scale COMPLETED
Check Postcondition VNF SCALE_OUT
*** Keywords ***
......@@ -44,10 +45,11 @@ Precondition Checks
${LccnSubscriptions}= Check subscriptions about one VNFInstance and operation type ${vnfInstanceId} VnfLcmOperationOccurrenceNotification operationType=SCALE
${scaleInfo}= Get Vnf Scale Info ${vnfInstanceId}
Postcondition Checks
Check Postcondition VNF
[Arguments] ${operation}
Check resource instantiated
${newScaleInfo}= Get Vnf Scale Info ${vnfInstanceId}
Compare ScaleInfos SCALE_OUT ${scaleInfo} ${newScaleInfo}
Compare ScaleInfos ${operation} ${scaleInfo} ${newScaleInfo}
Compare ScaleInfos
[Arguments] ${type} ${old_scaleinfo} ${new_scaleinfo}
......@@ -64,12 +66,8 @@ Compare ScaleInfos
Create a new Grant - Sync - Scale
Create a new Grant - Synchronous mode ${vnfInstanceId} ${vnfLcmOpOccId} SCALE
Check Response Status Is
[Arguments] ${expected_status}
Check Response Status ${expected_status} ${scaleOutResponse.status}
Check Scale HTTP Response Header Contains
[Arguments] ${CONTENT_TYPE}
Check HTTP Response Header Contains ${scaleOutResponse.headers} ${CONTENT_TYPE}
Check Operation Notification For Scale
[Arguments] ${status}
Check Operation Notification VnfLcmOperationOccurrenceNotification ${status}
\ No newline at end of file
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
......@@ -5,9 +5,12 @@ Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} spec=SOL003-VNF
Library OperatingSystem
Library BuiltIn
Library Process
Library Collections
Library JSONLibrary
Library MockServerLibrary
*** Variables ***
${json} {}
*** Keywords ***
Check subscriptions about one VNFInstance and operation type
......@@ -20,30 +23,34 @@ Check subscriptions about one VNFInstance and operation type
Array response body minItems=1
${body} Output response body
[Return] ${body}
Create Sessions
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}
Configure Notification Handler
[Arguments] ${element} ${endpoint}
${json}= Get File schemas/${element}.schema.json
${BODY}= evaluate json.loads('''${json}''') json
[Arguments] ${endpoint} ${status}
set to dictionary ${json["operationState"]} 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_SCHEMA" body=${BODY}
&{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}
[Return] &{notification_request}
Check Operation Notification
[Arguments] ${status} ${endpoint} ${vnfLcmOpOccId}
${req}= Configure Notification Handler VnfLcmOperationOccurrenceNotification ${endpoint}
Wait Until Keyword Succeeds 2 min 10 sec Verify Mock Expectation ${req}
${VnfLcmOccInstance}= Get VnfLcmOccInstance ${vnfLcmOpOccId}
Check operationState ${status} ${VnfLcmOccInstance}
Clear Requests ${endpoint}
Create Sessions
Start Process java -jar ${MOCK_SERVER_JAR} -serverPort ${notification_port} alias=mockInstance
Wait For Process handle=mockInstance timeout=5s on_timeout=continue
Create Mock Session ${NFVO_SCHEMA}://${NFVO_HOST}:${notification_port} #The API producer is set to NFVO according to SOL003-5.3.9
Configure Notification Forward
[Arguments] ${element} ${endpoint} ${endpoint_fwd}
${json}= Get File schemas/${element}.schema.json
${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}
\ No newline at end of file
Check Operation Notification
[Arguments] ${element} ${status}
Configure Notification Forward ${element} ${notification_ep} ${notification_ep_fwd}
Configure Notification Handler ${notification_ep_fwd} ${status}
Wait Until Keyword Succeeds 2 min 10 sec Verify Mock Expectation ${notification_request}
Clear Requests ${notification_ep}
Clear Requests ${notification_ep_fwd}
*** Settings ***
Resource environment/configuration.txt
Resource environment/variables.txt
Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}
... spec=SOL003-VNFLifecycleManagement-API.yaml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment