kaihlavi | d1a1fb7 | 2019-06-13 16:11:48 +0300 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library json |
kaihlavi | d1a1fb7 | 2019-06-13 16:11:48 +0300 | [diff] [blame] | 3 | Library ONAPLibrary.Utilities |
kaihlavi | 22bc923 | 2019-07-31 19:54:49 +0300 | [diff] [blame] | 4 | Library ONAPLibrary.Templating WITH NAME Templating |
kaihlavi | d1a1fb7 | 2019-06-13 16:11:48 +0300 | [diff] [blame] | 5 | Resource common.robot |
| 6 | |
| 7 | *** Variables *** |
| 8 | ${DCAE_PATH} /dcae |
| 9 | ${DCAE_CREATE_BLUEPRINT_PATH} /SERVICE/createBluePrint |
kaihlavi | 22bc923 | 2019-07-31 19:54:49 +0300 | [diff] [blame] | 10 | ${DCAE_VFCMT_TEMPLATE} create_vfcmt.jinja |
| 11 | ${DCAE_COMPOSITION_TEMPLATE} dcae_composition.jinja |
| 12 | ${DCAE_MONITORING_CONFIGURATION_TEMPLATE} dcae_monitoring_configuration.jinja |
kaihlavi | d1a1fb7 | 2019-06-13 16:11:48 +0300 | [diff] [blame] | 13 | ${DCAE_BE_ENDPOINT} http://localhost:8082 |
| 14 | |
| 15 | *** Keywords *** |
| 16 | |
| 17 | Add VFCMT To DCAE-DS |
| 18 | [Documentation] Create VFCMT with the given name and return its uuid |
| 19 | [Arguments] ${vfcmt_name} |
| 20 | ${map}= Create Dictionary vfcmtName=${vfcmt_name} description=VFCMT created by robot |
kaihlavi | 22bc923 | 2019-07-31 19:54:49 +0300 | [diff] [blame] | 21 | Create Environment create_vfcmt ${ASSETS_DIR} |
| 22 | ${data}= Apply Template create_vfcmt ${DCAE_VFCMT_TEMPLATE} ${map} |
kaihlavi | d1a1fb7 | 2019-06-13 16:11:48 +0300 | [diff] [blame] | 23 | ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/createVFCMT ${data} ${ASDC_DESIGNER_USER_ID} |
| 24 | Should Be Equal As Strings ${resp.status_code} 200 |
| 25 | [Return] ${resp.json()['uuid']} |
| 26 | |
| 27 | Run DCAE-DS Post Request |
| 28 | [Documentation] Runs a DCAE-DS post request |
| 29 | [Arguments] ${data_path} ${data} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_DCAE_BE_ENDPOINT}=${DCAE_BE_ENDPOINT} |
| 30 | Log Creating session ${MY_DCAE_BE_ENDPOINT} |
| 31 | ${session}= Create Session sdc_dcae_ds ${MY_DCAE_BE_ENDPOINT} |
| 32 | ${uuid}= Generate UUID4 |
| 33 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 34 | ${resp}= Post Request sdc_dcae_ds ${data_path} data=${data} headers=${headers} |
| 35 | Log Received response from DCAE-BE: ${resp.text} |
| 36 | [Return] ${resp} |
| 37 | |
| 38 | Run DCAE-DS Put Request |
| 39 | [Documentation] Runs a DCAE-DS put request |
| 40 | [Arguments] ${data_path} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_DCAE_BE_ENDPOINT}=${DCAE_BE_ENDPOINT} |
| 41 | Log Creating session ${MY_DCAE_BE_ENDPOINT} |
| 42 | ${session}= Create Session sdc_dcae_ds ${MY_DCAE_BE_ENDPOINT} |
| 43 | ${uuid}= Generate UUID4 |
| 44 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 45 | ${resp}= Put Request sdc_dcae_ds ${data_path} headers=${headers} |
| 46 | Log Received response from DCAE-BE: ${resp.text} |
| 47 | [Return] ${resp} |
| 48 | |
| 49 | Save Composition |
| 50 | [Arguments] ${vfcmt_uuid} ${vf_uuid} |
| 51 | ${map}= Create Dictionary cid=${vfcmt_uuid} vf_id=${vf_uuid} |
kaihlavi | 22bc923 | 2019-07-31 19:54:49 +0300 | [diff] [blame] | 52 | Create Environment dcae_composition ${ASSETS_DIR} |
| 53 | ${data}= Apply Template dcae_composition ${DCAE_COMPOSITION_TEMPLATE} ${map} |
kaihlavi | d1a1fb7 | 2019-06-13 16:11:48 +0300 | [diff] [blame] | 54 | ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/saveComposition/${vfcmt_uuid} ${data} ${ASDC_DESIGNER_USER_ID} |
| 55 | Should Be Equal As Strings ${resp.status_code} 200 |
| 56 | |
| 57 | Certify VFCMT |
| 58 | [Arguments] ${vfcmt_uuid} |
| 59 | ${resp}= Run DCAE-DS Put Request ${DCAE_PATH}/certify/vfcmt/${vfcmt_uuid} |
| 60 | Should Be Equal As Strings ${resp.status_code} 200 |
| 61 | [Return] ${resp.json()['uuid']} |
| 62 | |
| 63 | Add Monitoring Configuration To DCAE-DS |
| 64 | [Arguments] ${vfcmt_uuid} ${cs_uuid} ${vfi_name} ${mc_name} |
| 65 | ${map}= Create Dictionary template_uuid=${vfcmt_uuid} service_uuid=${cs_uuid} vfi_name=${vfi_name} name=${mc_name} |
kaihlavi | 22bc923 | 2019-07-31 19:54:49 +0300 | [diff] [blame] | 66 | Create Environment dcae_monitoring_configuration ${ASSETS_DIR} |
| 67 | ${data}= Apply Template dcae_monitoring_configuration ${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${map} |
kaihlavi | d1a1fb7 | 2019-06-13 16:11:48 +0300 | [diff] [blame] | 68 | ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/importMC ${data} ${ASDC_DESIGNER_USER_ID} |
| 69 | Should Be Equal As Strings ${resp.status_code} 200 |
| 70 | [Return] ${resp.json()['vfcmt']['uuid']} |
| 71 | |
| 72 | Submit Monitoring Configuration To DCAE-DS |
| 73 | [Arguments] ${mc_uuid} ${cs_uuid} ${vfi_name} |
kaihlavi | dc39684 | 2019-06-26 15:09:37 +0300 | [diff] [blame] | 74 | ${url_vfi_name} url_encode_string ${vfi_name} |
kaihlavi | d1a1fb7 | 2019-06-13 16:11:48 +0300 | [diff] [blame] | 75 | ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}${DCAE_CREATE_BLUEPRINT_PATH}/${mc_uuid}/${cs_uuid}/${url_vfi_name} ${None} ${ASDC_DESIGNER_USER_ID} |
| 76 | Should Be Equal As Strings ${resp.status_code} 200 |
| 77 | |