X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FCoe.robot;h=7bb457cb1b53eb5f040170403d48194c5d001291;hb=f293d3caad347994663c0750cbf6b790b404522b;hp=d4d2cd47d72c2b984e7ffb9fde58855561ba64a6;hpb=f5adb00565ca89be0a42cf6b90090d8c8c7973a5;p=integration%2Ftest.git diff --git a/csit/libraries/Coe.robot b/csit/libraries/Coe.robot index d4d2cd47d7..7bb457cb1b 100644 --- a/csit/libraries/Coe.robot +++ b/csit/libraries/Coe.robot @@ -14,6 +14,7 @@ Variables ../variables/coe/Modules.py Variables ../variables/netvirt/Modules.py *** Variables *** +${BUSY_BOX} ${CURDIR}/../variables/coe/busy-box.yaml ${CNI_BINARY_FILE} /opt/cni/bin/odlovs-cni ${CONFIG_FILE} /etc/cni/net.d/odlovs-cni.conf ${CONFIG_FILE_TEMPLATE} ${CURDIR}/../variables/coe/odlovs-cni.conf.j2 @@ -27,6 +28,7 @@ ${POD_RUNNING_STATUS} \\sRunning ${WATCHER_COE} ${CURDIR}/../variables/coe/coe.yaml @{NODE_IPs} ${K8s_MASTER_IP} ${K8s_MINION1_IP} ${K8s_MINION2_IP} @{COE_DIAG_SERVICES} OPENFLOW IFM ITM DATASTORE ELAN OVSDB +${VARIABLES_PATH} ${CURDIR}/../variables/coe *** Keywords *** Start Suite @@ -58,7 +60,7 @@ Configuration Playbook ${watcher} = String.Replace String ${watcher} port ${RESTCONFPORT} OperatingSystem.Create File ${WATCHER_COE} ${watcher} SSHKeywords.Copy_File_To_Remote_System ${K8s_MASTER_IP} ${WATCHER_COE} ${USER_HOME} - OperatingSystem.Move File ${PLAYBOOK} ${USER_HOME} + OperatingSystem.Copy File ${PLAYBOOK} ${USER_HOME} ${play_output} = OperatingSystem.Run ansible-playbook ${USER_HOME}/coe_play.yaml -i ${USER_HOME}/hosts.yaml BuiltIn.Log ${play_output} @@ -66,16 +68,16 @@ Set Connection ids and Bridge [Documentation] Sets the connection ids for all the nodes and get the bridge from configuration file . ${conn_id_1} = SSHLibrary.Open Connection ${K8s_MASTER_IP} SSHKeywords.Flexible_SSH_Login ${DEFAULT_USER} ${DEFAULT_PASSWORD} - BuiltIn.Set Suite Variable ${conn_id_1} + BuiltIn.Set Global Variable ${conn_id_1} ${conn_id_2} = SSHLibrary.Open Connection ${K8s_MINION1_IP} SSHKeywords.Flexible_SSH_Login ${DEFAULT_USER} ${DEFAULT_PASSWORD} - BuiltIn.Set Suite Variable ${conn_id_2} + BuiltIn.Set Global Variable ${conn_id_2} ${conn_id_3} = SSHLibrary.Open Connection ${K8s_MINION2_IP} SSHKeywords.Flexible_SSH_Login ${DEFAULT_USER} ${DEFAULT_PASSWORD} - BuiltIn.Set Suite Variable ${conn_id_3} + BuiltIn.Set Global Variable ${conn_id_3} ${file} = OperatingSystem.Get File ${CONFIG_FILE_TEMPLATE} ${line} ${bridge} = Should Match Regexp ${file} "ovsBridge": "(\\w.*)" - BuiltIn.Set Suite Variable ${bridge} + BuiltIn.Set Global Variable ${bridge} Verify Config Files [Documentation] Checks if the configuration files are present in all nodes @@ -184,3 +186,53 @@ Kube reset : FOR ${nodes} IN @{NODE_IPs} \ ${kube} = Utils.Run Command On Remote System And Log ${nodes} sudo kubeadm reset \ BuiltIn.Should Contain ${kube} Stopping the kubelet service. + +Create Pods + [Arguments] ${label} ${yaml} ${name} + [Documentation] Creates pods using the labels of the nodes and busy box names passed as arguments. + ${busybox} = OperatingSystem.Get File ${BUSY_BOX} + ${busybox} = String.Replace String ${busybox} string ${label} + ${busybox} = String.Replace String ${busybox} busyboxname ${name} + OperatingSystem.Create File ${VARIABLES_PATH}/${yaml} ${busybox} + SSHKeywords.Move_file_To_Remote_System ${K8s_MASTER_IP} ${VARIABLES_PATH}/${yaml} ${USER_HOME} + Utils.Run Command On Remote System And Log ${K8s_MASTER_IP} kubectl create -f ${yaml} + +Collect Pod Names and Ping + [Documentation] This keyword collects the pod names and checks connectivity between each and every pod with respect to one another. + ${lines} = Utils.Run Command On Remote System ${K8s_MASTER_IP} kubectl get pods -o wide + @{lines} = String.Split To Lines ${lines} 1 + : FOR ${status} IN @{lines} + \ ${pod_name} = Builtin.Should Match Regexp ${status} ^\\w+ + \ Ping Pods ${pod_name} @{lines} + +Ping Pods + [Arguments] ${pod_name} @{lines} + [Documentation] Ping pods to check connectivity between them + : FOR ${pod ip} IN @{lines} + \ ${status} = Run Keyword And Return Status Should Contain ${pod ip} ${pod_name} + \ BuiltIn.Continue For Loop If ${status} == True + \ ${pod_ip} = Builtin.Should Match Regexp ${pod ip} \\d+.\\d+.\\d+.\\d+ + \ ${ping} = Utils.Run Command On Remote System And Log ${K8s_MASTER_IP} kubectl exec -it ${pod_name} -- ping -c 3 ${pod_ip} + \ Builtin.Should Match Regexp ${ping} ${PING_REGEXP} + +Coe Suite Setup + @{suite names} Get Regexp Matches ${SUITES} coe\\/(\\w+).robot 1 + @{suite names updated} Create List + : FOR ${suites} IN @{suite names} + \ ${suites} Replace String ${suites} _ ${SPACE} + \ Append To List ${suite names updated} ${suites} + ${first suite} = Set Variable ${suite names updated[0]} + ${line} ${current suite} Should Match Regexp ${SUITE_NAME} .txt.(\\w.*) + ${status} = BuiltIn.Evaluate '${first suite}' == '${current suite}' + Run Keyword If '${status}' == 'True' Coe.Start Suite + +Coe Suite Teardown + @{suite names} Get Regexp Matches ${SUITES} coe\\/(\\w+).robot 1 + @{suite names updated} Create List + : FOR ${suites} IN @{suite names} + \ ${suites} Replace String ${suites} _ ${SPACE} + \ Append To List ${suite names updated} ${suites} + ${last suite} = Set Variable ${suite names updated[-1]} + ${line} ${current suite} Should Match Regexp ${SUITE_NAME} .txt.(\\w.*) + ${status} = BuiltIn.Evaluate '${last suite}' == '${current suite}' + Run Keyword If '${status}' == 'True' Coe.Stop Suite