blob: 3c7ee015c44e8e73ef0636bb995b93a3de3c4809 [file] [log] [blame]
Abdelmuhaimen Seaudi756eb6a2019-08-10 08:20:52 +00001*** Settings ***
2Documentation The main interface for interacting with CDS. It handles low level stuff like managing the http request library and CDS required fields
3Library RequestsLibrary
4Library ONAPLibrary.Utilities
5Library OperatingSystem
6Library Collections
Abdelmuhaimen Seaudi94cc7832019-08-14 17:53:15 +00007Library ONAPLibrary.JSON
8Library ONAPLibrary.ServiceMapping WITH NAME ServiceMapping
9Library ONAPLibrary.PreloadData WITH NAME Preload
10Library ONAPLibrary.Templating WITH NAME Templating
11Library ONAPLibrary.SDNC WITH NAME SDNC
12Library ONAPLibrary.SO WITH NAME SO
Abdelmuhaimen Seaudi756eb6a2019-08-10 08:20:52 +000013Resource 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 Seaudi94cc7832019-08-14 17:53:15 +000018${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 Seaudi756eb6a2019-08-10 08:20:52 +000029
30*** Keywords ***
31Run CDS Health Check
32 [Documentation] Runs a CDS health check
33 ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD}
Abdelmuhaimen Seaudi756eb6a2019-08-10 08:20:52 +000034 ${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 Seaudi94cc7832019-08-14 17:53:15 +000041Get 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
47Get 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
54Service 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
71Check 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}