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}
77 Create Network Service Instance
78 [Documentation] Instantiate NS for the testsuite.
79 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY}
80 Set Suite Variable ${NS_ID} ${id}
83 [Documentation] Get VNF identifier from OSM.
84 Variable Should Exist ${NS_ID} msg=Network service instance is not available
85 @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID}
87 Set Suite Variable ${VNF_ID} ${vnfr_list}[0]
89 Get Scale Count Before Scale Out
90 [Documentation] Get the scale count of the application of network service k8s instance
91 Variable Should Exist ${NS_ID} msg=Network service instance is not available
92 ${kdu_count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME}
94 Set Suite Variable ${INITIAL_KDU_COUNT} ${kdu_count}
96 Perform Manual KDU Scale Out
97 [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}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME}
107 IF ${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.
111 ${ns_op_id_2}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_IN
114 Check Scale Count After Scale In
115 [Documentation] Check whether the scale count is one less.
116 ${kdu_count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME}
117 IF ${kdu_count} != ${INITIAL_KDU_COUNT} Fail msg=There is the same number of KDU in the model after Scale In
119 Delete NS K8s Instance Test
120 [Documentation] Delete NS instance.
124 Remove K8s Cluster from OSM
125 [Documentation] Unregister K8s cluster from OSM.
127 Delete K8s Cluster ${K8SCLUSTER_NAME}
129 Delete NS Descriptor Test
130 [Documentation] Delete NS package from OSM.
132 Delete NSD ${NSD_NAME}
134 Delete VNF Descriptor Test
135 [Documentation] Delete NF package from OSM.
137 Delete VNFD ${VNFD_NAME}
142 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
143 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
144 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
145 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}
146 Run Keyword If Any Tests Failed Delete K8s Cluster ${K8SCLUSTER_NAME}