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