X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Ftestsuite%2Fk8s_01-create_k8s_cluster.robot;h=b87a174fa04ce3ca8017be3ff8ec44995444e6ab;hb=HEAD;hp=a49bbd301629f640f38bc1b8f27caff9616ac1b9;hpb=c0b3a8e31b493a7d4091562f3757e8fa6d724ba6;p=osm%2Ftests.git diff --git a/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot b/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot index a49bbd3..b87a174 100644 --- a/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot +++ b/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot @@ -1,3 +1,4 @@ +*** Comments *** # Copyright 2020 Canonical Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,119 +13,144 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** -Documentation [K8s-01] Create K8s cluster. +Documentation [K8s-01] Create K8s cluster. Library OperatingSystem Library String Library Collections Library Process Library SSHLibrary -Library %{ROBOT_DEVOPS_FOLDER}/lib/renderTemplate.py - -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 +Library ../lib/renderTemplate.py -Variables %{ROBOT_DEVOPS_FOLDER}/resources/k8s_01-create_k8s_cluster_data.py +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags k8s_01 cluster_k8s regression +Test Tags k8s_01 cluster_k8s Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** -${username} ubuntu -${password} ${EMPTY} +# 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 + +# 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 + +# Kubeconfig file +${KUBECONFIG_FILE} /home/ubuntu/.kube/config + +# NS instance name +${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} + +# Template and config file to use +${TEMPLATE} k8s_juju_template.yaml +${CONFIG_FILE} config.yaml *** Test Cases *** Render a template - - ${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} + [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} + Log To Console \n${stdout} Create Controller VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg1}' + [Documentation] Upload first VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG1}' Create Machines VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg2}' + [Documentation] Upload second VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG2}' Create K8s Cluster NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate K8s Cluster Network Service - - ${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} + [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} Get Management Ip Addresses - - ${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} - 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} - 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} - 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} - log ${ip_addr_5} - Set Suite Variable ${vnf_5_ip_addr} ${ip_addr_5} + [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} + 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} + 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} + 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} + 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} + Log ${ip_addr_5} + Set Suite Variable ${VNF_5_IP_ADDR} ${ip_addr_5} Test SSH Access - - 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} - -Check kubeconfig file - - Check If remote File Exists ${vnf_5_ip_addr} ${username} ${password} ${privatekey} ${kubeconfig_file} + [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 + 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} + +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_name} + [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}