blob: 6c97fac122074235ababf74ce2d679217bd22854 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation Testing openstack.
3Library OperatingSystem
4Library SSHLibrary
5Library RequestsLibrary
6Library JSONUtils
7Library OpenstackLibrary
8Library HEATUtils
9Library Collections
10Resource ../../resources/openstack/keystone_interface.robot
11Resource ../../resources/openstack/nova_interface.robot
12Resource ../../resources/openstack/heat_interface.robot
13Resource ../../resources/ssh/files.robot
14Resource ../../resources/ssh/processes.robot
15Resource packet_generator_interface.robot
16
17
18*** Variables ***
DR695Hccff30b2017-02-17 18:44:24 -050019
20*** Keywords ***
21Wait For Server
Jerry Flood9b5e79f2017-03-30 07:59:33 -040022 [Documentation] Attempts to login to the passed server info and verify (??). Uses server info to get public ip and locate corresponding provate key file
DR695Hccff30b2017-02-17 18:44:24 -050023 [Arguments] ${server_ip} ${timeout}=300s
Jerry Flood9b5e79f2017-03-30 07:59:33 -040024 ${file}= Catenate ${GLOBAL_VM_PRIVATE_KEY}
DR695Hccff30b2017-02-17 18:44:24 -050025 Wait Until Keyword Succeeds ${timeout} 5 sec Open Connection And Log In ${server_ip} root ${file}
Jerry Flood9b5e79f2017-03-30 07:59:33 -040026 ${lines}= Grep Local File "Accepted publickey" /var/log/auth.log
27 Log ${lines}
DR695Hccff30b2017-02-17 18:44:24 -050028 Should Not Be Empty ${lines}
Jerry Flood9b5e79f2017-03-30 07:59:33 -040029
30Get Server Ip
DR695Hccff30b2017-02-17 18:44:24 -050031 [Arguments] ${server_list} ${stack_info} ${key_name} ${network_name}=public
32 ${server_name}= Get From Dictionary ${stack_info} ${key_name}
33 ${server}= Get From Dictionary ${server_list} ${server_name}
34 Log Entering Get Openstack Server Ip
Jerry Flood81d33fb2017-11-21 16:21:21 -050035 ${ip}= Search Addresses ${server} ${network_name}
DR695Hccff30b2017-02-17 18:44:24 -050036 Log Returned Get Openstack Server Ip
Jerry Flood9b5e79f2017-03-30 07:59:33 -040037 [Return] ${ip}
DR695Hccff30b2017-02-17 18:44:24 -050038
39Find And Reboot The Server
Jerry Flood9b5e79f2017-03-30 07:59:33 -040040 [Documentation] Code to reboot the server by teh heat server name parameter value
DR695Hccff30b2017-02-17 18:44:24 -050041 [Arguments] ${stack_info} ${server_list} ${server_name_parameter}
42 ${server_name}= Get From Dictionary ${stack_info} ${server_name_parameter}
43 ${vfw_server}= Get From Dictionary ${server_list} ${server_name}
44 ${vfw_server_id}= Get From Dictionary ${vfw_server} id
45 Reboot Server auth ${vfw_server_id}
Jerry Flood9b5e79f2017-03-30 07:59:33 -040046
47
Jerry Flood81d33fb2017-11-21 16:21:21 -050048Search Addresses
49 [Arguments] ${server} ${network_name}
50 ${addresses} Get From Dictionary ${server} addresses
51 ${status} ${server_ip}= Run Keyword And Ignore Error Find Rackspace ${addresses} ${network_name}
52 Return From Keyword If '${status}'=='PASS' ${server_ip}
53 ${status} ${server_ip}= Run Keyword And Ignore Error Find Openstack ${addresses} ${network_name}
54 Return From Keyword If '${status}'=='PASS' ${server_ip}
55 ${status} ${server_ip}= Run Keyword And Ignore Error Find Openstack 2 ${addresses} ${network_name}
56 Return From Keyword If '${status}'=='PASS' ${server_ip}
57 Fail ${server}/${network_name} Not Found
58
59Find Rackspace
60 [Arguments] ${addresses} ${network_name}
61 ${ips} Get From Dictionary ${addresses} ${network_name}
62 ${ip}= Get V4 IP ${ips}
63 [Return] ${ip}
64
65Find Openstack
66 [Arguments] ${addresses} ${network_name}
67 ${network_name}= Set Variable If '${network_name}' == 'public' external ${network_name}
68 ${ip}= Get V4 IP Openstack ${addresses} ${network_name}
69 [Return] ${ip}
70
71Find Openstack 2
72 [Arguments] ${addresses} ${network_name}
73 ${network_name}= Set Variable If '${network_name}' == 'public' floating ${network_name}
74 ${ipmaps}= Get From Dictionary ${addresses} ${GLOBAL_INJECTED_NETWORK}
75 ${ip}= Get V4 IP Openstack 2 ${ipmaps} ${network_name}
76 [Return] ${ip}
77
78Get V4 IP
79 [Arguments] ${ipmaps}
80 :for ${ipmap} in @{ipmaps}
81 \ ${ip} Get From Dictionary ${ipmap} addr
82 \ ${version} Get From Dictionary ${ipmap} version
83 \ Return from Keyword if '${version}' == '4' ${ip}
84 Fail No Version 4 IP
85
86Get V4 IP Openstack
87 [Arguments] ${addresses} ${testtype}
88 ${ipmaps}= Get From Dictionary ${addresses} ${testtype}
89 :for ${ipmap} in @{ipmaps}
90 \ ${ip} Get From Dictionary ${ipmap} addr
91 \ ${version} Get From Dictionary ${ipmap} version
92 \ Return from Keyword if '${version}'=='4' ${ip}
93 Fail No Version 4 IP
94
95Get V4 IP Openstack 2
96 [Arguments] ${ipmaps} ${testtype}
97 :for ${ipmap} in @{ipmaps}
98 \ ${type} Get From Dictionary ${ipmap} OS-EXT-IPS:type
99 \ ${ip} Get From Dictionary ${ipmap} addr
100 \ ${version} Get From Dictionary ${ipmap} version
101 \ Return from Keyword if '${version}'=='4' and '${type}'=='${testtype}' ${ip}
102 Fail No Version 4 IP