Newer
Older
Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false
Library JSONLibrary
Library Process
Library JSONSchemaLibrary schemas/
Library OperatingSystem
Library MockServerLibrary
*** Keywords ***
Initialize System
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
Create Mock Session ${callback_uri}:${callback_port}
Check Operation Occurrence Id
${occid}= Get Value From Json ${response['headers']['Location']} ${response}
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
Create Mock Session ${callback_uri}:${callback_port}
Check subscription existence
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
Integer response status 200
Check Instance Deleted
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId}
# how to check if Fail is not supported? Also In Sol002
Check Cancel not supported
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId}
# how to check if Cancel is not supported? Also In Sol002
Check Continue not supported
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId}
# how to check if Continue is not supported? Also In Sol002
Check retry not supported
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId}
# how to check if retry is not supported? Also In Sol002
Check Rollback not supported
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId}
# how to check if rollback is not supported? Also In Sol002
Check resource FAILED_TEMP
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId}
String response body operationState FAILED_TEMP
Check resource not
[Arguments] ${status}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_lcm_op_occs/${nsLcmOpOccId}
Should Not Be Equal As Strings response body operationState ${status}
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 ${notification_timeout} ${poll_interval} 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=${element}
&{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}
set to dictionary ${json} notificationStatus ${status}
Log Creating mock request and response to handle ${endpoint}
&{req}= Create Mock Request Matcher POST ${endpoint} body_type="JSON" body=${BODY}
Set Global Variable ${req} ${notification_request}
&{headers} = Create Dictionary Content-Type=application/json
&{notification_response}= Create Mock Response headers=${headers} status_code=204
Create Mock Expectation ${notification_request} ${notification_response}
Check resource operationState is
[Arguments] ${state}
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
GET ${response['headers']['Location']}
${opocc}= Output response
Should Be Equal as Strings ${opocc['status']} 200
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${opocc['body']['nsInstanceId']}
Check resource not_instantiated
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${response['body']['id']}
String response body nsState NOT_INSTANTIATED
Check NS resource not_instantiated
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
GET ${response['headers']['Location']}
${opocc}= Output response
Should Be Equal as Strings ${opocc['status']} 200
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${opocc['body']['nsInstanceId']}
Check operation resource state is FAILED_TEMP
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
GET ${response['headers']['Location']}
${opocc}= Output response
Should Be Equal as Strings ${opocc['status']} 200
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${opocc['body']['nsInstanceId']}
Check operation resource state is not FAILED_TEMP
Check operation resource state is FAILED_TEMP
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
GET ${response['headers']['Location']}
${opocc}= Output response
Should Be Equal as Strings ${opocc['status']} 200
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${opocc['body']['nsInstanceId']}
String response body instantiationState not FAILED_TEMP
Check resource is finally failed
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
GET ${response['headers']['Location']}
${opocc}= Output response
Should Be Equal as Strings ${opocc['status']} 200
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${opocc['body']['nsInstanceId']}
String response body instantiationState FINALLY_FAILED
Launch another LCM operation
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/scaleNsToLevelRequest.json
Post ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${nsInstanceId}/scale_to_level ${body}
Integer response status 202
Check resource existence
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${nsInstanceId}
Integer response status 200
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${nsInstanceId}
Integer response status 404
Check HTTP Response Status Code Is
[Arguments] ${expected_status}
Log Validate Status code
Should Be Equal as Strings ${response['status']} ${expected_status}
Loading full blame...