Rahul Maheshwari | 9e7b67a | 2017-08-02 00:29:07 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test setting network address of host OS. |
| 4 | |
| 5 | Resource ../lib/rest_client.robot |
| 6 | Resource ../lib/ipmi_client.robot |
| 7 | Resource ../lib/utils.robot |
| 8 | Resource ../lib/openbmc_ffdc.robot |
| 9 | Library ../lib/utilities.py |
| 10 | |
| 11 | Test Setup Open Connection And Log In |
Steven Sombar | fac31e9 | 2017-12-15 09:40:34 -0600 | [diff] [blame] | 12 | Test Teardown Test Teardown Execution |
Rahul Maheshwari | 9e7b67a | 2017-08-02 00:29:07 -0500 | [diff] [blame] | 13 | |
George Keishing | 95686ef | 2017-10-29 23:47:52 -0500 | [diff] [blame] | 14 | Force Tags Host_Network_Test |
Rahul Maheshwari | 9e7b67a | 2017-08-02 00:29:07 -0500 | [diff] [blame] | 15 | |
| 16 | *** Variables *** |
| 17 | ${SET_ADDR_PREFIX} 0x00 0x08 0x61 0x80 0x21 0x70 0x62 0x21 0x00 0x01 0x06 0x04 |
| 18 | ${STATIC} 0x00 0x01 #equivalent address type 1 |
| 19 | ${DHCP} 0x00 0x00 #equivalent address type 0 |
| 20 | ${CLEAR_ADDR} 0x00 0x08 0x61 0x80 0x00 0x00 0x00 0x00 |
| 21 | |
| 22 | |
| 23 | *** Test Cases *** |
| 24 | |
| 25 | Set Static Host Network Address Via IPMI |
| 26 | [Documentation] Set static host network address via IPMI and verify |
| 27 | ... IP address set with REST. |
| 28 | [Tags] Set_Static_Host_Network_Address_Via_IPMI |
| 29 | |
| 30 | ${ip_address}= utilities.random_ip |
| 31 | ${gateway_ip}= utilities.random_ip |
| 32 | ${mac_address}= utilities.random_mac |
| 33 | ${prefix_length}= Evaluate random.randint(0, 32) modules=random |
| 34 | |
| 35 | ${mac_address_hex}= Mac Address To Hex String ${mac_address} |
| 36 | ${ip_address_hex}= IP Address To Hex String ${ip_address} |
| 37 | ${gateway_hex}= IP Address To Hex String ${gateway_ip} |
| 38 | ${prefix_hex}= Convert To Hex ${prefix_length} prefix=0x lowercase=yes |
| 39 | |
| 40 | ${ipmi_raw_cmd}= Catenate SEPARATOR= |
| 41 | ... ${SET_ADDR_PREFIX}${SPACE}${mac_address_hex}${SPACE}${STATIC}${SPACE} |
| 42 | ... ${ip_address_hex}${SPACE}${prefix_hex}${SPACE}${gateway_hex} |
| 43 | |
| 44 | Run IPMI command ${ipmi_raw_cmd} |
| 45 | |
manasarm | 104cc6b | 2018-02-07 12:35:05 +0530 | [diff] [blame] | 46 | ${data}= Read Properties ${NETWORK_MANAGER}host0/intf/addr |
Rahul Maheshwari | 9e7b67a | 2017-08-02 00:29:07 -0500 | [diff] [blame] | 47 | Should Contain ${data["Origin"]} Static |
| 48 | Should Be Equal ${data["Address"]} ${ip_address} |
| 49 | Should Be Equal ${data["Gateway"]} ${gateway_ip} |
| 50 | |
| 51 | ${new_mac_address}= |
manasarm | 104cc6b | 2018-02-07 12:35:05 +0530 | [diff] [blame] | 52 | ... Read Attribute ${NETWORK_MANAGER}host0/intf MACAddress |
Rahul Maheshwari | 9e7b67a | 2017-08-02 00:29:07 -0500 | [diff] [blame] | 53 | Should Be Equal ${new_mac_address} ${mac_address} |
| 54 | |
| 55 | |
| 56 | Set DHCP Host Address Via IPMI |
| 57 | [Documentation] Set dhcp host network address via IPMI and verify |
| 58 | ... IP address set with REST. |
| 59 | [Tags] Set_DHCP_Host_Address_Via_IPMI |
| 60 | |
| 61 | ${mac_address}= utilities.random_mac |
| 62 | ${mac_address_hex}= Mac Address To Hex String ${mac_address} |
| 63 | |
| 64 | ${ipmi_raw_cmd}= Catenate SEPARATOR= |
| 65 | ... ${SET_ADDR_PREFIX}${SPACE}${mac_address_hex}${SPACE}${DHCP} |
| 66 | Run IPMI command ${ipmi_raw_cmd} |
| 67 | |
manasarm | 104cc6b | 2018-02-07 12:35:05 +0530 | [diff] [blame] | 68 | ${origin}= Read Attribute ${NETWORK_MANAGER}host0/intf/addr Origin |
Rahul Maheshwari | 9e7b67a | 2017-08-02 00:29:07 -0500 | [diff] [blame] | 69 | ${new_mac_address}= |
manasarm | 104cc6b | 2018-02-07 12:35:05 +0530 | [diff] [blame] | 70 | ... Read Attribute ${NETWORK_MANAGER}host0/intf MACAddress |
Rahul Maheshwari | 9e7b67a | 2017-08-02 00:29:07 -0500 | [diff] [blame] | 71 | Should Contain ${origin} DHCP |
| 72 | Should Be Equal ${new_mac_address} ${mac_address} |
| 73 | |
| 74 | |
| 75 | *** Keywords *** |
| 76 | |
Steven Sombar | fac31e9 | 2017-12-15 09:40:34 -0600 | [diff] [blame] | 77 | Test Teardown Execution |
Rahul Maheshwari | 9e7b67a | 2017-08-02 00:29:07 -0500 | [diff] [blame] | 78 | [Documentation] Do the post test teardown. |
| 79 | |
| 80 | FFDC On Test Case Fail |
| 81 | Run IPMI command ${CLEAR_ADDR} |
| 82 | Close All Connections |