[ROBOT] ADD HTTPS based BULKPM test cases that use helm based components
[testsuite.git] / robot / resources / chart_museum.robot
1 *** Settings ***
2 Documentation     The main interface for interacting with CDS. It handles low level stuff like managing the http request library and CDS required fields
3 Library           RequestsLibrary
4 Resource          global_properties.robot
5 Library           SSHLibrary
6 Library           OperatingSystem
7 Library           String
8
9 *** Variables ***
10 ${registry_ovveride}                                            ${GLOBAL_INJECTED_NEXUS_DOCKER_REPO}
11
12 *** Keywords ***
13 Add chart repository
14     [Documentation]  Add chart repository to helm in robot/xtesting pod
15     [Arguments]                         ${chart_repo_name}                  ${chart_repo_fqdn}      ${chart_repo_username}      ${chart_repo_password}
16     ${helm_repo_add}=                   Set Variable                        helm repo add ${chart_repo_name} ${chart_repo_fqdn} --password ${chart_repo_password} --username ${chart_repo_username}
17     ${command_output} =                 Run And Return Rc And Output        ${helm_repo_add}
18     Should Be Equal As Integers         ${command_output[0]}                0
19     ${command_output} =                 Run And Return Rc And Output        helm repo update
20     Should Be Equal As Integers         ${command_output[0]}                0
21
22 Remove chart repository
23     [Documentation]  Remove chart repository from helm in robot/xtesting pod
24     [Arguments]                         ${chart_repo_name}
25     ${helm_repo_remove}=                Set Variable                            helm repo remove ${chart_repo_name}
26     ${command_output} =                 Run And Return Rc And Output            ${helm_repo_remove}
27     Should Be Equal As Integers         ${command_output[0]}                    0
28
29 Package and add charts to repository
30     [Documentation]  Package and add charts to k8s chart repository in robot/xtesting pod
31     [Arguments]                         ${chart_repo_name}                  ${chart_directory}      ${destination_directory}    ${chart_version}
32     ${helm_package}=                    Set Variable                        helm package --dependency-update --destination ${destination_directory} ${chart_directory} --version ${chart_version}
33     ${command_output} =                 Run And Return Rc And Output        ${helm_package}
34     Should Be Equal As Integers         ${command_output[0]}                0
35     ${helm_chart_name}=                 Fetch From Right                    ${chart_directory}      /
36     ${helm_push}=                       Set Variable                        helm push  ${destination_directory}/${helm_chart_name}-${chart_version}.tgz ${chart_repo_name}
37     ${command_output} =                 Run And Return Rc And Output        ${helm_push}
38     Should Be Equal As Integers         ${command_output[0]}                0
39
40
41 Install helm charts
42     [Documentation]  Install DCAE Servcie using helm charts
43     [Arguments]                             ${chart_repo_name}                      ${dcae_servcie_helm_charts}         ${dcae_service_helm_name}       ${wait_time}=2 min    ${set_values_override}=${EMPTY}
44     ${helm_install}=                        Set Variable                            helm install ${dcae_service_helm_name} ${chart_repo_name}/${dcae_servcie_helm_charts} --set global.repository=${registry_ovveride} ${set_values_override}
45     ${helm_install_command_output} =        Run And Return Rc And Output            ${helm_install}
46     Log                                     ${helm_install_command_output[1]}
47     Should Be Equal As Integers             ${helm_install_command_output[0]}       0
48     Wait Until Keyword Succeeds             ${wait_time}                            20 sec                             Checking Status Of Deployed Appliction Using Helm      ${dcae_servcie_helm_charts}                 ${dcae_service_helm_name}
49
50 Install helm charts from folder
51     [Documentation]  Install DCAE Servcie using helm charts not in repo
52     [Arguments]                             ${chart_folder}                         ${dcae_service_helm_name}       ${wait_time}=2 min  ${set_values_override}=${EMPTY}
53     ${helm_dependency_update}=              Set Variable                            helm dependency update ${chart_folder}
54     ${helm_dependency_update_output} =      Run And Return Rc And Output            ${helm_dependency_update}
55     Log                                     ${helm_dependency_update_output[1]}
56     Should Be Equal As Integers             ${helm_dependency_update_output[0]}     0
57     ${rest}  ${dcae_servcie_helm_charts} =      Split String From Right                     ${chart_folder}                 /           1
58     ${helm_install}=                        Set Variable                            helm install ${dcae_service_helm_name} ${chart_folder} --set global.repository=${registry_ovveride} ${set_values_override}
59     ${helm_install_command_output} =        Run And Return Rc And Output            ${helm_install}
60     Log                                     ${helm_install_command_output[1]}
61     Should Be Equal As Integers             ${helm_install_command_output[0]}       0
62     Wait Until Keyword Succeeds             ${wait_time}                            20 sec                             Checking Status Of Deployed Appliction Using Helm      ${dcae_servcie_helm_charts}                 ${dcae_service_helm_name}
63
64 Checking Status Of Deployed Appliction Using Helm
65     [Arguments]                         ${dcae_servcie_helm_charts}                 ${dcae_service_helm_name}
66     ${pod_status}=                      Set Variable                                kubectl get pods -n onap | grep ${dcae_service_helm_name} | awk '{print $3}'
67     ${pod_status_command_output} =      Run And Return Rc And Output                ${pod_status}
68     Should Be Equal As Integers         ${pod_status_command_output[0]}             0
69     Should Be Equal As Strings          ${pod_status_command_output[1]}             Running
70     ${pod_ready}=                       Set Variable                                kubectl get pods -n onap | grep ${dcae_service_helm_name} | awk '{print $2}'
71     ${pod_ready_command_output} =       Run And Return Rc And Output                ${pod_ready}
72     Should Be Equal As Integers         ${pod_ready_command_output[0]}              0
73     ${pre}       ${post} =      Split String    ${pod_ready_command_output[1]}          /           1
74     Should Be Equal As Strings          ${pre}                                      ${post}
75
76 Uninstall helm charts
77     [Documentation]  Uninstall DCAE Servcie using helm charts
78     [Arguments]                             ${dcae_service_helm_name}
79     ${helm_uninstall}=                      Set Variable                                    helm uninstall ${dcae_service_helm_name}
80     ${helm_uninstall_command_output}=       Run And Return Rc And Output                    ${helm_uninstall}
81     Should Be Equal As Integers             ${helm_uninstall_command_output[0]}             0
82
83
84
85
86
87
88
89