blob: f7ccdbc129613aad5e2ce8c3bd89d9a094b2267b [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
9
10Test Teardown FFDC On Test Case Fail
11
12Force Tags IPMI_Network
13
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050014
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -050015*** Variables ***
16
17${initial_lan_config} &{EMPTY}
18
19
20*** Test Cases ***
21
Rahul Maheshwaridf04d922019-07-30 12:15:36 -050022Retrieve IP Address Via IPMI And Verify Using Redfish
23 [Documentation] Retrieve IP address using IPMI and verify using Redfish.
24 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_Using_Redish
25
26 ${lan_print_ipmi}= Get LAN Print Dict
27
28 # Fetch IP address list using redfish.
29 ${ip_list_redfish}= Create List
30 Redfish.Login
31 ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI}
32 @{network_config_redfish}= Get From Dictionary ${resp.dict} IPv4StaticAddresses
33 : FOR ${network_config_redfish} IN @{network_config_redfish}
34 \ Append To List ${ip_list_redfish} ${network_config_redfish['Address']}
35
36 Valid Value lan_print_ipmi['IP Address'] ${ip_list_redfish}
37
38
39Retrieve Default Gateway Via IPMI And Verify Using Redfish
40 [Documentation] Retrieve default gateway via IPMI and verify using Redfish.
41 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_Redfish
42
43 ${lan_print_ipmi}= Get LAN Print Dict
44
45 # Fetch gateway address list using redfish.
46 ${gateway_list_redfish}= Create List
47 Redfish.Login
48 ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI}
49 @{network_config_redfish}= Get From Dictionary ${resp.dict} IPv4StaticAddresses
50 : FOR ${network_config_redfish} IN @{network_config_redfish}
51 \ Append To List ${gateway_list_redfish} ${network_config_redfish['Gateway']}
52
53 Valid Value lan_print_ipmi['Default Gateway IP'] ${gateway_list_redfish}
54
55
56Retrieve MAC Address Via IPMI And Verify Using Redfish
57 [Documentation] Retrieve MAC address via IPMI and verify using Redfish.
58 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish
59
60 ${lan_print_ipmi}= Get LAN Print Dict
61
62 Redfish.Login
63 ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI}
64 ${mac_address_redfish}= Get From Dictionary ${resp.dict} MACAddress
65
66 Valid Value lan_print_ipmi['MAC Address'] ${mac_address_redfish}
67
68
Rahul Maheshwaria7c39032019-09-18 02:15:01 -050069Test Valid IPMI Channels Supported
70 [Documentation] Verify IPMI channels supported on a given system.
71 [Tags] Test_Valid_IPMI_Channels_Supported
72
73 ${channel_count}= Get Physical Network Interface Count
74
75 # Note: IPMI network channel logically starts from 1.
76 :FOR ${channel_number} IN RANGE 1 ${channel_count}
77 \ Run IPMI Standard Command lan print ${channel_number}
78
79
80Test Invalid IPMI Channel Response
81 [Documentation] Verify invalid IPMI channels supported response.
82 [Tags] Test_Invalid_IPMI_Channel_Response
83
84 ${channel_count}= Get Physical Network Interface Count
85
86 # To target invalid channel, increment count.
87 ${channel_number}= Evaluate ${channel_count} + 1
88
89 # Example of invalid channel:
90 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
91 # Get Channel Info command failed: Parameter out of range
92 # Invalid channel: 3
93
94 ${stdout}= Run External IPMI Standard Command
95 ... lan print ${channel_number} fail_on_err=${0}
96 Should Contain ${stdout} Invalid channel
97 ... msg=IPMI channel ${channel_number} is invalid but seen working.
98
99
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500100Verify IPMI Inband Network Configuration
101 [Documentation] Verify BMC network configuration via inband IPMI.
102 [Tags] Verify_IPMI_Inband_Network_Configuration
103 [Teardown] Run Keywords Restore Configuration AND FFDC On Test Case Fail
104
105 Redfish Power On
106 ${initial_lan_config}= Get LAN Print Dict inband
107 Set Suite Variable ${initial_lan_config}
108
109 Set IPMI Inband Network Configuration 10.10.10.10 255.255.255.0 10.10.10.10
110 Sleep 10
111
112 ${lan_print_output}= Get LAN Print Dict inband
113 Valid Value lan_print_output['IP Address'] ["10.10.10.10"]
114 Valid Value lan_print_output['Subnet Mask'] ["255.255.255.0"]
115 Valid Value lan_print_output['Default Gateway IP'] ["10.10.10.10"]
116
117
118*** Keywords ***
119
Rahul Maheshwaria7c39032019-09-18 02:15:01 -0500120Get Physical Network Interface Count
121 [Documentation] Return valid physical network interfaces count.
122 # Example:
123 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
124 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
125
126 ${mac_entry_list}= Get BMC MAC Address List
127 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
128 ${physical_interface_count}= Get Length ${mac_unique_list}
129
130 [Return] ${physical_interface_count}
131
132
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500133Set IPMI Inband Network Configuration
134 [Documentation] Run sequence of standard IPMI command in-band and set
135 ... the IP configuration.
136 [Arguments] ${ip} ${netmask} ${gateway} ${login}=${1}
137
138 # Description of argument(s):
139 # ip The IP address to be set using ipmitool-inband.
140 # netmask The Netmask to be set using ipmitool-inband.
141 # gateway The Gateway address to be set using ipmitool-inband.
142
143 Run Inband IPMI Standard Command
144 ... lan set 1 ipsrc static login_host=${login}
145 Run Inband IPMI Standard Command
146 ... lan set 1 ipaddr ${ip} login_host=${0}
147 Run Inband IPMI Standard Command
148 ... lan set 1 netmask ${netmask} login_host=${0}
149 Run Inband IPMI Standard Command
150 ... lan set 1 defgw ipaddr ${gateway} login_host=${0}
151
152
153Restore Configuration
154 [Documentation] Restore the configuration to its pre-test state
Naman Navin Hegde9e8c0d82019-08-11 15:22:44 -0500155 ${length}= Get Length ${initial_lan_config}
156 Return From Keyword If ${length} == ${0}
157
158 Set IPMI Inband Network Configuration ${initial_lan_config['IP Address']}
159 ... ${initial_lan_config['Subnet Mask']}
160 ... ${initial_lan_config['Default Gateway IP']} login=${0}
Rahul Maheshwaridf04d922019-07-30 12:15:36 -0500161