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 | 68e71dc | 2018-09-11 08:30:02 -0500 | [diff] [blame] | 12 | ${SO_APIHAND_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_APIHAND_IP_ADDR}:${GLOBAL_MSO_APIHAND_SERVER_PORT} |
| 13 | ${SO_ASDCHAND_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_ASDCHAND_IP_ADDR}:${GLOBAL_MSO__ASDCHAND_SERVER_PORT} |
| 14 | ${SO_BPMN_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_BPMN_IP_ADDR}:${GLOBAL_MSO_BPMN_SERVER_PORT} |
| 15 | ${SO_CATDB_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_CATDB_IP_ADDR}:${GLOBAL_MSO__CATDB_SERVER_PORT} |
| 16 | ${SO_OPENSTACK_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_OPENSTACK_IP_ADDR}:${GLOBAL_MSO_OPENSTACK_SERVER_PORT} |
| 17 | ${SO_REQDB_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_REQDB_IP_ADDR}:${GLOBAL_MSO_REQDB_SERVER_PORT} |
| 18 | ${SO_SDNC_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_SDNC_IP_ADDR}:${GLOBAL_MSO_SDNC_SERVER_PORT} |
| 19 | ${SO_VFC_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_VFC_IP_ADDR}:${GLOBAL_MSO_VFC_SERVER_PORT} |
MichaelMorris | 9204b96 | 2019-03-15 11:45:47 +0000 | [diff] [blame] | 20 | ${SO_VNFM_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_VNFM_IP_ADDR}:${GLOBAL_MSO_VNFM_SERVER_PORT} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 21 | |
| 22 | *** Keywords *** |
Brian Freeman | 391680a | 2018-08-11 15:20:58 -0500 | [diff] [blame] | 23 | Run SO Global Health Check |
MichaelMorris | 9204b96 | 2019-03-15 11:45:47 +0000 | [diff] [blame] | 24 | Run SO Container Health Check API_HANDLER ${SO_APIHAND_ENDPOINT} |
| 25 | Run SO Container Health Check ASDC_HANDLER ${SO_ASDCHAND_ENDPOINT} |
| 26 | Run SO Container Health Check BPMN_INFRA ${SO_BPMN_ENDPOINT} |
| 27 | Run SO Container Health Check CATALOG_DB ${SO_CATDB_ENDPOINT} |
| 28 | Run SO Container Health Check OPENSTACK_INFRA ${SO_OPENSTACK_ENDPOINT} |
| 29 | Run SO Container Health Check REQUEST_DB ${SO_REQDB_ENDPOINT} |
| 30 | Run SO Container Health Check SDNC_INFRA ${SO_SDNC_ENDPOINT} |
| 31 | Run SO Container Health Check VFC_INFRA ${SO_VFC_ENDPOINT} |
| 32 | Run SO Container Health Check VNFM_INFRA ${SO_VNFM_ENDPOINT} |
Brian Freeman | 391680a | 2018-08-11 15:20:58 -0500 | [diff] [blame] | 33 | |
| 34 | |
| 35 | Run SO Container Health Check |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 36 | [Documentation] Runs an MSO global health check |
MichaelMorris | 9204b96 | 2019-03-15 11:45:47 +0000 | [diff] [blame] | 37 | [Arguments] ${so_endpoint_label} ${so_endpoint} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 38 | ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} |
Brian Freeman | 391680a | 2018-08-11 15:20:58 -0500 | [diff] [blame] | 39 | ${session}= Create Session mso ${so_endpoint} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 40 | ${uuid}= Generate UUID |
Brian Freeman | 391680a | 2018-08-11 15:20:58 -0500 | [diff] [blame] | 41 | ${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] | 42 | ${resp}= Get Request mso ${MSO_HEALTH_CHECK_PATH} headers=${headers} |
| 43 | Should Be Equal As Strings ${resp.status_code} 200 |
| 44 | |
Brian Freeman | ca5e32e | 2018-07-23 12:47:21 -0500 | [diff] [blame] | 45 | Run MSO Get ModelInvariantId |
Gary Wu | a94b1d5 | 2018-11-06 09:51:53 -0800 | [diff] [blame] | 46 | [Documentation] Runs an MSO Get ModelInvariantID for ClosedLoop Policies |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 47 | [Arguments] ${service_model_name} ${vf_module_label}=NULL |
Brian Freeman | ca5e32e | 2018-07-23 12:47:21 -0500 | [diff] [blame] | 48 | ${param_dict}= Create Dictionary serviceModelName ${service_model_name} |
| 49 | ${param}= Evaluate urllib.urlencode(${param_dict}) urllib |
Brian Freeman | 9756879 | 2018-08-28 09:57:23 -0500 | [diff] [blame] | 50 | ${data_path}= Catenate SEPARATOR= /ecomp/mso/catalog/v2/serviceVnfs? ${param} |
| 51 | ${resp}= Run MSO Catalog Get Request ${data_path} |
Brian Freeman | ca5e32e | 2018-07-23 12:47:21 -0500 | [diff] [blame] | 52 | Log ${resp.json()} |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 53 | # ${resp.json()['serviceVnfs'][0]['vfModules'][0]['vfModuleLabel'] should be 'base_vpkg' |
| 54 | ${model_invariant_id}= Set Variable NULL |
| 55 | @{ITEMS}= Copy List ${resp.json()['serviceVnfs']} |
| 56 | :FOR ${ELEMENT} IN @{ITEMS} |
| 57 | \ Log ${ELEMENT['vfModules']} |
| 58 | \ ${model_invariant_id} Set Variable If ('${vf_module_label}' in '${ELEMENT['vfModules'][0]['vfModuleLabel']}') ${ELEMENT['modelInfo']['modelInvariantUuid']} NULL |
| 59 | \ Exit For Loop If '${model_invariant_id}' != 'NULL' |
Gary Wu | a94b1d5 | 2018-11-06 09:51:53 -0800 | [diff] [blame] | 60 | Should Not Be Equal As Strings ${model_invariant_id} NULL |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 61 | [Return] ${model_invariant_id} |
Gary Wu | a94b1d5 | 2018-11-06 09:51:53 -0800 | [diff] [blame] | 62 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 63 | Run MSO Get Request |
| 64 | [Documentation] Runs an MSO get request |
| 65 | [Arguments] ${data_path} ${accept}=application/json |
| 66 | ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 67 | Log Creating session ${MSO_ENDPOINT} |
| 68 | ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 69 | ${uuid}= Generate UUID |
| 70 | ${headers}= Create Dictionary Accept=${accept} Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 71 | ${resp}= Get Request mso ${data_path} headers=${headers} |
| 72 | Log Received response from mso ${resp.text} |
| 73 | [Return] ${resp} |
Jerry Flood | 176d1da | 2017-10-02 10:38:30 -0400 | [diff] [blame] | 74 | |
Brian Freeman | 9756879 | 2018-08-28 09:57:23 -0500 | [diff] [blame] | 75 | Run MSO Catalog Get Request |
| 76 | [Documentation] Runs an MSO get request |
| 77 | [Arguments] ${data_path} ${accept}=application/json |
| 78 | ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD} |
| 79 | Log Creating session ${SO_CATDB_ENDPOINT} |
| 80 | ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth} |
| 81 | ${uuid}= Generate UUID |
| 82 | ${headers}= Create Dictionary Accept=${accept} Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 83 | ${resp}= Get Request so_catdb ${data_path} headers=${headers} |
| 84 | Log Received response from so_catdb ${resp.text} |
| 85 | [Return] ${resp} |
| 86 | |
| 87 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 88 | Poll MSO Get Request |
| 89 | [Documentation] Runs an MSO get request until a certain status is received. valid values are COMPLETE |
| 90 | [Arguments] ${data_path} ${status} |
| 91 | ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 92 | Log Creating session ${MSO_ENDPOINT} |
| 93 | ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 94 | ${uuid}= Generate UUID |
| 95 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 96 | #do this until it is done |
| 97 | :FOR ${i} IN RANGE 20 |
| 98 | \ ${resp}= Get Request mso ${data_path} headers=${headers} |
| 99 | \ Should Not Contain ${resp.text} FAILED |
Jerry Flood | 176d1da | 2017-10-02 10:38:30 -0400 | [diff] [blame] | 100 | \ Log ${resp.json()['request']['requestStatus']['requestState']} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 101 | \ ${exit_loop}= Evaluate "${resp.json()['request']['requestStatus']['requestState']}" == "${status}" |
| 102 | \ Exit For Loop If ${exit_loop} |
| 103 | \ Sleep 15s |
| 104 | Log Received response from mso ${resp.text} |
| 105 | [Return] ${resp} |
| 106 | |
Mor Dabastany | 186c358 | 2017-08-07 16:14:19 +0300 | [diff] [blame] | 107 | Run MSO Post request |
| 108 | [Documentation] Runs an MSO post request |
| 109 | [Arguments] ${data_path} ${data} |
| 110 | ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} |
| 111 | Log Creating session ${MSO_ENDPOINT} |
| 112 | ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth} |
| 113 | ${uuid}= Generate UUID |
| 114 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 115 | ${resp}= Post Request mso ${data_path} data=${data} headers=${headers} |
Mor Dabastany | 262d9d4 | 2017-08-14 15:27:36 +0300 | [diff] [blame] | 116 | Log Received response from mso ${resp.text} |
Mor Dabastany | 186c358 | 2017-08-07 16:14:19 +0300 | [diff] [blame] | 117 | [Return] ${resp} |
Tal Karbachinsky | c3bf551 | 2018-01-25 10:27:17 +0200 | [diff] [blame] | 118 | |
Brian Freeman | adaa237 | 2018-10-24 12:25:22 -0500 | [diff] [blame] | 119 | Run SO Catalog Post request |
| 120 | [Documentation] Runs an SO post request |
| 121 | [Arguments] ${data_path} ${data} ${so_port}= |
| 122 | ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD} |
| 123 | Log Creating session ${SO_CATDB_ENDPOINT} |
| 124 | ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth} |
| 125 | ${uuid}= Generate UUID |
| 126 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 127 | ${resp}= Post Request so_catdb ${data_path} data=${data} headers=${headers} |
| 128 | Log Received response from so_catdb ${resp.text} |
| 129 | [Return] ${resp} |
| 130 | |
| 131 | Run SO Catalog Put request |
| 132 | [Documentation] Runs an SO put request |
| 133 | [Arguments] ${data_path} ${data} ${so_port}= |
| 134 | ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD} |
| 135 | Log Creating session ${SO_CATDB_ENDPOINT} |
| 136 | ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth} |
| 137 | ${uuid}= Generate UUID |
| 138 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 139 | ${resp}= Put Request so_catdb ${data_path} data=${data} headers=${headers} |
| 140 | Log Received response from so_catdb ${resp.text} |
| 141 | [Return] ${resp} |
| 142 | |
Tal Karbachinsky | c3bf551 | 2018-01-25 10:27:17 +0200 | [diff] [blame] | 143 | Run MSO Delete request |
| 144 | [Documentation] Runs an MSO Delete request |
| 145 | [Arguments] ${data_path} ${data} |
Tal Karbachinsky | c3bf551 | 2018-01-25 10:27:17 +0200 | [diff] [blame] | 146 | ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD} |
| 147 | Log Creating session ${MSO_ENDPOINT} |
| 148 | ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth} |
| 149 | ${uuid}= Generate UUID |
| 150 | ${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] | 151 | ${resp}= Delete Request mso ${data_path} ${data} headers=${headers} |
Tal Karbachinsky | c3bf551 | 2018-01-25 10:27:17 +0200 | [diff] [blame] | 152 | Log Received response from mso ${resp.text} |
| 153 | [Return] ${resp} |