X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Ftests.git;a=blobdiff_plain;f=robot-systest%2Ftestsuite%2Fk8s_01-create_k8s_cluster.robot;fp=robot-systest%2Ftestsuite%2Fk8s_01-create_k8s_cluster.robot;h=899aed4faa21d2d417ab41c401803720f66b344b;hp=b87a174fa04ce3ca8017be3ff8ec44995444e6ab;hb=23ff8f980f66ef57fb4d254336a018e3a697a187;hpb=5e001f506b744021d5ef25999c9da28cf56d8fbc diff --git a/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot b/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot index b87a174..899aed4 100644 --- a/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot +++ b/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot @@ -1,4 +1,3 @@ -*** Comments *** # Copyright 2020 Canonical Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - *** Settings *** Documentation [K8s-01] Create K8s cluster. @@ -22,135 +20,148 @@ Library String Library Collections Library Process Library SSHLibrary -Library ../lib/renderTemplate.py +Library %{ROBOT_DEVOPS_FOLDER}/lib/renderTemplate.py -Resource ../lib/vnfd_lib.resource -Resource ../lib/nsd_lib.resource -Resource ../lib/ns_lib.resource -Resource ../lib/ssh_lib.resource +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Test Tags k8s_01 cluster_k8s +Force Tags k8s_01 cluster_k8s Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package files -${VNFD_PKG1} k8s_jujucontroller_vnf.tar.gz -${VNFD_PKG2} k8s_jujumachine_vnf.tar.gz -${NSD_PKG} k8s_juju_ns.tar.gz -${VNFD_NAME1} k8s_jujucontroller_vnf -${VNFD_NAME2} k8s_jujumachine_vnf -${NSD_NAME} k8s_juju +${vnfd_pkg1} k8s_jujucontroller_vnf.tar.gz +${vnfd_pkg2} k8s_jujumachine_vnf.tar.gz +${nsd_pkg} k8s_juju_ns.tar.gz +${vnfd_name1} k8s_jujucontroller_vnf +${vnfd_name2} k8s_jujumachine_vnf +${nsd_name} k8s_juju # VNF Member indexes -${VNF_MEMBER_INDEX_1} k8s_vnf1 -${VNF_MEMBER_INDEX_2} k8s_vnf2 -${VNF_MEMBER_INDEX_3} k8s_vnf3 -${VNF_MEMBER_INDEX_4} k8s_vnf4 -${VNF_MEMBER_INDEX_5} k8s_juju +${vnf_member_index_1} k8s_vnf1 +${vnf_member_index_2} k8s_vnf2 +${vnf_member_index_3} k8s_vnf3 +${vnf_member_index_4} k8s_vnf4 +${vnf_member_index_5} k8s_juju + +# Username +${username} ubuntu # Kubeconfig file -${KUBECONFIG_FILE} /home/ubuntu/.kube/config +${kubeconfig_file} /home/ubuntu/.kube/config # NS instance name -${NS_NAME} k8s-cluster +${ns_name} k8s-cluster # SSH keys and username to be used -${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub -${PRIVATEKEY} %{HOME}/.ssh/id_rsa -${USERNAME} ubuntu -${PASSWORD} ${EMPTY} +${publickey} %{HOME}/.ssh/id_rsa.pub +${privatekey} %{HOME}/.ssh/id_rsa +${username} ubuntu +${password} ${EMPTY} # Template and config file to use -${TEMPLATE} k8s_juju_template.yaml -${CONFIG_FILE} config.yaml +${template} k8s_juju_template.yaml +${config_file} config.yaml *** Test Cases *** Render a template - [Documentation] Generate from a template the instantiation parameters that will be used for the NS instance. - ${stdout}= Render Template ../resources/${TEMPLATE} ../resources/${CONFIG_FILE} IP_VM1=%{IP_VM1} IP_VM2=%{IP_VM2} IP_VM3=%{IP_VM3} IP_VM4=%{IP_VM4} IP_JUJU=%{IP_JUJU} NETWORK=%{VIM_MGMT_NET} + + ${stdout}= Render template %{ROBOT_DEVOPS_FOLDER}/resources/${template} %{ROBOT_DEVOPS_FOLDER}/resources/${config_file} IP_VM1=%{IP_VM1} IP_VM2=%{IP_VM2} IP_VM3=%{IP_VM3} IP_VM4=%{IP_VM4} IP_JUJU=%{IP_JUJU} NETWORK=%{VIM_MGMT_NET} Log To Console \n${stdout} + Create Controller VNF Descriptor - [Documentation] Upload first VNF package for the testsuite. - Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG1}' + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg1}' + Create Machines VNF Descriptor - [Documentation] Upload second VNF package for the testsuite. - Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG2}' + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg2}' + Create K8s Cluster NS Descriptor - [Documentation] Upload NS package for the testsuite. - Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + Instantiate K8s Cluster Network Service - [Documentation] Instantiate NS for the testsuite. - ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ns_config=${EMPTY} publickey=${PUBLICKEY} ns_launch_max_wait_time=70min config_file=%{ROBOT_DEVOPS_FOLDER}/resources/${CONFIG_FILE} - Set Suite Variable ${NS_ID} ${id} + + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ns_config=${EMPTY} publickey=${publickey} ns_launch_max_wait_time=70min config_file=%{ROBOT_DEVOPS_FOLDER}/resources/${config_file} + Set Suite Variable ${ns_id} ${id} + Get Management Ip Addresses - [Documentation] Get the mgmt IP addresses of the five VNF of the NS. - ${ip_addr_1}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} + + ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} Log ${ip_addr_1} - Set Suite Variable ${VNF_1_IP_ADDR} ${ip_addr_1} - ${ip_addr_2}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} + Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1} + ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} Log ${ip_addr_2} - Set Suite Variable ${VNF_2_IP_ADDR} ${ip_addr_2} - ${ip_addr_3}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_3} + Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2} + ${ip_addr_3} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_3} Log ${ip_addr_3} - Set Suite Variable ${VNF_3_IP_ADDR} ${ip_addr_3} - ${ip_addr_4}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_4} + Set Suite Variable ${vnf_3_ip_addr} ${ip_addr_3} + ${ip_addr_4} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_4} Log ${ip_addr_4} - Set Suite Variable ${VNF_4_IP_ADDR} ${ip_addr_4} - ${ip_addr_5}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_5} + Set Suite Variable ${vnf_4_ip_addr} ${ip_addr_4} + ${ip_addr_5} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_5} Log ${ip_addr_5} - Set Suite Variable ${VNF_5_IP_ADDR} ${ip_addr_5} + Set Suite Variable ${vnf_5_ip_addr} ${ip_addr_5} + Test SSH Access - [Documentation] Check that the five VNF are accessible via SSH in their respective mgmt IP address. - Variable Should Exist ${VNF_1_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_1}' is not available - Variable Should Exist ${VNF_2_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_2}' is not available - Variable Should Exist ${VNF_3_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_3}' is not available - Variable Should Exist ${VNF_4_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_4}' is not available - Variable Should Exist ${VNF_5_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_5}' is not available + + Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available + Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available + Variable Should Exist ${vnf_3_ip_addr} msg=IP address of the management VNF '${vnf_member_index_3}' is not available + Variable Should Exist ${vnf_4_ip_addr} msg=IP address of the management VNF '${vnf_member_index_4}' is not available + Variable Should Exist ${vnf_5_ip_addr} msg=IP address of the management VNF '${vnf_member_index_5}' is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} - Test SSH Connection ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} - Test SSH Connection ${VNF_3_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} - Test SSH Connection ${VNF_4_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} - Test SSH Connection ${VNF_5_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} + Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey} + Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey} + Test SSH Connection ${vnf_3_ip_addr} ${username} ${password} ${privatekey} + Test SSH Connection ${vnf_4_ip_addr} ${username} ${password} ${privatekey} + Test SSH Connection ${vnf_5_ip_addr} ${username} ${password} ${privatekey} + + +Check kubeconfig file + + Check If remote File Exists ${vnf_5_ip_addr} ${username} ${password} ${privatekey} ${kubeconfig_file} -Check Kubeconfig File - [Documentation] Check that the Kubeconfig file of the provisioned cluster is present in the VNF. - Check If Remote File Exists ${VNF_5_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${KUBECONFIG_FILE} Delete NS Instance - [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${NS_NAME} + + Delete NS ${ns_name} + Delete NS Descriptor - [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${NSD_NAME} + + Delete NSD ${nsd_name} + Delete Controller VNF Descriptor - [Documentation] Delete first VNF package from OSM. [Tags] cleanup - Delete VNFD ${VNFD_NAME1} + + Delete VNFD ${vnfd_name1} Delete Machines VNF Descriptor - [Documentation] Delete second VNF package from OSM. [Tags] cleanup - Delete VNFD ${VNFD_NAME2} + + Delete VNFD ${vnfd_name2} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - Run Keyword If Any Tests Failed Delete NS ${NS_NAME} - Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} - Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME1} - Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME2} + + Run Keyword If Any Tests Failed Delete NS ${ns_name} + Run Keyword If Any Tests Failed Delete NSD ${nsd_name} + Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}