Newer
Older
Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false
Library JSONLibrary
Library Process
Library JSONSchemaLibrary schemas/
Library OperatingSystem
Library MockServerLibrary
Variables descriptors/SOL006/VNFD/vnfd_SOL006.yaml
Variables descriptors/SOL006/NSD/nsd_SOL006.yaml
Variables descriptors/SOL001/VNFD/vnfd_SOL001.yaml
Variables descriptors/SOL001/NSD/nsd_SOL001.yaml
*** 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
Set Global Variable @{nsLcmOpOccId} ${response['headers']['Location']}
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}/${apiMajorVersion}/subscriptions/${subscriptionId}
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}"}
Delete ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Get ${apiRoot}/${apiName}/${apiMajorVersion}/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}/${apiMajorVersion}/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}/${apiMajorVersion}/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}/${apiMajorVersion}/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}/${apiMajorVersion}/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}/${apiMajorVersion}/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}/${apiMajorVersion}/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}
${BODY}= evaluate json.dumps(${json}) json
&{notification_request}= Create Mock Request Matcher POST ${callback_endpoint} body_type="JSON" body=${BODY}
Wait Until Keyword Succeeds ${total_polling_time} ${polling_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}=""
${json}= evaluate {"notificationStatus": {}}
Run Keyword If '${status}' != "" set to dictionary ${json["notificationStatus"]} dp=${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}
String ${response['body']['operationState']} ${state}
Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Probe resource 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}/${apiMajorVersion}/ns_instances/${opocc['body']['nsInstanceId']}
String response body nsState 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}/${apiMajorVersion}/ns_instances/${response['body']['id']}
String response body nsState 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}/${apiMajorVersion}/ns_instances/${opocc['body']['nsInstanceId']}
String response body nsState NOT_INSTANTIATED
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}/${apiMajorVersion}/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}/${apiMajorVersion}/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}/${apiMajorVersion}/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}"}
${template}= Get File jsons/scaleNsToLevelRequest.json
${body}= Format String ${template} instantiationLevelId=${instantiationLevelId}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/ns_instances/${nsInstanceId}/scale_to_level ${body}
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}/${apiMajorVersion}/ns_instances/${nsInstanceId}
Integer response status 200
Check HTTP Response Status Code Is
[Arguments] ${expected_status}
Log Validate Status code
Should Be Equal as Strings ${response['status']} ${expected_status}
Loading
Loading full blame…