blob: 93ca38058b84de4b978eadbbe89e72aa4d15bb5d [file] [log] [blame]
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -05001*** Settings ***
2
3Documentation Module to test IPMI network functionality.
4Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
Rahul Maheshwaria7c39032019-09-18 02:15:01 -05006Resource ../lib/bmc_network_utils.robot
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -05007Library ../lib/ipmi_utils.py
8Library ../lib/gen_robot_valid.py
Tony Leeea741302019-11-08 11:01:58 +08009Library ../lib/var_funcs.py
10Library ../lib/bmc_network_utils.py
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050011
Tony Leeea741302019-11-08 11:01:58 +080012Suite Setup Redfish.Login
13Test Setup Printn
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050014Test Teardown FFDC On Test Case Fail
15
16Force Tags IPMI_Network
17
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050018
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050019*** Variables ***
20
21${initial_lan_config} &{EMPTY}
22
23
24*** Test Cases ***
25
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050026Retrieve IP Address Via IPMI And Verify Using Redfish
27 [Documentation] Retrieve IP address using IPMI and verify using Redfish.
28 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_Using_Redish
29
Tony Leeea741302019-11-08 11:01:58 +080030 ${active_channel_config}= Get Active Channel Config
31 :FOR ${channel_number} IN @{active_channel_config.keys()}
32 \ Verify Channel Info ${channel_number} IPv4StaticAddresses ${active_channel_config}
33 END
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050034
Prashanth Katti9bebccb2019-09-25 06:38:04 -050035Retrieve Default Gateway Via IPMI And Verify
36 [Documentation] Retrieve default gateway via IPMI and verify it's existence on the BMC.
37 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050038
39 ${lan_print_ipmi}= Get LAN Print Dict
40
Prashanth Katti9bebccb2019-09-25 06:38:04 -050041 Verify Gateway On BMC ${lan_print_ipmi['Default Gateway IP']}
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050042
43
44Retrieve MAC Address Via IPMI And Verify Using Redfish
45 [Documentation] Retrieve MAC address via IPMI and verify using Redfish.
46 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish
47
Tony Leeea741302019-11-08 11:01:58 +080048 ${active_channel_config}= Get Active Channel Config
49 :FOR ${channel_number} IN @{active_channel_config.keys()}
50 \ Verify Channel Info ${channel_number} MACAddress ${active_channel_config}
51 END
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050052
53
Rahul Maheshwaria7c39032019-09-18 02:15:01 -050054Test Valid IPMI Channels Supported
55 [Documentation] Verify IPMI channels supported on a given system.
56 [Tags] Test_Valid_IPMI_Channels_Supported
57
58 ${channel_count}= Get Physical Network Interface Count
59
60 # Note: IPMI network channel logically starts from 1.
61 :FOR ${channel_number} IN RANGE 1 ${channel_count}
62 \ Run IPMI Standard Command lan print ${channel_number}
63
64
65Test Invalid IPMI Channel Response
66 [Documentation] Verify invalid IPMI channels supported response.
67 [Tags] Test_Invalid_IPMI_Channel_Response
68
69 ${channel_count}= Get Physical Network Interface Count
70
71 # To target invalid channel, increment count.
72 ${channel_number}= Evaluate ${channel_count} + 1
73
74 # Example of invalid channel:
75 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
76 # Get Channel Info command failed: Parameter out of range
77 # Invalid channel: 3
78
79 ${stdout}= Run External IPMI Standard Command
80 ... lan print ${channel_number} fail_on_err=${0}
81 Should Contain ${stdout} Invalid channel
82 ... msg=IPMI channel ${channel_number} is invalid but seen working.
83
84
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050085Verify IPMI Inband Network Configuration
86 [Documentation] Verify BMC network configuration via inband IPMI.
87 [Tags] Verify_IPMI_Inband_Network_Configuration
88 [Teardown] Run Keywords Restore Configuration AND FFDC On Test Case Fail
89
90 Redfish Power On
Tony Leeea741302019-11-08 11:01:58 +080091 ${initial_lan_config}= Get LAN Print Dict ipmi_cmd_type=inband
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050092 Set Suite Variable ${initial_lan_config}
93
94 Set IPMI Inband Network Configuration 10.10.10.10 255.255.255.0 10.10.10.10
95 Sleep 10
96
Tony Leeea741302019-11-08 11:01:58 +080097 ${lan_print_output}= Get LAN Print Dict ipmi_cmd_type=inband
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050098 Valid Value lan_print_output['IP Address'] ["10.10.10.10"]
99 Valid Value lan_print_output['Subnet Mask'] ["255.255.255.0"]
100 Valid Value lan_print_output['Default Gateway IP'] ["10.10.10.10"]
101
102
103*** Keywords ***
104
Rahul Maheshwaria7c39032019-09-18 02:15:01 -0500105Get Physical Network Interface Count
106 [Documentation] Return valid physical network interfaces count.
107 # Example:
108 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
109 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
110
111 ${mac_entry_list}= Get BMC MAC Address List
112 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
113 ${physical_interface_count}= Get Length ${mac_unique_list}
114
115 [Return] ${physical_interface_count}
116
117
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500118Set IPMI Inband Network Configuration
119 [Documentation] Run sequence of standard IPMI command in-band and set
120 ... the IP configuration.
121 [Arguments] ${ip} ${netmask} ${gateway} ${login}=${1}
122
123 # Description of argument(s):
124 # ip The IP address to be set using ipmitool-inband.
125 # netmask The Netmask to be set using ipmitool-inband.
126 # gateway The Gateway address to be set using ipmitool-inband.
127
128 Run Inband IPMI Standard Command
129 ... lan set 1 ipsrc static login_host=${login}
130 Run Inband IPMI Standard Command
131 ... lan set 1 ipaddr ${ip} login_host=${0}
132 Run Inband IPMI Standard Command
133 ... lan set 1 netmask ${netmask} login_host=${0}
134 Run Inband IPMI Standard Command
135 ... lan set 1 defgw ipaddr ${gateway} login_host=${0}
136
137
138Restore Configuration
139 [Documentation] Restore the configuration to its pre-test state
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500140 ${length}= Get Length ${initial_lan_config}
141 Return From Keyword If ${length} == ${0}
142
143 Set IPMI Inband Network Configuration ${initial_lan_config['IP Address']}
144 ... ${initial_lan_config['Subnet Mask']}
145 ... ${initial_lan_config['Default Gateway IP']} login=${0}
Rahul Maheshwaridf04d922019-07-30 12:15:36 -0500146
Tony Leeea741302019-11-08 11:01:58 +0800147
148Verify Channel Info
149 [Documentation] Verify the channel info.
150 [Arguments] ${channel_number} ${network_parameter} ${active_channel_config}
151
152 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses'
153 ... Verify IPv4 Static Address ${channel_number} ${active_channel_config}
154 ... ELSE IF '${network_parameter}' == 'MACAddress'
155 ... Verify MAC Address ${channel_number} ${active_channel_config}
156
157
158Verify IPv4 Static Address
159 [Documentation] Verify the IPv4 Static Address.
160 [Arguments] ${channel_number} ${active_channel_config}
161
162 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
163 ${ipv4_static_addresses}= Redfish.Get Attribute
164 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} IPv4StaticAddresses
165 ${redfish_ips}= Nested Get Address ${ipv4_static_addresses}
166 Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips
167 Valid Value lan_print_ipmi['IP Address'] ${redfish_ips}
168
169
170Verify MAC Address
171 [Documentation] Verify the MAC Address.
172 [Arguments] ${channel_number} ${active_channel_config}
173
174 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
175 ${redfish_mac_address}= Redfish.Get Attribute
176 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} MACAddress
177 Rprint Vars lan_print_ipmi redfish_mac_address
178 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}']