diff options
Diffstat (limited to 'tests/so/orchestration/resources')
12 files changed, 919 insertions, 0 deletions
diff --git a/tests/so/orchestration/resources/SoKeywords.robot b/tests/so/orchestration/resources/SoKeywords.robot new file mode 100644 index 00000000..f9f68984 --- /dev/null +++ b/tests/so/orchestration/resources/SoKeywords.robot @@ -0,0 +1,103 @@ +*** Settings *** +Library StringTemplater +Library Collections +Library RequestsLibrary +Library HttpLibrary.HTTP +Library OperatingSystem +Library BuiltIn +Library String +Library XML +Resource common/Variables.robot +Resource SoVariables.robot +Resource global_properties.robot +Resource so_interface.robot + +***Variables*** +${SO_REST_URL} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_SO_SERVER_PORT} + +*** Keywords *** +Wait To Poll + [Documentation] Sleep the execution for the specified time (in seconds). + Sleep ${POLL_WAIT_TIME} + +Poll Orchestration Request + [Documentation] Poll the service orchestration request for the completion. Uses MAX_POLL_COUNT to specify the maximum number of polling attempts. + [Arguments] ${request_id} + : FOR ${INDEX} IN RANGE 1 ${MAX_POLL_COUNT} + \ Log 'Poll Count :' + \ Log ${INDEX} + \ ${orchestration_request_response}= Get Orchestration Request Status ${request_id} + + # First check request status code + \ ${orch_request_status_code}= Set Variable ${orchestration_request_response.status_code} + \ ${orchestration_failure_message}= Run Keyword If ${orch_request_status_code} != ${HTTP_OK} Catenate Error Code ${orch_request_status_code} + \ ${request_completion_status}= Run Keyword If ${orch_request_status_code} != ${HTTP_OK} Set Variable '${ORCH_REQUEST_FAILED}' + \ Exit For Loop If ${orch_request_status_code} != ${HTTP_OK} + + # Get Status of Orchestration request + \ Log ${orchestration_request_response.content} + \ ${request_completion_status} Get Json Value ${orchestration_request_response.content} /request/requestStatus/requestState + \ ${orchestration_status_message}= Run Keyword If ${request_completion_status} != '${ORCH_REQUEST_IN_PROGRESS}' Get Json Value ${orchestration_request_response.content} /request/requestStatus/statusMessage + \ Log ${request_completion_status} + + # Check for FAILED status + \ ${orchestration_failure_message}= Run Keyword If ${request_completion_status} == '${ORCH_REQUEST_FAILED}' Set Variable ${orchestration_status_message} + \ Exit For Loop If ${request_completion_status} == '${ORCH_REQUEST_FAILED}' + + # Check for COMPLETE status + \ Exit For Loop If ${request_completion_status} == '${ORCH_REQUEST_COMPLETE}' + + # Check for MAX NO OF POLL count, and exit if it has reached the maximum poll count + \ ${orchestration_failure_message}= Run Keyword If ${INDEX} == ${MaxPollCount}-1 Set Variable ${TIME_OUT_MESSAGE} + \ Exit For Loop If ${INDEX} == ${MaxPollCount}-1 + \ Wait To Poll + LOG ${orchestration_failure_message} + ${request_completion_status} Get Substring ${request_completion_status} 1 -1 + [Return] ${request_completion_status} ${orchestration_failure_message} + +Get Orchestration Request Status + [Documentation] Get the status of the orchestrated service request. + [Arguments] ${request_id} + + ${url}= Catenate SEPARATOR=/ ${SO_ORCHESTRATION_REQUESTS_URI} ${request_id} + ${orchestration_request_response} Run SO Get Request ${url} + [Return] ${orchestration_request_response} + +Get Orchestration Request Status with parameters + [Documentation] Get the status of the orchestrated service request. + [Arguments] ${request_id} ${parameter} + + ${url}= Catenate ${SO_ORCHESTRATION_REQUESTS_URI}/${request_id}?${parameter} + ${orchestration_request_response} Run SO Get Request ${url} + [Return] ${orchestration_request_response} + +Get ExtSystemErrorSource + [Documentation] Return ExtSystemErrorSource from Get Orchestration Request + [Arguments] ${request_id} + + ${orchestration_request_response} Get Orchestration Request Status with parameters ${request_id} format=statusdetail + ${orchestration_request_response_json} Parse Json ${orchestration_request_response.content} + ${extSystemErrorSource} Convert to String ${orchestration_request_response_json['request']['requestStatus']['extSystemErrorSource']} + + [Return] ${extSystemErrorSource} + +Get RollbackExtSystemErrorSource + [Documentation] Return ExtSystemErrorSource from Get Orchestration Request + [Arguments] ${request_id} + + ${orchestration_request_response} Get Orchestration Request Status with parameters ${request_id} format=statusdetail + ${orchestration_request_response_json} Parse Json ${orchestration_request_response.content} + ${rollbackExtSystemErrorSource} Convert to String ${orchestration_request_response_json['request']['requestStatus']['rollbackExtSystemErrorSource']} + + [Return] ${rollbackExtSystemErrorSource} + +Get FlowStatus + [Documentation] Return Flow Status from Get Orchestration Request + [Arguments] ${request_id} + + ${orchestration_request_response} Get Orchestration Request Status with parameters ${request_id} format=statusdetail + ${orchestration_request_response_json} Parse Json ${orchestration_request_response.content} + Log ${orchestration_request_response_json} + ${flow_status} Convert to String ${orchestration_request_response_json['request']['requestStatus']['flowStatus']} + + [Return] ${flow_status}
\ No newline at end of file diff --git a/tests/so/orchestration/resources/SoVariables.robot b/tests/so/orchestration/resources/SoVariables.robot new file mode 100644 index 00000000..b3ea9098 --- /dev/null +++ b/tests/so/orchestration/resources/SoVariables.robot @@ -0,0 +1,67 @@ +*** Variables *** +### Orchestration Polling Properties ### +${POLL_WAIT_TIME} 5 +${MEGA_POLL_WAIT_TIME} 5 +${MAX_POLL_COUNT} 72 + +### Common Properties ### +${VNFS} vnfs +${VFMODULES} vfModules +${SO_REST_URI} /onap/so/infra/serviceInstantiation/v7/serviceInstances +${SO_ORCHESTRATION_REQUESTS_URI} /onap/so/infra/orchestrationRequests/v7 +${SO_HEALTHCHECK_URI} /manage/health + +${SO_AUDIT_REST_URI} /audit/v1/services/ + +### Layer3 Properties ### +&{SO_LAYER3_HEADERS} Content-Type=application/xml Accept=application/xml Authorization=Basic YXBpaEJwbW46Y2FtdW5kYS1SMTUxMiE= +### Service Properties ### +${SO_REST_URI_CREATE_SERVICE} ${SO_REST_URI} +${SO_REST_URI_DELETE_SERVICE} ${SO_REST_URI} + +### VNF Module Properties ### +${SO_REST_URI_CREATE_VFMODULE} ${SO_REST_URI}/<SERVICEINSTANCEID>/vnfs/<VNFINSTANCEID>/vfModules +${SO_REST_URI_DELETE_VFMODULE} ${SO_REST_URI}/<SERVICEINSTANCEID>/vnfs/<VNFINSTANCEID>/vfModules/<VFMODULEINSTANCEID> +### Messages ### +${TIME_OUT_MESSAGE} No Successful response within specified time +${ORCH_FAILURE_MESSAGE} Orchestration request has failed + +##### VF SPECIFIC PROPERTIES ##### +${INVALID_SERVICE_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid serviceInstanceId is specified" +${INVALID_VNF_INST_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid vnfInstanceId is specified" +${DELETE_VNF_FAIL_MSG} "Can't Delete Generic Vnf. Generic Vnf is still in use." + +##### NETWORK SPECIFIC PROPERTIES ##### +${INVALID_NW_INST_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid networkInstanceId is specified" +${INV_MODEL_NAME_MSG} "Received error from Network Adapter: Unknown Network Type: CONTRAIL_INTERNAL" +${BLANK_MODEL_NAME_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelName is specified" +${INV_REGION_ID_MSG} "Received error from Network Adapter: Cloud Site [RegionTwo] not found" +${BLANK_REGION_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid lcpCloudRegionId is specified" +${INV_TENANT_MSG} "Received error from Network Adapter: 404 Not Found: " +${BLANK_TENANT_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid tenantId is specified" +${INV_SOURCE_MSG} "Recipe does not exist in catalog DB" +${BLANK_SOURCE_MSG} "Error parsing request.${SPACE}${SPACE}No valid source is specified" +${BLANK_INVAR_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelInvariantId is specified" +${BLANK_VER_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelVersionId is specified" +${BLANK_REQ_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid requestorId is specified" + +### Orchestration Constants ### +${ORCH_REQUEST_COMPLETE} COMPLETE +${ORCH_REQUEST_COMPLETED} COMPLETED +${ORCH_REQUEST_FAILED} FAILED +${ORCH_REQUEST_IN_PROGRESS} IN_PROGRESS + +### MODEL TYPE ### +${MODEL_TYPE_SERVICE} service +${MODEL_TYPE_VNF} vnf +${MODEL_TYPE_VFMODULE} vfModule +${MODEL_TYPE_VOLUME_GROUP} volumeGroup +${MODEL_TYPE_NETWORK} network +${INV_MODEL_TYPE_VNF} vnf1 +${INVALID_MODEL_TYPE} INVALID_MODEL_TYPE +${INVALID_SERVICE_MODEL_NAME} INVALID_SERVICE_MODEL +${INVALID_VFMODULE_MODEL_NAME} INVALID_VFMODULE_MODEL +${INVALID_CLOUD_REGION_ID} INVALID_CLR + +### CLOUD DATA ### +${TENANT_ID} 22eb191dd41a4f3c9be370fc638322f4
\ No newline at end of file diff --git a/tests/so/orchestration/resources/aai/aai_interface.robot b/tests/so/orchestration/resources/aai/aai_interface.robot new file mode 100644 index 00000000..67e828d2 --- /dev/null +++ b/tests/so/orchestration/resources/aai/aai_interface.robot @@ -0,0 +1,91 @@ +*** Settings *** +Documentation The main interface for interacting with A&AI. It handles low level stuff like managing the http request library and A&AI required fields +Library RequestsLibrary +Library UUID +Library HTTPUtils +Resource ../global_properties.robot + +*** Variables *** +${AAI_HEALTH_PATH} /aai/util/echo?action=long +${VERSIONED_INDEX_PATH} /aai/v14 +${AAI_FRONTEND_ENDPOINT} ${GLOBAL_AAI_SERVER_PROTOCOL}://${GLOBAL_INJECTED_AAI1_IP_ADDR}:${GLOBAL_AAI_SERVER_PORT} + +*** Keywords *** +Run A&AI Health Check + [Documentation] Runs an A&AI health check + :FOR ${i} IN RANGE 20 + \ ${resp}= Run A&AI Get Request ${AAI_HEALTH_PATH} + \ Log Received response from so ${resp.json()} + \ Log Received response from so status ${resp.status_code} + \ ${exit_loop}= Evaluate ${resp.status_code} == 200 + \ Exit For Loop If ${exit_loop} + \ Sleep 15s + +Run A&AI Get Request + [Documentation] Runs an A&AI get request + [Arguments] ${data_path} + Disable Warnings + Create Session aai ${AAI_FRONTEND_ENDPOINT} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Accept=application/json Content-Type=application/json X-TransactionId=Test X-FromAppId=SO + ${resp}= Get Request aai ${data_path} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Run A&AI Put Request + [Documentation] Runs an A&AI put request + [Arguments] ${data_path} ${data} + Disable Warnings + Create Session aai ${AAI_FRONTEND_ENDPOINT} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Accept=application/json Content-Type=application/json X-TransactionId=Test X-FromAppId=SO + ${resp}= Put Request aai ${data_path} data=${data} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Run A&AI Post Request + [Documentation] Runs an A&AI Post request + [Arguments] ${data_path} ${data} + Disable Warnings + Create Session aai ${AAI_FRONTEND_ENDPOINT} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Post Request aai ${data_path} data=${data} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Run A&AI Patch Request + [Documentation] Runs an A&AI Post request + [Arguments] ${data_path} ${data} + Disable Warnings + Log ${data} + Create Session aai ${AAI_FRONTEND_ENDPOINT} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=application/json Content-Type=application/merge-patch+json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} X-HTTP-Method-Override=PATCH + ${resp}= Post Request aai ${data_path} data=${data} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Run A&AI Delete Request + [Documentation] Runs an A&AI delete request + [Arguments] ${data_path} ${resource_version} + Disable Warnings + Create Session aai ${AAI_FRONTEND_ENDPOINT} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Delete Request aai ${data_path}?resource-version=${resource_version} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Delete A&AI Entity + [Documentation] Deletes an entity in A&AI + [Arguments] ${uri} + ${get_resp}= Run A&AI Get Request ${VERSIONED_INDEX PATH}${uri} + Run Keyword If '${get_resp.status_code}' == '200' Delete A&AI Entity Exists ${uri} ${get_resp.json()['resource-version']} + +Delete A&AI Entity Exists + [Documentation] Deletes an A&AI entity + [Arguments] ${uri} ${resource_version_id} + ${put_resp}= Run A&AI Delete Request ${VERSIONED_INDEX PATH}${uri} ${resource_version_id} + Should Be Equal As Strings ${put_resp.status_code} 204 + diff --git a/tests/so/orchestration/resources/aai/service_instance.robot b/tests/so/orchestration/resources/aai/service_instance.robot new file mode 100644 index 00000000..bdf45475 --- /dev/null +++ b/tests/so/orchestration/resources/aai/service_instance.robot @@ -0,0 +1,191 @@ +*** Settings *** +Documentation Validate A&AI Serivce Instance +... +... Validate A&AI Serivce Instance + +Resource aai_interface.robot +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library JSONUtils +Library HttpLibrary.HTTP +Library StringTemplater +Resource ../json_templater.robot +Resource ../aai/aai_interface.robot +Resource ../properties/cloudRegion.robot +*** Variables *** +${INDEX PATH} /aai/v15 +${GENERIC_QUERY_PATH} /search/generic-query? +${SYSTEM USER} robot-ete +${CUSTOMER SPEC PATH} /business/customers/customer/ +${SERVICE SUBSCRIPTIONS} /service-subscriptions/service-subscription/ +${SERVICE_INSTANCE_QUERY} /service-instances?service-instance-name= +${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template +${vnf_orch_update_json} robot/assets/templates/aai/vnf_orch_update.template +${GENERIC_VNF_PATH_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module/\${vf_module_id} +${GENERIC_VNF_QUERY_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module?vf-module-name=\${vf_module_name} +${VLB_CLOSED_LOOP_HACK_BODY} robot/assets/templates/aai/vlb_closed_loop_hack.template +${ROOT_CLOUD_PATH} /cloud-infrastructure/cloud-regions/cloud-region +#*************** Test Case Variables ************* +${VLB_CLOSED_LOOP_DELETE} +${VLB_CLOSED_LOOP_VNF_ID} + + +*** Keywords *** +Validate Service Instance + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${service_instance_name} ${service_type} ${customer_name} ${orchestration_status} + ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name} + ${resp}= Run A&AI Get Request ${INDEX PATH}${CUSTOMER SPEC PATH}${cust_resp.json()['customer'][0]['global-customer-id']}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE_INSTANCE_QUERY}${service_instance_name} + Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name} + Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${orchestration_status} + +Validate Service Instance By Id + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${service_instance_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}/nodes/service-instances/service-instance/${service_instance_id}?depth=0&nodes-only + Should Be Equal As Strings ${resp.status_code} 200 + +Delete Service Instance by Id + [Documentation] Delete passed service in A&AI + [Arguments] ${service_instance_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}/nodes/service-instances/service-instance/${service_instance_id} + Run Keyword If '${resp.status_code}' == '200' Run A&AI Delete Request ${INDEX PATH}/nodes/service-instances/service-instance/${service_instance_id} ${resp.json()['resource-version']} + +Validate Customer By Id + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${customer_id} ${status_code} + ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers/customer/${customer_id} + Should Be Equal As Strings ${cust_resp.status_code} ${status_code} + +Validate Generic VNF + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${vnf_name} ${vnf_type} ${service_instance_id} + ${generic_vnf}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name} + Dictionary Should Contain Value ${generic_vnf.json()} ${vnf_name} + ${returned_vnf_type}= Get From Dictionary ${generic_vnf.json()} vnf-type + Should Contain ${returned_vnf_type} ${vnf_type} + ${vnf_id}= Get From Dictionary ${generic_vnf.json()} vnf-id + ${generic_vnf}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id}?depth=all + [Return] ${generic_vnf.json()} + +Delete Vnf by Id + [Documentation] Delete passed service in A&AI + [Arguments] ${vnf_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id} + + Run Keyword If '${resp.status_code}'=='200' Run A&AI Delete Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id} ${resp.json()['resource-version']} + +Delete Volume Group by Id + [Documentation] Delete passed service in A&AI + [Arguments] ${volume_group_instance_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_CLOUD_PATH}/${cloud_owner}/${cloud_region_id}/volume-groups/volume-group/${volume_group_instance_id} + + Run Keyword If '${resp.status_code}'=='200' Run A&AI Delete Request ${INDEX PATH}${ROOT_CLOUD_PATH}/${cloud_owner}/${cloud_region_id}/volume-groups/volume-group/${volume_group_instance_id} ${resp.json()['resource-version']} + +Validate Tenant By Name + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${tenant_name} ${cloud_owner} ${cloud_region} ${response_code} + ${tenants}= Run A&AI Get Request ${INDEX PATH}/cloud-infrastructure/cloud-regions/cloud-region/${cloud_owner}/${cloud_region}/tenants?tenant-name=${tenant_name} + Should Be Equal As Strings ${tenants.status_code} ${response_code} + Run Keyword If '${response_code}'=='200' Dictionary Should Contain Value ${tenants.json()['tenant'][0]} ${tenant_name} + +Validate Line of Business + [Arguments] ${vnf_id} @{Lobs} + :FOR ${ELEMENT} IN @{Lobs} + \ ${response} Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id}/related-to/lines-of-business?line-of-business-name=${ELEMENT} + \ Should Be Equal As Strings ${response.status_code} 200 + +Validate Platform + [Arguments] ${vnf_id} @{platforms} + :FOR ${platform} IN @{platforms} + \ ${response} Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id}/related-to/platforms?platform-name=${platform} + \ Should Be Equal As Strings ${response.status_code} 200 + + +Validate Owning Entity By Name + [Arguments] ${owning_entity_name} + ${oe_resp}= Run A&AI Get Request ${INDEX PATH}/business/owning-entities?owning-entity-name=${owning_entity_name} + Should Be Equal As Strings ${oe_resp.json()['owning-entity'][0]['owning-entity-name']} ${owning_entity_name} + + + +VLB Closed Loop Hack + [Arguments] ${service} ${generic_vnf} ${closedloop_vf_module} + Return From Keyword If '${service}' != 'vLB' + ${vnf_id}= Get From Dictionary ${generic_vnf} vnf-id + ${vf_modules}= Get From Dictionary ${generic_vnf} vf-modules + ${list}= Get From Dictionary ${vf_modules} vf-module + ${vfmodule}= Get From List ${list} 0 + ${persona_model_id}= Get From Dictionary ${closedloop_vf_module} invariantUUID + ${persona_model_version}= Get From Dictionary ${closedloop_vf_module} version + ${dummy}= Catenate dummy_${vnf_id} + ${dict}= Create Dictionary vnf_id=${vnf_id} vf_module_id=${dummy} persona_model_id=${persona_model_id} persona_model_version=${persona_model_version} + ${datapath}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict} + ${data}= Fill JSON Template File ${VLB_CLOSED_LOOP_HACK_BODY} ${dict} + ${put_resp}= Run A&AI Put Request ${INDEX PATH}${datapath} ${data} + ${status_string}= Convert To String ${put_resp.status_code} + Should Match Regexp ${status_string} ^(201|412)$ + Set Test Variable ${VLB_CLOSED_LOOP_DELETE} ${datapath} + Set Test Variable ${VLB_CLOSED_LOOP_VNF_ID} ${vnf_id} + +VLB Closed Loop Hack Update + [Documentation] Update the A&AI vDNS scaling vf module to have persona-model-version 1 rather than 1.0 + [Arguments] ${stack_name} + ${dict}= Create Dictionary vnf_id=${VLB_CLOSED_LOOP_VNF_ID} vf_module_name=${stack_name} + ${query}= Template String ${GENERIC_VNF_QUERY_TEMPLATE} ${dict} + ${get_resp}= Run A&AI Get Request ${INDEX_PATH}${query} + ${json}= Set Variable ${get_resp.json()} + Set to Dictionary ${json} persona-model-version 1 + ${vf_module_id}= Get From Dictionary ${json} vf-module-id + Set to Dictionary ${dict} vf_module_id=${vf_module_id} + ${uri}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict} + ${resp}= Run A&AI Put Request ${INDEX_PATH}${uri} ${json} + ${get_resp}= Run A&AI Get Request ${INDEX_PATH}${query} + +Teardown VLB Closed Loop Hack + Return From Keyword If ' ${VLB_CLOSED_LOOP_DELETE}' == '' + Delete A&AI Entity ${VLB_CLOSED_LOOP_DELETE} + +Validate VF Module + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${vf_module_name} ${stack_type} + Run Keyword If '${stack_type}'=='vLB' Validate vLB Stack ${vf_module_name} + Run Keyword If '${stack_type}'=='vFW' Validate Firewall Stack ${vf_module_name} + Run Keyword If '${stack_type}'=='vVG' Validate vVG Stack ${vf_module_name} + +*** Keywords *** +Create AAI Service Instance + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${customer_id} ${service_type} ${service_instance_id} ${service_instance_name} + ${json_string}= Catenate { "service-type": "VDNS" , "service-subscriptions":[{"service-instance-id":"instanceid123","service-instance-name":"VDNS"}]} + ${put_resp}= Run A&AI Put Request ${INDEX PATH}${CUSTOMER SPEC PATH}${CUSTOMER ID}${SERVICE SUBSCRIPTIONS}/{service_type} ${json_string} + Should Be Equal As Strings ${put_resp.status_code} 201 + [Return] ${put_resp.status_code} + +Validate Service Instance Not Exist + [Arguments] ${service_instance_name} ${service_type} ${customer_name} + ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name} + ${resp}= Run A&AI Get Request ${INDEX PATH}${CUSTOMER SPEC PATH}${cust_resp.json()['customer'][0]['global-customer-id']}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE_INSTANCE_QUERY}${service_instance_name} + Should Be Equal As Strings ${resp.status_code} 404 + +Validate Service Instance Not Exist By Id + [Arguments] ${service_instance_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}/nodes/service-instances/service-instance/${service_instance_id}?depth=0&nodes-only + Should Be Equal As Strings ${resp.status_code} 404 + +Validate Customer Not Exist + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${customer_name} + ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name} + Should Be Equal As Strings ${cust_resp.status_code} 404 + +Validate Owning Entity + [Arguments] ${owning_entity_id} ${status_code} + ${oe_resp}= Run A&AI Get Request ${INDEX PATH}/business/owning-entities/owning-entity/${owning_entity_id} + Should Be Equal As Strings ${oe_resp.status_code} ${status_code} + +Validate Project + [Arguments] ${project_name} ${status_code} + ${proj_resp}= Run A&AI Get Request ${INDEX PATH}/business/projects/project/${project_name} + Should Be Equal As Strings ${proj_resp.status_code} ${status_code} diff --git a/tests/so/orchestration/resources/bpmn-infra/aLaCarte/Create/ServiceInstance.robot b/tests/so/orchestration/resources/bpmn-infra/aLaCarte/Create/ServiceInstance.robot new file mode 100644 index 00000000..bab0b327 --- /dev/null +++ b/tests/so/orchestration/resources/bpmn-infra/aLaCarte/Create/ServiceInstance.robot @@ -0,0 +1,172 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library HttpLibrary.HTTP +Library OperatingSystem +Library BuiltIn +Library String +Library CSVLibrary +Resource ../../../json_templater.robot +Resource ../../../SoKeywords.robot +Resource ../../../common/SoVariables.robot +Resource ../../../so_interface.robot +Resource ../../../aai/service_instance.robot +Resource ../../../common/Variables.robot +Resource ../../../properties/tenant.robot +Resource ../../../properties/cloudRegion.robot + +*** Variables *** +${data_file} ../../../../data/bpmn-infra/aLaCarte/ServiceInstance.csv +${create_customer_template_file} tests/so/orchestration/assets/templates/aai/add_customer_required_fields.template +${create_service_subscription_template_file} tests/so/orchestration/assets/templates/aai/service_subscription_required_fields.template +${create_service_model_template_file} tests/so/orchestration/assets/templates/aai/service_model.template +${serviceInstanceDictionary} +${serv_inst_id} +${serv_inst_tc_code} +${SUBSCRIBER_TYPE} CUST +${EXPECTED_ORCHESTRATION_STATUS} Active +${tenant_json} tests/so/orchestration/assets/templates/setup_tenant.json +${cloud_region_json} tests/so/orchestration/assets/templates/setup_cloud_region.json +${NOT_APPLICABLE} NA + +*** Keywords *** + +Setup GR Create Service Instance + [Arguments] ${serv_inst_tc_code} + ${serviceInstanceDictionary} Read CSV Data And Create Dictionary ${CURDIR}/${data_file} + Set Suite Variable ${serviceInstanceDictionary} + Set Suite Variable ${serv_inst_tc_code} + + Setup Cloud Region + Setup Tenant in AAI + + ${create_service_instance_data} Get From Dictionary ${serviceInstanceDictionary} ${serv_inst_tc_code} + + ${SUBSCRIBER_ID} Get From Dictionary ${create_service_instance_data} subscriberId + Setup Customer ${SUBSCRIBER_ID} + ${SUBSCRIPTION_SERVICE_TYPE} Get From Dictionary ${create_service_instance_data} serviceType + Setup Service Subscription ${SUBSCRIBER_ID} ${SUBSCRIPTION_SERVICE_TYPE} + + Setup Service Model in A&AI ${serviceInstanceDictionary} ${serv_inst_tc_code} + +Teardown GR Create Service Instance + [Arguments] ${service_instance_id} + Delete Service Instance by Id ${service_instance_id} + + +Setup Cloud Region + [Documentation] Setup the cloud region in AAI + + ${cloud_region_data} Create Dictionary cloudOwner=${cloudOwner} cloudRegionId=${cloudRegionId} cloudType=${cloudType} + ... ownerDefinedType=${ownerDefinedType} cloudRegionVersion=${cloudRegionVersion} cloudZone=${cloudZone} + ... complexName=${complexName} sriovAutomation=${sriovAutomation} + ${create_cloud_region_json} Fill JSON Template File ${cloud_region_json} ${cloud_region_data} + Run A&AI Put Request ${VERSIONED_INDEX_PATH}/cloud-infrastructure/cloud-regions/cloud-region/${cloudOwner}/${cloudRegionId} ${create_cloud_region_json} + + ${json}= OperatingSystem.Get File tests/so/orchestration/assets/templates/gr-api/PhysicalServerCreate.json + ${returned_json}= To Json ${json} + Run A&AI Put Request aai/v14/cloud-infrastructure/pservers/pserver/rdm52r19c001 ${returned_json} + +Setup Tenant in AAI + [Documentation] Setup the tenant in AAI + + ${tenant_data} Create Dictionary tenantId=${aai_tenant_Id} tenantName=${aai_tenant_name} + ${create_tenant_json} Fill JSON Template File ${tenant_json} ${tenant_data} + Run A&AI Put Request ${VERSIONED_INDEX_PATH}/cloud-infrastructure/cloud-regions/cloud-region/${cloudOwner}/${cloudRegionId}/tenants/tenant/${aai_tenant_Id} ${create_tenant_json} + +Setup Customer + [Documentation] Creates customer for use in tests + [Arguments] ${SUBSCRIBER_ID} + + ${create_customer_data} Create Dictionary global_customer_id=${SUBSCRIBER_ID} subscriber_name=${SUBSCRIBER_ID} subscriber_type=${SUBSCRIBER_TYPE} + Set Suite Variable ${create_customer_data} + ${create_customer_json} Fill JSON Template File ${create_customer_template_file} ${create_customer_data} + + Run A&AI Put Request ${VERSIONED_INDEX_PATH}/business/customers/customer/${SUBSCRIBER_ID} ${create_customer_json} + +Setup Service Subscription + [Documentation] Creates service subscription for use in tests + [Arguments] ${SUBSCRIBER_ID} ${SUBSCRIPTION_SERVICE_TYPE} + ${create_service_subscription_data} Create Dictionary service_type=${SUBSCRIPTION_SERVICE_TYPE} + Set Suite Variable ${create_service_subscription_data} + ${create_service_subscription_json} Fill JSON Template File ${create_service_subscription_template_file} ${create_service_subscription_data} + + Run A&AI Put Request ${VERSIONED_INDEX_PATH}/business/customers/customer/${SUBSCRIBER_ID}/service-subscriptions/service-subscription/${SUBSCRIPTION_SERVICE_TYPE} ${create_service_subscription_json} + +Setup Service Model in A&AI + [Arguments] ${serviceeDictionary} ${serv_inst_tc_code} + + ${create_service_instance_data} Get From Dictionary ${serviceInstanceDictionary} ${serv_inst_tc_code} + ${modelInvariantId} Get From Dictionary ${create_service_instance_data} serviceInstModelInvariantId + ${modelVersionId} Get From Dictionary ${create_service_instance_data} serviceInstModelNameVersionId + ${modelName} Get From Dictionary ${create_service_instance_data} serviceInstModelName + ${modelType} Get From Dictionary ${create_service_instance_data} serviceInstModelType + ${modelVersion} Get From Dictionary ${create_service_instance_data} serviceInstModelVersion + ${modelDescription} Get From Dictionary ${create_service_instance_data} serviceInstModelDescription + Setup Model in AAI ${modelInvariantId} ${modelType} ${modelVersionId} ${modelName} ${modelVersion} ${modelDescription} + +Setup Model in AAI + [Documentation] Setup Model in AAI for use in tests + [Arguments] ${modelInvariantId} ${modelType} ${modelVersionId} ${modelName} ${modelVersion} ${modelDescription} + ${create_service_model_data} Create Dictionary modelInvariantId=${modelInvariantId} modelType=${modelType} modelVersionId=${modelVersionId} + ... modelName=${modelName} modelVersion=${modelVersion} modelDescription=${modelDescription} + ${create_service_model_json} Fill JSON Template File ${create_service_model_template_file} ${create_service_model_data} + + Run A&AI Put Request ${VERSIONED_INDEX_PATH}/service-design-and-creation/models/model/${modelInvariantId} ${create_service_model_json} + + +Create Service Instance + [Documentation] Test Template for CreateServiceInstanceInfra + [Arguments] ${serv_inst_tc_code} ${payload_template} + log in create si sub + Log ${serv_inst_tc_code} + Log ${payload_template} + ${create_service_instance_data} Get From Dictionary ${serviceInstanceDictionary} ${serv_inst_tc_code} + Log create si data + Log ${create_service_instance_data} + Log ${CURDIR}/${payload_template} + Log ${create_service_instance_data} + Log ready to fill + ${service_body}= Fill JSON Template File ${CURDIR}/${payload_template} ${create_service_instance_data} + Log got service body + Log ${service_body} + Log after service body + ${serv_inst_id} ${request_id} ${request_completion_status} ${status_code} Invoke Create Service Instance Flow ${service_body} + [Return] ${serv_inst_id} ${request_id} ${request_completion_status} ${status_code} ${service_body} + + + +Invoke Create Service Instance Flow + [Documentation] Create Service Instance + [Arguments] ${service_body} + log invoking + ${create_service_response} Run SO Post request ${SO_REST_URI_CREATE_SERVICE} ${service_body} + log retunred ${create_service_response} + Return From Keyword If ${create_service_response.status_code} != ${HTTP_ACCEPTED} ${EMPTY} ${EMPTY} ${EMPTY} ${create_service_response.status_code} + ${request_id_string} Get Json Value ${create_service_response.content} /requestReferences/requestId + ${request_id} Get Substring ${request_id_string} 1 -1 + ${instance_id_string} Get Json Value ${create_service_response.content} /requestReferences/instanceId + ${instance_id} Get Substring ${instance_id_string} 1 -1 + Log ${instance_id} + ${request_completion_status} ${orchestration_failure_message} Run Keyword If ${create_service_response.status_code} == ${HTTP_ACCEPTED} + ... Poll Orchestration Request ${request_id} + + [Return] ${instance_id} ${request_id} ${request_completion_status} ${create_service_response.status_code} + + Invoke Delete Service Instance Flow + [Documentation] Delete a service instance. + [Arguments] ${service_body} ${service_instance} + + ${delete_service_response} Run SO Delete request ${SO_REST_URI_DELETE_SERVICE}/${service_instance} data=${service_body} + + Return From Keyword If ${delete_service_response.status_code} != ${HTTP_ACCEPTED} ${EMPTY} ${EMPTY} ${EMPTY} ${delete_service_response.status_code} + + ${request_id_string} Get Json Value ${delete_service_response.content} /requestReferences/requestId + ${request_id} Get Substring ${request_id_string} 1 -1 + ${instance_id_string} Get Json Value ${delete_service_response.content} /requestReferences/instanceId + ${instance_id} Get Substring ${instance_id_string} 1 -1 + + ${request_completion_status} ${orchestration_failure_message} Run Keyword If ${delete_service_response.status_code} == ${HTTP_ACCEPTED} + ... Poll Orchestration Request ${request_id} + + [Return] ${instance_id} ${request_id} ${request_completion_status} ${delete_service_response.status_code} diff --git a/tests/so/orchestration/resources/common/SoVariables.robot b/tests/so/orchestration/resources/common/SoVariables.robot new file mode 100644 index 00000000..3bdfdc64 --- /dev/null +++ b/tests/so/orchestration/resources/common/SoVariables.robot @@ -0,0 +1,68 @@ +*** Variables *** +### Orchestration Polling Properties ### +${POLL_WAIT_TIME} 5 +${MEGA_POLL_WAIT_TIME} 5 +${MAX_POLL_COUNT} 72 + +### Common Properties ### +${VNFS} vnfs +${VFMODULES} vfModules +${SO_REST_URI} /onap/so/infra/serviceInstantiation/v7/serviceInstances +${SO_ORCHESTRATION_REQUESTS_URI} /onap/so/infra/orchestrationRequests/v7 +${SO_HEALTHCHECK_URI} /manage/health + +### Layer3 Properties ### +&{SO_LAYER3_HEADERS} Content-Type=application/xml Accept=application/xml Authorization=Basic YXBpaEJwbW46Y2FtdW5kYS1SMTUxMiE= +### Service Properties ### +${SO_REST_URI_CREATE_SERVICE} ${SO_REST_URI} +${SO_REST_URI_DELETE_SERVICE} ${SO_REST_URI} + +### VNF Module Properties ### +${SO_REST_URI_CREATE_VFMODULE} ${SO_REST_URI}/<SERVICEINSTANCEID>/vnfs/<VNFINSTANCEID>/vfModules +${SO_REST_URI_DELETE_VFMODULE} ${SO_REST_URI}/<SERVICEINSTANCEID>/vnfs/<VNFINSTANCEID>/vfModules/<VFMODULEINSTANCEID> +### Messages ### +${TIME_OUT_MESSAGE} No Successful response within specified time +${ORCH_FAILURE_MESSAGE} Orchestration request has failed + +##### VF SPECIFIC PROPERTIES ##### +${INVALID_SERVICE_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid serviceInstanceId is specified" +${INVALID_VNF_INST_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid vnfInstanceId is specified" +${DELETE_VNF_FAIL_MSG} "Can't Delete Generic Vnf. Generic Vnf is still in use." + +##### NETWORK SPECIFIC PROPERTIES ##### +${INVALID_NW_INST_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid networkInstanceId is specified" +${INV_MODEL_NAME_MSG} "Received error from Network Adapter: Unknown Network Type: CONTRAIL_INTERNAL" +${BLANK_MODEL_NAME_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelName is specified" +${INV_REGION_ID_MSG} "Received error from Network Adapter: Cloud Site [RegionTwo] not found" +${BLANK_REGION_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid lcpCloudRegionId is specified" +${INV_TENANT_MSG} "Received error from Network Adapter: 404 Not Found: " +${BLANK_TENANT_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid tenantId is specified" +${INV_SOURCE_MSG} "Recipe does not exist in catalog DB" +${BLANK_SOURCE_MSG} "Error parsing request.${SPACE}${SPACE}No valid source is specified" +${BLANK_INVAR_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelInvariantId is specified" +${BLANK_VER_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelVersionId is specified" +${BLANK_REQ_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid requestorId is specified" + +### Orchestration Constants ### +${ORCH_REQUEST_COMPLETE} COMPLETE +${ORCH_REQUEST_COMPLETED} COMPLETED +${ORCH_REQUEST_FAILED} FAILED +${ORCH_REQUEST_IN_PROGRESS} IN_PROGRESS + +### MODEL TYPE ### +${MODEL_TYPE_SERVICE} service +${MODEL_TYPE_VNF} vnf +${MODEL_TYPE_VFMODULE} vfModule +${MODEL_TYPE_VOLUME_GROUP} volumeGroup +${MODEL_TYPE_NETWORK} network +${INV_MODEL_TYPE_VNF} vnf1 +${INVALID_MODEL_TYPE} INVALID_MODEL_TYPE +${INVALID_SERVICE_MODEL_NAME} INVALID_SERVICE_MODEL +${INVALID_VFMODULE_MODEL_NAME} INVALID_VFMODULE_MODEL +${INVALID_CLOUD_REGION_ID} INVALID_CLR + + +### CLOUD DATA ### +${TENANT_ID} 22eb191dd41a4f3c9be370fc638322f4 + + diff --git a/tests/so/orchestration/resources/common/Variables.robot b/tests/so/orchestration/resources/common/Variables.robot new file mode 100644 index 00000000..a6ee32b2 --- /dev/null +++ b/tests/so/orchestration/resources/common/Variables.robot @@ -0,0 +1,15 @@ +*** Variables *** +### HTTP response Codes ### +${HTTP_OK} 200 +${HTTP_ACCEPTED} 202 +${HTTP_NO_CONTENT} 204 +${HTTP_BAD_REQUEST} 400 +${HTTP_BAD_GATEWAY} 502 +${HTTP_RESOURCE_NOT_FOUND} 404 +${INTERNAL_SERVER_ERROR} 500 +${METHOD_NOT_ALLOWED} 405 + +###TRUE FLASE##### +${TRUE_VALUE} true +${FALSE_VALUE} false + diff --git a/tests/so/orchestration/resources/global_properties.robot b/tests/so/orchestration/resources/global_properties.robot new file mode 100644 index 00000000..a4a0f44d --- /dev/null +++ b/tests/so/orchestration/resources/global_properties.robot @@ -0,0 +1,74 @@ +*** Settings *** +Documentation store all properties that can change or are used in multiple places here +... format is all caps with underscores between words and prepended with GLOBAL +... make sure you prepend them with GLOBAL so that other files can easily see it is from this file. + + +*** Variables *** +${GLOBAL_APPLICATION_ID} robot-ete +${GLOBAL_SELENIUM_BROWSER} chrome +${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} Create Dictionary +${GLOBAL_SELENIUM_DELAY} 0 +${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} 5 +${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} 15 +${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} orchestration +${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} volume +${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} compute +${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} network +${GLOBAL_OPENSTACK_GLANCE_SERVICE_TYPE} image +${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} identity +${GLOBAL_OPENSTACK_STACK_DEPLOYMENT_TIMEOUT} 600s +${GLOBAL_AAI_CLOUD_OWNER} CloudOwner +${GLOBAL_AAI_CLOUD_OWNER_DEFINED_TYPE} OwnerType +${GLOBAL_AAI_COMPLEX_NAME} clli1 +${GLOBAL_AAI_PHYSICAL_LOCATION_ID} clli1 +${GLOBAL_BUILD_NUMBER} 0 +${GLOBAL_VID_UI_TIMEOUT_SHORT} 20s +${GLOBAL_VID_UI_TIMEOUT_MEDIUM} 60s +${GLOBAL_VID_UI_TIMEOUT_LONG} 120s +${GLOBAL_VM_PRIVATE_KEY} ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pvt +${GLOBAL_AAI_ZONE_ID} nova1 +${GLOBAL_AAI_ZONE_NAME} nova +${GLOBAL_AAI_DESIGN_TYPE} integration +${GLOBAL_AAI_ZONE_CONTEXT} labs +${GLOBAL_AAI_SERVER_PROTOCOL} http +${GLOBAL_INJECTED_AAI1_IP_ADDR} localhost +${GLOBAL_AAI_SERVER_PORT} 9900 +${GLOBAL_AAI_USERNAME} test +${GLOBAL_AAI_PASSWORD} test +${GLOBAL_INJECTED_OPENSTACK_TENANT_ID} test +${GLOBAL_INJECTED_OPENSTACK_USERNAME} test +${GLOBAL_INJECTED_OPENSTACK_PASSWORD} test +${GLOBAL_INJECTED_KEYSTONE} test +${GLOBAL_PACKET_GENERATOR_PORT} test +${GLOBAL_PACKET_GENERATOR_USERNAME} test +${GLOBAL_PACKET_GENERATOR_PASSWORD} test +${GLOBAL_SERVICE_TEMPLATE_MAPPING} test +${GLOBAL_DNS_TRAFFIC_DURATION} test +${GLOBAL_INJECTED_NETWORK} test +${GLOBAL_SO_SERVER_PROTOCOL} http +${GLOBAL_INJECTED_SO_IP_ADDR} localhost +${GLOBAL_SO_SERVER_PORT} 8080 +${GLOBAL_SO_ASDC_PORT} 8085 +${GLOBAL_SO_CATALOG_PORT} 8082 +${GLOBAL_SO_CAMUNDA_PORT} 8081 +${GLOBAL_SO_SIMULATOR_PORT} 10000 +${resourceLocation} /app/csar/ +${GLOBAL_SO_CATDB_API_URI} aaaa + +${GLOBAL_INJECTED_PROPERTIES} None +${GLOBAL_INJECTED_ARTIFACTS_VERSION} None +${GLOBAL_INJECTED_PUBLIC_NET_ID} None +${GLOBAL_INJECTED_CLOUD_ENV} None +${GLOBAL_INJECTED_SCRIPT_VERSION} None +${GLOBAL_INJECTED_VM_IMAGE_NAME} None +${GLOBAL_INJECTED_VM_FLAVOR} None +${GLOBAL_PRELOAD_PARAMETERS} None + +${GLOBAL_SDNGC_USERNAME} admin +${GLOBAL_SDNGC_PASSWORD} admin +${GLOBAL_SDNGC_SERVER_PROTOCOL} https +#${GLOBAL_INJECTED_SDNC_IP_ADDR} +${GLOBAL_INJECTED_SDNC_IP_ADDR} aaaa +${GLOBAL_SDNGC_REST_PORT} 8443 +${GLOBAL_SDNGC_ADMIN_PORT} 8443
\ No newline at end of file diff --git a/tests/so/orchestration/resources/json_templater.robot b/tests/so/orchestration/resources/json_templater.robot new file mode 100644 index 00000000..0dd88b90 --- /dev/null +++ b/tests/so/orchestration/resources/json_templater.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation This resource is filling out json string templates and returning the json back +Library RequestsLibrary +Library StringTemplater +Library OperatingSystem +Library CSVLibrary +Library Collections +Resource global_properties.robot + +*** Keywords *** +Fill JSON Template + [Documentation] Runs substitution on template to return a filled in json + [Arguments] ${json} ${arguments} + ${returned_string}= Template String ${json} ${arguments} + Log ${returned_string} + ${returned_json}= To Json ${returned_string} + [Return] ${returned_json} + +Fill JSON Template File + [Documentation] Runs substitution on template to return a filled in json + [Arguments] ${json_file} ${arguments} + ${json}= OperatingSystem.Get File ${json_file} + ${returned_json}= Fill JSON Template ${json} ${arguments} + [Return] ${returned_json} + +Read CSV Data And Create Dictionary + [Documentation] Read CSV Data And Create Dictionary + [Arguments] ${file} + + ${status} Run Keyword And Return Status Variable Should Exist ${file} + ${csv_file} = set variable if ${status}==True ${file} + LOG ${csv_file} + ${dictionary} Create Dictionary + ${dictionary_list} read csv file to associative ${csv_file} + + ${dict_count} Get Length ${dictionary_list} + : FOR ${row_num} IN RANGE 0 ${dict_count} + \ Log ${dictionary_list[${row_num}]} + \ ${dict_key} Get From Dictionary ${dictionary_list[${row_num}]} uniqueKey + \ Set To Dictionary ${dictionary} ${dict_key} ${dictionary_list[${row_num}]} + + [Return] ${dictionary}
\ No newline at end of file diff --git a/tests/so/orchestration/resources/properties/cloudRegion.robot b/tests/so/orchestration/resources/properties/cloudRegion.robot new file mode 100644 index 00000000..b38f4285 --- /dev/null +++ b/tests/so/orchestration/resources/properties/cloudRegion.robot @@ -0,0 +1,13 @@ +*** Settings *** +Documentation Properties for CloudRegion + + +*** Variables *** +${cloudOwner} CloudOwner +${cloudRegionId} regionOne +${cloudType} openstack +${ownerDefinedType} LCP +${cloudRegionVersion} 3.0.3 +${cloudZone} TEST1 +${complexName} regionOne +${sriovAutomation} false
\ No newline at end of file diff --git a/tests/so/orchestration/resources/properties/tenant.robot b/tests/so/orchestration/resources/properties/tenant.robot new file mode 100644 index 00000000..2e1ae75d --- /dev/null +++ b/tests/so/orchestration/resources/properties/tenant.robot @@ -0,0 +1,7 @@ +*** Settings *** +Documentation Properties for Tenant + + +*** Variables *** +${aai_tenant_Id} 0422ffb57ba042c0800a29dc85ca70f8 +${aai_tenant_Name} tenantName
\ No newline at end of file diff --git a/tests/so/orchestration/resources/so_interface.robot b/tests/so/orchestration/resources/so_interface.robot new file mode 100644 index 00000000..6db22bf2 --- /dev/null +++ b/tests/so/orchestration/resources/so_interface.robot @@ -0,0 +1,76 @@ +*** Settings *** +Documentation The main interface for interacting with SO. It handles low level stuff like managing the http request library and SO required fields +Library RequestsLibrary +Library UUID +Library OperatingSystem +Library Collections +Library HTTPUtils +Resource global_properties.robot +Resource json_templater.robot +*** Variables *** +${SO_ENDPOINT} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_SO_SERVER_PORT} +${CATALOG_DB_ENDPOINT} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_SO_CATALOG_PORT} +${CAMUNDA_DB_ENDPOINT} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_SO_CAMUNDA_PORT} +${SIMULATOR_ENDPOINT} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_SO_SIMULATOR_PORT} + +*** Keywords *** + +Run SO Get Request + [Documentation] Runs an SO get request + [Arguments] ${full_path} ${accept}=application/json ${endPoint}=${SO_ENDPOINT} + Disable Warnings + Log Creating session ${SO_ENDPOINT} + ${session}= Create Session so ${SO_ENDPOINT} + ${uuid}= Generate UUID + ${uuidstring}= Convert To String ${uuid} + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + ${resp}= Get Request so ${full_path} headers=${headers} + Log Received response from so ${resp.text} + [Return] ${resp} + +Poll SO Get Request + [Documentation] Runs an SO get request until a certain status is received. valid values are COMPLETE + [Arguments] ${data_path} ${status} + Disable Warnings + Log Creating session ${SO_ENDPOINT} + ${session}= Create Session so ${SO_ENDPOINT} + ${uuid}= Generate UUID + ${uuidstring}= Convert To String ${uuid} + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + #do this until it is done + :FOR ${i} IN RANGE 20 + \ ${resp}= Get Request so ${data_path} headers=${headers} + \ Should Not Contain ${resp.text} FAILED + \ Log ${resp.json()['request']['requestStatus']['requestState']} + \ ${exit_loop}= Evaluate "${resp.json()['request']['requestStatus']['requestState']}" == "${status}" + \ Exit For Loop If ${exit_loop} + \ Sleep 15s + Log Received response from so ${resp.text} + [Return] ${resp} + +Run SO Post request + [Documentation] Runs an SO post request + [Arguments] ${data_path} ${data} + Disable Warnings + Log Creating session ${SO_ENDPOINT} + ${session}= Create Session so ${SO_ENDPOINT} + ${uuid}= Generate UUID + ${uuidstring}= Convert To String ${uuid} + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + ${resp}= Post Request so ${data_path} data=${data} headers=${headers} + Log Received response from so ${resp.text} + [Return] ${resp} + + +Run SO Delete request + [Documentation] Runs an SO Delete request + [Arguments] ${data_path} ${data} + Disable Warnings + Log Creating session ${SO_ENDPOINT} + ${session}= Create Session so ${SO_ENDPOINT} + ${uuid}= Generate UUID + ${uuidstring}= Convert To String ${uuid} + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + ${resp}= Delete Request so ${data_path} ${data} headers=${headers} + Log Received response from so ${resp.text} + [Return] ${resp} |