Bug 2327 fix to verify ipaddress in sol003_02 testsuite
[osm/tests.git] / robot-systest / testsuite / k8s_12-openldap_helm_day-2.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-12] Openldap Helm chart.
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
31 Test Tags   k8s_12   cluster_k8s   regression   azure
32
33 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
34
35
36 *** Variables ***
37 # K8s cluster name and version
38 ${K8SCLUSTER_NAME}   k8s12
39 ${K8SCLUSTER_VERSION}   v1
40
41 # NS and VNF descriptor package folder and ids
42 ${VNFD_PKG}   openldap_primitives_knf
43 ${VNFD_NAME}   openldap_knf
44 ${NSD_PKG}   openldap_primitives_ns
45 ${NSD_NAME}   openldap_ns
46
47 # NS instance name and configuration
48 ${NS_NAME}   ldap
49 ${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}], additionalParamsForVnf: [ {member-vnf-index: openldap, additionalParamsForKdu: [ {kdu_name: ldap, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}} ] } ] }
50
51 ${NS_ID}   ${EMPTY}
52 ${PUBLICKEY}   ${EMPTY}
53 ${VNF_MEMBER_INDEX}   openldap
54 ${KDU_NAME}   ldap
55 ${UPGRADE_ACTION}   upgrade
56 ${ROLLBACK_ACTION}   rollback
57 ${REPLICA_COUNT}   3
58 ${ACTION_NAME}   get-user-info
59 ${ACTION_PARAM_CN}   admin
60 ${ACTION_PARAM_DC}   example.org
61
62
63 *** Test Cases ***
64 Create Package For OpenLDAP CNF
65     [Documentation]   Upload VNF package for the testsuite.
66     Create VNFD   '%{PACKAGES_FOLDER}/${VNFD_PKG}'
67
68 Create Package For OpenLDAP NS
69     [Documentation]   Upload NS package for the testsuite.
70     Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
71
72 Add K8s Cluster To OSM
73     [Documentation]   Register K8s cluster in OSM.
74     Create K8s Cluster   %{K8S_CREDENTIALS}   ${K8SCLUSTER_VERSION}   %{VIM_TARGET}   %{VIM_MGMT_NET}   ${K8SCLUSTER_NAME}
75     Check For K8s Cluster To Be Enabled   ${K8SCLUSTER_NAME}
76
77 Create Network Service Instance
78     [Documentation]   Instantiate NS for the testsuite.
79     ${id}=   Create Network Service   ${NSD_NAME}   %{VIM_TARGET}   ${NS_NAME}   ${NS_CONFIG}   ${PUBLICKEY}
80     Log   ${id}
81
82 Get Ns Id
83     [Documentation]   Get NS instance id from OSM.
84     ${id}=   Get Ns Id   ${NS_NAME}
85     Set Suite Variable   ${NS_ID}   ${id}
86
87 Get Vnf Id
88     [Documentation]   Get VNF instance id from OSM.
89     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
90     @{vnfr_list}=   Get Ns Vnfr Ids   ${NS_ID}
91     Log List   ${vnfr_list}
92     Set Suite Variable   ${VNF_ID}   ${vnfr_list}[0]
93
94 Execute Day 2 Operations
95     [Documentation]   Performs one Day 2 operation.
96     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
97     ${ns_op_id}=   Execute NS K8s Action   ${NS_NAME}   ${ACTION_NAME}   ${VNF_MEMBER_INDEX}   ${KDU_NAME}   cn=${ACTION_PARAM_CN}   dc=${ACTION_PARAM_DC}
98     Log   ${ns_op_id}
99
100 Execute Upgrade Operation
101     [Documentation]   Perform OSM action to upgrade the number of replicas of a deployment in the CNF.
102     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
103     ${ns_op_id}=   Execute NS K8s Action   ${NS_NAME}   ${UPGRADE_ACTION}   ${VNF_MEMBER_INDEX}   ${KDU_NAME}   replicaCount=${REPLICA_COUNT}
104     Log   ${ns_op_id}
105
106 Check Replicas After Upgrade Operation
107     [Documentation]   Check that the number of replicas after the upgrade is the expected one.
108     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
109     ${count}=   Get Vnf Kdu Replica Count   ${VNF_ID}   ${KDU_NAME}
110     Log   ${count}
111     Should Be Equal As Integers   ${count}   ${REPLICA_COUNT}
112
113 Execute Rollback Operation
114     [Documentation]   Perform OSM action to rollback the previous upgrade of the CNF.
115     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
116     ${ns_op_id}=   Execute NS K8s Action   ${NS_NAME}   ${ROLLBACK_ACTION}   ${VNF_MEMBER_INDEX}   ${KDU_NAME}
117     Log   ${ns_op_id}
118
119 Check Replicas After Rollback Operation
120     [Documentation]   Check that the number of replcias after the rollback is the expected one.
121     Variable Should Exist   ${NS_ID}   msg=Network service instance is not available
122     ${count}=   Get Vnf Kdu Replica Count   ${VNF_ID}   ${KDU_NAME}
123     Log   ${count}
124     Should Be Empty   ${count}
125
126 Delete Network Service Instance
127     [Documentation]   Delete NS instance.
128     [Tags]   cleanup
129     Delete NS   ${NS_NAME}
130
131 Remove K8s Cluster from OSM
132     [Documentation]   Delete K8s cluster from OSM.
133     [Tags]   cleanup
134     Delete K8s Cluster   ${K8SCLUSTER_NAME}
135
136 Delete NS Descriptor Test
137     [Documentation]   Delete NS package from OSM.
138     [Tags]   cleanup
139     Delete NSD   ${NSD_NAME}
140
141 Delete VNF Descriptor Test
142     [Documentation]   Delete NF package from OSM.
143     [Tags]   cleanup
144     Delete VNFD   ${VNFD_NAME}
145
146
147 *** Keywords ***
148 Suite Cleanup
149     [Documentation]   Test Suit Cleanup: Deleting Descriptor, instance and vim
150     Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
151     Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
152     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}
153     Run Keyword If Any Tests Failed   Delete K8s Cluster   ${K8SCLUSTER_NAME}