blob: e3aa4b91fb719e0b57fbe15b5ee51018e119fcf6 [file] [log] [blame]
kaihlavid1a1fb72019-06-13 16:11:48 +03001*** Settings ***
2Library json
kaihlavid1a1fb72019-06-13 16:11:48 +03003Library ONAPLibrary.Utilities
4
5Resource json_templater.robot
6Resource common.robot
7
8*** Variables ***
9${DCAE_PATH} /dcae
10${DCAE_CREATE_BLUEPRINT_PATH} /SERVICE/createBluePrint
11${DCAE_VFCMT_TEMPLATE} ${ASSETS_DIR}create_vfcmt.template
12${DCAE_COMPOSITION_TEMPLATE} ${ASSETS_DIR}dcae_composition.template
13${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${ASSETS_DIR}dcae_monitoring_configuration.template
14${DCAE_BE_ENDPOINT} http://localhost:8082
15
16*** Keywords ***
17
18Add VFCMT To DCAE-DS
19 [Documentation] Create VFCMT with the given name and return its uuid
20 [Arguments] ${vfcmt_name}
21 ${map}= Create Dictionary vfcmtName=${vfcmt_name} description=VFCMT created by robot
22 ${data}= Fill JSON Template File ${DCAE_VFCMT_TEMPLATE} ${map}
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
27Run 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
38Run 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
49Save Composition
50 [Arguments] ${vfcmt_uuid} ${vf_uuid}
51 ${map}= Create Dictionary cid=${vfcmt_uuid} vf_id=${vf_uuid}
52 ${data}= Fill JSON Template File ${DCAE_COMPOSITION_TEMPLATE} ${map}
53 ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/saveComposition/${vfcmt_uuid} ${data} ${ASDC_DESIGNER_USER_ID}
54 Should Be Equal As Strings ${resp.status_code} 200
55
56Certify VFCMT
57 [Arguments] ${vfcmt_uuid}
58 ${resp}= Run DCAE-DS Put Request ${DCAE_PATH}/certify/vfcmt/${vfcmt_uuid}
59 Should Be Equal As Strings ${resp.status_code} 200
60 [Return] ${resp.json()['uuid']}
61
62Add Monitoring Configuration To DCAE-DS
63 [Arguments] ${vfcmt_uuid} ${cs_uuid} ${vfi_name} ${mc_name}
64 ${map}= Create Dictionary template_uuid=${vfcmt_uuid} service_uuid=${cs_uuid} vfi_name=${vfi_name} name=${mc_name}
65 ${data}= Fill JSON Template File ${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${map}
66 ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/importMC ${data} ${ASDC_DESIGNER_USER_ID}
67 Should Be Equal As Strings ${resp.status_code} 200
68 [Return] ${resp.json()['vfcmt']['uuid']}
69
70Submit Monitoring Configuration To DCAE-DS
71 [Arguments] ${mc_uuid} ${cs_uuid} ${vfi_name}
kaihlavidc396842019-06-26 15:09:37 +030072 ${url_vfi_name} url_encode_string ${vfi_name}
kaihlavid1a1fb72019-06-13 16:11:48 +030073 ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}${DCAE_CREATE_BLUEPRINT_PATH}/${mc_uuid}/${cs_uuid}/${url_vfi_name} ${None} ${ASDC_DESIGNER_USER_ID}
74 Should Be Equal As Strings ${resp.status_code} 200
75