blob: 8b292131e6eeb3cb36678a7e6a8caf71fc5e138b [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
Brian Freeman0d866b52019-05-08 20:30:14 -050024 #${file}= Catenate ${GLOBAL_VM_PRIVATE_KEY}
25 # Preload is using onap public key
26 ${file}= Catenate ${GLOBAL_ONAP_PRIVATE_KEY}
DR695Hccff30b2017-02-17 18:44:24 -050027 Wait Until Keyword Succeeds ${timeout} 5 sec Open Connection And Log In ${server_ip} root ${file}
Jerry Flood9b5e79f2017-03-30 07:59:33 -040028 ${lines}= Grep Local File "Accepted publickey" /var/log/auth.log
29 Log ${lines}
DR695Hccff30b2017-02-17 18:44:24 -050030 Should Not Be Empty ${lines}
Jerry Flood9b5e79f2017-03-30 07:59:33 -040031
32Get Server Ip
DR695Hccff30b2017-02-17 18:44:24 -050033 [Arguments] ${server_list} ${stack_info} ${key_name} ${network_name}=public
34 ${server_name}= Get From Dictionary ${stack_info} ${key_name}
35 ${server}= Get From Dictionary ${server_list} ${server_name}
36 Log Entering Get Openstack Server Ip
Jerry Flood81d33fb2017-11-21 16:21:21 -050037 ${ip}= Search Addresses ${server} ${network_name}
DR695Hccff30b2017-02-17 18:44:24 -050038 Log Returned Get Openstack Server Ip
Jerry Flood9b5e79f2017-03-30 07:59:33 -040039 [Return] ${ip}
DR695Hccff30b2017-02-17 18:44:24 -050040
41Find And Reboot The Server
Jerry Flood9b5e79f2017-03-30 07:59:33 -040042 [Documentation] Code to reboot the server by teh heat server name parameter value
DR695Hccff30b2017-02-17 18:44:24 -050043 [Arguments] ${stack_info} ${server_list} ${server_name_parameter}
44 ${server_name}= Get From Dictionary ${stack_info} ${server_name_parameter}
45 ${vfw_server}= Get From Dictionary ${server_list} ${server_name}
46 ${vfw_server_id}= Get From Dictionary ${vfw_server} id
47 Reboot Server auth ${vfw_server_id}
Jerry Flood9b5e79f2017-03-30 07:59:33 -040048
49
Jerry Flood81d33fb2017-11-21 16:21:21 -050050Search Addresses
51 [Arguments] ${server} ${network_name}
52 ${addresses} Get From Dictionary ${server} addresses
53 ${status} ${server_ip}= Run Keyword And Ignore Error Find Rackspace ${addresses} ${network_name}
54 Return From Keyword If '${status}'=='PASS' ${server_ip}
55 ${status} ${server_ip}= Run Keyword And Ignore Error Find Openstack ${addresses} ${network_name}
56 Return From Keyword If '${status}'=='PASS' ${server_ip}
57 ${status} ${server_ip}= Run Keyword And Ignore Error Find Openstack 2 ${addresses} ${network_name}
58 Return From Keyword If '${status}'=='PASS' ${server_ip}
59 Fail ${server}/${network_name} Not Found
60
61Find Rackspace
62 [Arguments] ${addresses} ${network_name}
63 ${ips} Get From Dictionary ${addresses} ${network_name}
64 ${ip}= Get V4 IP ${ips}
65 [Return] ${ip}
66
67Find Openstack
68 [Arguments] ${addresses} ${network_name}
69 ${network_name}= Set Variable If '${network_name}' == 'public' external ${network_name}
70 ${ip}= Get V4 IP Openstack ${addresses} ${network_name}
71 [Return] ${ip}
72
73Find Openstack 2
74 [Arguments] ${addresses} ${network_name}
75 ${network_name}= Set Variable If '${network_name}' == 'public' floating ${network_name}
76 ${ipmaps}= Get From Dictionary ${addresses} ${GLOBAL_INJECTED_NETWORK}
77 ${ip}= Get V4 IP Openstack 2 ${ipmaps} ${network_name}
78 [Return] ${ip}
79
80Get V4 IP
81 [Arguments] ${ipmaps}
82 :for ${ipmap} in @{ipmaps}
83 \ ${ip} Get From Dictionary ${ipmap} addr
84 \ ${version} Get From Dictionary ${ipmap} version
85 \ Return from Keyword if '${version}' == '4' ${ip}
86 Fail No Version 4 IP
87
88Get V4 IP Openstack
89 [Arguments] ${addresses} ${testtype}
90 ${ipmaps}= Get From Dictionary ${addresses} ${testtype}
91 :for ${ipmap} in @{ipmaps}
92 \ ${ip} Get From Dictionary ${ipmap} addr
93 \ ${version} Get From Dictionary ${ipmap} version
94 \ Return from Keyword if '${version}'=='4' ${ip}
95 Fail No Version 4 IP
96
97Get V4 IP Openstack 2
98 [Arguments] ${ipmaps} ${testtype}
99 :for ${ipmap} in @{ipmaps}
100 \ ${type} Get From Dictionary ${ipmap} OS-EXT-IPS:type
101 \ ${ip} Get From Dictionary ${ipmap} addr
102 \ ${version} Get From Dictionary ${ipmap} version
103 \ Return from Keyword if '${version}'=='4' and '${type}'=='${testtype}' ${ip}
104 Fail No Version 4 IP