blob: 39bac45b1d7fb8657d46d35863756c2a76c8ea0e [file] [log] [blame]
George Keishing364e93d2020-03-05 04:31:49 -06001*** Settings ***
2
3Documentation Module to test IPMI network functionality.
4Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
6Resource ../lib/bmc_network_utils.robot
7Library ../lib/ipmi_utils.py
8Library ../lib/gen_robot_valid.py
9Library ../lib/var_funcs.py
10Library ../lib/bmc_network_utils.py
11
12Suite Setup Redfish.Login
13Test Setup Printn
14Test Teardown FFDC On Test Case Fail
15
16Force Tags IPMI_Network_Verify
17
18*** Test Cases ***
19
20Retrieve IP Address Via IPMI And Verify Using Redfish
21 [Documentation] Retrieve IP address using IPMI and verify using Redfish.
22 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_Using_Redish
23
24 ${active_channel_config}= Get Active Channel Config
25 FOR ${channel_number} IN @{active_channel_config.keys()}
26 Verify Channel Info ${channel_number} IPv4StaticAddresses ${active_channel_config}
27 END
28
29Retrieve Default Gateway Via IPMI And Verify
30 [Documentation] Retrieve default gateway via IPMI and verify it's existence on the BMC.
31 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify
32
33 ${lan_print_ipmi}= Get LAN Print Dict
34
35 Verify Gateway On BMC ${lan_print_ipmi['Default Gateway IP']}
36
37
38Retrieve MAC Address Via IPMI And Verify Using Redfish
39 [Documentation] Retrieve MAC address via IPMI and verify using Redfish.
40 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish
41
42 ${active_channel_config}= Get Active Channel Config
43 FOR ${channel_number} IN @{active_channel_config.keys()}
44 Verify Channel Info ${channel_number} MACAddress ${active_channel_config}
45 END
46
47
48Test Valid IPMI Channels Supported
49 [Documentation] Verify IPMI channels supported on a given system.
50 [Tags] Test_Valid_IPMI_Channels_Supported
51
52 ${channel_count}= Get Physical Network Interface Count
53
54 # Note: IPMI network channel logically starts from 1.
55 FOR ${channel_number} IN RANGE 1 ${channel_count}
56 Run IPMI Standard Command lan print ${channel_number}
57 END
58
59
60Test Invalid IPMI Channel Response
61 [Documentation] Verify invalid IPMI channels supported response.
62 [Tags] Test_Invalid_IPMI_Channel_Response
63
64 ${channel_count}= Get Physical Network Interface Count
65
66 # To target invalid channel, increment count.
67 ${channel_number}= Evaluate ${channel_count} + 1
68
69 # Example of invalid channel:
70 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
71 # Get Channel Info command failed: Parameter out of range
72 # Invalid channel: 3
73
74 ${stdout}= Run External IPMI Standard Command
75 ... lan print ${channel_number} fail_on_err=${0}
76 Should Contain ${stdout} Invalid channel
77 ... msg=IPMI channel ${channel_number} is invalid but seen working.
78
79
80Get IP Address Source And Verify Using Redfish
81 [Documentation] Get IP address source and verify it using Redfish.
82 [Tags] Get_IP_Address_Source_And_Verify_Using_Redfish
83
84 ${active_channel_config}= Get Active Channel Config
85 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER}
86
87 ${ipv4_addresses}= Redfish.Get Attribute
88 ... /redfish/v1/Managers/bmc/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
89 ... IPv4Addresses
90
91 FOR ${ipv4_address} IN @{ipv4_addresses}
92 ${ip_address_source}=
93 ... Set Variable if '${ipv4_address['Address']}' == '${lan_config['IP Address']}'
94 ... ${ipv4_address['AddressOrigin']} Address
95 Exit For Loop IF "${ip_address_source}" != 'None'
96 END
97
98 Valid Value lan_config['IP Address Source'] ['${ip_address_source}']
99
100
101*** Keywords ***
102
103Get Physical Network Interface Count
104 [Documentation] Return valid physical network interfaces count.
105 # Example:
106 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
107 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
108
109 ${mac_entry_list}= Get BMC MAC Address List
110 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
111 ${physical_interface_count}= Get Length ${mac_unique_list}
112
113 [Return] ${physical_interface_count}
114
115
116Verify Channel Info
117 [Documentation] Verify the channel info.
118 [Arguments] ${channel_number} ${network_parameter} ${active_channel_config}
119
120 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses'
121 ... Verify IPv4 Static Address ${channel_number} ${active_channel_config}
122 ... ELSE IF '${network_parameter}' == 'MACAddress'
123 ... Verify MAC Address ${channel_number} ${active_channel_config}
124
125
126Verify IPv4 Static Address
127 [Documentation] Verify the IPv4 Static Address.
128 [Arguments] ${channel_number} ${active_channel_config}
129
130 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
131 ${ipv4_static_addresses}= Redfish.Get Attribute
132 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} IPv4StaticAddresses
133 ${redfish_ips}= Nested Get Address ${ipv4_static_addresses}
134 Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips
135 Valid Value lan_print_ipmi['IP Address'] ${redfish_ips}
136
137
138Verify MAC Address
139 [Documentation] Verify the MAC Address.
140 [Arguments] ${channel_number} ${active_channel_config}
141
142 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
143 ${redfish_mac_address}= Redfish.Get Attribute
144 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} MACAddress
145 Rprint Vars lan_print_ipmi redfish_mac_address
146 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}']