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 SSHLibrary.Set Default Configuration timeout=${DEFAULT_DEVSTACK_PROMPT_TIMEOUT}
32 DevstackUtils.Get DevStack Nodes Data
33 RequestsLibrary.Create Session session http://${odl_ip}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
35 Write Commands Until Prompt
36 [Arguments] ${cmd} ${timeout}=${DEFAULT_DEVSTACK_PROMPT_TIMEOUT}
37 [Documentation] quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
38 SSHLibrary.Set Client Configuration timeout=${timeout}
40 SSHLibrary.Write ${cmd};echo Command Returns $?
41 ${output} = SSHLibrary.Read Until Prompt
44 Write Commands Until Prompt And Log
45 [Arguments] ${cmd} ${timeout}=${DEFAULT_DEVSTACK_PROMPT_TIMEOUT}
46 [Documentation] quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
47 ${output} = DevstackUtils.Write Commands Until Prompt ${cmd} ${timeout}
51 Log Devstack Nodes Data
52 ${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}
53 ... OS_CMP_IPS: @{OS_CMP_IPS}
54 BuiltIn.Log DevStack Nodes Data:\n${output}
56 Get DevStack Hostnames
57 [Documentation] Assign hostname global variables for DevStack nodes
58 ${OS_CNTL_HOSTNAME} = OpenStackOperations.Get Hypervisor Hostname From IP ${OS_CNTL_IP}
59 ${OS_CMP1_HOSTNAME} = OpenStackOperations.Get Hypervisor Hostname From IP ${OS_CMP1_IP}
60 ${OS_CMP2_HOSTNAME} = OpenStackOperations.Get Hypervisor Hostname From IP ${OS_CMP2_IP}
61 BuiltIn.Set Suite Variable ${OS_CNTL_HOSTNAME}
62 BuiltIn.Set Suite Variable ${OS_CMP1_HOSTNAME}
63 BuiltIn.Set Suite Variable ${OS_CMP2_HOSTNAME}
65 Set Node Data For AllinOne Setup
66 [Documentation] Assign global variables for DevStack nodes where the Control Node enables Compute service also.
67 BuiltIn.Set Suite Variable ${OS_CMP1_IP} ${OS_CNTL_IP}
68 BuiltIn.Set Suite Variable ${OS_CMP2_IP} ${OS_CNTL_IP}
69 BuiltIn.Set Suite Variable @{OS_ALL_IPS} ${OS_CNTL_IP}
70 BuiltIn.Set Suite Variable @{OS_CMP_IPS} ${OS_CNTL_IP}
71 BuiltIn.Set Suite Variable ${OS_CMP1_CONN_ID} ${OS_CNTL_CONN_ID}
72 BuiltIn.Set Suite Variable ${OS_CMP2_CONN_ID} ${OS_CNTL_CONN_ID}
73 BuiltIn.Set Suite Variable @{OS_ALL_CONN_IDS} ${OS_CNTL_CONN_ID}
74 BuiltIn.Set Suite Variable @{OS_CMP_CONN_IDS} ${OS_CNTL_CONN_ID}
76 Set Node Data For Control And Compute Node Setup
77 [Documentation] Assign global variables for DevStack nodes where the control node is also the compute
78 BuiltIn.Set Suite Variable ${OS_CMP1_IP} ${OS_CNTL_IP}
79 BuiltIn.Set Suite Variable ${OS_CMP2_IP} ${OS_COMPUTE_1_IP}
80 BuiltIn.Set Suite Variable @{OS_ALL_IPS} ${OS_CNTL_IP} ${OS_CMP2_IP}
81 BuiltIn.Set Suite Variable @{OS_CMP_IPS} ${OS_CMP1_IP} ${OS_CMP2_IP}
82 BuiltIn.Set Suite Variable ${OS_CMP1_CONN_ID} ${OS_CNTL_CONN_ID}
83 DevstackUtils.Open Connection OS_CMP2_CONN_ID ${OS_COMPUTE_1_IP}
84 BuiltIn.Set Suite Variable @{OS_ALL_CONN_IDS} ${OS_CNTL_CONN_ID} ${OS_CMP2_CONN_ID}
85 BuiltIn.Set Suite Variable @{OS_CMP_CONN_IDS} ${OS_CNTL_CONN_ID} ${OS_CMP2_CONN_ID}
87 Set Node Data For Control And Two Compute Node Setup
88 [Documentation] Assign global variables for DevStack nodes where the control node is different than the compute
89 BuiltIn.Set Suite Variable ${OS_CMP1_IP} ${OS_COMPUTE_1_IP}
90 BuiltIn.Set Suite Variable ${OS_CMP2_IP} ${OS_COMPUTE_2_IP}
91 BuiltIn.Set Suite Variable @{OS_ALL_IPS} ${OS_CNTL_IP} ${OS_CMP1_IP} ${OS_CMP2_IP}
92 BuiltIn.Set Suite Variable @{OS_CMP_IPS} ${OS_CMP1_IP} ${OS_CMP2_IP}
93 DevstackUtils.Open Connection OS_CMP1_CONN_ID ${OS_COMPUTE_1_IP}
94 DevstackUtils.Open Connection OS_CMP2_CONN_ID ${OS_COMPUTE_2_IP}
95 BuiltIn.Set Suite Variable @{OS_ALL_CONN_IDS} ${OS_CNTL_CONN_ID} ${OS_CMP1_CONN_ID} ${OS_CMP2_CONN_ID}
96 BuiltIn.Set Suite Variable @{OS_CMP_CONN_IDS} ${OS_CMP1_CONN_ID} ${OS_CMP2_CONN_ID}
98 Get DevStack Nodes Data
99 [Documentation] Assign global variables for DevStack nodes
100 BuiltIn.Set Suite Variable ${OS_CNTL_IP} ${OS_CONTROL_NODE_IP}
101 DevstackUtils.Open Connection OS_CNTL_CONN_ID ${OS_CNTL_IP}
102 BuiltIn.Run Keyword If "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp" DevstackUtils.Set Node Data For AllinOne Setup
103 ... ELSE IF "${OPENSTACK_TOPO}" == "1cmb-0ctl-1cmp" DevstackUtils.Set Node Data For Control And Compute Node Setup
104 ... ELSE IF "${OPENSTACK_TOPO}" == "0cmb-1ctl-2cmp" DevstackUtils.Set Node Data For Control And Two Compute Node Setup
105 DevstackUtils.Get DevStack Hostnames
106 DevstackUtils.Log Devstack Nodes Data