Gunaseelan | ed0eb1b | 2017-08-08 08:12:12 -0500 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 15 | *** Settings *** |
| 16 | Documentation Library for various utilities |
| 17 | Library SSHLibrary |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 18 | Library String |
| 19 | Library DateTime |
| 20 | Library Process |
| 21 | Library Collections |
| 22 | Library RequestsLibrary |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 23 | |
| 24 | *** Keywords *** |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 25 | Login And Run Command On Remote System |
Suchitra Vemuri | 23ddbef | 2019-06-24 17:47:17 -0700 | [diff] [blame] | 26 | [Arguments] ${cmd} ${ip} ${user} ${pass}=${None} ${container_type}=${None} ${container_name}=${None} ${prompt}=~$ ${prompt_timeout}=50s ${container_prompt}=# |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 27 | [Documentation] SSH's into a remote host (and logs into the container if container_type and container_name are specified), tries to switch to root user and executes a command and returns output |
| 28 | ${conn_id} Login To Remote System ${ip} ${user} ${pass} ${container_type} ${container_name} ${prompt} ${prompt_timeout} ${container_prompt} |
| 29 | ${output}= Run Command On Remote System ${cmd} ${conn_id} ${user} ${pass} |
Kailash Khalasi | bf1478b | 2018-10-17 11:58:58 -0700 | [diff] [blame] | 30 | Log ${output} |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 31 | Logout From Remote System ${conn_id} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 32 | [Return] ${output} |
| 33 | |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 34 | Login To Remote System |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 35 | [Arguments] ${ip} ${user} ${pass}=${None} ${container_type}=${None} ${container_name}=${None} ${prompt}=~$ ${prompt_timeout}=15s ${container_prompt}=# |
| 36 | [Documentation] SSH's into a remote host (and logs into the container if container_type and container_name are specified) and returns connection ID |
Kailash Khalasi | c930eac | 2018-09-05 12:18:23 -0700 | [diff] [blame] | 37 | ${conn_id}= SSHLibrary.Open Connection ${ip} prompt=${prompt} timeout=${prompt_timeout} |
You Wang | 59ded6c | 2018-10-05 17:43:44 -0700 | [diff] [blame] | 38 | Run Keyword If '${pass}' != '${None}' SSHLibrary.Login ${user} ${pass} |
| 39 | ... ELSE SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/id_rsa |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 40 | # Login to the lxc container |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 41 | Run Keyword If '${container_type}' == 'LXC' Run Keywords |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 42 | ... SSHLibrary.Write lxc exec ${container_name} /bin/bash AND |
| 43 | ... SSHLibrary.Read Until ${container_prompt} AND |
| 44 | ... SSHLibrary.Set Client Configuration prompt=${container_prompt} |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 45 | # Login to the k8s container |
| 46 | Run Keyword If '${container_type}' == 'K8S' Run Keywords |
| 47 | ... SSHLibrary.Write kubectl -n $(kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}') exec ${container_name} -it /bin/bash AND |
| 48 | ... SSHLibrary.Read Until ${container_prompt} AND |
| 49 | ... SSHLibrary.Set Client Configuration prompt=${container_prompt} |
| 50 | # Try to switch to root user |
| 51 | ${conn}= SSHLibrary.Get Connection ${conn_id} |
| 52 | Run Keyword And Ignore Error SSHLibrary.Write sudo -s |
| 53 | ${output}= SSHLibrary.Read Until Regexp \#|${conn.prompt}|password for ${user}: |
| 54 | Run Keyword If 'password for ${user}:' not in '''${output}''' Return From Keyword ${conn_id} |
| 55 | SSHLibrary.Set Client Configuration prompt=\# |
| 56 | SSHLibrary.Write ${pass} |
| 57 | SSHLibrary.Read Until Prompt |
| 58 | [Return] ${conn_id} |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 59 | |
| 60 | Logout From Remote System |
| 61 | [Arguments] ${conn_id} |
| 62 | [Documentation] Exit from the SSH session to a remote host |
| 63 | SSHLibrary.Switch Connection ${conn_id} |
Kailash Khalasi | c930eac | 2018-09-05 12:18:23 -0700 | [diff] [blame] | 64 | SSHLibrary.Close Connection |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 65 | |
| 66 | Run Command On Remote System |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 67 | [Arguments] ${cmd} ${conn_id} ${user} ${pass}=${None} |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 68 | [Documentation] Executes a command on remote host and returns output |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 69 | ${conn}= SSHLibrary.Get Connection ${conn_id} |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 70 | SSHLibrary.Switch Connection ${conn_id} |
| 71 | SSHLibrary.Write ${cmd} |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 72 | ${output}= SSHLibrary.Read Until Regexp ${conn.prompt}|password for ${user}: |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 73 | Run Keyword If 'password for ${user}:' not in '''${output}''' Return From Keyword ${output} |
| 74 | SSHLibrary.Write ${pass} |
| 75 | ${output}= SSHlibrary.Read Until Prompt |
| 76 | [Return] ${output} |
Kailash Khalasi | c930eac | 2018-09-05 12:18:23 -0700 | [diff] [blame] | 77 | |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 78 | Execute Command on CIAB Server in Specific VM |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 79 | [Arguments] ${system} ${vm} ${cmd} ${user}=${VM_USER} ${password}=${VM_PASS} ${prompt}=$ ${use_key}=True ${strip_line}=True |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 80 | [Documentation] SSHs into ${HOST} where CIAB is running and executes a command in the Prod Vagrant VM where all the containers are running |
| 81 | ${conn_id}= SSHLibrary.Open Connection ${system} prompt=${prompt} timeout=300s |
| 82 | Run Keyword If '${use_key}' == 'False' SSHLibrary.Login ${user} ${pass} ELSE SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/${SSH_KEY} any |
| 83 | SSHLibrary.Write ssh ${vm} |
| 84 | SSHLibrary.Read Until Prompt |
| 85 | SSHLibrary.Write ${cmd} |
| 86 | ${output}= SSHLibrary.Read Until Prompt |
| 87 | SSHLibrary.Close Connection |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 88 | ${output_1}= Run Keyword If '${strip_line}' == 'True' Get Line ${output} 0 |
| 89 | ${output}= Set Variable If '${strip_line}' == 'True' ${output_1} ${output} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 90 | [Return] ${output} |
| 91 | |
| 92 | Execute Command on Compute Node in CIAB |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 93 | [Arguments] ${system} ${node} ${hostname} ${cmd} ${user}=${VM_USER} ${password}=${VM_PASS} ${prompt}=$ ${use_key}=True |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 94 | [Documentation] SSHs into ${HOST} where CIAB is running and executes a command in the Prod Vagrant VM where all the containers are running |
| 95 | ${conn_id}= SSHLibrary.Open Connection ${system} prompt=${prompt} timeout=300s |
| 96 | Run Keyword If '${use_key}' == 'False' SSHLibrary.Login ${user} ${pass} ELSE SSHLibrary.Login With Public Key ${user} %{HOME}/.ssh/${SSH_KEY} any |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 97 | SSHLibrary.Write ssh ${node} |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 98 | SSHLibrary.Read Until Prompt |
| 99 | SSHLibrary.Write ssh root@${hostname} |
| 100 | SSHLibrary.Read Until \# |
| 101 | SSHLibrary.Write ${cmd} |
| 102 | ${output}= SSHLibrary.Read Until \# |
| 103 | SSHLibrary.Close Connection |
| 104 | [Return] ${output} |
| 105 | |
Kailash Khalasi | 3a4e0f5 | 2017-06-01 16:35:59 -0700 | [diff] [blame] | 106 | Execute Command Locally |
| 107 | [Arguments] ${cmd} |
| 108 | ${output}= Run ${cmd} |
| 109 | [Return] ${output} |
| 110 | |
Kailash Khalasi | 2f567a4 | 2017-09-27 13:50:05 -0700 | [diff] [blame] | 111 | Execute ONOS Command |
| 112 | [Arguments] ${onos} ${port} ${cmd} ${user}=karaf ${pass}=karaf |
| 113 | ${conn_id}= SSHLibrary.Open Connection ${onos} port=${port} prompt=onos> timeout=300s |
| 114 | SSHLibrary.Login ${user} ${pass} |
| 115 | ${output}= SSHLibrary.Execute Command ${cmd} |
| 116 | SSHLibrary.Close Connection |
| 117 | [Return] ${output} |
| 118 | |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 119 | Get Docker Container ID |
Kailash Khalasi | 2f567a4 | 2017-09-27 13:50:05 -0700 | [diff] [blame] | 120 | [Arguments] ${container_name} |
| 121 | [Documentation] Retrieves the id of the requested docker container running inside headnode |
| 122 | ${container_id}= Run docker ps | grep ${container_name} | awk '{print $1}' |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 123 | Log ${container_id} |
| 124 | [Return] ${container_id} |
| 125 | |
| 126 | Get Docker Logs |
| 127 | [Arguments] ${system} ${container_id} ${user}=${USER} ${password}=${PASSWD} ${prompt}=prod:~$ |
| 128 | [Documentation] Retrieves the id of the requested docker container running inside given ${HOST} |
| 129 | ##In Ciab, all containers are run in the prod vm so we must log into that |
| 130 | ${conn_id}= SSHLibrary.Open Connection ${system} prompt=$ timeout=300s |
| 131 | SSHLibrary.Login With Public Key ${USER} %{HOME}/.ssh/${SSH_KEY} any |
| 132 | #SSHLibrary.Login ${HOST_USER} ${HOST_PASSWORD} |
Kailash Khalasi | f6de259 | 2017-09-13 13:37:14 -0700 | [diff] [blame] | 133 | SSHLibrary.Write ssh head1 |
Kailash Khalasi | b6e87fc | 2017-04-18 15:08:19 -0700 | [diff] [blame] | 134 | SSHLibrary.Read Until ${prompt} |
| 135 | SSHLibrary.Write docker logs -t ${container_id} |
| 136 | ${container_logs}= SSHLibrary.Read Until ${prompt} |
| 137 | SSHLibrary.Close Connection |
| 138 | Log ${container_logs} |
Kailash Khalasi | 2adbad8 | 2017-05-15 14:53:40 -0700 | [diff] [blame] | 139 | [Return] ${container_logs} |
Kailash Khalasi | 86e231e | 2017-06-06 13:13:43 -0700 | [diff] [blame] | 140 | |
| 141 | Remove Value From List |
| 142 | [Arguments] ${list} ${val} |
| 143 | ${length}= Get Length ${list} |
Kailash Khalasi | 2f567a4 | 2017-09-27 13:50:05 -0700 | [diff] [blame] | 144 | : FOR ${INDEX} IN RANGE 0 ${length} |
Kailash Khalasi | 86e231e | 2017-06-06 13:13:43 -0700 | [diff] [blame] | 145 | \ Log ${list[${INDEX}]} |
| 146 | \ ${value}= Get Dictionary Values ${list[${INDEX}]} |
| 147 | \ Log ${value[0]} |
| 148 | \ Run Keyword If '${value[0]}' == '${val}' Remove From List ${list} ${INDEX} |
Kailash Khalasi | 2f567a4 | 2017-09-27 13:50:05 -0700 | [diff] [blame] | 149 | \ Run Keyword If '${value[0]}' == '${val}' Exit For Loop |
| 150 | |
| 151 | Test Ping |
Kailash Khalasi | 422d1ab | 2018-09-18 09:54:26 -0700 | [diff] [blame] | 152 | [Arguments] ${status} ${src} ${user} ${pass} ${dest} ${interface} ${prompt}=$ ${prompt_timeout}=60s |
Kailash Khalasi | 55ca9f2 | 2018-09-17 17:36:55 -0700 | [diff] [blame] | 153 | [Documentation] SSH's into src and attempts to ping dest. Status determines if ping should pass | fail |
| 154 | ${conn_id}= SSHLibrary.Open Connection ${src} prompt=${prompt} timeout=${prompt_timeout} |
| 155 | SSHLibrary.Login ${user} ${pass} |
Kailash Khalasi | 422d1ab | 2018-09-18 09:54:26 -0700 | [diff] [blame] | 156 | ${result}= SSHLibrary.Execute Command ping -I ${interface} -c 5 ${dest} |
Kailash Khalasi | 55ca9f2 | 2018-09-17 17:36:55 -0700 | [diff] [blame] | 157 | SSHLibrary.Close Connection |
| 158 | Log ${result} |
| 159 | Run Keyword If '${status}' == 'PASS' Should Contain ${result} 64 bytes |
| 160 | Run Keyword If '${status}' == 'PASS' Should Contain ${result} 0% packet loss |
| 161 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 100% packet loss |
| 162 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 80% packet loss |
| 163 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 60% packet loss |
| 164 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 40% packet loss |
| 165 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} 20% packet loss |
| 166 | Run Keyword If '${status}' == 'PASS' Should Not Contain ${result} Destination Host Unreachable |
| 167 | Run Keyword If '${status}' == 'FAIL' Should Not Contain ${result} 64 bytes |
| 168 | Run Keyword If '${status}' == 'FAIL' Should Contain ${result} 100% packet loss |
| 169 | Log To Console \n ${result} |
Kailash Khalasi | c930eac | 2018-09-05 12:18:23 -0700 | [diff] [blame] | 170 | |
| 171 | Clean Up Objects |
| 172 | [Arguments] ${model_api} |
Kailash Khalasi | c930eac | 2018-09-05 12:18:23 -0700 | [diff] [blame] | 173 | @{ids}= Create List |
| 174 | ${resp}= CORD Get ${model_api} |
| 175 | ${jsondata}= To Json ${resp.content} |
| 176 | Log ${jsondata} |
| 177 | ${length}= Get Length ${jsondata['items']} |
| 178 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 179 | \ ${value}= Get From List ${jsondata['items']} ${INDEX} |
| 180 | \ ${id}= Get From Dictionary ${value} id |
| 181 | \ Append To List ${ids} ${id} |
| 182 | : FOR ${i} IN @{ids} |
| 183 | \ CORD Delete ${model_api} ${i} |
Kailash Khalasi | c930eac | 2018-09-05 12:18:23 -0700 | [diff] [blame] | 184 | |
| 185 | CORD Get |
| 186 | [Documentation] Make a GET call to XOS |
| 187 | [Arguments] ${service} |
| 188 | ${resp}= Get Request ${server_ip} ${service} |
| 189 | Log ${resp.content} |
| 190 | Should Be Equal As Strings ${resp.status_code} 200 |
| 191 | [Return] ${resp} |
| 192 | |
Kailash Khalasi | f3e0a9f | 2018-09-18 13:43:42 -0700 | [diff] [blame] | 193 | CORD Post |
| 194 | [Documentation] Make a POST call to XOS |
| 195 | [Arguments] ${service} ${data} |
| 196 | ${data}= Evaluate json.dumps(${data}) json |
| 197 | ${resp}= Post Request ${SERVER_IP} uri=${service} data=${data} |
| 198 | Log ${resp.content} |
| 199 | Should Be Equal As Strings ${resp.status_code} 200 |
| 200 | [Return] ${resp} |
| 201 | |
Kailash Khalasi | 16d95c1 | 2018-09-21 14:17:28 -0700 | [diff] [blame] | 202 | CORD Put |
| 203 | [Documentation] Make a PUT call to XOS |
| 204 | [Arguments] ${service} ${data} ${data_id} |
| 205 | ${data}= Evaluate json.dumps(${data}) json |
| 206 | ${resp}= Put Request ${SERVER_IP} uri=${service}/${data_id} data=${data} |
| 207 | Log ${resp.content} |
| 208 | Should Be Equal As Strings ${resp.status_code} 200 |
| 209 | ${id}= Get Json Value ${resp.content} /id |
| 210 | Set Suite Variable ${id} |
| 211 | [Return] ${resp} |
| 212 | |
Kailash Khalasi | c930eac | 2018-09-05 12:18:23 -0700 | [diff] [blame] | 213 | CORD Delete |
| 214 | [Documentation] Make a DELETE call to XOS |
| 215 | [Arguments] ${service} ${data_id} |
| 216 | ${resp}= Delete Request ${SERVER_IP} uri=${service}/${data_id} |
| 217 | Log ${resp.content} |
| 218 | Should Be Equal As Strings ${resp.status_code} 200 |
| 219 | [Return] ${resp} |
Kailash Khalasi | a0810ce | 2018-09-10 13:03:27 -0700 | [diff] [blame] | 220 | |
Kailash Khalasi | f3e0a9f | 2018-09-18 13:43:42 -0700 | [diff] [blame] | 221 | Get Service Owner Id |
| 222 | [Arguments] ${service} |
| 223 | ${resp}= CORD Get ${service} |
| 224 | ${jsondata}= To Json ${resp.content} |
| 225 | log ${jsondata} |
| 226 | ${length}= Get Length ${jsondata['items']} |
| 227 | : for ${INDEX} IN RANGE 0 ${length} |
| 228 | \ ${value}= Get From List ${jsondata['items']} ${INDEX} |
| 229 | \ ${id}= Get From Dictionary ${value} id |
| 230 | [Return] ${id} |
| 231 | |
Kailash Khalasi | a0810ce | 2018-09-10 13:03:27 -0700 | [diff] [blame] | 232 | Kill Linux Process |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 233 | [Arguments] ${process} ${ip} ${user} ${pass}=${None} ${container_type}=${None} ${container_name}=${None} |
| 234 | ${rc}= Login And Run Command On Remote System kill $(ps aux | grep '${process}' | awk '{print $2}'); echo $? ${ip} ${user} ${pass} ${container_type} ${container_name} |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 235 | Should Be Equal As Integers ${rc} 0 |
You Wang | aee3511 | 2018-09-28 16:07:49 -0700 | [diff] [blame] | 236 | |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 237 | Check Remote File Contents |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 238 | [Arguments] ${file_should_exist} ${file} ${pattern} ${ip} ${user} ${pass}=${None} ${container_type}=${None} ${container_name}=${None} ${prompt}=~$ |
| 239 | ${output}= Login And Run Command On Remote System cat ${file} | grep '${pattern}' ${ip} ${user} ${pass} ${container_type} ${container_name} ${prompt} |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 240 | Run Keyword If '${file_should_exist}' == 'True' Should Contain ${output} ${pattern} |
| 241 | ... ELSE Should Not Contain ${output} ${pattern} |
| 242 | |
| 243 | Check Ping |
You Wang | 5be816a | 2018-10-11 16:45:31 -0700 | [diff] [blame] | 244 | [Arguments] ${ping_should_pass} ${dst_ip} ${iface} ${ip} ${user} ${pass}=${None} ${container_type}=${None} ${container_name}=${None} |
| 245 | ${result}= Login And Run Command On Remote System ping -I ${iface} -c 3 ${dst_ip} ${ip} ${user} ${pass} ${container_type} ${container_name} |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 246 | Check Ping Result ${ping_should_pass} ${result} |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 247 | |
| 248 | Check Remote System Reachability |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 249 | [Arguments] ${reachable} ${ip} |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 250 | [Documentation] Check if the specified IP address is reachable or not |
You Wang | f2ddde6 | 2019-02-13 16:53:10 -0800 | [diff] [blame] | 251 | ${result}= Run ping -c 3 ${ip} |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 252 | Check Ping Result ${reachable} ${result} |
| 253 | |
| 254 | Check Ping Result |
| 255 | [Arguments] ${reachable} ${result} |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 256 | Run Keyword If '${reachable}' == 'True' Should Contain ${result} 64 bytes |
| 257 | Run Keyword If '${reachable}' == 'True' Should Contain Any ${result} 0% packet loss 0.0% packet loss |
| 258 | Run Keyword If '${reachable}' == 'True' Should Not Contain Any ${result} 100% packet loss 100.0% packet loss |
| 259 | Run Keyword If '${reachable}' == 'False' Should Not Contain ${result} 64 bytes |
| 260 | Run Keyword If '${reachable}' == 'False' Should Contain Any ${result} 100% packet loss 100.0% packet loss |
Kailash | f49efeb | 2019-05-23 12:12:41 -0700 | [diff] [blame] | 261 | |
| 262 | Set Deployment Config Variables |
| 263 | [Documentation] Parses through the given deployment config and sets all the "src" and "dst" variables |
| 264 | ${source}= Evaluate ${hosts}.get("src") |
| 265 | ${length_src}= Get Length ${source} |
| 266 | ${src}= Set Variable src |
| 267 | : FOR ${INDEX} IN RANGE 0 ${length_src} |
| 268 | \ Set Suite Variable ${${src}${INDEX}} ${source[${INDEX}]} |
| 269 | ${destination}= Evaluate ${hosts}.get("dst") |
| 270 | ${length_dst}= Get Length ${destination} |
| 271 | ${dst}= Set Variable dst |
| 272 | : FOR ${INDEX} IN RANGE 0 ${length_dst} |
| 273 | \ Set Suite Variable ${${dst}${INDEX}} ${destination[${INDEX}]} |
| 274 | |