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