blob: 33cd1c2922f82eec0fa192051102a2718aa14ef1 [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
Steven Sombarfac31e92017-12-15 09:40:34 -060012Test Teardown Test Teardown Execution
Rahul Maheshwari9e7b67a2017-08-02 00:29:07 -050013
George Keishing42c84ea2023-09-07 20:31:45 +053014Force Tags Host_Network
Rahul Maheshwari9e7b67a2017-08-02 00:29:07 -050015
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
25Set 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
manasarm104cc6b2018-02-07 12:35:05 +053046 ${data}= Read Properties ${NETWORK_MANAGER}host0/intf/addr
Rahul Maheshwari9e7b67a2017-08-02 00:29:07 -050047 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}=
manasarm104cc6b2018-02-07 12:35:05 +053052 ... Read Attribute ${NETWORK_MANAGER}host0/intf MACAddress
Rahul Maheshwari9e7b67a2017-08-02 00:29:07 -050053 Should Be Equal ${new_mac_address} ${mac_address}
54
55
56Set 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
manasarm104cc6b2018-02-07 12:35:05 +053068 ${origin}= Read Attribute ${NETWORK_MANAGER}host0/intf/addr Origin
Rahul Maheshwari9e7b67a2017-08-02 00:29:07 -050069 ${new_mac_address}=
manasarm104cc6b2018-02-07 12:35:05 +053070 ... Read Attribute ${NETWORK_MANAGER}host0/intf MACAddress
Rahul Maheshwari9e7b67a2017-08-02 00:29:07 -050071 Should Contain ${origin} DHCP
72 Should Be Equal ${new_mac_address} ${mac_address}
73
74
75*** Keywords ***
76
Steven Sombarfac31e92017-12-15 09:40:34 -060077Test Teardown Execution
Rahul Maheshwari9e7b67a2017-08-02 00:29:07 -050078 [Documentation] Do the post test teardown.
79
80 FFDC On Test Case Fail
81 Run IPMI command ${CLEAR_ADDR}
82 Close All Connections