blob: 0378caffc7c2989385f8792f7b85f6978f357b02 [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
44 [Documentation] Runs an MSO Get ModelInvariantID for ClosedLoop Polieis
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'
58 [Return] ${model_invariant_id}
Brian Freemanca5e32e2018-07-23 12:47:21 -050059
DR695Hccff30b2017-02-17 18:44:24 -050060Run 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}
DR695Hbf5a3a32017-06-30 13:09:57 -040064 Log Creating session ${MSO_ENDPOINT}
65 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -050066 ${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 Flood176d1da2017-10-02 10:38:30 -040071
Brian Freeman97568792018-08-28 09:57:23 -050072Run MSO Catalog Get Request
73 [Documentation] Runs an MSO get request
74 [Arguments] ${data_path} ${accept}=application/json
75 ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD}
76 Log Creating session ${SO_CATDB_ENDPOINT}
77 ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth}
78 ${uuid}= Generate UUID
79 ${headers}= Create Dictionary Accept=${accept} Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
80 ${resp}= Get Request so_catdb ${data_path} headers=${headers}
81 Log Received response from so_catdb ${resp.text}
82 [Return] ${resp}
83
84
DR695Hccff30b2017-02-17 18:44:24 -050085Poll MSO Get Request
86 [Documentation] Runs an MSO get request until a certain status is received. valid values are COMPLETE
87 [Arguments] ${data_path} ${status}
88 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
DR695Hbf5a3a32017-06-30 13:09:57 -040089 Log Creating session ${MSO_ENDPOINT}
90 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -050091 ${uuid}= Generate UUID
92 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
93 #do this until it is done
94 :FOR ${i} IN RANGE 20
95 \ ${resp}= Get Request mso ${data_path} headers=${headers}
96 \ Should Not Contain ${resp.text} FAILED
Jerry Flood176d1da2017-10-02 10:38:30 -040097 \ Log ${resp.json()['request']['requestStatus']['requestState']}
DR695Hccff30b2017-02-17 18:44:24 -050098 \ ${exit_loop}= Evaluate "${resp.json()['request']['requestStatus']['requestState']}" == "${status}"
99 \ Exit For Loop If ${exit_loop}
100 \ Sleep 15s
101 Log Received response from mso ${resp.text}
102 [Return] ${resp}
103
Mor Dabastany186c3582017-08-07 16:14:19 +0300104Run MSO Post request
105 [Documentation] Runs an MSO post request
106 [Arguments] ${data_path} ${data}
107 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
108 Log Creating session ${MSO_ENDPOINT}
109 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
110 ${uuid}= Generate UUID
111 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
112 ${resp}= Post Request mso ${data_path} data=${data} headers=${headers}
Mor Dabastany262d9d42017-08-14 15:27:36 +0300113 Log Received response from mso ${resp.text}
Mor Dabastany186c3582017-08-07 16:14:19 +0300114 [Return] ${resp}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200115
Brian Freemanadaa2372018-10-24 12:25:22 -0500116Run SO Catalog Post request
117 [Documentation] Runs an SO post request
118 [Arguments] ${data_path} ${data} ${so_port}=
119 ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD}
120 Log Creating session ${SO_CATDB_ENDPOINT}
121 ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth}
122 ${uuid}= Generate UUID
123 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
124 ${resp}= Post Request so_catdb ${data_path} data=${data} headers=${headers}
125 Log Received response from so_catdb ${resp.text}
126 [Return] ${resp}
127
128Run SO Catalog Put request
129 [Documentation] Runs an SO put request
130 [Arguments] ${data_path} ${data} ${so_port}=
131 ${auth}= Create List ${GLOBAL_MSO_CATDB_USERNAME} ${GLOBAL_MSO_PASSWORD}
132 Log Creating session ${SO_CATDB_ENDPOINT}
133 ${session}= Create Session so_catdb ${SO_CATDB_ENDPOINT} auth=${auth}
134 ${uuid}= Generate UUID
135 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
136 ${resp}= Put Request so_catdb ${data_path} data=${data} headers=${headers}
137 Log Received response from so_catdb ${resp.text}
138 [Return] ${resp}
139
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200140Run MSO Delete request
141 [Documentation] Runs an MSO Delete request
142 [Arguments] ${data_path} ${data}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200143 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
144 Log Creating session ${MSO_ENDPOINT}
145 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
146 ${uuid}= Generate UUID
147 ${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 -0500148 ${resp}= Delete Request mso ${data_path} ${data} headers=${headers}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200149 Log Received response from mso ${resp.text}
150 [Return] ${resp}