From: Karthika Panneer Date: Tue, 3 Jul 2018 05:47:10 +0000 (-0700) Subject: Scalability Of Pods In COE X-Git-Tag: pre-potassium~495 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=integration%2Ftest.git;a=commitdiff_plain;h=f293d3caad347994663c0750cbf6b790b404522b Scalability Of Pods In COE Change-Id: I9047165c62bca08f9d7c6b586ffec35ce3316bb8 Signed-off-by: Karthika Panneer --- 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 diff --git a/csit/suites/coe/Pod_Connectivity.robot b/csit/suites/coe/Pod_Connectivity.robot deleted file mode 100644 index 87a2b1062a..0000000000 --- a/csit/suites/coe/Pod_Connectivity.robot +++ /dev/null @@ -1,58 +0,0 @@ -*** Settings *** -Suite Setup Coe.Start Suite -Suite Teardown Coe.Stop Suite -Test Teardown Coe.Tear Down -Library BuiltIn -Library SSHLibrary -Library String -Resource ../../libraries/Coe.robot -Resource ../../libraries/DataModels.robot -Resource ../../libraries/SSHKeywords.robot -Resource ../../libraries/Utils.robot -Resource ../../variables/netvirt/Variables.robot -Resource ../../variables/Variables.robot - -*** Variables *** -${BUSY_BOX} ${CURDIR}/../../variables/coe/busy-box.yaml -${VARIABLES_PATH} ${CURDIR}/../../variables/coe -@{BB_NAMES} busybox1 busybox2 busybox3 busybox4 -@{BUSY_BOXES} busy-box-1.yaml busy-box-2.yaml busy-box-3.yaml busy-box-4.yaml - -*** Test Cases *** -Verify L2 Connectivity Between Pods - [Documentation] This testcase verifies the connectivity between pods brought up on the same node.Pods are brought on the same node by using the same node selector in busybox.yaml files. - Create Pods ssd ${BUSY_BOXES[0]} ${BB_NAMES[0]} - Create Pods ssd ${BUSY_BOXES[1]} ${BB_NAMES[1]} - BuiltIn.Wait Until Keyword Succeeds 55s 2s Coe.Check Pod Status Is Running - Ping Pods - -Verify L3 Connectivity Between Pods - [Documentation] This testcase verifies the connectivity between pods brought up on different nodes.Nodes are given different labels(eg : ssd,ssl) through Coe.Label Nodes keyword. - ... These labels are also inlcuded as node selectors in busybox.yaml files ,thus the pods are placed on the desired nodes avoiding random allocation of pods. - ... For the pod to be eligible to run on a node, the node must have each of the indicated key-value pairs as labels. - Create Pods ssd ${BUSY_BOXES[2]} ${BB_NAMES[2]} - Create Pods ssl ${BUSY_BOXES[3]} ${BB_NAMES[3]} - BuiltIn.Wait Until Keyword Succeeds 55s 2s Coe.Check Pod Status Is Running - Ping Pods - -*** Keywords *** -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} - -Ping Pods - [Documentation] Ping pods to check connectivity between them - ${lines} = Utils.Run Command On Remote System ${K8s_MASTER_IP} kubectl get pods -o wide - ${pod_name} = String.Get Line ${lines} 1 - ${pod_name} = Builtin.Should Match Regexp ${pod_name} ^\\w+ - @{lines} = String.Split To Lines ${lines} 2 - : FOR ${status} IN @{lines} - \ ${pod_ip} = Builtin.Should Match Regexp ${status} \\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} diff --git a/csit/suites/coe/Pods_Basic_Connectivity_Tests.robot b/csit/suites/coe/Pods_Basic_Connectivity_Tests.robot new file mode 100644 index 0000000000..76703197cb --- /dev/null +++ b/csit/suites/coe/Pods_Basic_Connectivity_Tests.robot @@ -0,0 +1,34 @@ +*** Settings *** +Suite Setup Coe Suite Setup +Suite Teardown Coe Suite Teardown +Test Teardown Coe.Tear Down +Library BuiltIn +Library SSHLibrary +Library String +Resource ../../libraries/Coe.robot +Resource ../../libraries/DataModels.robot +Resource ../../libraries/SSHKeywords.robot +Resource ../../libraries/Utils.robot +Resource ../../variables/netvirt/Variables.robot +Resource ../../variables/Variables.robot + +*** Variables *** +@{BB_NAMES} busybox1 busybox2 busybox3 busybox4 +@{BUSY_BOXES} busy-box-1.yaml busy-box-2.yaml busy-box-3.yaml busy-box-4.yaml + +*** Test Cases *** +Verify L2 Connectivity Between Pods + [Documentation] This testcase verifies the connectivity between pods brought up on the same node.Pods are brought on the same node by using the same node selector in busybox.yaml files. + Coe.Create Pods ssd ${BUSY_BOXES[0]} ${BB_NAMES[0]} + Coe.Create Pods ssd ${BUSY_BOXES[1]} ${BB_NAMES[1]} + BuiltIn.Wait Until Keyword Succeeds 55s 2s Coe.Check Pod Status Is Running + Coe.Collect Pod Names and Ping + +Verify L3 Connectivity Between Pods + [Documentation] This testcase verifies the connectivity between pods brought up on different nodes.Nodes are given different labels(eg : ssd,ssl) through Coe.Label Nodes keyword. + ... These labels are also inlcuded as node selectors in busybox.yaml files ,thus the pods are placed on the desired nodes avoiding random allocation of pods. + ... For the pod to be eligible to run on a node, the node must have each of the indicated key-value pairs as labels. + Coe.Create Pods ssd ${BUSY_BOXES[2]} ${BB_NAMES[2]} + Coe.Create Pods ssl ${BUSY_BOXES[3]} ${BB_NAMES[3]} + BuiltIn.Wait Until Keyword Succeeds 55s 2s Coe.Check Pod Status Is Running + Coe.Collect Pod Names and Ping diff --git a/csit/suites/coe/Pods_Scalability_Tests.robot b/csit/suites/coe/Pods_Scalability_Tests.robot new file mode 100644 index 0000000000..f63f84f5f9 --- /dev/null +++ b/csit/suites/coe/Pods_Scalability_Tests.robot @@ -0,0 +1,24 @@ +*** Settings *** +Suite Setup Coe Suite Setup +Suite Teardown Coe Suite Teardown +Test Teardown Coe.Tear Down +Library BuiltIn +Library SSHLibrary +Library String +Resource ../../libraries/Coe.robot +Resource ../../libraries/DataModels.robot +Resource ../../libraries/SSHKeywords.robot +Resource ../../libraries/Utils.robot +Resource ../../variables/netvirt/Variables.robot +Resource ../../variables/Variables.robot + +*** Variables *** +${NO_OF_PODS_PER_VM} 15 + +*** Test Cases *** +Verify Connectivity Between Pods + : FOR ${i} IN RANGE 1 ${NO_OF_PODS_PER_VM}+1 + \ Coe.Create Pods ssd busybox${i}.yaml busybox${i} + \ Coe.Create Pods ssl pod${i}.yaml pod${i} + BuiltIn.Wait Until Keyword Succeeds 55s 2s Coe.Check Pod Status Is Running + Coe.Collect Pod Names and Ping diff --git a/csit/testplans/coe-container-networking.txt b/csit/testplans/coe-container-networking.txt index f2927f8af4..d4be19971c 100644 --- a/csit/testplans/coe-container-networking.txt +++ b/csit/testplans/coe-container-networking.txt @@ -1,3 +1,3 @@ # Place the suites in run order: -integration/test/csit/suites/coe/Pod_Connectivity.robot - +integration/test/csit/suites/coe/Pods_Basic_Connectivity_Tests.robot +integration/test/csit/suites/coe/Pods_Scalability_Tests.robot