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
5 # http://www.apache.org/licenses/LICENSE-2.0
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.
14 Documentation [K8s-11] Simple Helm K8s Scale.
16 Library OperatingSystem
22 Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
23 Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
24 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
25 Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
26 Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
27 Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot
28 Resource %{ROBOT_DEVOPS_FOLDER}/lib/kubectl_lib.robot
30 Force Tags k8s_11 cluster_k8s daily regression
32 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
36 # K8s cluster name and version
37 ${k8scluster_name} k8s11
38 ${k8scluster_version} v1
40 # NS and VNF descriptor package folder and ids
41 ${vnfd_pkg} openldap_scale_knf
42 ${vnfd_name} openldap_scale_knf
43 ${nsd_pkg} openldap_scale_ns
44 ${nsd_name} openldap_scale_ns
46 # Username and SSH private key for accessing OSM host
49 ${privatekey} %{OSM_RSA_FILE}
52 ${publickey} %{HOME}/.ssh/id_rsa.pub
53 ${vnf_member_index} openldap
55 ${scaling_group} scale-kdu
57 ${application_selector} app=openldap
59 # NS instance name and configuration
60 ${ns_name} openldap-scale
61 ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], additionalParamsForVnf: [ {"member-vnf-index": "${vnf_member_index}", additionalParamsForKdu: [{kdu_name: "${kdu_name}", "additionalParams": {"replicaCount": "${replica_count}"}} ]} ]}
64 Create Simple K8s Scale VNF Descriptor
65 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
67 Create Simple K8s Scale NS Descriptor
68 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
70 Add K8s Cluster To OSM
71 Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name}
73 Create Network Service Instance
74 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
75 Set Suite Variable ${ns_id} ${id}
78 Variable Should Exist ${ns_id} msg=Network service instance is not available
79 ${id}= Get Vnf Id ${ns_id} ${vnf_member_index}
80 Set Suite Variable ${vnf_id} ${id}
83 Variable Should Exist ${vnf_id} msg=VNF instance is not available
84 ${namespace}= Get Vnf Namespace ${vnf_id}
85 Set Suite Variable ${vnf_namespace} ${namespace}
87 Get Scale Count Before Scale Out
88 [Documentation] Get the scale count of the application of network service k8s instance
90 Variable Should Exist ${vnf_namespace} msg=Network service instance is not available
91 ${kdu_count}= Count Pod Number %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${vnf_namespace} ${application_selector}
93 Set Suite Variable ${initial_kdu_count} ${kdu_count}
95 Perform Manual KDU Scale Out
96 [Documentation] Scale out the application of network service k8s instance.
98 ${ns_op_id_1}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT
101 Check Scale Count After Scale Out
102 [Documentation] Check whether the scale count is more than one.
104 Variable Should Exist ${initial_kdu_count} msg=Initial KDU count is not available
105 ${kdu_count}= Count Pod Number %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${vnf_namespace} ${application_selector}
107 Run Keyword Unless ${kdu_count} == ${initial_kdu_count} + 2 Fail msg=There is no new KDU in the model after Scale Out
109 Perform Manual KDU Scale In
110 [Documentation] Scale in the application of network service k8s instance.
112 ${ns_op_id_2}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN
115 Check Scale Count After Scale In
116 [Documentation] Check whether the scale count is one less.
118 ${kdu_count}= Count Pod Number %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${vnf_namespace} ${application_selector}
119 Run Keyword Unless ${kdu_count} == ${initial_kdu_count} Fail msg=There is the same number of KDU in the model after Scale In
121 Delete NS K8s Instance Test
125 Remove K8s Cluster from OSM
127 Delete K8s Cluster ${k8scluster_name}
129 Delete NS Descriptor Test
131 Delete NSD ${nsd_name}
133 Delete VNF Descriptor Test
135 Delete VNFD ${vnfd_name}
140 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
141 Run Keyword If Any Tests Failed Delete NS ${ns_name}
142 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
143 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}
144 Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name}