[ROBOT] Fix failing CMPv2 and 5gbulkpm test cases in CI
[testsuite.git] / robot / resources / test_templates / cmpv2.robot
1 *** Settings ***
2 Documentation    CMPv2 test cases
3 Library         OperatingSystem
4 Library         RequestsLibrary
5 Library         Collections
6 Library         ONAPLibrary.JSON
7 Library         ONAPLibrary.Utilities
8 Library         ONAPLibrary.Templating    WITH NAME    Templating
9 Resource        pnf_registration_without_SO_template.robot
10 Resource        ../global_properties.robot
11 Resource        ../resources/test_templates/pnf_registration_without_SO_template.robot
12 Resource        ../chart_museum.robot
13
14
15
16 *** Variables ***
17 ${pnf_simulator_single_event}=  ves/pnf_simulator_single_event.jinja
18 ${VES_ENDPOINT}    ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_HTTPS_SERVER_PORT}
19 ${VES_data_path}   eventListener/v7
20 ${single_event_data_path}   /simulator/event
21 ${users}  ${EXECDIR}/robot/assets/cmpv2/mongo-users.json
22 ${HELM_RELEASE}   kubectl --namespace onap get pods | sed 's/ .*//' | grep robot | sed 's/-.*//'
23 ${CMPv2_helm_values}   ${EXECDIR}/robot/assets/cmpv2
24 ${VES_Client_helm_charts}   ${EXECDIR}/robot/assets/helm/ves-client
25
26 *** Keywords ***
27
28 Suite setup
29     [Arguments]  ${PNF_entry_dict}
30     Add chart repository                        chart-museum                  http://chart-museum:80      onapinitializer      demo123456!
31     Send VES integration request    ${PNF_entry_dict}
32     ${command_output} =                 Run And Return Rc And Output        ${HELM_RELEASE}
33     Should Be Equal As Integers         ${command_output[0]}                0
34     Set Global Variable   ${ONAP_HELM_RELEASE}   ${command_output[1]}
35     Log To Console                              Deploying VES Client
36     Install VES Client
37     Log To Console                              Deploying VES collector with CMPv2 and correct sans
38     Install VES collector with CMPv2
39     Log To Console                              Deploying VES collector with CMPv2 and wrong SANs
40     Install VES collector with CMPv2 and wrong SANs
41
42 Install VES Client
43     [Arguments]  ${cert}=cmpv2
44     ${override} =                       Set Variable                       -f ${CMPv2_helm_values}/ves_client_values_cmpv2.yaml --set fullnameOverride=${ONAP_HELM_RELEASE}-ves-client-cmpv2 --set mongodb.fullnameOverride=${ONAP_HELM_RELEASE}-ves-db-client-cmpv2 --set config.mongoDbName=${ONAP_HELM_RELEASE}-ves-db-client-cmpv2 --set certMethod=${cert} --debug
45     Install helm charts from folder     ${VES_Client_helm_charts}           ${ONAP_HELM_RELEASE}-ves-client                 set_values_override=${override}
46
47 Install VES collector with CMPv2
48     ${override} =                       Set Variable                       -f ${CMPv2_helm_values}/ves_correct_sans_cmpv2.yaml --debug
49     Install helm charts                 chart-museum                       dcae-ves-collector         ${ONAP_HELM_RELEASE}-dcae-ves-cmpv2-cert-corect-sans           6m      ${override}
50
51 Install VES collector with CMPv2 and wrong SANs
52     ${override} =                       Set Variable                       -f ${CMPv2_helm_values}/ves_wrong_sans_cmpv2.yaml --debug
53     Install helm charts                 chart-museum                       dcae-ves-collector         ${ONAP_HELM_RELEASE}-dcae-ves-cmpv2-cert-wrong-sans           6m      ${override}
54
55 VES Client send single VES event
56     [Arguments]  ${event}   ${ves_host}   ${ves_port}  ${pnf_sim_host}  ${pnf_sim_port}  ${http_reposnse_code}=202
57     ${pnf_sim_endpoint}=            Set Variable                http://${pnf_sim_host}.onap:${pnf_sim_port}
58     ${ves_url}=                     Set Variable                ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${ves_host}:${ves_port}/${VES_data_path}
59     ${single_event}=                Create Dictionary           event=${event}              ves_url=${ves_url}
60     Templating.Create Environment   pnf                         ${GLOBAL_TEMPLATE_FOLDER}
61     ${data}=                        Templating.Apply Template   pnf                         ${pnf_simulator_single_event}   ${single_event}
62     ${session}=                     Create Session              pnf_sim                     ${pnf_sim_endpoint}
63     ${headers}=                     Create Dictionary            Accept=application/json    Content-Type=application/json
64     ${post_resp}=                   Post Request                pnf_sim                     ${single_event_data_path}       data=${data}        headers=${headers}
65     Log                             PNF registration request ${data}
66     Should Be Equal As Strings      ${post_resp.status_code}    ${http_reposnse_code}
67     Log                             VES has accepted event with status code ${post_resp.status_code}
68     [Return]                        ${post_resp}
69
70 Usecase Teardown
71     Uninstall helm charts               ${ONAP_HELM_RELEASE}-ves-client
72     Uninstall helm charts               ${ONAP_HELM_RELEASE}-dcae-ves-cmpv2-cert-corect-sans
73     Uninstall helm charts               ${ONAP_HELM_RELEASE}-dcae-ves-cmpv2-cert-wrong-sans