aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/chart_museum.robot
blob: 8969336e1af0b83f6d75ffdaff90ef5fb8ec1251 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
*** Settings ***
Documentation     The main interface for interacting with CDS. It handles low level stuff like managing the http request library and CDS required fields
Library           RequestsLibrary
Resource          global_properties.robot
Library           SSHLibrary
Library           OperatingSystem
Library           String

*** Variables ***
${registry_ovveride}                                            ${GLOBAL_INJECTED_NEXUS_DOCKER_REPO}

*** Keywords ***
Add chart repository
    [Documentation]  Add chart repository to helm in robot/xtesting pod
    [Arguments]                         ${chart_repo_name}                  ${chart_repo_fqdn}      ${chart_repo_username}      ${chart_repo_password}
    ${helm_repo_add}=                   Set Variable                        helm repo add ${chart_repo_name} ${chart_repo_fqdn} --password ${chart_repo_password} --username ${chart_repo_username}
    ${command_output} =                 Run And Return Rc And Output        ${helm_repo_add}
    Should Be Equal As Integers         ${command_output[0]}                0
    ${command_output} =                 Run And Return Rc And Output        helm repo update
    Should Be Equal As Integers         ${command_output[0]}                0

Remove chart repository
    [Documentation]  Remove chart repository from helm in robot/xtesting pod
    [Arguments]                         ${chart_repo_name}
    ${helm_repo_remove}=                Set Variable                            helm repo remove ${chart_repo_name}
    ${command_output} =                 Run And Return Rc And Output            ${helm_repo_remove}
    Should Be Equal As Integers         ${command_output[0]}                    0

Package and add charts to repository
    [Documentation]  Package and add charts to k8s chart repository in robot/xtesting pod
    [Arguments]                         ${chart_repo_name}                  ${chart_directory}      ${destination_directory}    ${chart_version}
    ${helm_package}=                    Set Variable                        helm package --dependency-update --destination ${destination_directory} ${chart_directory} --version ${chart_version}
    ${command_output} =                 Run And Return Rc And Output        ${helm_package}
    Should Be Equal As Integers         ${command_output[0]}                0
    ${helm_chart_name}=                 Fetch From Right                    ${chart_directory}      /
    ${helm_push}=                       Set Variable                        helm push  ${destination_directory}/${helm_chart_name}-${chart_version}.tgz ${chart_repo_name}
    ${command_output} =                 Run And Return Rc And Output        ${helm_push}
    Should Be Equal As Integers         ${command_output[0]}                0


Install helm charts
    [Documentation]  Install DCAE Servcie using helm charts
    [Arguments]                             ${chart_repo_name}                      ${dcae_servcie_helm_charts}         ${dcae_service_helm_name}       ${wait_time}=6m0s   ${set_values_override}=${EMPTY}
    ${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} --wait --timeout ${wait_time}
    ${helm_install_command_output} =        Run And Return Rc And Output            ${helm_install}
    Log                                     ${helm_install_command_output[1]}
    Should Be Equal As Integers             ${helm_install_command_output[0]}       0

Install helm charts from folder
    [Documentation]  Install DCAE Servcie using helm charts not in repo
    [Arguments]                             ${chart_folder}                         ${dcae_service_helm_name}       ${wait_time}=2m0s  ${set_values_override}=${EMPTY}
    ${helm_dependency_update}=              Set Variable                            helm dependency update ${chart_folder}
    ${helm_dependency_update_output} =      Run And Return Rc And Output            ${helm_dependency_update}
    Log                                     ${helm_dependency_update_output[1]}
    Should Be Equal As Integers             ${helm_dependency_update_output[0]}     0
    ${rest}  ${dcae_servcie_helm_charts} =  Split String From Right               ${chart_folder}               /           1
    ${helm_install}=                        Set Variable                            helm install ${dcae_service_helm_name} ${chart_folder} --set global.repository=${registry_ovveride} ${set_values_override} --wait --timeout ${wait_time}
    ${helm_install_command_output} =        Run And Return Rc And Output            ${helm_install}
    Log                                     ${helm_install_command_output[1]}
    Should Be Equal As Integers             ${helm_install_command_output[0]}       0

Uninstall helm charts
    [Documentation]  Uninstall DCAE Servcie using helm charts
    [Arguments]                             ${dcae_service_helm_name}
    ${helm_uninstall}=                      Set Variable                                    helm uninstall ${dcae_service_helm_name} --timeout 5m0s
    ${helm_uninstall_command_output}=       Run And Return Rc And Output                    ${helm_uninstall}
    Should Be Equal As Integers             ${helm_uninstall_command_output[0]}             0
    ${helm_check}=                          Set Variable                                    kubectl get pods -n onap | grep ${dcae_service_helm_name}
    Wait Until Keyword Succeeds             5 minute                                        5 sec                            Helm charts uninstallation check       ${helm_check}

Helm charts uninstallation check
    [Arguments]                             ${helm_check}
    ${helm_uninstall_check_output}=         Run And Return Rc And Output                    ${helm_check}
    Should Be Equal As Integers             ${helm_uninstall_check_output[0]}               1
    Log                                     ${helm_uninstall_check_output[1]}