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
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/package_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/juju_lib.robot
30 Variables %{ROBOT_DEVOPS_FOLDER}/resources/k8s_08-simple_k8s_scaling_data.py
32 Force Tags k8s_08 cluster_k8s daily regression sanity
34 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
39 ${model_name} ${EMPTY}
40 ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
42 ${vnf_member_index} native_k8s_scale_charm-vnf
43 ${action_name} changecontent
44 ${kdu_name} native-kdu
45 ${application_name} nginx
48 Create Simple K8s Scale VNF Descriptor
49 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
51 Create Simple K8s Scale NS Descriptor
52 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
54 Add K8s Cluster To OSM
55 Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name}
57 Network Service K8s Instance Test
58 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
59 Set Suite Variable ${ns_id} ${id}
62 [Documentation] Get the model name of the network service k8s instance
64 Variable Should Exist ${ns_id} msg=Network service instance is not available
65 ${name}= Get Model Name ${ns_id} ${kdu_name}
66 Set Suite Variable ${model_name} ${name}
68 Get Scale Count Before Scale Out
69 [Documentation] Get the scale count of the application of network service k8s instance
71 Variable Should Exist ${model_name} msg=Model name is not available
72 ${kdu_count}= Get Scale Number ${application_name} ${model_name}
73 Set Suite Variable ${initial_kdu_count} ${kdu_count}
75 Perform Manual KDU Scale Out
76 [Documentation] Scale out the application of network service k8s instance.
78 ${ns_op_id_2}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT
80 Check Scale Count After Scale Out
81 [Documentation] Check whether the scale count is more than one.
83 Variable Should Exist ${initial_kdu_count} msg=Initial KDU count is not available
84 ${kdu_count}= Get Scale Number ${application_name} ${model_name}
85 Run Keyword Unless ${kdu_count} == ${initial_kdu_count} + 1 Fail msg=There is no new KDU in the model after Scale Out
87 Perform Manual KDU Scale In
88 [Documentation] Scale in the application of network service k8s instance.
90 ${ns_op_id_3}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN
92 Check Scale Count After Scale In
93 [Documentation] Check whether the scale count is one less.
95 ${kdu_count}= Get Scale Number ${application_name} ${model_name}
96 Run Keyword Unless ${kdu_count} == ${initial_kdu_count} Fail msg=There is the same number of KDU in the model after Scale In
98 Delete NS K8s Instance Test
102 Remove K8s Cluster from OSM
104 Delete K8s Cluster ${k8scluster_name}
106 Delete NS Descriptor Test
108 Delete NSD ${nsd_name}
110 Delete VNF Descriptor Test
112 Delete VNFD ${vnfd_name}
114 Delete VNF NS Packages
116 Delete Package '%{PACKAGES_FOLDER}/${vnfd_pkg}'
117 Delete Package '%{PACKAGES_FOLDER}/${nsd_pkg}'
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}
126 Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name}