Abdelmuhaimen Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation The main interface for interacting with CDS. It handles low level stuff like managing the http request library and CDS required fields |
| 3 | Library RequestsLibrary |
| 4 | Library ONAPLibrary.Utilities |
| 5 | Library OperatingSystem |
| 6 | Library Collections |
Abdelmuhaimen Seaudi | 94cc783 | 2019-08-14 17:53:15 +0000 | [diff] [blame^] | 7 | Library ONAPLibrary.JSON |
| 8 | Library ONAPLibrary.ServiceMapping WITH NAME ServiceMapping |
| 9 | Library ONAPLibrary.PreloadData WITH NAME Preload |
| 10 | Library ONAPLibrary.Templating WITH NAME Templating |
| 11 | Library ONAPLibrary.SDNC WITH NAME SDNC |
| 12 | Library ONAPLibrary.SO WITH NAME SO |
Abdelmuhaimen Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 13 | Resource global_properties.robot |
| 14 | |
| 15 | *** Variables *** |
| 16 | ${CDS_HEALTH_CHECK_PATH} /api/v1/execution-service/health-check |
| 17 | ${CDS_HEALTH_ENDPOINT} ${GLOBAL_CCSDK_CDS_SERVER_PROTOCOL}://${GLOBAL_INJECTED_CCSDK_CDS_BLUEPRINT_PROCESSOR_IP_ADDR}:${GLOBAL_CCSDK_CDS_HEALTH_SERVER_PORT} |
Abdelmuhaimen Seaudi | 94cc783 | 2019-08-14 17:53:15 +0000 | [diff] [blame^] | 18 | ${SDC_SERVICE_CATALOG_ENDPOINT} ${GLOBAL_SDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_BE_IP_ADDR}:${GLOBAL_SDC_BE_PORT} |
| 19 | |
| 20 | ${SDC_SERVICE_CATALOG_PATH} sdc2/rest/v1/catalog/services/serviceName/demoVLB_CDS/serviceVersion/1.0 |
| 21 | ${SO_CATALOGDB_PATH} /ecomp/mso/catalog/v2/serviceVnfs?serviceModelName |
| 22 | ${SO_APIHANDLER_PATH} /onap/so/infra/serviceInstantiation/v7/serviceInstances |
| 23 | ${SO_REQUESTDB_PATH} /infraActiveRequests |
| 24 | |
| 25 | ${customer} Demonstration |
| 26 | ${cloudOwner} CloudOwner |
| 27 | ${subscriptionServiceType} vLB |
| 28 | ${SO_TEMPLATE_PATH} so |
Abdelmuhaimen Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 29 | |
| 30 | *** Keywords *** |
| 31 | Run CDS Health Check |
| 32 | [Documentation] Runs a CDS health check |
| 33 | ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD} |
Abdelmuhaimen Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 34 | ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth} |
| 35 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 36 | ${resp}= Get Request cds ${CDS_HEALTH_CHECK_PATH} headers=${headers} |
| 37 | Log Received response code from cds ${resp} |
| 38 | Log Received content from cds ${resp.content} |
| 39 | Should Be Equal As Strings ${resp.status_code} 200 |
| 40 | |
Abdelmuhaimen Seaudi | 94cc783 | 2019-08-14 17:53:15 +0000 | [diff] [blame^] | 41 | Get Service Catalog |
| 42 | [Arguments] ${cds-service-model} |
| 43 | ${resp}= SDC.Run Get Request ${SDC_SERVICE_CATALOG_ENDPOINT} ${SDC_SERVICE_CATALOG_PATH} cs0008 auth=${GLOBAL_SDC_AUTHENTICATION} |
| 44 | Should Be Equal As Strings ${resp.status_code} 200 |
| 45 | [Return] ${resp.json()['uuid']} ${resp.json()['invariantUUID']} |
| 46 | |
| 47 | Get Service VNFs |
| 48 | [Arguments] ${cds-service-model} |
| 49 | ${auth}= Create List ${GLOBAL_SO_CATDB_USERNAME} ${GLOBAL_SO_PASSWORD} |
| 50 | ${resp}= SO.Run Get Request ${GLOBAL_SO_CATDB_ENDPOINT} ${SO_CATALOGDB_PATH}=${cds-service-model} auth=${auth} |
| 51 | Should Be Equal As Strings ${resp.status_code} 200 |
| 52 | [Return] ${resp.json()} |
| 53 | |
| 54 | Service Assign & Activate |
| 55 | [Arguments] ${cds_service_model} ${service_uuid} ${service_invariantUUID} ${resp.json()} |
| 56 | ${time_now}= Get Time |
| 57 | @{date_time}= Split String ${time_now} |
| 58 | ${time_stamp}= Catenate SEPARATOR=_ @{date_time}[0] @{date_time}[1] |
| 59 | ${customized_time_stamp}= Remove String ${time_stamp} : |
| 60 | ${cds_instance_name}= Set Variable cds_vlb_svc_${customized_time_stamp} |
| 61 | ${global_parameters}= Get Globally Injected Parameters |
| 62 | ${dict}= Set To Dictionary ${global_parameters} cds_instance_name=${cds_instance_name} customer=${customer} cloudOwner=${cloudOwner} subscriptionServiceType=${subscriptionServiceType} cds_service_model=${cds_service_model} service_uuid=${service_uuid} service_invariantUUID=${service_invariantUUID} resp=${resp.json()} |
| 63 | Templating.Create Environment cds ${GLOBAL_TEMPLATE_FOLDER} |
| 64 | ${data}= Templating.Apply Template cds ${SO_TEMPLATE_PATH}/cds_service_template.jinja ${dict} |
| 65 | Log ${data} |
| 66 | ${auth}= Create List ${GLOBAL_SO_USERNAME} ${GLOBAL_SO_PASSWORD} |
| 67 | ${resp}= SO.Run Post Request ${GLOBAL_SO_APIHAND_ENDPOINT} ${SO_APIHANDLER_PATH} ${data} auth=${auth} |
| 68 | Should Be Equal As Strings ${resp.status_code} 202 |
| 69 | [Return] ${resp.json()['requestReferences']['requestId']} |
| 70 | |
| 71 | Check Infra Active Requests |
| 72 | [Arguments] ${cds_requestid} |
| 73 | ${auth}= Create List ${GLOBAL_SO_CATDB_USERNAME } ${GLOBAL_SO_PASSWORD} |
| 74 | SO.Run Polling Get Request ${GLOBAL_SO_REQDB_ENDPOINT} ${SO_REQUESTDB_PATH}/${cds_requestid} tries=30 interval=60 auth=${auth} |