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-08] Simple 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/ssh_lib.robot
26 Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot
27 Resource %{ROBOT_DEVOPS_FOLDER}/lib/juju_lib.robot
29 Force Tags k8s_08 cluster_k8s daily regression
31 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
35 # NS and VNF descriptor package folder and ids
36 ${vnfd_pkg} charm-packages/native_k8s_scale_charm_vnf
37 ${vnfd_name} native_k8s_scale_charm-vnf
38 ${nsd_pkg} charm-packages/native_k8s_scale_charm_ns
39 ${nsd_name} native_k8s_scale_charm-ns
41 # NS instance name and configuration
42 ${ns_name} native-k8s-scale
43 ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
45 ${publickey} %{HOME}/.ssh/id_rsa.pub
47 # Username and SSH private key for accessing OSM host
50 ${privatekey} %{OSM_RSA_FILE}
52 ${model_name} ${EMPTY}
53 ${vnf_member_index} native_k8s_scale_charm-vnf
54 ${action_name} changecontent
55 ${kdu_name} native-kdu
56 ${application_name} nginx
57 ${scaling_group} scale-kdu
60 Create Simple K8s Scale VNF Descriptor
61 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
63 Create Simple K8s Scale NS Descriptor
64 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
66 Network Service K8s Instance Test
67 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
68 Set Suite Variable ${ns_id} ${id}
71 [Documentation] Get the model name of the network service k8s instance
73 Variable Should Exist ${ns_id} msg=Network service instance is not available
74 ${name}= Get Model Name %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${ns_id} ${kdu_name}
75 Set Suite Variable ${model_name} ${name}
77 Get Scale Count Before Scale Out
78 [Documentation] Get the scale count of the application of network service k8s instance
80 Variable Should Exist ${model_name} msg=Model name is not available
81 ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${application_name} ${model_name}
82 Set Suite Variable ${initial_kdu_count} ${kdu_count}
84 Perform Manual KDU Scale Out
85 [Documentation] Scale out the application of network service k8s instance.
87 ${ns_op_id_2}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT
89 Check Scale Count After Scale Out
90 [Documentation] Check whether the scale count is more than one.
92 Variable Should Exist ${initial_kdu_count} msg=Initial KDU count is not available
93 ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${application_name} ${model_name}
94 Run Keyword If ${kdu_count} != ${initial_kdu_count} + 1 Fail msg=There is no new KDU in the model after Scale Out
96 Perform Manual KDU Scale In
97 [Documentation] Scale in the application of network service k8s instance.
99 ${ns_op_id_3}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN
101 Check Scale Count After Scale In
102 [Documentation] Check whether the scale count is one less.
104 ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${application_name} ${model_name}
105 Run Keyword If ${kdu_count} != ${initial_kdu_count} Fail msg=There is the same number of KDU in the model after Scale In
107 Delete NS K8s Instance Test
111 Delete NS Descriptor Test
113 Delete NSD ${nsd_name}
115 Delete VNF Descriptor Test
117 Delete VNFD ${vnfd_name}
122 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
123 Run Keyword If Any Tests Failed Delete NS ${ns_name}
124 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
125 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}