go.ligato.io/vpp-agent/v3@v3.5.0/tests/robot/libraries/kubernetes/Restarts_Setup.robot (about) 1 *** Settings *** 2 Library SSHLibrary 3 Library ${CURDIR}/kube_config_gen.py 4 Resource ${CURDIR}/KubeEnv.robot 5 Resource ${CURDIR}/KubeSetup.robot 6 Resource ${CURDIR}/KubeCtl.robot 7 Resource ${CURDIR}/../SshCommons.robot 8 Documentation Contains keywords uset to setup and teardown test suites 9 ... focused on restart scenarios. 10 11 *** Keywords *** 12 Restarts Suite Setup with ${vnf_count} VNFs at ${memif_per_vnf} memifs each and ${novpp_count} non-VPP containers 13 [Documentation] Clear any existing Kubernetes elements and deploy the topology. 14 ${vnf_count}= BuiltIn.Convert_to_Integer ${vnf_count} 15 ${novpp_count}= BuiltIn.Convert_to_Integer ${novpp_count} 16 Cleanup_Restarts_Deployment_On_Cluster ${testbed_connection} 17 ${topology}= Generate YAML Config Files ${vnf_count} ${novpp_count} ${memif_per_vnf} 18 Set Suite Variable ${topology} 19 Set Suite Variable ${vnf_count} 20 Set Suite Variable ${novpp_count} 21 KubeEnv.Deploy_Etcd_And_Verify_Running ${testbed_connection} 22 KubeEnv.Deploy_Vswitch_Pod_And_Verify_Running ${testbed_connection} 23 KubeEnv.Deploy_VNF_Pods ${testbed_connection} ${vnf_count} 24 KubeEnv.Deploy_NoVPP_Pods ${testbed_connection} ${novpp_count} 25 KubeEnv.Deploy_SFC_Pod_And_Verify_Running ${testbed_connection} 26 Open_Restarts_Connections node_index=1 cluster_id=${CLUSTER_ID} 27 28 Restarts_Suite_Teardown 29 [Documentation] Log leftover output from pods, remove pods, execute common teardown. 30 KubeEnv.Log_Pods_For_Debug ${testbed_connection} exp_nr_vswitch=1 31 Close_Restarts_Connections 32 Cleanup_Restarts_Deployment_On_Cluster ${testbed_connection} 33 KubeSetup.Kubernetes Suite Teardown ${CLUSTER_ID} 34 35 Cleanup_Restarts_Deployment_On_Cluster 36 [Arguments] ${testbed_connection} 37 [Documentation] Delete all Kubernetes elements and wait for completion. 38 SSHLibrary.Switch_Connection ${testbed_connection} 39 SshCommons.Execute_Command_And_Log kubectl delete all --all --namespace=default 40 Wait_Until_Pod_Removed ${testbed_connection} 41 42 Open_Restarts_Connections 43 [Documentation] Open and save SSH connections to ETCD and SFC pods. 44 [Arguments] ${node_index}=1 ${cluster_id}=INTEGRATION1 45 BuiltIn.Log Many ${node_index} ${cluster_id} 46 47 ${etcd_connection}= KubeEnv.Open_Connection_To_Node etcd ${cluster_id} ${node_index} 48 BuiltIn.Set_Suite_Variable ${etcd_connection} 49 KubeEnv.Get_Into_Container_Prompt_In_Pod ${etcd_connection} ${etcd_pod_name} prompt=# 50 51 ${sfc_connection}= KubeEnv.Open_Connection_To_Node sfc ${cluster_id} ${node_index} 52 BuiltIn.Set_Suite_Variable ${sfc_connection} 53 KubeEnv.Get_Into_Container_Prompt_In_Pod ${sfc_connection} ${sfc_pod_name} prompt=# 54 55 Close_Restarts_Connections 56 [Documentation] Close SSH connections to ETCD and SFC pods. 57 BuiltIn.Log Many ${sfc_connection} ${etcd_connection} 58 KubeEnv.Leave_Container_Prompt_In_Pod ${sfc_connection} 59 KubeEnv.Leave_Container_Prompt_In_Pod ${etcd_connection} 60 61 SSHLibrary.Switch_Connection ${sfc_connection} 62 SSHLibrary.Close_Connection 63 SSHLibrary.Switch_Connection ${etcd_connection} 64 SSHLibrary.Close_Connection 65 66 Generate_YAML_Config_Files 67 [Documentation] Generate YAML config files for the desired topology. 68 [Arguments] ${vnf_count} ${novpp_count} ${memif_per_vnf} 69 BuiltIn.Log Many ${vnf_count} ${novpp_count} ${memif_per_vnf} 70 ${topology}= kube_config_gen.generate_config 71 ... ${vnf_count} ${novpp_count} ${memif_per_vnf} 72 ... ${CURDIR}/../../resources/k8-yaml ${K8_GENERATED_CONFIG_FOLDER} 73 ... ${AGENT_VPP_IMAGE_NAME} ${VNF_IMAGE_NAME} ${SFC_CONTROLLER_IMAGE_NAME} 74 [Return] ${topology}