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
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 Documentation [K8s-08] Simple K8s Scale.
18 Library OperatingSystem
24 Resource ../lib/vnfd_lib.resource
25 Resource ../lib/nsd_lib.resource
26 Resource ../lib/ns_lib.resource
27 Resource ../lib/ns_operation_lib.resource
28 Resource ../lib/ssh_lib.resource
29 Resource ../lib/k8scluster_lib.resource
30 Resource ../lib/juju_lib.resource
32 Test Tags k8s_08 cluster_k8s regression azure
34 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
38 # NS and VNF descriptor package folder and ids
39 ${VNFD_PKG} charm-packages/native_k8s_scale_charm_vnf
40 ${VNFD_NAME} native_k8s_scale_charm-vnf
41 ${NSD_PKG} charm-packages/native_k8s_scale_charm_ns
42 ${NSD_NAME} native_k8s_scale_charm-ns
44 ${KDU_NAME} native-kdu
45 ${APPLICATION_NAME} nginx
46 ${VNF_MEMBER_INDEX} native_k8s_scale_charm-vnf
47 ${INSTANTIATION_COUNT} 2
49 # NS instance name and configuration
50 ${NS_NAME} native-k8s-scale
51 ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], additionalParamsForVnf: [{member-vnf-index: ${VNF_MEMBER_INDEX}, additionalParamsForKdu: [{ kdu_name: ${KDU_NAME}, additionalParams: { overlay: { applications: { ${APPLICATION_NAME}: { scale: ${INSTANTIATION_COUNT} } }}}}]}]}
53 ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
55 # Username and SSH private key for accessing OSM host
58 ${PRIVATEKEY} %{OSM_RSA_FILE}
60 ${MODEL_NAME} ${EMPTY}
61 ${ACTION_NAME} changecontent
62 ${SCALING_GROUP} scale-kdu
66 Create Simple K8s Scale VNF Descriptor
67 [Documentation] Upload VNF package for the testsuite.
68 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
70 Create Simple K8s Scale NS Descriptor
71 [Documentation] Upload NS package for the testsuite.
72 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
74 Network Service K8s Instance Test
75 [Documentation] Instantiate NS for the testsuite.
76 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY}
77 Set Suite Variable ${NS_ID} ${id}
80 [Documentation] Get the model name of the network service k8s instance
81 Variable Should Exist ${NS_ID} msg=Network service instance is not available
82 ${name}= Get Model Name %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${NS_ID} ${KDU_NAME}
83 Set Suite Variable ${MODEL_NAME} ${name}
85 Get Scale Count Before Scale Out
86 [Documentation] Get the scale count of the application of network service k8s instance
87 Variable Should Exist ${MODEL_NAME} msg=Model name is not available
88 ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${APPLICATION_NAME} ${MODEL_NAME}
89 Set Suite Variable ${INITIAL_KDU_COUNT} ${kdu_count}
90 IF ${INITIAL_KDU_COUNT} != ${INSTANTIATION_COUNT} Fail msg=Instantiation parameters were not applied.
92 Perform Manual KDU Scale Out
93 [Documentation] Scale out the application of network service k8s instance.
94 ${ns_op_id_2}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_OUT
97 Check Scale Count After Scale Out
98 [Documentation] Check whether the scale count is more than one.
100 Variable Should Exist ${INITIAL_KDU_COUNT} msg=Initial KDU count is not available
101 ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${APPLICATION_NAME} ${MODEL_NAME}
102 IF ${kdu_count} != ${INITIAL_KDU_COUNT} + 1 Fail msg=There is no new KDU in the model after Scale Out
104 Perform Manual KDU Scale In
105 [Documentation] Scale in the application of network service k8s instance.
106 ${ns_op_id_3}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_IN
109 Check Scale Count After Scale In
110 [Documentation] Check whether the scale count is one less.
111 ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${APPLICATION_NAME} ${MODEL_NAME}
112 IF ${kdu_count} != ${INITIAL_KDU_COUNT} Fail msg=There is the same number of KDU in the model after Scale In
114 Delete NS K8s Instance Test
115 [Documentation] Delete NS instance.
119 Delete NS Descriptor Test
120 [Documentation] Delete NS package from OSM.
122 Delete NSD ${NSD_NAME}
124 Delete VNF Descriptor Test
125 [Documentation] Delete NF package from OSM.
127 Delete VNFD ${VNFD_NAME}
132 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
133 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
134 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
135 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}