blob: dec02d76efe1aa5716637927e20dcb9e01fa5018 [file] [log] [blame]
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -05001*** Settings ***
2Documentation Test BMC multiple network interface functionalities.
3
4# User input BMC IP for the eth1.
5# Use can input as -v OPENBMC_HOST_1:xx.xxx.xx from command line.
6Library ../../lib/bmc_redfish.py https://${OPENBMC_HOST_1}:${HTTPS_PORT}
7... ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} WITH NAME Redfish1
8
9Resource ../../lib/resource.robot
10Resource ../../lib/common_utils.robot
11Resource ../../lib/connection_client.robot
12Resource ../../lib/bmc_network_utils.robot
13Resource ../../lib/openbmc_ffdc.robot
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050014Resource ../../lib/bmc_ldap_utils.robot
Anves Kumar rayankula2f9632f2021-07-05 04:37:45 -050015Resource ../../lib/snmp/resource.robot
16Resource ../../lib/snmp/redfish_snmp_utils.robot
Anves Kumar rayankulaa38ec2e2021-07-10 01:09:23 -050017Library ../../lib/jobs_processing.py
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050018
19Suite Setup Suite Setup Execution
20Test Teardown FFDC On Test Case Fail
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050021Suite Teardown Run Keywords Redfish1.Logout AND Redfish.Logout
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050022
Anves Kumar rayankulad0a2f332021-07-14 07:53:12 -050023*** Variables ***
24
25${cmd_prefix} ipmitool -I lanplus -C 17 -p 623 -U ${OPENBMC_USERNAME} -P ${OPENBMC_PASSWORD}
26
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050027*** Test Cases ***
28
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050029Verify Both Interfaces BMC IP Addresses Accessible Via SSH
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050030 [Documentation] Verify both interfaces (eth0, eth1) BMC IP addresses accessible via SSH.
31 [Tags] Verify_Both_Interfaces_BMC_IP_Addresses_Accessible_Via_SSH
32
33 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST}
34 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST_1}
35 Close All Connections
36
37
Anves Kumar rayankula55d51922021-07-01 06:37:00 -050038Verify Redfish Works On Both Interfaces
39 [Documentation] Verify access BMC with both interfaces (eth0, eth1) IP addresses via Redfish.
40 [Tags] Verify_Redfish_Works_On_Both_Interfaces
41 [Teardown] Run Keywords
42 ... Configure Hostname ${hostname} AND Validate Hostname On BMC ${hostname}
43
44 Redfish1.Login
45 Redfish.Login
46
47 ${hostname}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
48 ${data}= Create Dictionary HostName=openbmc
49 Redfish1.patch ${REDFISH_NW_ETH_IFACE}eth1 body=&{data}
50 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
51
52 Validate Hostname On BMC openbmc
53
54 ${resp1}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0
55 ${resp2}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1
56 Should Be Equal ${resp1.dict['HostName']} ${resp2.dict['HostName']}
57
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050058
59Verify LDAP Login Works When Eth1 IP Is Not Configured
60 [Documentation] Verify LDAP login works when eth1 IP is erased.
61 [Tags] Verify_LDAP_Login_Works_When_Eth1_IP_Is_Not_Configured
62 [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${2}
63 ... AND Delete IP Address ${OPENBMC_HOST_1}
64 [Teardown] Run Keywords Redfish.Login AND
65 ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway}
66
67 Create LDAP Configuration
68 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
69 Redfish.Logout
70
71
Anves Kumar rayankula2f9632f2021-07-05 04:37:45 -050072Verify SNMP Works When Eth1 IP Is Not Configured
73 [Documentation] Verify SNMP works when eth1 IP is not configured.
74 [Tags] Verify_SNMP_Works_When_Eth1_IP_Is_Not_Configured
75 [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${2}
76 ... AND Delete IP Address ${OPENBMC_HOST_1}
77 [Teardown] Run Keywords Redfish.Login AND
78 ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway}
79
80 Create Error On BMC And Verify Trap
81
82
Anves Kumar rayankula04bc48c2021-07-08 23:33:37 -050083Disable And Enable Eth0 Interface
84 [Documentation] Disable and Enable eth0 ethernet interface via redfish.
85 [Tags] Disable_And_Enable_Eth0_Interface
86 [Template] Set BMC Ethernet Interfaces State
87
88 # interface_ip interface enabled
89 ${OPENBMC_HOST} eth0 ${False}
90 ${OPENBMC_HOST} eth0 ${True}
91
92
Anves Kumar rayankulaa38ec2e2021-07-10 01:09:23 -050093Verify Both Interfaces Access Concurrently Via Redfish
94 [Documentation] Verify both interfaces access conurrently via redfish.
95 [Tags] Verify_Both_Interfaces_Access_Concurrently_Via_Redfish
96
97 Redfish.Login
98 Redfish1.Login
99
100 ${dict}= Execute Process Multi Keyword ${2}
101 ... Redfish.Patch ${REDFISH_NW_ETH_IFACE}eth0 body={'DHCPv4':{'UseDNSServers':${True}}}
102 ... Redfish1.Patch ${REDFISH_NW_ETH_IFACE}eth1 body={'DHCPv4':{'UseDNSServers':${True}}}
103
104 Dictionary Should Not Contain Value ${dict} False
105 ... msg=One or more operations has failed.
106
107 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0
108 ${resp1}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1
109
110 Should Be Equal ${resp.dict["DHCPv4"]['UseDNSServers']} ${True}
111 Should Be Equal ${resp1.dict["DHCPv4"]['UseDNSServers']} ${True}
112
Anves Kumar rayankula54482cd2021-07-09 07:13:25 -0500113
114Able To Access Serial Console Via Both Network Interfaces
115 [Documentation] Able to access serial console via both network interfaces.
116 [Tags] Able_To_Access_Serial_Console_Via_Both_Network Interfaces
117
118 Open Connection And Log In host=${OPENBMC_HOST} port=2200
119 Open Connection And Log In host=${OPENBMC_HOST_1} port=2200
120 Close All Connections
121
122
Anves Kumar rayankulad0a2f332021-07-14 07:53:12 -0500123Verify IPMI Works On Both Network Interfaces
124 [Documentation] Verify IPMI works on both network interfaces.
125 [Tags] Verify_IPMI_Works_On_Both_Network_Interfaces
126
127 Run IPMI ${OPENBMC_HOST_1} power on
128 ${status1}= Run IPMI ${OPENBMC_HOST} power status
129 ${status2}= Run IPMI ${OPENBMC_HOST_1} power status
130 Should Be Equal ${status1} ${status2}
131
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -0500132*** Keywords ***
133
134Get Network Configuration Using Channel Number
135 [Documentation] Get ethernet interface.
136 [Arguments] ${channel_number}
137
138 # Description of argument(s):
139 # channel_number Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1").
140
141 ${active_channel_config}= Get Active Channel Config
142 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
143 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
144
145 @{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses
146 [Return] @{network_configurations}
147
148
149Suite Setup Execution
150 [Documentation] Do suite setup task.
151
152 Valid Value OPENBMC_HOST_1
153
154 # Check both interfaces are configured and reachable.
155 Ping Host ${OPENBMC_HOST}
156 Ping Host ${OPENBMC_HOST_1}
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -0500157
158 ${network_configurations}= Get Network Configuration Using Channel Number ${2}
159 FOR ${network_configuration} IN @{network_configurations}
160
161 Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST_1}'
162 ... Run Keywords Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']}
163 ... AND Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']}
164 ... AND Exit For Loop
165
166 END
Anves Kumar rayankula04bc48c2021-07-08 23:33:37 -0500167
168
169Set BMC Ethernet Interfaces State
170 [Documentation] Set BMC ethernet interface state.
171 [Arguments] ${interface_ip} ${interface} ${enabled}
172 [Teardown] Redfish1.Logout
173
174 # Description of argument(s):
175 # interface_ip IP address of ethernet interface.
176 # interface The ethernet interface name (eg. eth0 or eth1).
177 # enabled Indicates interface should be enabled (eg. True or False).
178
179 Redfish1.Login
180
181 ${data}= Create Dictionary InterfaceEnabled=${enabled}
182
183 Redfish1.patch ${REDFISH_NW_ETH_IFACE}${interface} body=&{data}
184 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
185
186 Sleep ${NETWORK_TIMEOUT}s
187 ${interface_status}= Redfish1.Get Attribute ${REDFISH_NW_ETH_IFACE}${interface} InterfaceEnabled
188 Should Be Equal ${interface_status} ${enabled}
189
190 ${status}= Run Keyword And Return Status Ping Host ${interface_ip}
191
192 Run Keyword If ${enabled} == ${True} Should Be Equal ${status} ${True}
193 ... ELSE Should Be Equal ${status} ${False}
Anves Kumar rayankulad0a2f332021-07-14 07:53:12 -0500194
195
196Run IPMI
197 [Documentation] Run IPMI command.
198 [Arguments] ${host} ${sub_cmd}
199
200 # Description of argument(s):
201 # host BMC host name or IP address.
202 # sub_cmd The IPMI command string to be executed.
203
204 ${rc} ${output}= Run And Return Rc And Output ${cmd_prefix} -H ${host} ${sub_cmd}
205 Should Be Equal As Strings ${rc} 0
206 [Return] ${output}
207