Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test BMC multiple network interface functionalities. |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 3 | ... Run on setup with both eth0 and eth1 in static mode. |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 4 | |
| 5 | # User input BMC IP for the eth1. |
| 6 | # Use can input as -v OPENBMC_HOST_1:xx.xxx.xx from command line. |
| 7 | Library ../../lib/bmc_redfish.py https://${OPENBMC_HOST_1}:${HTTPS_PORT} |
| 8 | ... ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} WITH NAME Redfish1 |
| 9 | |
| 10 | Resource ../../lib/resource.robot |
| 11 | Resource ../../lib/common_utils.robot |
| 12 | Resource ../../lib/connection_client.robot |
| 13 | Resource ../../lib/bmc_network_utils.robot |
| 14 | Resource ../../lib/openbmc_ffdc.robot |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 15 | Resource ../../lib/bmc_ldap_utils.robot |
Anves Kumar rayankula | 2f9632f | 2021-07-05 04:37:45 -0500 | [diff] [blame] | 16 | Resource ../../lib/snmp/resource.robot |
| 17 | Resource ../../lib/snmp/redfish_snmp_utils.robot |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 18 | Resource ../../lib/certificate_utils.robot |
Sweta Potthuri | 79ba8a2 | 2024-09-25 04:09:45 -0500 | [diff] [blame^] | 19 | Resource ../../lib/protocol_setting_utils.robot |
Anves Kumar rayankula | a38ec2e | 2021-07-10 01:09:23 -0500 | [diff] [blame] | 20 | Library ../../lib/jobs_processing.py |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 21 | Library OperatingSystem |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 22 | |
| 23 | Suite Setup Suite Setup Execution |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 24 | Test Setup Run Keywords Redfish.Login AND Redfish1.Login |
| 25 | Test Teardown Run Keywords FFDC On Test Case Fail AND Redfish.Logout AND Redfish1.Logout |
Sweta Potthuri | 79ba8a2 | 2024-09-25 04:09:45 -0500 | [diff] [blame^] | 26 | Suite Teardown Run Keywords Redfish1.Logout AND Redfish.Logout |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 27 | |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 28 | *** Variables *** |
| 29 | |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 30 | ${cmd_prefix} ipmitool -I lanplus -C 17 -p 623 -U ${IPMI_USERNAME} -P ${IPMI_PASSWORD} |
Sweta Potthuri | 2667f2c | 2022-10-11 07:55:21 -0500 | [diff] [blame] | 31 | ${test_ipv4_addr} 10.7.7.7 |
| 32 | ${test_ipv4_addr2} 10.7.7.8 |
| 33 | ${test_subnet_mask} 255.255.255.0 |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 34 | |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 35 | *** Test Cases *** |
| 36 | |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 37 | Verify Both Interfaces BMC IP Addresses Accessible Via SSH |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 38 | [Documentation] Verify both interfaces (eth0, eth1) BMC IP addresses accessible via SSH. |
| 39 | [Tags] Verify_Both_Interfaces_BMC_IP_Addresses_Accessible_Via_SSH |
| 40 | |
| 41 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST} |
| 42 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST_1} |
| 43 | Close All Connections |
| 44 | |
| 45 | |
Anves Kumar rayankula | 55d5192 | 2021-07-01 06:37:00 -0500 | [diff] [blame] | 46 | Verify Redfish Works On Both Interfaces |
| 47 | [Documentation] Verify access BMC with both interfaces (eth0, eth1) IP addresses via Redfish. |
| 48 | [Tags] Verify_Redfish_Works_On_Both_Interfaces |
| 49 | [Teardown] Run Keywords |
| 50 | ... Configure Hostname ${hostname} AND Validate Hostname On BMC ${hostname} |
| 51 | |
Anves Kumar rayankula | 55d5192 | 2021-07-01 06:37:00 -0500 | [diff] [blame] | 52 | ${hostname}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
| 53 | ${data}= Create Dictionary HostName=openbmc |
| 54 | Redfish1.patch ${REDFISH_NW_ETH_IFACE}eth1 body=&{data} |
| 55 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 56 | |
| 57 | Validate Hostname On BMC openbmc |
| 58 | |
| 59 | ${resp1}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0 |
| 60 | ${resp2}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1 |
| 61 | Should Be Equal ${resp1.dict['HostName']} ${resp2.dict['HostName']} |
| 62 | |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 63 | |
| 64 | Verify LDAP Login Works When Eth1 IP Is Not Configured |
| 65 | [Documentation] Verify LDAP login works when eth1 IP is erased. |
| 66 | [Tags] Verify_LDAP_Login_Works_When_Eth1_IP_Is_Not_Configured |
kothais | 01f95fc | 2023-11-01 14:12:51 +0000 | [diff] [blame] | 67 | [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${SECONDARY_CHANNEL_NUMBER} |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 68 | ... AND Redfish.Login AND Delete IP Address ${OPENBMC_HOST_1} |
| 69 | [Teardown] Run Keywords Redfish.Logout AND Redfish.Login AND |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 70 | ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway} |
| 71 | |
| 72 | Create LDAP Configuration |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 73 | Redfish.Logout |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 74 | Sleep 30 |
Sweta Potthuri | b9513c6 | 2023-03-01 01:11:43 -0600 | [diff] [blame] | 75 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 76 | |
| 77 | |
| 78 | Verify LDAP Login Works When Both Interfaces Are Configured |
| 79 | [Documentation] Verify LDAP login works when both interfaces are configured. |
| 80 | [Tags] Verify_LDAP_Login_Works_When_Both_Interfaces_Are_Configured |
Sweta Potthuri | b9513c6 | 2023-03-01 01:11:43 -0600 | [diff] [blame] | 81 | |
| 82 | Create LDAP Configuration |
| 83 | Redfish.Logout |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 84 | Sleep 30 |
Sweta Potthuri | b9513c6 | 2023-03-01 01:11:43 -0600 | [diff] [blame] | 85 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 86 | |
| 87 | |
| 88 | Verify Secure LDAP Login Works When Both Interfaces Are Configured |
| 89 | [Documentation] Verify Secure LDAP login works when both the interfaces are configured. |
| 90 | [Tags] Verify_Secure_LDAP_Login_Works_When_Both_Interfaces_Are_Configured |
Sweta Potthuri | b9513c6 | 2023-03-01 01:11:43 -0600 | [diff] [blame] | 91 | |
| 92 | Create LDAP Configuration ${LDAP_TYPE} ${LDAP_SERVER_URI_1} ${LDAP_BIND_DN} |
| 93 | ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN} |
| 94 | Redfish.Logout |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 95 | Sleep 30 |
Sweta Potthuri | b9513c6 | 2023-03-01 01:11:43 -0600 | [diff] [blame] | 96 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 97 | |
| 98 | |
Anves Kumar rayankula | 2f9632f | 2021-07-05 04:37:45 -0500 | [diff] [blame] | 99 | Verify SNMP Works When Eth1 IP Is Not Configured |
| 100 | [Documentation] Verify SNMP works when eth1 IP is not configured. |
| 101 | [Tags] Verify_SNMP_Works_When_Eth1_IP_Is_Not_Configured |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 102 | [Setup] Run Keywords Redfish.Login AND |
| 103 | ... Set Test Variable ${CHANNEL_NUMBER} ${SECONDARY_CHANNEL_NUMBER} |
Anves Kumar rayankula | 2f9632f | 2021-07-05 04:37:45 -0500 | [diff] [blame] | 104 | ... AND Delete IP Address ${OPENBMC_HOST_1} |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 105 | [Teardown] Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway} |
Anves Kumar rayankula | 2f9632f | 2021-07-05 04:37:45 -0500 | [diff] [blame] | 106 | |
| 107 | Create Error On BMC And Verify Trap |
| 108 | |
| 109 | |
Anves Kumar rayankula | 04bc48c | 2021-07-08 23:33:37 -0500 | [diff] [blame] | 110 | Disable And Enable Eth0 Interface |
| 111 | [Documentation] Disable and Enable eth0 ethernet interface via redfish. |
| 112 | [Tags] Disable_And_Enable_Eth0_Interface |
| 113 | [Template] Set BMC Ethernet Interfaces State |
| 114 | |
| 115 | # interface_ip interface enabled |
| 116 | ${OPENBMC_HOST} eth0 ${False} |
| 117 | ${OPENBMC_HOST} eth0 ${True} |
| 118 | |
| 119 | |
Anves Kumar rayankula | a38ec2e | 2021-07-10 01:09:23 -0500 | [diff] [blame] | 120 | Verify Both Interfaces Access Concurrently Via Redfish |
| 121 | [Documentation] Verify both interfaces access conurrently via redfish. |
| 122 | [Tags] Verify_Both_Interfaces_Access_Concurrently_Via_Redfish |
| 123 | |
Anves Kumar rayankula | a38ec2e | 2021-07-10 01:09:23 -0500 | [diff] [blame] | 124 | ${dict}= Execute Process Multi Keyword ${2} |
Sweta Potthuri | 79ba8a2 | 2024-09-25 04:09:45 -0500 | [diff] [blame^] | 125 | ... Redfish.patch ${REDFISH_NW_ETH_IFACE}eth0 body={'DHCPv4':{'UseDNSServers':${True}}} |
| 126 | ... Redfish1.patch ${REDFISH_NW_ETH_IFACE}eth1 body={'DHCPv4':{'UseDNSServers':${True}}} |
Anves Kumar rayankula | a38ec2e | 2021-07-10 01:09:23 -0500 | [diff] [blame] | 127 | |
| 128 | Dictionary Should Not Contain Value ${dict} False |
| 129 | ... msg=One or more operations has failed. |
| 130 | |
| 131 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0 |
| 132 | ${resp1}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1 |
| 133 | |
| 134 | Should Be Equal ${resp.dict["DHCPv4"]['UseDNSServers']} ${True} |
| 135 | Should Be Equal ${resp1.dict["DHCPv4"]['UseDNSServers']} ${True} |
| 136 | |
Anves Kumar rayankula | 54482cd | 2021-07-09 07:13:25 -0500 | [diff] [blame] | 137 | Able To Access Serial Console Via Both Network Interfaces |
| 138 | [Documentation] Able to access serial console via both network interfaces. |
George Keishing | c4914b7 | 2021-07-27 08:03:19 -0500 | [diff] [blame] | 139 | [Tags] Able_To_Access_Serial_Console_Via_Both_Network_Interfaces |
Anves Kumar rayankula | 54482cd | 2021-07-09 07:13:25 -0500 | [diff] [blame] | 140 | |
| 141 | Open Connection And Log In host=${OPENBMC_HOST} port=2200 |
| 142 | Open Connection And Log In host=${OPENBMC_HOST_1} port=2200 |
| 143 | Close All Connections |
| 144 | |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 145 | Verify IPMI Works On Both Network Interfaces |
| 146 | [Documentation] Verify IPMI works on both network interfaces. |
| 147 | [Tags] Verify_IPMI_Works_On_Both_Network_Interfaces |
| 148 | |
| 149 | Run IPMI ${OPENBMC_HOST_1} power on |
| 150 | ${status1}= Run IPMI ${OPENBMC_HOST} power status |
| 151 | ${status2}= Run IPMI ${OPENBMC_HOST_1} power status |
| 152 | Should Be Equal ${status1} ${status2} |
| 153 | |
Sweta Potthuri | 2667f2c | 2022-10-11 07:55:21 -0500 | [diff] [blame] | 154 | Verify Modifying IP Address Multiple Times On Interface |
| 155 | [Documentation] Verify modifying IP address multiple times on interface. |
| 156 | [Tags] Verify_Modifying_IP_Address_Multiple_Times_On_Interface |
| 157 | [Teardown] Run Keywords |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 158 | ... Delete IP Address ${test_ipv4_addr} AND Redfish.Logout |
Sweta Potthuri | 2667f2c | 2022-10-11 07:55:21 -0500 | [diff] [blame] | 159 | |
| 160 | ${test_gateway}= Get BMC Default Gateway |
| 161 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 162 | Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway} |
| 163 | Update IP Address ${test_ipv4_addr2} ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 164 | Run Keyword Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 165 | Run Keyword Wait For Host To Ping ${OPENBMC_HOST_1} ${NETWORK_TIMEOUT} |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 166 | |
| 167 | Verify Able To Load Certificates Via Eth1 IP Address |
George Keishing | b13682a | 2021-07-20 08:52:39 -0500 | [diff] [blame] | 168 | [Documentation] Verify able to load certificates via eth1 IP address. |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 169 | [Tags] Verify_Able_To_Load_Certificates_Via_Eth1_IP_Address |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 170 | [Template] Install Certificate Via Redfish And Verify |
| 171 | |
| 172 | # cert_type cert_format expected_status |
| 173 | CA Valid Certificate ok |
| 174 | Client Valid Certificate Valid Privatekey ok |
| 175 | |
Sweta Potthuri | 79ba8a2 | 2024-09-25 04:09:45 -0500 | [diff] [blame^] | 176 | Enable SSH Protocol Via Eth1 And Verify On Both Interfaces |
| 177 | [Documentation] Enable SSH protocol via eth1 and verify on both interfaces. |
| 178 | [Tags] Enable_SSH_Protocol_Via_Eth1_And_Verify_On_Both_Interfaces |
| 179 | |
| 180 | Set SSH Value Via Eth1 ${True} |
| 181 | # Check if SSH is really enabled via Redfish via eth1. |
| 182 | Verify SSH Protocol State Via Eth1 ${True} |
| 183 | # Check if SSH login and commands on SSH session work on both interfaces. |
| 184 | Verify SSH Login And Commands Work |
| 185 | Verify SSH Login And Commands Work ${OPENBMC_HOST_1} |
| 186 | |
| 187 | Disable SSH Protocol Via Eth1 And Verify On Both Interfaces |
| 188 | [Documentation] Disable SSH protocol via eth1 and verify on both interfaces. |
| 189 | [Tags] Disable_SSH_Protocol_Via_Eth1_And_Verify_On_Both_Interfaces |
| 190 | [Teardown] Set SSH Value Via Eth1 ${True} |
| 191 | |
| 192 | Set SSH Value Via Eth1 ${False} |
| 193 | # Check if SSH is really disabled via Redfish via eth1. |
| 194 | Verify SSH Protocol State Via Eth1 ${False} |
| 195 | # Check if SSH login and commands fail on eth1. |
| 196 | ${status}= Run Keyword And Return Status |
| 197 | ... Verify SSH Login And Commands Work ${OPENBMC_HOST_1} |
| 198 | |
| 199 | Should Be Equal As Strings ${status} False |
| 200 | ... msg=SSH Login and commands are working after disabling SSH via eth1. |
| 201 | |
| 202 | # Check if SSH login and commands fail. |
| 203 | ${status}= Run Keyword And Return Status |
| 204 | ... Verify SSH Login And Commands Work |
| 205 | |
| 206 | Should Be Equal As Strings ${status} False |
| 207 | ... msg=SSH Login and commands are working after disabling SSH. |
| 208 | |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 209 | *** Keywords *** |
| 210 | |
| 211 | Get Network Configuration Using Channel Number |
| 212 | [Documentation] Get ethernet interface. |
| 213 | [Arguments] ${channel_number} |
| 214 | |
| 215 | # Description of argument(s): |
| 216 | # channel_number Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1"). |
| 217 | |
| 218 | ${active_channel_config}= Get Active Channel Config |
| 219 | ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} |
| 220 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 221 | |
| 222 | @{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 223 | RETURN @{network_configurations} |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 224 | |
| 225 | |
| 226 | Suite Setup Execution |
| 227 | [Documentation] Do suite setup task. |
| 228 | |
| 229 | Valid Value OPENBMC_HOST_1 |
| 230 | |
| 231 | # Check both interfaces are configured and reachable. |
| 232 | Ping Host ${OPENBMC_HOST} |
| 233 | Ping Host ${OPENBMC_HOST_1} |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 234 | |
kothais | 01f95fc | 2023-11-01 14:12:51 +0000 | [diff] [blame] | 235 | ${network_configurations}= Get Network Configuration Using Channel Number ${SECONDARY_CHANNEL_NUMBER} |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 236 | FOR ${network_configuration} IN @{network_configurations} |
| 237 | |
| 238 | Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST_1}' |
| 239 | ... Run Keywords Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']} |
| 240 | ... AND Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']} |
| 241 | ... AND Exit For Loop |
| 242 | |
| 243 | END |
Anves Kumar rayankula | 04bc48c | 2021-07-08 23:33:37 -0500 | [diff] [blame] | 244 | |
| 245 | |
| 246 | Set BMC Ethernet Interfaces State |
| 247 | [Documentation] Set BMC ethernet interface state. |
| 248 | [Arguments] ${interface_ip} ${interface} ${enabled} |
| 249 | [Teardown] Redfish1.Logout |
| 250 | |
| 251 | # Description of argument(s): |
| 252 | # interface_ip IP address of ethernet interface. |
| 253 | # interface The ethernet interface name (eg. eth0 or eth1). |
| 254 | # enabled Indicates interface should be enabled (eg. True or False). |
| 255 | |
| 256 | Redfish1.Login |
| 257 | |
| 258 | ${data}= Create Dictionary InterfaceEnabled=${enabled} |
| 259 | |
| 260 | Redfish1.patch ${REDFISH_NW_ETH_IFACE}${interface} body=&{data} |
| 261 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 262 | |
| 263 | Sleep ${NETWORK_TIMEOUT}s |
| 264 | ${interface_status}= Redfish1.Get Attribute ${REDFISH_NW_ETH_IFACE}${interface} InterfaceEnabled |
| 265 | Should Be Equal ${interface_status} ${enabled} |
| 266 | |
| 267 | ${status}= Run Keyword And Return Status Ping Host ${interface_ip} |
| 268 | |
| 269 | Run Keyword If ${enabled} == ${True} Should Be Equal ${status} ${True} |
| 270 | ... ELSE Should Be Equal ${status} ${False} |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 271 | |
| 272 | |
| 273 | Run IPMI |
| 274 | [Documentation] Run IPMI command. |
| 275 | [Arguments] ${host} ${sub_cmd} |
| 276 | |
| 277 | # Description of argument(s): |
| 278 | # host BMC host name or IP address. |
| 279 | # sub_cmd The IPMI command string to be executed. |
| 280 | |
| 281 | ${rc} ${output}= Run And Return Rc And Output ${cmd_prefix} -H ${host} ${sub_cmd} |
| 282 | Should Be Equal As Strings ${rc} 0 |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 283 | RETURN ${output} |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 284 | |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 285 | |
| 286 | Install Certificate Via Redfish And Verify |
| 287 | [Documentation] Install and verify certificate using Redfish. |
| 288 | [Arguments] ${cert_type} ${cert_format} ${expected_status} ${delete_cert}=${True} |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 289 | [Teardown] Remove Directory certificate_dir recursive=True |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 290 | |
| 291 | # Description of argument(s): |
| 292 | # cert_type Certificate type (e.g. "Client" or "CA"). |
| 293 | # cert_format Certificate file format |
| 294 | # (e.g. "Valid_Certificate_Valid_Privatekey"). |
| 295 | # expected_status Expected status of certificate replace Redfish |
| 296 | # request (i.e. "ok" or "error"). |
| 297 | # delete_cert Certificate will be deleted before installing if this True. |
| 298 | |
Anvesh-Kumar_Rayankula | 58b5569 | 2024-09-13 03:23:03 -0500 | [diff] [blame] | 299 | Create Directory certificate_dir |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 300 | # AUTH_URI is a global variable defined in lib/resource.robot |
| 301 | Set Test Variable ${AUTH_URI} https://${OPENBMC_HOST_1} |
| 302 | Run Keyword If '${cert_type}' == 'CA' and '${delete_cert}' == '${True}' |
| 303 | ... Delete All CA Certificate Via Redfish |
| 304 | ... ELSE IF '${cert_type}' == 'Client' and '${delete_cert}' == '${True}' |
| 305 | ... Delete Certificate Via BMC CLI ${cert_type} |
| 306 | |
| 307 | ${cert_file_path}= Generate Certificate File Via Openssl ${cert_format} |
| 308 | ${bytes}= OperatingSystem.Get Binary File ${cert_file_path} |
| 309 | ${file_data}= Decode Bytes To String ${bytes} UTF-8 |
| 310 | |
| 311 | ${certificate_uri}= Set Variable If |
| 312 | ... '${cert_type}' == 'Client' ${REDFISH_LDAP_CERTIFICATE_URI} |
| 313 | ... '${cert_type}' == 'CA' ${REDFISH_CA_CERTIFICATE_URI} |
| 314 | |
| 315 | ${cert_id}= Install Certificate File On BMC ${certificate_uri} ${expected_status} data=${file_data} |
| 316 | Logging Installed certificate id: ${cert_id} |
| 317 | |
| 318 | Sleep 30s |
| 319 | ${cert_file_content}= OperatingSystem.Get File ${cert_file_path} |
| 320 | ${bmc_cert_content}= Run Keyword If '${expected_status}' == 'ok' redfish_utils.Get Attribute |
| 321 | ... ${certificate_uri}/${cert_id} CertificateString |
| 322 | Run Keyword If '${expected_status}' == 'ok' Should Contain ${cert_file_content} ${bmc_cert_content} |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 323 | RETURN ${cert_id} |
Sweta Potthuri | 79ba8a2 | 2024-09-25 04:09:45 -0500 | [diff] [blame^] | 324 | |
| 325 | Set SSH Value Via Eth1 |
| 326 | [Documentation] Enable or disable SSH protocol via Eth1. |
| 327 | [Arguments] ${enable_value}=${True} |
| 328 | |
| 329 | # Description of argument(s}: |
| 330 | # enable_value Enable or disable SSH, e.g. (true, false). |
| 331 | |
| 332 | ${ssh_state}= Create Dictionary ProtocolEnabled=${enable_value} |
| 333 | ${data}= Create Dictionary SSH=${ssh_state} |
| 334 | |
| 335 | Redfish1.Login |
| 336 | Redfish1.patch ${REDFISH_NW_PROTOCOL_URI} body=&{data} |
| 337 | ... valid_status_codes=[${HTTP_NO_CONTENT}] |
| 338 | |
| 339 | # Wait for timeout for new values to take effect. |
| 340 | Sleep ${NETWORK_TIMEOUT}s |
| 341 | |
| 342 | Verify SSH Protocol State Via Eth1 |
| 343 | [Documentation] Verify SSH protocol state via eth1. |
| 344 | [Arguments] ${state}=${True} |
| 345 | |
| 346 | # Description of argument(s}: |
| 347 | # state Enable or disable SSH, e.g. (true, false) |
| 348 | |
| 349 | ${resp}= Redfish1.Get ${REDFISH_NW_PROTOCOL_URI} |
| 350 | Should Be Equal As Strings ${resp.dict['SSH']['ProtocolEnabled']} ${state} |
| 351 | ... msg=Protocol states are not matching. |