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-11] Simple Helm 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/connectivity_lib.resource
29 Resource ../lib/ssh_lib.resource
30 Resource ../lib/k8scluster_lib.resource
32 Test Tags k8s_11 cluster_k8s
34 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
38 # K8s cluster name and version
39 ${K8SCLUSTER_NAME} k8s11
40 ${K8SCLUSTER_VERSION} v1
42 # NS and VNF descriptor package folder and ids
43 ${VNFD_PKG} openldap_scale_knf
44 ${VNFD_NAME} openldap_scale_knf
45 ${NSD_PKG} openldap_scale_ns
46 ${NSD_NAME} openldap_scale_ns
48 # NS instance name and configuration
49 ${NS_NAME} openldap-scale
50 ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
52 # Username and SSH private key for accessing OSM host
55 ${PRIVATEKEY} %{OSM_RSA_FILE}
58 ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
59 ${VNF_MEMBER_INDEX} openldap
60 ${KDU_NAME} native-kdu
61 ${SCALING_GROUP} scale-kdu
65 Create Simple K8s Scale VNF Descriptor
66 [Documentation] Upload VNF package for the testsuite.
67 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
69 Create Simple K8s Scale NS Descriptor
70 [Documentation] Upload NS package for the testsuite.
71 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
73 Add K8s Cluster To OSM
74 [Documentation] Register K8s cluster in OSM.
75 Create K8s Cluster %{K8S_CREDENTIALS} ${K8SCLUSTER_VERSION} %{VIM_TARGET} %{VIM_MGMT_NET} ${K8SCLUSTER_NAME}
76 Check For K8s Cluster To Be Ready ${K8SCLUSTER_NAME}
78 Create Network Service Instance
79 [Documentation] Instantiate NS for the testsuite.
80 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY}
81 Set Suite Variable ${NS_ID} ${id}
84 [Documentation] Get VNF identifier from OSM.
85 Variable Should Exist ${NS_ID} msg=Network service instance is not available
86 @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID}
88 Set Suite Variable ${VNF_ID} ${vnfr_list}[0]
90 Get Scale Count Before Scale Out
91 [Documentation] Get the scale count of the application of network service k8s instance
92 Variable Should Exist ${NS_ID} msg=Network service instance is not available
93 ${kdu_count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME}
95 Set Suite Variable ${INITIAL_KDU_COUNT} ${kdu_count}
97 Perform Manual KDU Scale Out
98 [Documentation] Scale out the application of network service k8s instance.
99 ${ns_op_id_1}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_OUT
102 Check Scale Count After Scale Out
103 [Documentation] Check whether the scale count is more than one.
105 Variable Should Exist ${INITIAL_KDU_COUNT} msg=Initial KDU count is not available
106 ${kdu_count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME}
108 IF ${kdu_count} != ${INITIAL_KDU_COUNT} + 2 Fail msg=There is no new KDU in the model after Scale Out
110 Perform Manual KDU Scale In
111 [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.
117 ${kdu_count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME}
118 IF ${kdu_count} != ${INITIAL_KDU_COUNT} Fail msg=There is the same number of KDU in the model after Scale In
120 Delete NS K8s Instance Test
121 [Documentation] Delete NS instance.
125 Remove K8s Cluster from OSM
126 [Documentation] Unregister K8s cluster from OSM.
128 Delete K8s Cluster ${K8SCLUSTER_NAME}
130 Delete NS Descriptor Test
131 [Documentation] Delete NS package from OSM.
133 Delete NSD ${NSD_NAME}
135 Delete VNF Descriptor Test
136 [Documentation] Delete NF package from OSM.
138 Delete VNFD ${VNFD_NAME}
143 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
144 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
145 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
146 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}
147 Run Keyword If Any Tests Failed Delete K8s Cluster ${K8SCLUSTER_NAME}