blob: 1e555dbf05edeb0d7e66d86bdb7b393ce76e579c [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation The main interface for interacting with MSO. It handles low level stuff like managing the http request library and MSO required fields
3Library RequestsLibrary
DR695H18872bc2019-06-13 16:16:52 -04004Library ONAPLibrary.Utilities
DR695Hccff30b2017-02-17 18:44:24 -05005Library OperatingSystem
6Library Collections
7Resource global_properties.robot
DR695Hccff30b2017-02-17 18:44:24 -05008*** Variables ***
Brian Freeman391680a2018-08-11 15:20:58 -05009${MSO_HEALTH_CHECK_PATH} /manage/health
Jerry Flood176d1da2017-10-02 10:38:30 -040010${MSO_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_SERVER_PORT}
Brian Freeman68e71dc2018-09-11 08:30:02 -050011${SO_APIHAND_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_APIHAND_IP_ADDR}:${GLOBAL_MSO_APIHAND_SERVER_PORT}
12${SO_ASDCHAND_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_ASDCHAND_IP_ADDR}:${GLOBAL_MSO__ASDCHAND_SERVER_PORT}
13${SO_BPMN_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_BPMN_IP_ADDR}:${GLOBAL_MSO_BPMN_SERVER_PORT}
14${SO_CATDB_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_CATDB_IP_ADDR}:${GLOBAL_MSO__CATDB_SERVER_PORT}
15${SO_OPENSTACK_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_OPENSTACK_IP_ADDR}:${GLOBAL_MSO_OPENSTACK_SERVER_PORT}
16${SO_REQDB_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_REQDB_IP_ADDR}:${GLOBAL_MSO_REQDB_SERVER_PORT}
17${SO_SDNC_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_SDNC_IP_ADDR}:${GLOBAL_MSO_SDNC_SERVER_PORT}
18${SO_VFC_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_VFC_IP_ADDR}:${GLOBAL_MSO_VFC_SERVER_PORT}
MichaelMorris9204b962019-03-15 11:45:47 +000019${SO_VNFM_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_VNFM_IP_ADDR}:${GLOBAL_MSO_VNFM_SERVER_PORT}
DR695Hccff30b2017-02-17 18:44:24 -050020
21*** Keywords ***
Brian Freeman391680a2018-08-11 15:20:58 -050022Run SO Global Health Check
MichaelMorris9204b962019-03-15 11:45:47 +000023 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 Run SO Container Health Check VNFM_INFRA ${SO_VNFM_ENDPOINT}
Brian Freeman391680a2018-08-11 15:20:58 -050032
33
34Run SO Container Health Check
DR695Hccff30b2017-02-17 18:44:24 -050035 [Documentation] Runs an MSO global health check
MichaelMorris9204b962019-03-15 11:45:47 +000036 [Arguments] ${so_endpoint_label} ${so_endpoint}
DR695Hccff30b2017-02-17 18:44:24 -050037 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
Brian Freeman391680a2018-08-11 15:20:58 -050038 ${session}= Create Session mso ${so_endpoint}
DR695H18872bc2019-06-13 16:16:52 -040039 ${uuid}= Generate UUID4
Brian Freeman391680a2018-08-11 15:20:58 -050040 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
DR695Hccff30b2017-02-17 18:44:24 -050041 ${resp}= Get Request mso ${MSO_HEALTH_CHECK_PATH} headers=${headers}
42 Should Be Equal As Strings ${resp.status_code} 200
43
Brian Freemanca5e32e2018-07-23 12:47:21 -050044Run MSO Get ModelInvariantId
Gary Wua94b1d52018-11-06 09:51:53 -080045 [Documentation] Runs an MSO Get ModelInvariantID for ClosedLoop Policies
Brian Freemand65e2aa2018-07-26 11:13:46 -050046 [Arguments] ${service_model_name} ${vf_module_label}=NULL
Brian Freemanca5e32e2018-07-23 12:47:21 -050047 ${param_dict}= Create Dictionary serviceModelName ${service_model_name}
48 ${param}= Evaluate urllib.urlencode(${param_dict}) urllib
Brian Freeman97568792018-08-28 09:57:23 -050049 ${data_path}= Catenate SEPARATOR= /ecomp/mso/catalog/v2/serviceVnfs? ${param}
50 ${resp}= Run MSO Catalog Get Request ${data_path}
Brian Freemanca5e32e2018-07-23 12:47:21 -050051 Log ${resp.json()}
Brian Freemand65e2aa2018-07-26 11:13:46 -050052 # ${resp.json()['serviceVnfs'][0]['vfModules'][0]['vfModuleLabel'] should be 'base_vpkg'
53 ${model_invariant_id}= Set Variable NULL
54 @{ITEMS}= Copy List ${resp.json()['serviceVnfs']}
55 :FOR ${ELEMENT} IN @{ITEMS}
56 \ Log ${ELEMENT['vfModules']}
57 \ ${model_invariant_id} Set Variable If ('${vf_module_label}' in '${ELEMENT['vfModules'][0]['vfModuleLabel']}') ${ELEMENT['modelInfo']['modelInvariantUuid']} NULL
58 \ Exit For Loop If '${model_invariant_id}' != 'NULL'
Gary Wua94b1d52018-11-06 09:51:53 -080059 Should Not Be Equal As Strings ${model_invariant_id} NULL
Brian Freemand65e2aa2018-07-26 11:13:46 -050060 [Return] ${model_invariant_id}
Gary Wua94b1d52018-11-06 09:51:53 -080061
DR695Hccff30b2017-02-17 18:44:24 -050062Run MSO Get Request
63 [Documentation] Runs an MSO get request
64 [Arguments] ${data_path} ${accept}=application/json
65 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
DR695Hbf5a3a32017-06-30 13:09:57 -040066 Log Creating session ${MSO_ENDPOINT}
67 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695H18872bc2019-06-13 16:16:52 -040068 ${uuid}= Generate UUID4
DR695Hccff30b2017-02-17 18:44:24 -050069 ${headers}= Create Dictionary Accept=${accept} Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
70 ${resp}= Get Request mso ${data_path} headers=${headers}
71 Log Received response from mso ${resp.text}
72 [Return] ${resp}
Jerry Flood176d1da2017-10-02 10:38:30 -040073
Brian Freeman97568792018-08-28 09:57:23 -050074Run MSO Catalog Get Request
75 [Documentation] Runs an MSO get request
76 [Arguments] ${data_path} ${accept}=application/json
77 ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD}
78 Log Creating session ${SO_CATDB_ENDPOINT}
79 ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth}
DR695H18872bc2019-06-13 16:16:52 -040080 ${uuid}= Generate UUID4
Brian Freeman97568792018-08-28 09:57:23 -050081 ${headers}= Create Dictionary Accept=${accept} Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
82 ${resp}= Get Request so_catdb ${data_path} headers=${headers}
83 Log Received response from so_catdb ${resp.text}
84 [Return] ${resp}
85
86
DR695Hccff30b2017-02-17 18:44:24 -050087Poll MSO Get Request
88 [Documentation] Runs an MSO get request until a certain status is received. valid values are COMPLETE
89 [Arguments] ${data_path} ${status}
90 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
DR695Hbf5a3a32017-06-30 13:09:57 -040091 Log Creating session ${MSO_ENDPOINT}
92 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695H18872bc2019-06-13 16:16:52 -040093 ${uuid}= Generate UUID4
DR695Hccff30b2017-02-17 18:44:24 -050094 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
95 #do this until it is done
96 :FOR ${i} IN RANGE 20
97 \ ${resp}= Get Request mso ${data_path} headers=${headers}
98 \ Should Not Contain ${resp.text} FAILED
Jerry Flood176d1da2017-10-02 10:38:30 -040099 \ Log ${resp.json()['request']['requestStatus']['requestState']}
DR695Hccff30b2017-02-17 18:44:24 -0500100 \ ${exit_loop}= Evaluate "${resp.json()['request']['requestStatus']['requestState']}" == "${status}"
101 \ Exit For Loop If ${exit_loop}
102 \ Sleep 15s
103 Log Received response from mso ${resp.text}
104 [Return] ${resp}
105
Mor Dabastany186c3582017-08-07 16:14:19 +0300106Run MSO Post request
107 [Documentation] Runs an MSO post request
108 [Arguments] ${data_path} ${data}
109 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
110 Log Creating session ${MSO_ENDPOINT}
111 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695H18872bc2019-06-13 16:16:52 -0400112 ${uuid}= Generate UUID4
Mor Dabastany186c3582017-08-07 16:14:19 +0300113 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
114 ${resp}= Post Request mso ${data_path} data=${data} headers=${headers}
Mor Dabastany262d9d42017-08-14 15:27:36 +0300115 Log Received response from mso ${resp.text}
Mor Dabastany186c3582017-08-07 16:14:19 +0300116 [Return] ${resp}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200117
Brian Freemanadaa2372018-10-24 12:25:22 -0500118Run SO Catalog Post request
119 [Documentation] Runs an SO post request
120 [Arguments] ${data_path} ${data} ${so_port}=
121 ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD}
122 Log Creating session ${SO_CATDB_ENDPOINT}
123 ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth}
DR695H18872bc2019-06-13 16:16:52 -0400124 ${uuid}= Generate UUID4
Brian Freemanadaa2372018-10-24 12:25:22 -0500125 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
126 ${resp}= Post Request so_catdb ${data_path} data=${data} headers=${headers}
127 Log Received response from so_catdb ${resp.text}
128 [Return] ${resp}
129
130Run SO Catalog Put request
131 [Documentation] Runs an SO put request
132 [Arguments] ${data_path} ${data} ${so_port}=
133 ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD}
134 Log Creating session ${SO_CATDB_ENDPOINT}
135 ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth}
DR695H18872bc2019-06-13 16:16:52 -0400136 ${uuid}= Generate UUID4
Brian Freemanadaa2372018-10-24 12:25:22 -0500137 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
138 ${resp}= Put Request so_catdb ${data_path} data=${data} headers=${headers}
139 Log Received response from so_catdb ${resp.text}
140 [Return] ${resp}
141
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200142Run MSO Delete request
143 [Documentation] Runs an MSO Delete request
144 [Arguments] ${data_path} ${data}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200145 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
146 Log Creating session ${MSO_ENDPOINT}
147 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695H18872bc2019-06-13 16:16:52 -0400148 ${uuid}= Generate UUID4
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200149 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
DR695Hb034c282018-02-23 18:33:19 -0500150 ${resp}= Delete Request mso ${data_path} ${data} headers=${headers}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200151 Log Received response from mso ${resp.text}
152 [Return] ${resp}