| 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 | 
| Naman Navin Hegde | 45dd94f | 2019-09-17 22:27:12 -0500 | [diff] [blame] | 7 | Library                 ../../lib/bmc_network_utils.py | 
| Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 8 | Library                 ../../lib/gen_print.py | 
|  | 9 | Library                 ../../lib/gen_robot_print.py | 
|  | 10 | Library                 ../../lib/openbmctool_utils.py | 
|  | 11 | Library                 ../../lib/gen_misc.py | 
|  | 12 | Library                 ../../lib/gen_robot_valid.py | 
|  | 13 | Resource                ../../syslib/utils_os.robot | 
|  | 14 | Resource                ../../lib/resource.robot | 
|  | 15 | Resource                ../../lib/bmc_network_utils.robot | 
|  | 16 | Resource                ../../lib/utils.robot | 
|  | 17 | Resource                ../../lib/common_utils.robot | 
|  | 18 |  | 
|  | 19 |  | 
|  | 20 | Suite Setup             Suite Setup Execution | 
|  | 21 | Test Setup              Printn | 
|  | 22 |  | 
|  | 23 | *** Variables *** | 
|  | 24 |  | 
|  | 25 | ${ip}                   10.5.5.5 | 
|  | 26 | ${dns_ip}               10.10.10.10 | 
|  | 27 | ${domain_name}          randomName.com | 
| Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 28 | ${mac_address}          76:e2:84:14:87:91 | 
|  | 29 | ${ntp_server}           pool.ntp.org | 
| Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 30 | ${parser}               |grep "ipv4"|awk -F/ 'NR==1{print$5}' | 
|  | 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} | 
| Naman Navin Hegde | 45dd94f | 2019-09-17 22:27:12 -0500 | [diff] [blame] | 130 | # Get NTP server details via REDFISH. | 
|  | 131 | ${eth0}=  Redfish.Get Properties  ${REDFISH_NW_PROTOCOL_URI} | 
|  | 132 | Valid Value  eth0['NTP']['NTPServers'][0]  ['${ntp_server}'] | 
| Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 133 |  | 
|  | 134 |  | 
|  | 135 | Verify GetNTP | 
|  | 136 | [Documentation]  Verify that openbmctool can run the getNTP command. | 
|  | 137 | [Tags]  Verify_GetNTP | 
|  | 138 |  | 
|  | 139 | Network  setNTP  I=eth0  N=${ntp_server} | 
| Naman Navin Hegde | 45dd94f | 2019-09-17 22:27:12 -0500 | [diff] [blame] | 140 | # Get NTP server details via REDFISH. | 
|  | 141 | ${eth0}=  Redfish.Get Properties  ${REDFISH_NW_PROTOCOL_URI} | 
| Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 142 | ${tool_ntp}=  Network  getNTP  I=eth0 | 
| Naman Navin Hegde | 45dd94f | 2019-09-17 22:27:12 -0500 | [diff] [blame] | 143 | Valid Value  eth0['NTP']['NTPServers'][0]  ['${tool_ntp}'] | 
|  | 144 |  | 
|  | 145 |  | 
|  | 146 | Verify SetDomainName | 
|  | 147 | [Documentation]  Verify set domain name via openbmctool. | 
|  | 148 | [Tags]  Verify_SetDomainName | 
|  | 149 |  | 
|  | 150 | Network  setDomainName  I=eth0  D=${domain_name} | 
|  | 151 | ${eth0}=  Redfish.Get Properties  ${REDFISH_NW_ETH0_URI} | 
|  | 152 | ${eth0_domain_name}=  Strip String  ${eth0['FQDN']} | 
|  | 153 | ...  characters=${eth0['HostName']}.  mode=left | 
|  | 154 | Valid Value  eth0_domain_name  ['${domain_name}'] | 
|  | 155 |  | 
|  | 156 |  | 
|  | 157 | Verify GetDomainName | 
|  | 158 | [Documentation]  Verify get domain name via openbmctool. | 
|  | 159 | [Tags]  Verify_GetDomainName | 
|  | 160 |  | 
|  | 161 | Network  setDomainName  I=eth0  D=${domain_name} | 
|  | 162 | ${eth0}=  Redfish.Get Properties  ${REDFISH_NW_ETH0_URI} | 
|  | 163 | ${eth0_domain_name}=  Strip String  ${eth0['FQDN']} | 
|  | 164 | ...  characters=${eth0['HostName']}.  mode=left | 
|  | 165 | ${tool_domain_name}=  Network  getDomainName  I=eth0 | 
|  | 166 | Valid Value  eth0_domain_name  ['${tool_domain_name}'] | 
| Naman Navin Hegde | 6b09db3 | 2019-09-10 00:54:12 -0500 | [diff] [blame] | 167 |  | 
|  | 168 |  | 
| Naman Navin Hegde | 1192b62 | 2019-11-04 23:51:07 -0600 | [diff] [blame] | 169 | Verify Add VLAN | 
|  | 170 | [Documentation]  Verify add VLAN via openbmctool. | 
|  | 171 | [Tags]  Verify_Add_VLAN | 
|  | 172 | [Teardown]  Network  deleteVLAN  I=eth0_35 | 
|  | 173 |  | 
|  | 174 | Network  addVLAN  I=eth0  n=35 | 
|  | 175 | ${eth0_vlan}=  Redfish.Get Properties  ${REDFISH_NW_ETH0_URI}VLANs/eth0_35 | 
|  | 176 | Valid Value  eth0_vlan['Id']  ['eth0_35'] | 
|  | 177 |  | 
|  | 178 |  | 
|  | 179 | Verify Delete VLAN | 
|  | 180 | [Documentation]  Verify delete VLAN via openbmctool. | 
|  | 181 | [Tags]  Verify_Delete_VLAN | 
|  | 182 |  | 
|  | 183 | Network  addVLAN  I=eth0  n=35 | 
|  | 184 | ${eth0_vlan}=  Redfish.Get Properties  ${REDFISH_NW_ETH0_URI}VLANs/eth0_35 | 
|  | 185 | Valid Value  eth0_vlan['Id']  ['eth0_35'] | 
|  | 186 | Network  deleteVLAN  I=eth0_35 | 
|  | 187 | Redfish.Get Properties | 
|  | 188 | ...  ${REDFISH_NW_ETH0_URI}VLANs/eth0_35  valid_status_codes=[${HTTP_NOT_FOUND}] | 
|  | 189 |  | 
|  | 190 |  | 
| Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 191 | *** Keywords *** | 
|  | 192 |  | 
|  | 193 | Suite Setup Execution | 
|  | 194 | [Documentation]  Verify connectivity to run openbmctool commands. | 
|  | 195 |  | 
|  | 196 | Valid Value  OPENBMC_HOST | 
|  | 197 | Valid Value  OPENBMC_USERNAME | 
|  | 198 | Valid Value  OPENBMC_PASSWORD | 
| Naman Navin Hegde | 45dd94f | 2019-09-17 22:27:12 -0500 | [diff] [blame] | 199 | Redfish.Login | 
| Naman Navin Hegde | 5369145 | 2019-07-30 00:22:37 -0500 | [diff] [blame] | 200 |  | 
|  | 201 | # Verify connectivity to the BMC host. | 
|  | 202 | ${bmc_version}=  Get BMC Version | 
|  | 203 |  | 
|  | 204 | # Verify can find the openbmctool. | 
|  | 205 | ${openbmctool_file_path}=  which  openbmctool.py | 
|  | 206 | Printn | 
|  | 207 | Rprint Vars  openbmctool_file_path | 
|  | 208 |  | 
|  | 209 | # Get the version number from openbmctool. | 
|  | 210 | ${openbmctool_version}=  Get Openbmctool Version | 
|  | 211 |  | 
|  | 212 | ${rc}  ${res}=  Openbmctool Execute Command  network view-config${parser} | 
|  | 213 | Set Suite Variable  ${interface}  ${res.strip()} | 
|  | 214 |  | 
|  | 215 | Rprint Vars  openbmctool_version  OPENBMC_HOST  bmc_version[1] | 
|  | 216 |  | 
|  | 217 |  | 
|  | 218 | Validate Non Existence Of IP On BMC | 
|  | 219 | [Documentation]  Verify that IP address is not present in set of IP addresses. | 
|  | 220 | [Arguments]  ${ip_address}  ${ip_data} | 
|  | 221 |  | 
|  | 222 | # Description of argument(s): | 
|  | 223 | # ip_address  IP address to check (e.g. xx.xx.xx.xx). | 
|  | 224 | # ip_data     Set of the IP addresses present. | 
|  | 225 |  | 
|  | 226 | Should Not Contain Match  ${ip_data}  ${ip_address}/* | 
|  | 227 | ...  msg=${ip_address} found in the list provided. | 
|  | 228 |  | 
|  | 229 |  | 
|  | 230 | Wait And Verify IP On BMC | 
|  | 231 | [Documentation]  Wait and verify if system IP exists. | 
|  | 232 | [Arguments]  ${ip} | 
|  | 233 |  | 
|  | 234 | # Description of argument(s): | 
|  | 235 | # ip  IP address to verify (e.g. xx.xx.xx.xx). | 
|  | 236 |  | 
|  | 237 | # Note:Network restart takes around 15-18s after network-config with openbmctool. | 
|  | 238 |  | 
|  | 239 | Sleep  ${NETWORK_TIMEOUT}s | 
|  | 240 | Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT} | 
|  | 241 |  | 
|  | 242 | Verify IP On BMC  ${ip} |