blob: 0bb4f49aab3f4c85ee6a38605f1420aa48bc1a76 [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}
MichaelMorris9204b962019-03-15 11:45:47 +000020${SO_VNFM_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_VNFM_IP_ADDR}:${GLOBAL_MSO_VNFM_SERVER_PORT}
DR695Hccff30b2017-02-17 18:44:24 -050021
22*** Keywords ***
Brian Freeman391680a2018-08-11 15:20:58 -050023Run SO Global Health Check
MichaelMorris9204b962019-03-15 11:45:47 +000024 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 Freeman391680a2018-08-11 15:20:58 -050033
34
35Run SO Container Health Check
DR695Hccff30b2017-02-17 18:44:24 -050036 [Documentation] Runs an MSO global health check
MichaelMorris9204b962019-03-15 11:45:47 +000037 [Arguments] ${so_endpoint_label} ${so_endpoint}
DR695Hccff30b2017-02-17 18:44:24 -050038 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
Brian Freeman391680a2018-08-11 15:20:58 -050039 ${session}= Create Session mso ${so_endpoint}
DR695Hccff30b2017-02-17 18:44:24 -050040 ${uuid}= Generate UUID
Brian Freeman391680a2018-08-11 15:20:58 -050041 ${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 -050042 ${resp}= Get Request mso ${MSO_HEALTH_CHECK_PATH} headers=${headers}
43 Should Be Equal As Strings ${resp.status_code} 200
44
Brian Freemanca5e32e2018-07-23 12:47:21 -050045Run MSO Get ModelInvariantId
Gary Wua94b1d52018-11-06 09:51:53 -080046 [Documentation] Runs an MSO Get ModelInvariantID for ClosedLoop Policies
Brian Freemand65e2aa2018-07-26 11:13:46 -050047 [Arguments] ${service_model_name} ${vf_module_label}=NULL
Brian Freemanca5e32e2018-07-23 12:47:21 -050048 ${param_dict}= Create Dictionary serviceModelName ${service_model_name}
49 ${param}= Evaluate urllib.urlencode(${param_dict}) urllib
Brian Freeman97568792018-08-28 09:57:23 -050050 ${data_path}= Catenate SEPARATOR= /ecomp/mso/catalog/v2/serviceVnfs? ${param}
51 ${resp}= Run MSO Catalog Get Request ${data_path}
Brian Freemanca5e32e2018-07-23 12:47:21 -050052 Log ${resp.json()}
Brian Freemand65e2aa2018-07-26 11:13:46 -050053 # ${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 Wua94b1d52018-11-06 09:51:53 -080060 Should Not Be Equal As Strings ${model_invariant_id} NULL
Brian Freemand65e2aa2018-07-26 11:13:46 -050061 [Return] ${model_invariant_id}
Gary Wua94b1d52018-11-06 09:51:53 -080062
DR695Hccff30b2017-02-17 18:44:24 -050063Run 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}
DR695Hbf5a3a32017-06-30 13:09:57 -040067 Log Creating session ${MSO_ENDPOINT}
68 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -050069 ${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 Flood176d1da2017-10-02 10:38:30 -040074
Brian Freeman97568792018-08-28 09:57:23 -050075Run 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
DR695Hccff30b2017-02-17 18:44:24 -050088Poll 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}
DR695Hbf5a3a32017-06-30 13:09:57 -040092 Log Creating session ${MSO_ENDPOINT}
93 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -050094 ${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 Flood176d1da2017-10-02 10:38:30 -0400100 \ Log ${resp.json()['request']['requestStatus']['requestState']}
DR695Hccff30b2017-02-17 18:44:24 -0500101 \ ${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 Dabastany186c3582017-08-07 16:14:19 +0300107Run 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 Dabastany262d9d42017-08-14 15:27:36 +0300116 Log Received response from mso ${resp.text}
Mor Dabastany186c3582017-08-07 16:14:19 +0300117 [Return] ${resp}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200118
Brian Freemanadaa2372018-10-24 12:25:22 -0500119Run 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
131Run 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 Karbachinskyc3bf5512018-01-25 10:27:17 +0200143Run MSO Delete request
144 [Documentation] Runs an MSO Delete request
145 [Arguments] ${data_path} ${data}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200146 ${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}
DR695Hb034c282018-02-23 18:33:19 -0500151 ${resp}= Delete Request mso ${data_path} ${data} headers=${headers}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200152 Log Received response from mso ${resp.text}
153 [Return] ${resp}