Revert "Feature 11001: Robot framework linting for E2E tests"
[osm/tests.git] / robot-systest / testsuite / k8s_13-two_helm_kdu.robot
1 #   Licensed under the Apache License, Version 2.0 (the "License");
2 #   you may not use this file except in compliance with the License.
3 #   You may obtain a copy of the License at
4 #
5 #       http://www.apache.org/licenses/LICENSE-2.0
6 #
7 #   Unless required by applicable law or agreed to in writing, software
8 #   distributed under the License is distributed on an "AS IS" BASIS,
9 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 #   See the License for the specific language governing permissions and
11 #   limitations under the License.
12
13 *** Settings ***
14 Documentation   [K8s-13] Two Helm-based KDU stored in public and private OCI repositories.
15
16 Library   OperatingSystem
17 Library   String
18 Library   Collections
19 Library   Process
20
21 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
22 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
23 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
24 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
25 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
26 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot
27 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/repo_lib.robot
28
29 Force Tags   k8s_13   cluster_k8s   daily   azure
30
31 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
32
33
34 *** Variables ***
35 # NS and VNF descriptor package folder and ids
36 ${vnfd_pkg}   two_helm_oci_knf
37 ${vnfd_name}   two_helm_oci_knf
38 ${nsd_pkg}   two_helm_oci_ns
39 ${nsd_name}   two_helm_oci_ns
40
41 # NS instance name and configuration
42 ${ns_name}   ldap
43 ${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}], additionalParamsForVnf: [ {member-vnf-index: two_helm_oci, additionalParamsForKdu: [ {kdu_name: haproxy, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}}, {kdu_name: ldap, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}} ] } ] }
44
45 ${ns_id}   ${EMPTY}
46 ${publickey}   ${EMPTY}
47 ${vnf_member_index}   two_helm_oci
48 ${kdu1_name}   haproxy
49 ${kdu2_name}   ldap
50 ${upgrade_action}   upgrade
51 ${rollback_action}   rollback
52 ${replica_count}   3
53
54 # OCI helm repo configuration
55 ${repo_name}   osm-gitlab
56 ${repo_uri}   %{OCI_REGISTRY_URL}
57 ${repo_user}   %{OCI_REGISTRY_USER}
58 ${repo_password}   %{OCI_REGISTRY_PASSWORD}
59
60 *** Test Cases ***
61 Create Package For CNF
62     [Documentation]   Create Package For CNF
63     [Tags]   prepare
64     Create VNFD   '%{PACKAGES_FOLDER}/${vnfd_pkg}'
65
66 Create Package For NS
67     [Documentation]   Create Package For NS
68     [Tags]   prepare
69     Create NSD   '%{PACKAGES_FOLDER}/${nsd_pkg}'
70
71 Create Helm OCI Repo
72     [Documentation]   Create Helm OCI Repo for openldap kdu
73     [Tags]   prepare
74     Create Repo   ${repo_name}   ${repo_uri}   helm-chart   ${repo_user}   ${repo_password}   --oci
75
76 Create Network Service Instance
77     [Documentation]   Create Network Service Instance
78     [Tags]   prepare
79     ${id}=   Create Network Service   ${nsd_name}   %{VIM_TARGET}   ${ns_name}   ${ns_config}   ${publickey}
80
81 Get Ns Id
82     [Documentation]   Get ID of NS instance
83     [Tags]   verify
84     ${id}=   Get Ns Id   ${ns_name}
85     Set Suite Variable   ${ns_id}   ${id}
86
87 Get Vnf Id
88     [Documentation]   Get ID of VNF
89     [Tags]   verify
90     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
91     @{vnfr_list}=   Get Ns Vnfr Ids   ${ns_id}
92     Log List   ${vnfr_list}
93     Set Suite Variable   ${vnf_id}   ${vnfr_list}[0]
94
95 Execute Upgrade Operation over first KDU
96     [Documentation]   Execute Upgrade Operation over first KDU
97     [Tags]   verify
98     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
99     ${ns_op_id}=   Execute NS K8s Action   ${ns_name}   ${upgrade_action}   ${vnf_member_index}   ${kdu1_name}   replicaCount=${replica_count}
100
101 Check Replicas After Upgrade Operation over first KDU
102     [Documentation]   Check Replicas After Upgrade Operation over first KDU
103     [Tags]   verify
104     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
105     ${count}=   Get Vnf Kdu Replica Count   ${vnf_id}   ${kdu1_name}
106     Log   ${count}
107     Should Be Equal As Integers   ${count}   ${replica_count}
108
109 Execute Rollback Operation over first KDU
110     [Documentation]   Execute Rollback Operation over first KDU
111     [Tags]   verify
112     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
113     ${ns_op_id}=   Execute NS K8s Action   ${ns_name}   ${rollback_action}   ${vnf_member_index}   ${kdu1_name}
114
115 Check Replicas After Rollback Operation over first KDU
116     [Documentation]   Check Replicas After Rollback Operation over first KDU
117     [Tags]   verify
118     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
119     ${count}=   Get Vnf Kdu Replica Count   ${vnf_id}   ${kdu1_name}
120     Log   ${count}
121     Should Be Empty   ${count}
122
123 Execute Upgrade Operation over second KDU
124     [Documentation]   Execute Upgrade Operation over second KDU
125     [Tags]   verify
126     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
127     ${ns_op_id}=   Execute NS K8s Action   ${ns_name}   ${upgrade_action}   ${vnf_member_index}   ${kdu2_name}   replicaCount=${replica_count}
128
129 Check Replicas After Upgrade Operation over second KDU
130     [Documentation]   Check Replicas After Upgrade Operation over second KDU
131     [Tags]   verify
132     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
133     ${count}=   Get Vnf Kdu Replica Count   ${vnf_id}   ${kdu2_name}
134     Log   ${count}
135     Should Be Equal As Integers   ${count}   ${replica_count}
136
137 Execute Rollback Operation over second KDU
138     [Documentation]   Execute Rollback Operation over second KDU
139     [Tags]   verify
140     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
141     ${ns_op_id}=   Execute NS K8s Action   ${ns_name}   ${rollback_action}   ${vnf_member_index}   ${kdu2_name}
142
143 Check Replicas After Rollback Operation over second KDU
144     [Documentation]   Check Replicas After Rollback Operation over second KDU
145     [Tags]   verify
146     Variable Should Exist   ${ns_id}   msg=Network service instance is not available
147     ${count}=   Get Vnf Kdu Replica Count   ${vnf_id}   ${kdu2_name}
148     Log   ${count}
149     Should Be Empty   ${count}
150
151 Delete Network Service Instance
152     [Documentation]   Delete Network Service Instance
153     [Tags]   cleanup
154     Delete NS   ${ns_name}
155
156 Delete Helm OCI Repo
157     [Documentation]   Delete Helm OCI Repo
158     [Tags]   prepare
159     Delete Repo   ${repo_name}
160
161 Delete NS Descriptor Test
162     [Documentation]   Delete NS Descriptor Test
163     [Tags]   cleanup
164     Delete NSD   ${nsd_name}
165
166 Delete VNF Descriptor Test
167     [Documentation]   Delete VNF Descriptor Test
168     [Tags]   cleanup
169     Delete VNFD   ${vnfd_name}
170
171
172 *** Keywords ***
173 Suite Cleanup
174     [Documentation]   Test Suit Cleanup: Deleting Descriptor, instance and vim
175     Run Keyword If Any Tests Failed   Delete NS   ${ns_name}
176     Run Keyword If Any Tests Failed   Delete NSD   ${nsd_name}
177     Run Keyword If Any Tests Failed   Delete VNFD   ${vnfd_name}