blob: bc0aa3c0e7c7c6cdfbb313f2ce38cabf2d6c7d75 [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
Jerry Flood176d1da2017-10-02 10:38:30 -04004Library UUID
DR695Hccff30b2017-02-17 18:44:24 -05005Library OperatingSystem
6Library Collections
7Resource global_properties.robot
8Resource ../resources/json_templater.robot
9*** Variables ***
Brian Freeman391680a2018-08-11 15:20:58 -050010${MSO_HEALTH_CHECK_PATH} /manage/health
Jerry Flood176d1da2017-10-02 10:38:30 -040011${MSO_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_SERVER_PORT}
Brian Freeman68e71dc2018-09-11 08:30:02 -050012${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}
DR695Hccff30b2017-02-17 18:44:24 -050020
21*** Keywords ***
Brian Freeman391680a2018-08-11 15:20:58 -050022Run 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
33Run SO Container Health Check
DR695Hccff30b2017-02-17 18:44:24 -050034 [Documentation] Runs an MSO global health check
Brian Freeman391680a2018-08-11 15:20:58 -050035 [Arguments] ${so_endpoint_label} ${so_endpoint}
DR695Hccff30b2017-02-17 18:44:24 -050036 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
Brian Freeman391680a2018-08-11 15:20:58 -050037 ${session}= Create Session mso ${so_endpoint}
DR695Hccff30b2017-02-17 18:44:24 -050038 ${uuid}= Generate UUID
Brian Freeman391680a2018-08-11 15:20:58 -050039 ${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 -050040 ${resp}= Get Request mso ${MSO_HEALTH_CHECK_PATH} headers=${headers}
41 Should Be Equal As Strings ${resp.status_code} 200
42
Brian Freemanca5e32e2018-07-23 12:47:21 -050043Run MSO Get ModelInvariantId
Gary Wua94b1d52018-11-06 09:51:53 -080044 [Documentation] Runs an MSO Get ModelInvariantID for ClosedLoop Policies
Brian Freemand65e2aa2018-07-26 11:13:46 -050045 [Arguments] ${service_model_name} ${vf_module_label}=NULL
Brian Freemanca5e32e2018-07-23 12:47:21 -050046 ${param_dict}= Create Dictionary serviceModelName ${service_model_name}
47 ${param}= Evaluate urllib.urlencode(${param_dict}) urllib
Brian Freeman97568792018-08-28 09:57:23 -050048 ${data_path}= Catenate SEPARATOR= /ecomp/mso/catalog/v2/serviceVnfs? ${param}
49 ${resp}= Run MSO Catalog Get Request ${data_path}
Brian Freemanca5e32e2018-07-23 12:47:21 -050050 Log ${resp.json()}
Brian Freemand65e2aa2018-07-26 11:13:46 -050051 # ${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'
Gary Wua94b1d52018-11-06 09:51:53 -080058 Should Not Be Equal As Strings ${model_invariant_id} NULL
Brian Freemand65e2aa2018-07-26 11:13:46 -050059 [Return] ${model_invariant_id}
Gary Wua94b1d52018-11-06 09:51:53 -080060
DR695Hccff30b2017-02-17 18:44:24 -050061Run MSO Get Request
62 [Documentation] Runs an MSO get request
63 [Arguments] ${data_path} ${accept}=application/json
64 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
DR695Hbf5a3a32017-06-30 13:09:57 -040065 Log Creating session ${MSO_ENDPOINT}
66 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -050067 ${uuid}= Generate UUID
68 ${headers}= Create Dictionary Accept=${accept} Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
69 ${resp}= Get Request mso ${data_path} headers=${headers}
70 Log Received response from mso ${resp.text}
71 [Return] ${resp}
Jerry Flood176d1da2017-10-02 10:38:30 -040072
Brian Freeman97568792018-08-28 09:57:23 -050073Run MSO Catalog Get Request
74 [Documentation] Runs an MSO get request
75 [Arguments] ${data_path} ${accept}=application/json
76 ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD}
77 Log Creating session ${SO_CATDB_ENDPOINT}
78 ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth}
79 ${uuid}= Generate UUID
80 ${headers}= Create Dictionary Accept=${accept} Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
81 ${resp}= Get Request so_catdb ${data_path} headers=${headers}
82 Log Received response from so_catdb ${resp.text}
83 [Return] ${resp}
84
85
DR695Hccff30b2017-02-17 18:44:24 -050086Poll MSO Get Request
87 [Documentation] Runs an MSO get request until a certain status is received. valid values are COMPLETE
88 [Arguments] ${data_path} ${status}
89 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
DR695Hbf5a3a32017-06-30 13:09:57 -040090 Log Creating session ${MSO_ENDPOINT}
91 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -050092 ${uuid}= Generate UUID
93 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
94 #do this until it is done
95 :FOR ${i} IN RANGE 20
96 \ ${resp}= Get Request mso ${data_path} headers=${headers}
97 \ Should Not Contain ${resp.text} FAILED
Jerry Flood176d1da2017-10-02 10:38:30 -040098 \ Log ${resp.json()['request']['requestStatus']['requestState']}
DR695Hccff30b2017-02-17 18:44:24 -050099 \ ${exit_loop}= Evaluate "${resp.json()['request']['requestStatus']['requestState']}" == "${status}"
100 \ Exit For Loop If ${exit_loop}
101 \ Sleep 15s
102 Log Received response from mso ${resp.text}
103 [Return] ${resp}
104
Mor Dabastany186c3582017-08-07 16:14:19 +0300105Run MSO Post request
106 [Documentation] Runs an MSO post request
107 [Arguments] ${data_path} ${data}
108 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
109 Log Creating session ${MSO_ENDPOINT}
110 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
111 ${uuid}= Generate UUID
112 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
113 ${resp}= Post Request mso ${data_path} data=${data} headers=${headers}
Mor Dabastany262d9d42017-08-14 15:27:36 +0300114 Log Received response from mso ${resp.text}
Mor Dabastany186c3582017-08-07 16:14:19 +0300115 [Return] ${resp}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200116
Brian Freemanadaa2372018-10-24 12:25:22 -0500117Run SO Catalog Post request
118 [Documentation] Runs an SO post request
119 [Arguments] ${data_path} ${data} ${so_port}=
120 ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD}
121 Log Creating session ${SO_CATDB_ENDPOINT}
122 ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth}
123 ${uuid}= Generate UUID
124 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
125 ${resp}= Post Request so_catdb ${data_path} data=${data} headers=${headers}
126 Log Received response from so_catdb ${resp.text}
127 [Return] ${resp}
128
129Run SO Catalog Put request
130 [Documentation] Runs an SO put request
131 [Arguments] ${data_path} ${data} ${so_port}=
132 ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD}
133 Log Creating session ${SO_CATDB_ENDPOINT}
134 ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth}
135 ${uuid}= Generate UUID
136 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
137 ${resp}= Put Request so_catdb ${data_path} data=${data} headers=${headers}
138 Log Received response from so_catdb ${resp.text}
139 [Return] ${resp}
140
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200141Run MSO Delete request
142 [Documentation] Runs an MSO Delete request
143 [Arguments] ${data_path} ${data}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200144 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
145 Log Creating session ${MSO_ENDPOINT}
146 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
147 ${uuid}= Generate UUID
148 ${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 -0500149 ${resp}= Delete Request mso ${data_path} ${data} headers=${headers}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200150 Log Received response from mso ${resp.text}
151 [Return] ${resp}