Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Verify OBMC tool's network fuctionality. |
| 3 | |
| 4 | |
| 5 | Library String |
| 6 | Library OperatingSystem |
| 7 | Library ../../lib/gen_print.py |
| 8 | Library ../../lib/gen_robot_print.py |
| 9 | Library ../../lib/openbmctool_utils.py |
| 10 | Library ../../lib/gen_misc.py |
| 11 | Library ../../lib/gen_robot_valid.py |
| 12 | Resource ../../syslib/utils_os.robot |
| 13 | Resource ../../lib/resource.robot |
| 14 | Resource ../../lib/bmc_network_utils.robot |
| 15 | Resource ../../lib/utils.robot |
| 16 | Resource ../../lib/common_utils.robot |
| 17 | |
| 18 | |
| 19 | Suite Setup Suite Setup Execution |
| 20 | Test Setup Printn |
| 21 | |
| 22 | *** Variables *** |
| 23 | |
| 24 | ${ip} 10.5.5.5 |
| 25 | ${dns_ip} 10.10.10.10 |
| 26 | ${domain_name} randomName.com |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 27 | ${mac_address} 76:e2:84:14:87:91 |
| 28 | ${ntp_server} pool.ntp.org |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 29 | ${parser} |grep "ipv4"|awk -F/ 'NR==1{print$5}' |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 30 | ${eth0_resource_path} /xyz/openbmc_project/network/eth0 |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 31 | ${ignore_err} ${0} |
| 32 | |
| 33 | |
| 34 | *** Test Cases *** |
| 35 | |
| 36 | Verify GetIP |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 37 | [Documentation] Verify that openbmctool can run the getIP command. |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 38 | [Tags] Verify_GetIP |
| 39 | |
| 40 | ${ip_records}= Network getIP I=eth0 |
| 41 | ${addresses}= Nested Get Address ${ip_records} |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 42 | Verify IP On BMC ${addresses}[${0}] |
| 43 | |
| 44 | |
| 45 | Verify AddIP |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 46 | [Documentation] Verify that openbmctool can run the addIP command. |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 47 | [Tags] Verify_AddIP |
| 48 | |
| 49 | Network addIP I=${interface} a=${ip} l=24 p=ipv4 |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 50 | Wait And Verify IP On BMC ${ip} |
| 51 | |
| 52 | |
| 53 | Verify GetDefaultGW |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 54 | [Documentation] Verify that openbmctool can run the getDefaultGW command. |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 55 | [Tags] Verify_GetDefaultGW |
| 56 | |
| 57 | ${default_gw}= Network getDefaultGW |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 58 | Verify Gateway On BMC ${default_gw} |
| 59 | |
| 60 | |
| 61 | Verify RemoveIP |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 62 | [Documentation] Verify that openbmctool can run the rmIP command. |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 63 | [Tags] Verify_RemoveIP |
| 64 | |
| 65 | Network addIP I=${interface} a=${ip} l=24 p=ipv4 |
| 66 | Wait And Verify IP On BMC ${ip} |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 67 | Network rmIP I=${interface} a=${ip} |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 68 | ${status}= Run Keyword And Return Status Wait And Verify IP On BMC ${ip} |
| 69 | Should Be Equal ${status} ${False} |
| 70 | |
| 71 | |
| 72 | Verify SetDNS |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 73 | [Documentation] Verify that openbmctool can run the setDNS command. |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 74 | [Tags] Verify_SetDNS |
| 75 | |
| 76 | Network setDNS I=eth0 d=${dns_ip} |
| 77 | ${dns_config}= CLI Get Nameservers |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 78 | Should Contain ${dns_config} ${dns_ip} |
| 79 | |
| 80 | |
| 81 | Verify GetDNS |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 82 | [Documentation] Verify that openbmctool can run the getDNS command. |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 83 | [Tags] Verify_GetDNS |
| 84 | |
| 85 | Network setDNS I=eth0 d=${dns_ip} |
| 86 | ${dns_data}= Network getDNS I=eth0 |
| 87 | ${dns_config}= CLI Get Nameservers |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 88 | Should Contain ${dns_config} ${dns_data}[${0}] |
| 89 | |
| 90 | |
| 91 | Verify SetHostName |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 92 | [Documentation] Verify that openbmctool can run the setHostName command. |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 93 | [Tags] Verify_SetHostName |
| 94 | |
| 95 | Network setHostName H=randomName |
| 96 | ${bmc_hostname}= Get BMC Hostname |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 97 | Should Be Equal As Strings ${bmc_hostname} randomName |
| 98 | |
| 99 | |
| 100 | Verify GetHostName |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 101 | [Documentation] Verify that openbmctool can run the getHostName command. |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 102 | [Tags] Verify_GetHostName |
| 103 | |
| 104 | ${tool_hostname}= Network getHostName |
| 105 | ${bmc_hostname}= Get BMC Hostname |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 106 | Should Be Equal As Strings ${bmc_hostname} ${tool_hostname} |
| 107 | |
| 108 | |
Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 109 | Verify SetMACAddress |
| 110 | [Documentation] Verify that openbmctool can set a new MAC address. |
| 111 | [Tags] Verify_SetMACAddress |
| 112 | |
| 113 | Network setMACAddress I=eth0 MA=${mac_address} |
| 114 | Validate MAC On BMC ${mac_address} |
| 115 | |
| 116 | |
| 117 | Verify GetMACAddress |
| 118 | [Documentation] Verify that openbmctool can get the MAC address. |
| 119 | [Tags] Verify_GetMACAddress |
| 120 | |
| 121 | ${mac_addr}= Network getMACAddress I=eth0 |
| 122 | Validate MAC On BMC ${mac_addr} |
| 123 | |
| 124 | |
| 125 | Verify SetNTP |
| 126 | [Documentation] Verify that openbmctool can run the setNTP command. |
| 127 | [Tags] Verify_SetNTP |
| 128 | |
| 129 | Network setNTP I=eth0 N=${ntp_server} |
| 130 | # Get NTP server details via REST. |
| 131 | ${eth0}= Read Properties ${eth0_resource_path} quiet=1 |
| 132 | Rprint Vars eth0 |
| 133 | Valid Value eth0['NTPServers'][0] ['${ntp_server}'] |
| 134 | |
| 135 | |
| 136 | Verify GetNTP |
| 137 | [Documentation] Verify that openbmctool can run the getNTP command. |
| 138 | [Tags] Verify_GetNTP |
| 139 | |
| 140 | Network setNTP I=eth0 N=${ntp_server} |
| 141 | # Get NTP server details via REST method. |
| 142 | ${eth0}= Read Properties ${eth0_resource_path} quiet=1 |
| 143 | Rprint Vars eth0 |
| 144 | ${tool_ntp}= Network getNTP I=eth0 |
| 145 | Valid Value eth0['NTPServers'][0] ['${tool_ntp}'] |
| 146 | |
| 147 | |
Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 148 | *** Keywords *** |
| 149 | |
| 150 | Suite Setup Execution |
| 151 | [Documentation] Verify connectivity to run openbmctool commands. |
| 152 | |
| 153 | Valid Value OPENBMC_HOST |
| 154 | Valid Value OPENBMC_USERNAME |
| 155 | Valid Value OPENBMC_PASSWORD |
| 156 | |
| 157 | # Verify connectivity to the BMC host. |
| 158 | ${bmc_version}= Get BMC Version |
| 159 | |
| 160 | # Verify can find the openbmctool. |
| 161 | ${openbmctool_file_path}= which openbmctool.py |
| 162 | Printn |
| 163 | Rprint Vars openbmctool_file_path |
| 164 | |
| 165 | # Get the version number from openbmctool. |
| 166 | ${openbmctool_version}= Get Openbmctool Version |
| 167 | |
| 168 | ${rc} ${res}= Openbmctool Execute Command network view-config${parser} |
| 169 | Set Suite Variable ${interface} ${res.strip()} |
| 170 | |
| 171 | Rprint Vars openbmctool_version OPENBMC_HOST bmc_version[1] |
| 172 | |
| 173 | |
| 174 | Validate Non Existence Of IP On BMC |
| 175 | [Documentation] Verify that IP address is not present in set of IP addresses. |
| 176 | [Arguments] ${ip_address} ${ip_data} |
| 177 | |
| 178 | # Description of argument(s): |
| 179 | # ip_address IP address to check (e.g. xx.xx.xx.xx). |
| 180 | # ip_data Set of the IP addresses present. |
| 181 | |
| 182 | Should Not Contain Match ${ip_data} ${ip_address}/* |
| 183 | ... msg=${ip_address} found in the list provided. |
| 184 | |
| 185 | |
| 186 | Wait And Verify IP On BMC |
| 187 | [Documentation] Wait and verify if system IP exists. |
| 188 | [Arguments] ${ip} |
| 189 | |
| 190 | # Description of argument(s): |
| 191 | # ip IP address to verify (e.g. xx.xx.xx.xx). |
| 192 | |
| 193 | # Note:Network restart takes around 15-18s after network-config with openbmctool. |
| 194 | |
| 195 | Sleep ${NETWORK_TIMEOUT}s |
| 196 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 197 | |
| 198 | Verify IP On BMC ${ip} |