2 Documentation General Utils library. This library has broad scope, it can be used by any robot system tests.
3 Library RequestsLibrary
5 Resource OpenStackOperations.robot
6 Resource ../variables/Variables.robot
9 ${DEFAULT_DEVSTACK_PROMPT_TIMEOUT} 10s
10 ${DEVSTACK_SYSTEM_PASSWORD} \ # set to empty, but provide for others to override if desired
11 ${OS_CNTL_CONN_ID} None
12 ${OS_CMP1_CONN_ID} None
13 ${OS_CMP2_CONN_ID} None
14 ${OS_CNTL_IP} ${EMPTY}
15 ${OS_CMP1_IP} ${EMPTY}
16 ${OS_CMP2_IP} ${EMPTY}
17 @{OS_ALL_IPS} @{EMPTY}
18 @{OS_CMP_IPS} @{EMPTY}
22 [Arguments] ${name} ${ip}
23 ${conn_id} = SSHLibrary.Open Connection ${ip} prompt=${DEFAULT_LINUX_PROMPT}
24 SSHKeywords.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
25 BuiltIn.Set Suite Variable \${${name}} ${conn_id}
29 [Arguments] ${odl_ip}=${ODL_SYSTEM_IP}
30 [Documentation] Open connections to the nodes
31 DevstackUtils.Get DevStack Nodes Data
32 RequestsLibrary.Create Session session http://${odl_ip}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
33 SSHLibrary.Set Default Configuration timeout=${DEFAULT_DEVSTACK_PROMPT_TIMEOUT}
34 BuiltIn.Run Keyword If 0 < ${NUM_OS_SYSTEM} DevstackUtils.Open Connection OS_CNTL_CONN_ID ${OS_CONTROL_NODE_IP}
35 BuiltIn.Run Keyword If 1 < ${NUM_OS_SYSTEM} DevstackUtils.Open Connection OS_CMP1_CONN_ID ${OS_COMPUTE_1_IP}
36 BuiltIn.Run Keyword If 2 < ${NUM_OS_SYSTEM} DevstackUtils.Open Connection OS_CMP2_CONN_ID ${OS_COMPUTE_2_IP}
38 Write Commands Until Prompt
39 [Arguments] ${cmd} ${timeout}=${DEFAULT_DEVSTACK_PROMPT_TIMEOUT}
40 [Documentation] quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
41 SSHLibrary.Set Client Configuration timeout=${timeout}
43 SSHLibrary.Write ${cmd};echo Command Returns $?
44 ${output} = SSHLibrary.Read Until Prompt
47 Write Commands Until Prompt And Log
48 [Arguments] ${cmd} ${timeout}=${DEFAULT_DEVSTACK_PROMPT_TIMEOUT}
49 [Documentation] quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
50 ${output} = DevstackUtils.Write Commands Until Prompt ${cmd} ${timeout}
54 Log Devstack Nodes Data
55 ${output} = BuiltIn.Catenate SEPARATOR=\n OS_CNTL_HOSTNAME: ${OS_CNTL_HOSTNAME} - OS_CNTL_IP: ${OS_CNTL_IP} - OS_CONTROL_NODE_IP: ${OS_CONTROL_NODE_IP} OS_CMP1_HOSTNAME: ${OS_CMP1_HOSTNAME} - OS_CMP1_IP: ${OS_CMP1_IP} - OS_COMPUTE_1_IP: ${OS_COMPUTE_1_IP} OS_CMP2_HOSTNAME: ${OS_CMP2_HOSTNAME} - OS_CMP2_IP: ${OS_CMP2_IP} - OS_COMPUTE_2_IP: ${OS_COMPUTE_2_IP} OS_ALL_IPS: @{OS_ALL_IPS}
56 ... OS_CMP_IPS: @{OS_CMP_IPS}
57 BuiltIn.Log DevStack Nodes Data:\n${output}
59 Get DevStack Hostnames
60 [Documentation] Assign hostname global variables for DevStack nodes
61 ${OS_CNTL_HOSTNAME} = OpenStackOperations.Get Hypervisor Hostname From IP ${OS_CNTL_IP}
62 ${OS_CMP1_HOSTNAME} = OpenStackOperations.Get Hypervisor Hostname From IP ${OS_CMP1_IP}
63 ${OS_CMP2_HOSTNAME} = OpenStackOperations.Get Hypervisor Hostname From IP ${OS_CMP2_IP}
64 BuiltIn.Set Suite Variable ${OS_CNTL_HOSTNAME}
65 BuiltIn.Set Suite Variable ${OS_CMP1_HOSTNAME}
66 BuiltIn.Set Suite Variable ${OS_CMP2_HOSTNAME}
68 Set Node Data For AllinOne Setup
69 [Documentation] Assign global variables for DevStack nodes where the Control Node enables Compute service also.
70 BuiltIn.Set Suite Variable @{OS_ALL_IPS} ${OS_CNTL_IP}
72 Set Node Data For Control And Compute Node Setup
73 [Documentation] Assign global variables for DevStack nodes where the control node is also the compute
74 BuiltIn.Set Suite Variable ${OS_CMP1_IP} ${OS_CNTL_IP}
75 BuiltIn.Set Suite Variable ${OS_CMP2_IP} ${OS_COMPUTE_1_IP}
76 BuiltIn.Set Suite Variable @{OS_ALL_IPS} ${OS_CNTL_IP} ${OS_CMP2_IP}
77 BuiltIn.Set Suite Variable @{OS_CMP_IPS} ${OS_CMP1_IP} ${OS_CMP2_IP}
79 Set Node Data For Control Only Node Setup
80 [Documentation] Assign global variables for DevStack nodes where the control node is different than the compute
81 BuiltIn.Set Suite Variable ${OS_CMP1_IP} ${OS_COMPUTE_1_IP}
82 BuiltIn.Set Suite Variable ${OS_CMP2_IP} ${OS_COMPUTE_2_IP}
83 BuiltIn.Set Suite Variable @{OS_ALL_IPS} ${OS_CNTL_IP} ${OS_CMP1_IP} ${OS_CMP2_IP}
84 BuiltIn.Set Suite Variable @{OS_CMP_IPS} ${OS_CMP1_IP} ${OS_CMP2_IP}
86 Get DevStack Nodes Data
87 [Documentation] Assign global variables for DevStack nodes
88 BuiltIn.Set Suite Variable ${OS_CNTL_IP} ${OS_CONTROL_NODE_IP}
89 BuiltIn.Run Keyword If ${NUM_OS_SYSTEM} == 1 DevstackUtils.Set Node Data For AllinOne Setup
90 ... ELSE IF ${NUM_OS_SYSTEM} == 2 DevstackUtils.Set Node Data For Control And Compute Node Setup
91 ... ELSE IF ${NUM_OS_SYSTEM} == 3 DevstackUtils.Set Node Data For Control Only Node Setup
92 DevstackUtils.Get DevStack Hostnames
93 DevstackUtils.Log Devstack Nodes Data