2 Documentation General Utils library. This library has broad scope, it can be used by any robot system tests.
4 Library RequestsLibrary
6 Resource OpenStackOperations.robot
7 Resource ../variables/Variables.robot
11 ${DEFAULT_DEVSTACK_PROMPT_TIMEOUT} 10s
12 ${DEVSTACK_SYSTEM_PASSWORD} \ # set to empty, but provide for others to override if desired
13 ${OS_CNTL_CONN_ID} None
14 ${OS_CMP1_CONN_ID} None
15 ${OS_CMP2_CONN_ID} None
16 ${OS_CNTL_IP} ${EMPTY}
17 ${OS_CMP1_IP} ${EMPTY}
18 ${OS_CMP2_IP} ${EMPTY}
19 @{OS_ALL_IPS} @{EMPTY}
20 @{OS_CMP_IPS} @{EMPTY}
26 [Arguments] ${name} ${ip}
27 ${conn_id} = SSHLibrary.Open Connection ${ip} prompt=${DEFAULT_LINUX_PROMPT}
28 SSHKeywords.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
29 BuiltIn.Set Suite Variable \${${name}} ${conn_id}
33 [Documentation] Open connections to the nodes
34 [Arguments] ${odl_ip}=${ODL_SYSTEM_IP}
35 SSHLibrary.Set Default Configuration timeout=${DEFAULT_DEVSTACK_PROMPT_TIMEOUT}
36 DevstackUtils.Get DevStack Nodes Data
37 RequestsLibrary.Create Session session http://${odl_ip}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
39 Write Commands Until Prompt
40 [Documentation] quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
41 [Arguments] ${cmd} ${timeout}=${DEFAULT_DEVSTACK_PROMPT_TIMEOUT}
42 SSHLibrary.Set Client Configuration timeout=${timeout}
44 SSHLibrary.Write ${cmd};echo Command Returns $?
45 ${output} = SSHLibrary.Read Until Prompt
48 Write Commands Until Prompt And Log
49 [Documentation] quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
50 [Arguments] ${cmd} ${timeout}=${DEFAULT_DEVSTACK_PROMPT_TIMEOUT}
51 ${output} = DevstackUtils.Write Commands Until Prompt ${cmd} ${timeout}
55 Log Devstack Nodes Data
56 ${output} = BuiltIn.Catenate
58 ... OS_CNTL_HOSTNAME: ${OS_CNTL_HOSTNAME} - OS_CNTL_IP: ${OS_CNTL_IP} - OS_CONTROL_NODE_IP: ${OS_CONTROL_NODE_IP}
59 ... OS_CMP1_HOSTNAME: ${OS_CMP1_HOSTNAME} - OS_CMP1_IP: ${OS_CMP1_IP} - OS_COMPUTE_1_IP: ${OS_COMPUTE_1_IP}
60 ... OS_CMP2_HOSTNAME: ${OS_CMP2_HOSTNAME} - OS_CMP2_IP: ${OS_CMP2_IP} - OS_COMPUTE_2_IP: ${OS_COMPUTE_2_IP}
61 ... OS_ALL_IPS: @{OS_ALL_IPS}
62 ... OS_CMP_IPS: @{OS_CMP_IPS}
63 ... OS_NODE_CNT: ${OS_NODE_CNT}
64 ... OS_ALL_CONN_IDS: @{OS_ALL_CONN_IDS}
65 ... OS_CMP_CONN_IDS: @{OS_CMP_CONN_IDS}
66 BuiltIn.Log DevStack Nodes Data:\n${output}
68 Get DevStack Hostnames
69 [Documentation] Assign hostname global variables for DevStack nodes
70 ${OS_CNTL_HOSTNAME} = OpenStackOperations.Get Hypervisor Hostname From IP ${OS_CNTL_IP}
71 ${OS_CMP1_HOSTNAME} = OpenStackOperations.Get Hypervisor Hostname From IP ${OS_CMP1_IP}
72 ${OS_CMP2_HOSTNAME} = OpenStackOperations.Get Hypervisor Hostname From IP ${OS_CMP2_IP}
73 BuiltIn.Set Suite Variable ${OS_CNTL_HOSTNAME}
74 BuiltIn.Set Suite Variable ${OS_CMP1_HOSTNAME}
75 BuiltIn.Set Suite Variable ${OS_CMP2_HOSTNAME}
77 Set Node Data For AllinOne Setup
78 [Documentation] Assign global variables for DevStack nodes where the Control Node enables Compute service also.
79 BuiltIn.Set Suite Variable ${OS_CMP1_IP} ${OS_CNTL_IP}
80 BuiltIn.Set Suite Variable ${OS_CMP2_IP} ${OS_CNTL_IP}
81 BuiltIn.Set Suite Variable @{OS_ALL_IPS} ${OS_CNTL_IP}
82 BuiltIn.Set Suite Variable @{OS_CMP_IPS} ${OS_CNTL_IP}
83 BuiltIn.Set Suite Variable ${OS_CMP1_CONN_ID} ${OS_CNTL_CONN_ID}
84 BuiltIn.Set Suite Variable ${OS_CMP2_CONN_ID} ${OS_CNTL_CONN_ID}
85 BuiltIn.Set Suite Variable @{OS_ALL_CONN_IDS} ${OS_CNTL_CONN_ID}
86 BuiltIn.Set Suite Variable @{OS_CMP_CONN_IDS} ${OS_CNTL_CONN_ID}
88 Set Node Data For Control And Compute Node Setup
89 [Documentation] Assign global variables for DevStack nodes where the control node is also the compute
90 BuiltIn.Set Suite Variable ${OS_CMP1_IP} ${OS_CNTL_IP}
91 BuiltIn.Set Suite Variable ${OS_CMP2_IP} ${OS_COMPUTE_1_IP}
92 BuiltIn.Set Suite Variable @{OS_ALL_IPS} ${OS_CNTL_IP} ${OS_CMP2_IP}
93 BuiltIn.Set Suite Variable @{OS_CMP_IPS} ${OS_CMP1_IP} ${OS_CMP2_IP}
94 BuiltIn.Set Suite Variable ${OS_CMP1_CONN_ID} ${OS_CNTL_CONN_ID}
95 DevstackUtils.Open Connection OS_CMP2_CONN_ID ${OS_COMPUTE_1_IP}
96 BuiltIn.Set Suite Variable @{OS_ALL_CONN_IDS} ${OS_CNTL_CONN_ID} ${OS_CMP2_CONN_ID}
97 BuiltIn.Set Suite Variable @{OS_CMP_CONN_IDS} ${OS_CNTL_CONN_ID} ${OS_CMP2_CONN_ID}
99 Set Node Data For Control And Two Compute Node Setup
100 [Documentation] Assign global variables for DevStack nodes where the control node is different than the compute
101 BuiltIn.Set Suite Variable ${OS_CMP1_IP} ${OS_COMPUTE_1_IP}
102 BuiltIn.Set Suite Variable ${OS_CMP2_IP} ${OS_COMPUTE_2_IP}
103 BuiltIn.Set Suite Variable @{OS_ALL_IPS} ${OS_CNTL_IP} ${OS_CMP1_IP} ${OS_CMP2_IP}
104 BuiltIn.Set Suite Variable @{OS_CMP_IPS} ${OS_CMP1_IP} ${OS_CMP2_IP}
105 DevstackUtils.Open Connection OS_CMP1_CONN_ID ${OS_COMPUTE_1_IP}
106 DevstackUtils.Open Connection OS_CMP2_CONN_ID ${OS_COMPUTE_2_IP}
107 BuiltIn.Set Suite Variable @{OS_ALL_CONN_IDS} ${OS_CNTL_CONN_ID} ${OS_CMP1_CONN_ID} ${OS_CMP2_CONN_ID}
108 BuiltIn.Set Suite Variable @{OS_CMP_CONN_IDS} ${OS_CMP1_CONN_ID} ${OS_CMP2_CONN_ID}
110 Get DevStack Nodes Data
111 [Documentation] Assign global variables for DevStack nodes
112 BuiltIn.Set Suite Variable ${OS_CNTL_IP} ${OS_CONTROL_NODE_IP}
113 DevstackUtils.Open Connection OS_CNTL_CONN_ID ${OS_CNTL_IP}
114 IF "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp"
115 DevstackUtils.Set Node Data For AllinOne Setup
116 ELSE IF "${OPENSTACK_TOPO}" == "1cmb-0ctl-1cmp"
117 DevstackUtils.Set Node Data For Control And Compute Node Setup
118 ELSE IF "${OPENSTACK_TOPO}" == "0cmb-1ctl-2cmp"
119 DevstackUtils.Set Node Data For Control And Two Compute Node Setup
121 ${OS_NODE_CNT} = BuiltIn.Get Length ${OS_ALL_IPS}
122 BuiltIn.Set Suite Variable ${OS_NODE_CNT}
123 DevstackUtils.Get DevStack Hostnames
124 DevstackUtils.Log Devstack Nodes Data