| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation   Test BMC DHCP multiple network interface functionalities. | 
| Sweta Potthuri | 49c86a0 | 2023-10-12 07:43:13 -0500 | [diff] [blame] | 3 | ...  Run on setup eth0 in static and eth1 in DHCP. | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 4 |  | 
|  | 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 | 
|  | 10 |  | 
|  | 11 | Suite Setup     Suite Setup Execution | 
|  | 12 | Test Teardown   FFDC On Test Case Fail | 
|  | 13 | Suite Teardown  Redfish.Logout | 
|  | 14 |  | 
| George Keishing | 3d87b0e | 2025-02-06 18:35:23 +0530 | [diff] [blame] | 15 | Test Tags       Multiple_Interfaces_DHCP | 
|  | 16 |  | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 17 | *** Variables *** | 
|  | 18 |  | 
|  | 19 | &{DHCP_ENABLED}           DHCPEnabled=${True} | 
|  | 20 | &{DHCP_DISABLED}          DHCPEnabled=${False} | 
|  | 21 | &{ENABLE_DHCP}            DHCPv4=${DHCP_ENABLED} | 
|  | 22 | &{DISABLE_DHCP}           DHCPv4=${DHCP_DISABLED} | 
|  | 23 | ${ethernet_interface}     eth1 | 
|  | 24 |  | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 25 | &{dns_enable_dict}                 UseDNSServers=${True} | 
|  | 26 | &{dns_disable_dict}                UseDNSServers=${False} | 
|  | 27 | &{ntp_enable_dict}                 UseNTPServers=${True} | 
|  | 28 | &{ntp_disable_dict}                UseNTPServers=${False} | 
|  | 29 | &{domain_name_enable_dict}         UseDomainName=${True} | 
|  | 30 | &{domain_name_disable_dict}        UseDomainName=${False} | 
|  | 31 | &{enable_multiple_properties}      UseDomainName=${True} | 
|  | 32 | ...                                UseNTPServers=${True} | 
|  | 33 | ...                                UseDNSServers=${True} | 
|  | 34 | &{disable_multiple_properties}     UseDomainName=${False} | 
|  | 35 | ...                                UseNTPServers=${False} | 
|  | 36 | ...                                UseDNSServers=${False} | 
|  | 37 |  | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 38 | *** Test Cases *** | 
|  | 39 |  | 
|  | 40 | Disable DHCP On Eth1 And Verify System Is Accessible By Eth0 | 
| George Keishing | 618aff7 | 2023-03-09 09:55:19 +0530 | [diff] [blame] | 41 | [Documentation]  Disable DHCP on eth1 using Redfish and verify | 
|  | 42 | ...              if system is accessible by eth0. | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 43 | [Tags]  Disable_DHCP_On_Eth1_And_Verify_System_Is_Accessible_By_Eth0 | 
|  | 44 | [Teardown]  Set DHCPEnabled To Enable Or Disable  True  eth1 | 
|  | 45 |  | 
|  | 46 | Set DHCPEnabled To Enable Or Disable  False  eth1 | 
| Sweta Potthuri | 0e3f3f8 | 2023-10-19 05:30:29 -0500 | [diff] [blame] | 47 | ${DHCPEnabled}=  Get IPv4 DHCP Enabled Status  ${2} | 
| Sweta Potthuri | 49c86a0 | 2023-10-12 07:43:13 -0500 | [diff] [blame] | 48 | Should Be Equal  ${DHCPEnabled}  ${False} | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 49 | Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT} | 
|  | 50 |  | 
|  | 51 | Enable DHCP On Eth1 And Verify System Is Accessible By Eth0 | 
| George Keishing | 618aff7 | 2023-03-09 09:55:19 +0530 | [diff] [blame] | 52 | [Documentation]  Enable DHCP on eth1 using Redfish and verify if system | 
|  | 53 | ...              is accessible by eth0. | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 54 | [Tags]  Enable_DHCP_On_Eth1_And_Verify_System_Is_Accessible_By_Eth0 | 
|  | 55 | [Setup]  Set DHCPEnabled To Enable Or Disable  False  eth1 | 
|  | 56 |  | 
|  | 57 | Set DHCPEnabled To Enable Or Disable  True  eth1 | 
| Sweta Potthuri | 0e3f3f8 | 2023-10-19 05:30:29 -0500 | [diff] [blame] | 58 | ${DHCPEnabled}=  Get IPv4 DHCP Enabled Status  ${2} | 
| Sweta Potthuri | 49c86a0 | 2023-10-12 07:43:13 -0500 | [diff] [blame] | 59 | Should Be Equal  ${DHCPEnabled}  ${True} | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 60 | Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT} | 
|  | 61 |  | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 62 | Set Network Property via Redfish And Verify | 
|  | 63 | [Documentation]  Set network property via Redfish and verify. | 
|  | 64 | [Tags]  Set_Network_Property_via_Redfish_And_Verify | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 65 | [Template]  Apply DHCP Config | 
|  | 66 |  | 
|  | 67 | # property | 
|  | 68 | ${dns_enable_dict} | 
|  | 69 | ${dns_disable_dict} | 
|  | 70 | ${domain_name_enable_dict} | 
|  | 71 | ${domain_name_disable_dict} | 
|  | 72 | ${ntp_enable_dict} | 
|  | 73 | ${ntp_disable_dict} | 
|  | 74 | ${enable_multiple_properties} | 
|  | 75 | ${disable_multiple_properties} | 
|  | 76 |  | 
| Sweta Potthuri | d597984 | 2025-05-21 23:17:17 -0500 | [diff] [blame] | 77 | Set Network Property For DHCPv6 via Redfish And Verify | 
|  | 78 | [Documentation]  Set network property for DHCPv6 via Redfish and verify. | 
|  | 79 | [Tags]  Set_Network_Property_For_DHCPv6_via_Redfish_And_Verify | 
|  | 80 | [Template]  Apply DHCPv6 Config And Verify | 
|  | 81 |  | 
|  | 82 | # property | 
|  | 83 | ${dns_enable_dict} | 
|  | 84 | ${dns_disable_dict} | 
|  | 85 | ${domain_name_enable_dict} | 
|  | 86 | ${domain_name_disable_dict} | 
|  | 87 | ${ntp_enable_dict} | 
|  | 88 | ${ntp_disable_dict} | 
|  | 89 | ${enable_multiple_properties} | 
|  | 90 | ${disable_multiple_properties} | 
|  | 91 |  | 
| Sweta Potthuri | 51ce121 | 2023-10-11 02:18:12 -0500 | [diff] [blame] | 92 | Enable DHCP On Eth1 And Check No Impact On Eth0 | 
|  | 93 | [Documentation]  Enable DHCP On Eth1 And Check No Impact On Eth0. | 
|  | 94 | [Tags]  Enable_DHCP_On_Eth1_And_Check_No_Impact_On_Eth0 | 
|  | 95 | [Setup]  Set DHCPEnabled To Enable Or Disable  False  eth1 | 
|  | 96 |  | 
|  | 97 | # Getting the eth0 details before enabling DHCP. | 
|  | 98 | ${ip_data_before}=  Get BMC IP Info | 
|  | 99 |  | 
| Sweta Potthuri | 49c86a0 | 2023-10-12 07:43:13 -0500 | [diff] [blame] | 100 | # Enable DHCP on eth1. | 
| Sweta Potthuri | 51ce121 | 2023-10-11 02:18:12 -0500 | [diff] [blame] | 101 | Set DHCPEnabled To Enable Or Disable  True  eth1 | 
|  | 102 |  | 
|  | 103 | # Check the value of DHCPEnabled on eth0 is not impacted. | 
| Sweta Potthuri | 0e3f3f8 | 2023-10-19 05:30:29 -0500 | [diff] [blame] | 104 | ${DHCPEnabled}=  Get IPv4 DHCP Enabled Status  ${1} | 
| Sweta Potthuri | 51ce121 | 2023-10-11 02:18:12 -0500 | [diff] [blame] | 105 | Should Be Equal  ${DHCPEnabled}  ${False} | 
|  | 106 |  | 
|  | 107 | # Getting eth0 details after enabling DHCP. | 
|  | 108 | ${ip_data_after}=  Get BMC IP Info | 
|  | 109 |  | 
|  | 110 | # Before and after IP details must match. | 
|  | 111 | Should Be Equal  ${ip_data_before}  ${ip_data_after} | 
|  | 112 |  | 
| Sweta Potthuri | dad3b9b | 2024-01-03 08:19:38 -0600 | [diff] [blame] | 113 | Enable DHCP On Eth1 And Check Persistency On Reboot | 
|  | 114 | [Documentation]  Enable DHCP on Eth1 and check persistency | 
|  | 115 | ...  on reboot and should not switch to static. | 
|  | 116 | [Tags]  Enable_DHCP_On_Eth1_And_Check_Persistency_On_Reboot | 
|  | 117 | [Setup]  Set DHCPEnabled To Enable Or Disable  False  eth1 | 
|  | 118 |  | 
|  | 119 | Set DHCPEnabled To Enable Or Disable  True  eth1 | 
|  | 120 | Redfish OBMC Reboot (off)  stack_mode=skip | 
|  | 121 | ${DHCPEnabled}=  Get IPv4 DHCP Enabled Status  ${2} | 
|  | 122 | Should Be Equal  ${DHCPEnabled}  ${True} | 
|  | 123 |  | 
| Sweta Potthuri | 49c86a0 | 2023-10-12 07:43:13 -0500 | [diff] [blame] | 124 | Switch Between DHCP And Static | 
|  | 125 | [Documentation]  Switch between DHCP and static. | 
|  | 126 | [Tags]  Switch_Between_DHCP_And_Static | 
|  | 127 | [Teardown]  Set DHCPEnabled To Enable Or Disable  True  eth1 | 
|  | 128 |  | 
|  | 129 | # Fetch the IP details before. | 
|  | 130 | ${ip_addr_before}  ${gateway_before}  ${subnetmask_before}  Get DHCP IP Info | 
|  | 131 |  | 
|  | 132 | # Switch Between Static and DHCP. | 
|  | 133 | FOR  ${i}  IN RANGE  ${10} | 
|  | 134 | Set DHCPEnabled To Enable Or Disable  False  eth1 | 
|  | 135 | Set DHCPEnabled To Enable Or Disable  True  eth1 | 
|  | 136 | END | 
|  | 137 | Sleep  5s | 
|  | 138 |  | 
|  | 139 | # Fetch the IP details after. | 
|  | 140 | ${ip_addr_after}  ${gateway_after}  ${subnetmask_after}  Get DHCP IP Info | 
|  | 141 |  | 
|  | 142 | # DHCP Details must be the same before and after. | 
|  | 143 | Should Be Equal  ${ip_addr_before}  ${ip_addr_after} | 
|  | 144 | Should Be Equal  ${gateway_before}  ${gateway_after} | 
|  | 145 | Should Be Equal  ${subnetmask_before}  ${subnetmask_after} | 
|  | 146 |  | 
| Sweta Potthuri | 0e3f3f8 | 2023-10-19 05:30:29 -0500 | [diff] [blame] | 147 | Disable DHCP On Eth1 And Verify DHCP IP Erased | 
|  | 148 | [Documentation]  Disable DHCP on Eth1 and verify DHCP IP erased. | 
|  | 149 | [Tags]  Disable_DHCP_On_Eth1_And_Verify_DHCP_IP_Erased | 
|  | 150 | [Teardown]  Set DHCPEnabled To Enable Or Disable  True  eth1 | 
|  | 151 |  | 
|  | 152 | Set DHCPEnabled To Enable Or Disable  False  eth1 | 
|  | 153 | ${DHCPEnabled}=  Get IPv4 DHCP Enabled Status  ${2} | 
|  | 154 | Should Be Equal  ${DHCPEnabled}  ${False} | 
|  | 155 |  | 
|  | 156 | ${dhcp_ip_list}=  Get Network Configuration Using Channel Number  ${2} | 
|  | 157 |  | 
|  | 158 | Should Be Empty  ${dhcp_ip_list} | 
|  | 159 | ...  msg=From switching from DHCP to Static DHCP IP is not erased. | 
|  | 160 |  | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 161 | *** Keywords *** | 
|  | 162 |  | 
|  | 163 | Set DHCPEnabled To Enable Or Disable | 
|  | 164 | [Documentation]  Enable or Disable DHCP on the interface. | 
| George Keishing | 618aff7 | 2023-03-09 09:55:19 +0530 | [diff] [blame] | 165 | [Arguments]  ${dhcp_enabled}=${False}  ${interface}=${ethernet_interface} | 
| George Keishing | 45e1d5f | 2025-03-11 19:24:36 +0530 | [diff] [blame] | 166 | ...          ${valid_status_code}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 167 |  | 
|  | 168 | # Description of argument(s): | 
|  | 169 | # dhcp_enabled        False for disabling DHCP and True for Enabling DHCP. | 
|  | 170 | # interface           eth0 or eth1. Default is eth1. | 
| George Keishing | 618aff7 | 2023-03-09 09:55:19 +0530 | [diff] [blame] | 171 | # valid_status_code   Expected valid status code from Patch request. | 
|  | 172 | #                     Default is HTTP_OK. | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 173 |  | 
|  | 174 | ${data}=  Set Variable If  ${dhcp_enabled} == ${False}  ${DISABLE_DHCP}  ${ENABLE_DHCP} | 
|  | 175 | ${resp}=  Redfish.Patch | 
| ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 176 | ...  /redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/${interface} | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 177 | ...  body=${data}  valid_status_codes=${valid_status_code} | 
|  | 178 |  | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 179 | Apply DHCP Config | 
|  | 180 | [Documentation]  Apply DHCP Config | 
|  | 181 | [Arguments]  ${property} | 
|  | 182 |  | 
|  | 183 | # Description of Argument(s): | 
|  | 184 | # property  DHCP property values. | 
|  | 185 |  | 
| Sweta Potthuri | d597984 | 2025-05-21 23:17:17 -0500 | [diff] [blame] | 186 | Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface} | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 187 | ...  body={"DHCPv4":${property}}  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 188 |  | 
| Sweta Potthuri | d597984 | 2025-05-21 23:17:17 -0500 | [diff] [blame] | 189 | ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface} | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 190 | Verify Ethernet Config Property  ${property}  ${resp.dict["DHCPv4"]} | 
|  | 191 |  | 
| Sweta Potthuri | d597984 | 2025-05-21 23:17:17 -0500 | [diff] [blame] | 192 | Apply DHCPv6 Config And Verify | 
|  | 193 | [Documentation]  Apply DHCPv6 config and verify. | 
|  | 194 | [Arguments]  ${property} | 
|  | 195 |  | 
|  | 196 | # Description of Argument(s): | 
|  | 197 | # property  DHCPv6 property values. | 
|  | 198 |  | 
|  | 199 | Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface} | 
|  | 200 | ...  body={"DHCPv6":${property}}  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 201 | ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface} | 
|  | 202 |  | 
|  | 203 | Verify Ethernet Config Property  ${property}  ${resp.dict["DHCPv6"]} | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 204 |  | 
|  | 205 | Verify Ethernet Config Property | 
|  | 206 | [Documentation]  verify ethernet config properties. | 
|  | 207 | [Arguments]  ${property}  ${response_data} | 
|  | 208 |  | 
|  | 209 | # Description of argument(s): | 
|  | 210 | # ${property}       DHCP Properties in dictionary. | 
|  | 211 | # Example: | 
|  | 212 | # property         value | 
|  | 213 | # DHCPEnabled      :False | 
|  | 214 | # UseDomainName    :True | 
|  | 215 | # UseNTPServers    :True | 
|  | 216 | # UseDNSServers    :True | 
|  | 217 | # ${response_data}  DHCP Response data in dictionary. | 
|  | 218 | # Example: | 
|  | 219 | # property         value | 
|  | 220 | # DHCPEnabled      :False | 
|  | 221 | # UseDomainName    :True | 
|  | 222 | # UseNTPServers    :True | 
|  | 223 | # UseDNSServers    :True | 
|  | 224 |  | 
|  | 225 | ${key_map}=  Get Dictionary Items  ${property} | 
|  | 226 | FOR  ${key}  ${value}  IN  @{key_map} | 
|  | 227 | Should Be Equal As Strings  ${response_data['${key}']}  ${value} | 
|  | 228 | END | 
|  | 229 |  | 
|  | 230 | Restore Configuration | 
|  | 231 | [Documentation]  Restore the configuration to Both Static Network | 
|  | 232 |  | 
| George Keishing | e6e161e | 2025-05-08 10:18:30 +0530 | [diff] [blame] | 233 | IF  '${CHANNEL_NUMBER}' == '${1}' | 
|  | 234 | Add IP Address  ${OPENBMC_HOST}  ${eth0_subnet_mask}  ${eth0_gateway} | 
|  | 235 | ELSE IF  '${CHANNEL_NUMBER}' == '{2}' | 
|  | 236 | Add IP Address  ${OPENBMC_HOST_ETH1}  ${eth1_subnet_mask}  ${eth1_gateway} | 
|  | 237 | END | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 238 |  | 
|  | 239 | Get Network Configuration Using Channel Number | 
|  | 240 | [Documentation]  Get ethernet interface. | 
|  | 241 | [Arguments]  ${channel_number} | 
|  | 242 |  | 
|  | 243 | # Description of argument(s): | 
|  | 244 | # channel_number   Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1"). | 
|  | 245 |  | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 246 | ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface} | 
|  | 247 |  | 
|  | 248 | @{network_configurations}=  Get From Dictionary  ${resp.dict}  IPv4StaticAddresses | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 249 | RETURN  @{network_configurations} | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 250 |  | 
| Sweta Potthuri | ab87174 | 2023-02-20 11:08:42 -0600 | [diff] [blame] | 251 | Suite Setup Execution | 
|  | 252 | [Documentation]  Do suite setup task. | 
|  | 253 |  | 
|  | 254 | Ping Host  ${OPENBMC_HOST} | 
|  | 255 | Redfish.Login | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 256 |  | 
| Sweta Potthuri | d597984 | 2025-05-21 23:17:17 -0500 | [diff] [blame] | 257 | ${active_channel_config}=  Get Active Channel Config | 
|  | 258 | ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']} | 
|  | 259 |  | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 260 | # Get the configuration of eth1 | 
|  | 261 | ${network_configurations}=  Get Network Configuration Using Channel Number  ${2} | 
|  | 262 | FOR  ${network_configuration}  IN  @{network_configurations} | 
| Sridevi Ramesh | 6dcfc39 | 2025-05-06 11:09:43 -0500 | [diff] [blame] | 263 | IF  '${network_configuration['Address']}' == '${OPENBMC_HOST_ETH1}' | 
|  | 264 | Set Suite Variable  ${eth1_subnet_mask}  ${network_configuration['SubnetMask']} | 
|  | 265 | Set Suite Variable  ${eth1_gateway}  ${network_configuration['Gateway']} | 
|  | 266 | BREAK | 
|  | 267 | END | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 268 | END | 
|  | 269 |  | 
|  | 270 | # Get the configuration of eth0 | 
|  | 271 | ${network_configurations}=  Get Network Configuration Using Channel Number  ${1} | 
|  | 272 | FOR  ${network_configuration}  IN  @{network_configurations} | 
| Sridevi Ramesh | 6dcfc39 | 2025-05-06 11:09:43 -0500 | [diff] [blame] | 273 | IF  '${network_configuration['Address']}' == '${OPENBMC_HOST}' | 
|  | 274 | Set Suite Variable  ${eth0_subnet_mask}  ${network_configuration['SubnetMask']} | 
|  | 275 | Set Suite Variable  ${eth0_gateway}  ${network_configuration['Gateway']} | 
|  | 276 | BREAK | 
|  | 277 | END | 
| Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 278 | END |