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 |
| 12 | Test Teardown Post Test Execution |
| 13 | |
| 14 | |
| 15 | *** Variables *** |
| 16 | ${SET_ADDR_PREFIX} 0x00 0x08 0x61 0x80 0x21 0x70 0x62 0x21 0x00 0x01 0x06 0x04 |
| 17 | ${STATIC} 0x00 0x01 #equivalent address type 1 |
| 18 | ${DHCP} 0x00 0x00 #equivalent address type 0 |
| 19 | ${CLEAR_ADDR} 0x00 0x08 0x61 0x80 0x00 0x00 0x00 0x00 |
| 20 | |
| 21 | |
| 22 | *** Test Cases *** |
| 23 | |
| 24 | Set Static Host Network Address Via IPMI |
| 25 | [Documentation] Set static host network address via IPMI and verify |
| 26 | ... IP address set with REST. |
| 27 | [Tags] Set_Static_Host_Network_Address_Via_IPMI |
| 28 | |
| 29 | ${ip_address}= utilities.random_ip |
| 30 | ${gateway_ip}= utilities.random_ip |
| 31 | ${mac_address}= utilities.random_mac |
| 32 | ${prefix_length}= Evaluate random.randint(0, 32) modules=random |
| 33 | |
| 34 | ${mac_address_hex}= Mac Address To Hex String ${mac_address} |
| 35 | ${ip_address_hex}= IP Address To Hex String ${ip_address} |
| 36 | ${gateway_hex}= IP Address To Hex String ${gateway_ip} |
| 37 | ${prefix_hex}= Convert To Hex ${prefix_length} prefix=0x lowercase=yes |
| 38 | |
| 39 | ${ipmi_raw_cmd}= Catenate SEPARATOR= |
| 40 | ... ${SET_ADDR_PREFIX}${SPACE}${mac_address_hex}${SPACE}${STATIC}${SPACE} |
| 41 | ... ${ip_address_hex}${SPACE}${prefix_hex}${SPACE}${gateway_hex} |
| 42 | |
| 43 | Run IPMI command ${ipmi_raw_cmd} |
| 44 | |
| 45 | ${data}= Read Properties ${XYZ_NETWORK_MANAGER}host0/intf/addr |
| 46 | Should Contain ${data["Origin"]} Static |
| 47 | Should Be Equal ${data["Address"]} ${ip_address} |
| 48 | Should Be Equal ${data["Gateway"]} ${gateway_ip} |
| 49 | |
| 50 | ${new_mac_address}= |
| 51 | ... Read Attribute ${XYZ_NETWORK_MANAGER}host0/intf MACAddress |
| 52 | Should Be Equal ${new_mac_address} ${mac_address} |
| 53 | |
| 54 | |
| 55 | Set DHCP Host Address Via IPMI |
| 56 | [Documentation] Set dhcp host network address via IPMI and verify |
| 57 | ... IP address set with REST. |
| 58 | [Tags] Set_DHCP_Host_Address_Via_IPMI |
| 59 | |
| 60 | ${mac_address}= utilities.random_mac |
| 61 | ${mac_address_hex}= Mac Address To Hex String ${mac_address} |
| 62 | |
| 63 | ${ipmi_raw_cmd}= Catenate SEPARATOR= |
| 64 | ... ${SET_ADDR_PREFIX}${SPACE}${mac_address_hex}${SPACE}${DHCP} |
| 65 | Run IPMI command ${ipmi_raw_cmd} |
| 66 | |
| 67 | ${origin}= Read Attribute ${XYZ_NETWORK_MANAGER}host0/intf/addr Origin |
| 68 | ${new_mac_address}= |
| 69 | ... Read Attribute ${XYZ_NETWORK_MANAGER}host0/intf MACAddress |
| 70 | Should Contain ${origin} DHCP |
| 71 | Should Be Equal ${new_mac_address} ${mac_address} |
| 72 | |
| 73 | |
| 74 | *** Keywords *** |
| 75 | |
| 76 | Post Test Execution |
| 77 | [Documentation] Do the post test teardown. |
| 78 | |
| 79 | FFDC On Test Case Fail |
| 80 | Run IPMI command ${CLEAR_ADDR} |
| 81 | Close All Connections |