2 Suite Setup Coe.Start Suite
3 Suite Teardown Coe.Stop Suite
4 Test Teardown Coe.Tear Down
8 Resource ../../libraries/Coe.robot
9 Resource ../../libraries/DataModels.robot
10 Resource ../../libraries/SSHKeywords.robot
11 Resource ../../libraries/Utils.robot
12 Resource ../../variables/netvirt/Variables.robot
13 Resource ../../variables/Variables.robot
16 ${BUSY_BOX} ${CURDIR}/../../variables/coe/busy-box.yaml
17 ${VARIABLES_PATH} ${CURDIR}/../../variables/coe
18 @{BB_NAMES} busybox1 busybox2 busybox3 busybox4
19 @{BUSY_BOXES} busy-box-1.yaml busy-box-2.yaml busy-box-3.yaml busy-box-4.yaml
22 Verify L2 Connectivity Between Pods
23 [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.
24 Create Pods ssd ${BUSY_BOXES[0]} ${BB_NAMES[0]}
25 Create Pods ssd ${BUSY_BOXES[1]} ${BB_NAMES[1]}
26 BuiltIn.Wait Until Keyword Succeeds 55s 2s Coe.Check Pod Status Is Running
29 Verify L3 Connectivity Between Pods
30 [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.
31 ... 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.
32 ... For the pod to be eligible to run on a node, the node must have each of the indicated key-value pairs as labels.
33 Create Pods ssd ${BUSY_BOXES[2]} ${BB_NAMES[2]}
34 Create Pods ssl ${BUSY_BOXES[3]} ${BB_NAMES[3]}
35 BuiltIn.Wait Until Keyword Succeeds 55s 2s Coe.Check Pod Status Is Running
40 [Arguments] ${label} ${yaml} ${name}
41 [Documentation] Creates pods using the labels of the nodes and busy box names passed as arguments.
42 ${busybox} = OperatingSystem.Get File ${BUSY_BOX}
43 ${busybox} = String.Replace String ${busybox} string ${label}
44 ${busybox} = String.Replace String ${busybox} busyboxname ${name}
45 OperatingSystem.Create File ${VARIABLES_PATH}/${yaml} ${busybox}
46 SSHKeywords.Move_file_To_Remote_System ${K8s_MASTER_IP} ${VARIABLES_PATH}/${yaml} ${USER_HOME}
47 Utils.Run Command On Remote System And Log ${K8s_MASTER_IP} kubectl create -f ${yaml}
50 [Documentation] Ping pods to check connectivity between them
51 ${lines} = Utils.Run Command On Remote System ${K8s_MASTER_IP} kubectl get pods -o wide
52 ${pod_name} = String.Get Line ${lines} 1
53 ${pod_name} = Builtin.Should Match Regexp ${pod_name} ^\\w+
54 @{lines} = String.Split To Lines ${lines} 2
55 : FOR ${status} IN @{lines}
56 \ ${pod_ip} = Builtin.Should Match Regexp ${status} \\d+.\\d+.\\d+.\\d+
57 \ ${ping} = Utils.Run Command On Remote System And Log ${K8s_MASTER_IP} kubectl exec -it ${pod_name} -- ping -c 3 ${pod_ip}
58 \ Builtin.Should Match Regexp ${ping} ${PING_REGEXP}