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":"${AUTHORIZATION}"}
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":"${AUTHORIZATION}"}
Delete ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${nsInstanceId}
Check Fail not supported
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
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":"${AUTHORIZATION}"}
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":"${AUTHORIZATION}"}
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":"${AUTHORIZATION}"}
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":"${AUTHORIZATION}"}
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":"${AUTHORIZATION}"}
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":"${AUTHORIZATION}"}
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 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=${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}=""
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 ${endpoint}
&{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}
Check resource instantiated
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${nsInstanceId}
Check resource not_instantiated
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${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":"${AUTHORIZATION}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${nsInstanceId}
String response body instantiationState FAILED_TEMP
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":"${AUTHORIZATION}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${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":"${AUTHORIZATION}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${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":"${AUTHORIZATION}"}
${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":"${AUTHORIZATION}"}
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":"${AUTHORIZATION}"}
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}
Check Postcondition NS Instance is deleted
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
Get ${apiRoot}/${apiName}/${apiVersion}/ns_instances/${nsInstanceId}
Integer response status 404
Check Postcondition NS Instance is not modified
GET IndividualNSInstance
${resp_dict}= evaluate json.loads('''${response['body']}''') json
${body}= Get File jsons/CreateNsRequest.json
Dictionaries Should Be Equal ${resp_dict} ${body} values=True
Check HTTP Response Header Contains
[Arguments] ${HEADER_TOCHECK}
Should Contain ${response['headers']} ${HEADER_TOCHECK}
Log Header is present
Check HTTP Response Body Json Schema Is
[Arguments] ${input}
${schema} = Catenate SEPARATOR= ${input} .schema.json
Check Postcondition NS Instance is not deleted
Set Headers {"Accept":"${ACCEPT}"}
Loading full blame...