DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation The main interface for interacting with MSO. It handles low level stuff like managing the http request library and MSO required fields |
| 3 | Library RequestsLibrary |
Jerry Flood | 176d1da | 2017-10-02 10:38:30 -0400 | [diff] [blame] | 4 | Library UUID |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 5 | Library OperatingSystem |
| 6 | Library Collections |
| 7 | Resource global_properties.robot |
| 8 | Resource ../resources/json_templater.robot |
| 9 | *** Variables *** |
Brian Freeman | 391680a | 2018-08-11 15:20:58 -0500 | [diff] [blame] | 10 | ${MSO_HEALTH_CHECK_PATH} /manage/health |
Jerry Flood | 176d1da | 2017-10-02 10:38:30 -0400 | [diff] [blame] | 11 | ${MSO_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_SERVER_PORT} |
Brian Freeman | 391680a | 2018-08-11 15:20:58 -0500 | [diff] [blame] | 12 | ${SO_APIHAND_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_APIHAND_SERVER_PORT} |
| 13 | ${SO_ASDCHAND_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO__ASDCHAND_SERVER_PORT} |
| 14 | ${SO_BPMN_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_BPMN_SERVER_PORT} |
| 15 | ${SO_CATDB_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO__CATDB_SERVER_PORT} |
| 16 | ${SO_OPENSTACK_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_OPENSTACK_SERVER_PORT} |
| 17 | ${SO_REQDB_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_REQDB_SERVER_PORT} |
| 18 | ${SO_SDNC_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_SDNC_SERVER_PORT} |
| 19 | ${SO_VFC_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_VFC_SERVER_PORT} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 20 | |
| 21 | *** Keywords *** |
Brian Freeman | 391680a | 2018-08-11 15:20:58 -0500 | [diff] [blame] | 22 | Run SO Global Health Check |
| 23 | Run SO Container Health Check API_HANDLER ${SO_APIHAND_ENDPOINT} |
| 24 | Run SO Container Health Check ASDC_HANDLER ${SO_ASDCHAND_ENDPOINT} |
| 25 | Run SO Container Health Check BPMN_INFRA ${SO_BPMN_ENDPOINT} |
| 26 | Run SO Container Health Check CATALOG_DB ${SO_CATDB_ENDPOINT} |
| 27 | Run SO Container Health Check OPENSTACK_INFRA ${SO_OPENSTACK_ENDPOINT} |
| 28 | Run SO Container Health Check REQUEST_DB ${SO_REQDB_ENDPOINT} |
| 29 | Run SO Container Health Check SDNC_INFRA ${SO_SDNC_ENDPOINT} |
| 30 | Run SO Container Health Check VFC_INFRA ${SO_VFC_ENDPOINT} |
| 31 | |
| 32 | |
| 33 | Run SO Container Health Check |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 34 | [Documentation] Runs an MSO global health check |
Brian Freeman | 391680a | 2018-08-11 15:20:58 -0500 | [diff] [blame] | 35 | [Arguments] ${so_endpoint_label} ${so_endpoint} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 36 | ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} |
Brian Freeman | 391680a | 2018-08-11 15:20:58 -0500 | [diff] [blame] | 37 | ${session}= Create Session mso ${so_endpoint} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 38 | ${uuid}= Generate UUID |
Brian Freeman | 391680a | 2018-08-11 15:20:58 -0500 | [diff] [blame] | 39 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 40 | ${resp}= Get Request mso ${MSO_HEALTH_CHECK_PATH} headers=${headers} |
| 41 | Should Be Equal As Strings ${resp.status_code} 200 |
| 42 | |
Brian Freeman | ca5e32e | 2018-07-23 12:47:21 -0500 | [diff] [blame] | 43 | Run MSO Get ModelInvariantId |
| 44 | [Documentation] Runs an MSO Get ModelInvariantID for ClosedLoop Polieis |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 45 | [Arguments] ${service_model_name} ${vf_module_label}=NULL |
Brian Freeman | ca5e32e | 2018-07-23 12:47:21 -0500 | [diff] [blame] | 46 | ${param_dict}= Create Dictionary serviceModelName ${service_model_name} |
| 47 | ${param}= Evaluate urllib.urlencode(${param_dict}) urllib |
| 48 | ${data_path}= Catenate SEPARATOR= /ecomp/mso/catalog/v2/serviceVnfs? ${param} |
| 49 | ${resp}= Run MSO Get Request ${data_path} |
| 50 | Log ${resp.json()} |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 51 | # ${resp.json()['serviceVnfs'][0]['vfModules'][0]['vfModuleLabel'] should be 'base_vpkg' |
| 52 | ${model_invariant_id}= Set Variable NULL |
| 53 | @{ITEMS}= Copy List ${resp.json()['serviceVnfs']} |
| 54 | :FOR ${ELEMENT} IN @{ITEMS} |
| 55 | \ Log ${ELEMENT['vfModules']} |
| 56 | \ ${model_invariant_id} Set Variable If ('${vf_module_label}' in '${ELEMENT['vfModules'][0]['vfModuleLabel']}') ${ELEMENT['modelInfo']['modelInvariantUuid']} NULL |
| 57 | \ Exit For Loop If '${model_invariant_id}' != 'NULL' |
| 58 | [Return] ${model_invariant_id} |
Brian Freeman | ca5e32e | 2018-07-23 12:47:21 -0500 | [diff] [blame] | 59 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 60 | Run MSO Get Request |
| 61 | [Documentation] Runs an MSO get request |
| 62 | [Arguments] ${data_path} ${accept}=application/json |
| 63 | ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 64 | Log Creating session ${MSO_ENDPOINT} |
| 65 | ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 66 | ${uuid}= Generate UUID |
| 67 | ${headers}= Create Dictionary Accept=${accept} Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 68 | ${resp}= Get Request mso ${data_path} headers=${headers} |
| 69 | Log Received response from mso ${resp.text} |
| 70 | [Return] ${resp} |
Jerry Flood | 176d1da | 2017-10-02 10:38:30 -0400 | [diff] [blame] | 71 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 72 | Poll MSO Get Request |
| 73 | [Documentation] Runs an MSO get request until a certain status is received. valid values are COMPLETE |
| 74 | [Arguments] ${data_path} ${status} |
| 75 | ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 76 | Log Creating session ${MSO_ENDPOINT} |
| 77 | ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 78 | ${uuid}= Generate UUID |
| 79 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 80 | #do this until it is done |
| 81 | :FOR ${i} IN RANGE 20 |
| 82 | \ ${resp}= Get Request mso ${data_path} headers=${headers} |
| 83 | \ Should Not Contain ${resp.text} FAILED |
Jerry Flood | 176d1da | 2017-10-02 10:38:30 -0400 | [diff] [blame] | 84 | \ Log ${resp.json()['request']['requestStatus']['requestState']} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 85 | \ ${exit_loop}= Evaluate "${resp.json()['request']['requestStatus']['requestState']}" == "${status}" |
| 86 | \ Exit For Loop If ${exit_loop} |
| 87 | \ Sleep 15s |
| 88 | Log Received response from mso ${resp.text} |
| 89 | [Return] ${resp} |
| 90 | |
Mor Dabastany | 186c358 | 2017-08-07 16:14:19 +0300 | [diff] [blame] | 91 | Run MSO Post request |
| 92 | [Documentation] Runs an MSO post request |
| 93 | [Arguments] ${data_path} ${data} |
| 94 | ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} |
| 95 | Log Creating session ${MSO_ENDPOINT} |
| 96 | ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth} |
| 97 | ${uuid}= Generate UUID |
| 98 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 99 | ${resp}= Post Request mso ${data_path} data=${data} headers=${headers} |
Mor Dabastany | 262d9d4 | 2017-08-14 15:27:36 +0300 | [diff] [blame] | 100 | Log Received response from mso ${resp.text} |
Mor Dabastany | 186c358 | 2017-08-07 16:14:19 +0300 | [diff] [blame] | 101 | [Return] ${resp} |
Tal Karbachinsky | c3bf551 | 2018-01-25 10:27:17 +0200 | [diff] [blame] | 102 | |
| 103 | Run MSO Delete request |
| 104 | [Documentation] Runs an MSO Delete request |
| 105 | [Arguments] ${data_path} ${data} |
Tal Karbachinsky | c3bf551 | 2018-01-25 10:27:17 +0200 | [diff] [blame] | 106 | ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} |
| 107 | Log Creating session ${MSO_ENDPOINT} |
| 108 | ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth} |
| 109 | ${uuid}= Generate UUID |
| 110 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
DR695H | b034c28 | 2018-02-23 18:33:19 -0500 | [diff] [blame] | 111 | ${resp}= Delete Request mso ${data_path} ${data} headers=${headers} |
Tal Karbachinsky | c3bf551 | 2018-01-25 10:27:17 +0200 | [diff] [blame] | 112 | Log Received response from mso ${resp.text} |
| 113 | [Return] ${resp} |