Adjust DCAE-DS CSIT for Jenkins and to master
[integration/csit.git] / tests / sdc-dcae-d / dcaed / monitoring_configuration_service_test.robot
1 *** Settings ***
2 Library           ONAPLibrary.Utilities
3
4 Resource          asdc_interface.robot
5 Resource          dcaed_interface.robot
6
7 *** Test Cases ***
8 Create Service With Monitoring Configuration Test
9     [Tags]  dcaed
10     [Documentation]   Create a service with a monitoring configuration -
11     ...               this test case implements the steps described in
12     ...               https://wiki.onap.org/display/DW/How+to+Create+a+Service+with+a+Monitoring+Configuration+using+SDC
13     ...               excluding distribution of the service
14
15     ${unique_postfix}=  Generate Unique Postfix
16     ${test_vf_name}=   Set Variable   TestVF_${unique_postfix}
17     ${test_cs_name}=   Set Variable   TestService_${unique_postfix}
18     ${test_vfcmt_name}=   Set Variable   TestVFCMT_${unique_postfix}
19     ${test_mc_name}=   Set Variable   TestMC_${unique_postfix}
20
21     ${cert_vf_unique_id}    ${cert_vf_uuid}   Onboard DCAE Microservice   ${test_vf_name}
22     ${cert_vfcmt_uuid}   Create Monitoring Template   ${test_vfcmt_name}   ${cert_vf_uuid}
23     ${cs_unique_id}   Create Monitoring Configuration   ${test_cs_name}   ${cert_vf_unique_id}   ${test_vf_name}   ${cert_vfcmt_uuid}   ${test_mc_name}
24     Approve Service    ${cs_unique_id}
25
26 *** Keywords ***
27 Generate Unique Postfix
28     [Documentation]   Create and return unique postfix to be used in various unique names  
29     ${tmp_id} =   Generate Timestamp
30     ${tmp_str} =   Convert To String   ${tmp_id}
31     [return]    ${tmp_str}
32
33 Onboard DCAE Microservice
34     [Documentation]   Create DCAE Microservice with a given name, add Tosca artifacts to it and certify it
35     ...               Return the unique_id and uuid of the certified VF
36     [Arguments]   ${test_vf_name}
37     ${data}=  asdc_interface.Create Catalog Resource Data   ${test_vf_name}   TestVendor
38     ${vf_unique_id}=  asdc_interface.Post ASDC Resource Request Unauthenticated  ${data}
39
40     asdc_interface.Add Tosca Artifact to Resource   template   ${vf_unique_id}
41     asdc_interface.Add Tosca Artifact to Resource   translate   ${vf_unique_id}
42     asdc_interface.Add Tosca Artifact to Resource   schema   ${vf_unique_id}
43
44     ${cert_vf_unique_id}    ${cert_vf_uuid}    asdc_interface.Certify ASDC Catalog Resource   ${vf_unique_id}   ${ASDC_DESIGNER_USER_ID}
45     [return]   ${cert_vf_unique_id}    ${cert_vf_uuid}
46
47 Create Monitoring Template
48     [Documentation]   Create a new monitoring template containing the DCAE VF, certify it and return the uuid   
49     [Arguments]   ${vfcmt_name}   ${vf_uuid}
50     ${vfcmt_uuid}   dcaed_interface.Add VFCMT To DCAE-DS   ${vfcmt_name}
51     dcaed_interface.Save Composition   ${vfcmt_uuid}   ${vf_uuid}
52
53     # Note that certification is not instructed in
54     # https://wiki.onap.org/display/DW/How+to+Create+a+Service+with+a+Monitoring+Configuration+using+SDC
55     # due to limitations of GUI so this test case goes beyond the instructions at this certification step
56
57     ${cert_vfcmt_uuid}   dcaed_interface.Certify VFCMT   ${vfcmt_uuid}
58     [return]   ${cert_vfcmt_uuid}
59
60 Create Monitoring Configuration
61     [Documentation]   Create a monitoring configuration for a given service based on a previously created VFCMT 
62     ...               Return the unique_id of the created catalog service for the monitoring configuration
63     [Arguments]   ${service_name}   ${vf_unique_id}   ${vf_name}   ${vfcmt_uuid}   ${mc_name}
64     ${cs_unique_id}   ${cs_uuid}    asdc_interface.Add Catalog Service For Monitoring Template   ${service_name}
65     ${vfi_uuid}  ${vfi_name}   asdc_interface.Add ASDC Resource Instance   ${cs_unique_id}   ${vf_unique_id}   ${vf_name}
66     ${mc_uuid}   dcaed_interface.Add Monitoring Configuration To DCAE-DS  ${vfcmt_uuid}   ${cs_uuid}    ${vfi_name}   ${mc_name}
67     dcaed_interface.Submit Monitoring Configuration To DCAE-DS   ${mc_uuid}   ${cs_uuid}  ${vfi_name}
68     [return]   ${cs_unique_id}
69
70 Approve Service
71     [Documentation]    Perform the required steps to certify and approve the given ASDC catalog service
72     [Arguments]    ${cs_unique_id}
73     asdc_interface.Checkin ASDC Catalog Service    ${cs_unique_id}
74     asdc_interface.Request Certify ASDC Catalog Service    ${cs_unique_id}
75     asdc_interface.Start Certify ASDC Catalog Service    ${cs_unique_id}
76     ${cert_cs_unique_id}=    asdc_interface.Certify ASDC Catalog Service    ${cs_unique_id}
77     asdc_interface.Approve ASDC Catalog Service    ${cert_cs_unique_id}
78