blob: 70faf3bffbb7142f2dcb4217864aa527b81e67da [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 Freeman391680a2018-08-11 15:20:58 -050012${SO_APIHAND_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_APIHAND_SERVER_PORT}
13${SO_ASDCHAND_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO__ASDCHAND_SERVER_PORT}
14${SO_BPMN_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_BPMN_SERVER_PORT}
15${SO_CATDB_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO__CATDB_SERVER_PORT}
16${SO_OPENSTACK_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_OPENSTACK_SERVER_PORT}
17${SO_REQDB_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_REQDB_SERVER_PORT}
18${SO_SDNC_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_MSO_SDNC_SERVER_PORT}
19${SO_VFC_ENDPOINT} ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_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
48 ${data_path}= Catenate SEPARATOR= /ecomp/mso/catalog/v2/serviceVnfs? ${param}
49 ${resp}= Run MSO Get Request ${data_path}
50 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
DR695Hccff30b2017-02-17 18:44:24 -050072Poll MSO Get Request
73 [Documentation] Runs an MSO get request until a certain status is received. valid values are COMPLETE
74 [Arguments] ${data_path} ${status}
75 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
DR695Hbf5a3a32017-06-30 13:09:57 -040076 Log Creating session ${MSO_ENDPOINT}
77 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -050078 ${uuid}= Generate UUID
79 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
80 #do this until it is done
81 :FOR ${i} IN RANGE 20
82 \ ${resp}= Get Request mso ${data_path} headers=${headers}
83 \ Should Not Contain ${resp.text} FAILED
Jerry Flood176d1da2017-10-02 10:38:30 -040084 \ Log ${resp.json()['request']['requestStatus']['requestState']}
DR695Hccff30b2017-02-17 18:44:24 -050085 \ ${exit_loop}= Evaluate "${resp.json()['request']['requestStatus']['requestState']}" == "${status}"
86 \ Exit For Loop If ${exit_loop}
87 \ Sleep 15s
88 Log Received response from mso ${resp.text}
89 [Return] ${resp}
90
Mor Dabastany186c3582017-08-07 16:14:19 +030091Run MSO Post request
92 [Documentation] Runs an MSO post request
93 [Arguments] ${data_path} ${data}
94 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
95 Log Creating session ${MSO_ENDPOINT}
96 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
97 ${uuid}= Generate UUID
98 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
99 ${resp}= Post Request mso ${data_path} data=${data} headers=${headers}
Mor Dabastany262d9d42017-08-14 15:27:36 +0300100 Log Received response from mso ${resp.text}
Mor Dabastany186c3582017-08-07 16:14:19 +0300101 [Return] ${resp}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200102
103Run MSO Delete request
104 [Documentation] Runs an MSO Delete request
105 [Arguments] ${data_path} ${data}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200106 ${auth}= Create List ${GLOBAL_MSO_USERNAME} ${GLOBAL_MSO_PASSWORD}
107 Log Creating session ${MSO_ENDPOINT}
108 ${session}= Create Session mso ${MSO_ENDPOINT} auth=${auth}
109 ${uuid}= Generate UUID
110 ${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 -0500111 ${resp}= Delete Request mso ${data_path} ${data} headers=${headers}
Tal Karbachinskyc3bf5512018-01-25 10:27:17 +0200112 Log Received response from mso ${resp.text}
113 [Return] ${resp}