blob: f57086653ca461e19b8ccc482ed9ef5b5abb4665 [file] [log] [blame]
Rahul Maheshwari9e7b67a2017-08-02 00:29:07 -05001*** Settings ***
2
3Documentation Test setting network address of host OS.
4
5Resource ../lib/rest_client.robot
6Resource ../lib/ipmi_client.robot
7Resource ../lib/utils.robot
8Resource ../lib/openbmc_ffdc.robot
9Library ../lib/utilities.py
10
11Test Setup Open Connection And Log In
12Test 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
24Set 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
55Set 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
76Post 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