Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Vmi network utilities keywords. |
| 3 | |
| 4 | Resource ../../lib/resource.robot |
| 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | Resource ../../lib/bmc_redfish_utils.robot |
| 8 | Resource ../../lib/state_manager.robot |
shrsuman123 | 7ba02f3 | 2021-08-26 04:50:56 -0500 | [diff] [blame] | 9 | Resource ../../lib/bmc_network_utils.robot |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 10 | Library ../../lib/bmc_network_utils.py |
| 11 | |
| 12 | *** Variables *** |
| 13 | |
shrsuman123 | 7e9b212 | 2021-09-28 06:06:16 -0500 | [diff] [blame] | 14 | &{DHCP_ENABLED} DHCPEnabled=${True} |
| 15 | &{DHCP_DISABLED} DHCPEnabled=${False} |
| 16 | |
| 17 | &{ENABLE_DHCP} DHCPv4=&{DHCP_ENABLED} |
| 18 | &{DISABLE_DHCP} DHCPv4=&{DHCP_DISABLED} |
| 19 | |
Megha G N | a214833 | 2025-03-06 07:28:15 -0600 | [diff] [blame] | 20 | &{SLAAC_ENABLED} IPv6AutoConfigEnabled=${True} |
| 21 | &{SLAAC_DISABLED} IPv6AutoConfigEnabled=${False} |
| 22 | |
| 23 | &{ENABLE_SLAAC} StatelessAddressAutoConfig=&{SLAAC_ENABLED} |
| 24 | &{DISABLE_SLAAC} StatelessAddressAutoConfig=&{SLAAC_DISABLED} |
| 25 | |
| 26 | &{DHCPv6_ENABLED} OperatingMode=Enabled |
| 27 | &{DHCPv6_DISABLED} OperatingMode=Disabled |
| 28 | |
| 29 | &{ENABLE_DHCPv6} DHCPv6=&{DHCPv6_ENABLED} |
| 30 | &{DISABLE_DHCPv6} DHCPv6=&{DHCPv6_DISABLED} |
| 31 | |
Megha G N | a9cf2d8 | 2023-10-09 07:41:11 -0500 | [diff] [blame] | 32 | ${wait_time} 40s |
shrsuman123 | a035578 | 2021-10-18 05:56:56 -0500 | [diff] [blame] | 33 | ${ethernet_interface} eth0 |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 34 | |
| 35 | *** Keywords *** |
| 36 | |
| 37 | Set Static IPv4 Address To VMI And Verify |
| 38 | [Documentation] Set static IPv4 address to VMI. |
| 39 | [Arguments] ${ip} ${gateway} ${netmask} ${valid_status_code}=${HTTP_ACCEPTED} |
shrsuman123 | a035578 | 2021-10-18 05:56:56 -0500 | [diff] [blame] | 40 | ... ${interface}=${ethernet_interface} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 41 | |
| 42 | # Description of argument(s): |
| 43 | # ip VMI IPv4 address. |
| 44 | # gateway Gateway for VMI IP. |
| 45 | # netmask Subnetmask for VMI IP. |
| 46 | # valid_status_code Expected valid status code from GET request. Default is HTTP_ACCEPTED. |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 47 | # interface VMI interface (eg. eth0 or eth1). |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 48 | |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 49 | ${ip_details}= Create dictionary Address=${ip} SubnetMask=${netmask} Gateway=${gateway} |
| 50 | ${ip_data}= Create List ${ip_details} |
| 51 | ${resp}= Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
| 52 | ... body={'IPv4StaticAddresses':${ip_data}} valid_status_codes=[${valid_status_code}] |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 53 | |
| 54 | # Wait few seconds for new configuration to get populated on runtime. |
| 55 | Sleep ${wait_time} |
| 56 | |
| 57 | Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED} |
| 58 | ${host_power_state} ${host_state}= Redfish Get Host State |
| 59 | Run Keyword If '${host_power_state}' == 'On' and '${host_state}' == 'Enabled' |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 60 | ... Verify VMI Network Interface Details ${ip} Static ${gateway} ${netmask} ${interface} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 61 | |
| 62 | Verify VMI Network Interface Details |
| 63 | [Documentation] Verify VMI network interface details. |
| 64 | [Arguments] ${ip} ${origin} ${gateway} ${netmask} |
shrsuman123 | a035578 | 2021-10-18 05:56:56 -0500 | [diff] [blame] | 65 | ... ${interface}=${ethernet_interface} ${valid_status_code}=${HTTP_OK} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 66 | |
| 67 | # Description of argument(s): |
| 68 | # ip VMI IPv4 address. |
| 69 | # origin Origin of IPv4 address eg. Static or DHCP. |
| 70 | # gateway Gateway for VMI IP. |
| 71 | # netmask Subnetmask for VMI IP. |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 72 | # interface VMI interface (eg. eth0 or eth1). |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 73 | # valid_status_code Expected valid status code from GET request. Default is HTTP_OK. |
| 74 | |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 75 | ${vmi_ip}= Get VMI Network Interface Details ${interface} ${valid_status_code} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 76 | Should Be Equal As Strings ${origin} ${vmi_ip["IPv4_AddressOrigin"]} |
| 77 | Should Be Equal As Strings ${gateway} ${vmi_ip["IPv4_Gateway"]} |
| 78 | Should Be Equal As Strings ${netmask} ${vmi_ip["IPv4_SubnetMask"]} |
| 79 | Should Be Equal As Strings ${ip} ${vmi_ip["IPv4_Address"]} |
| 80 | |
| 81 | Delete VMI IPv4 Address |
| 82 | [Documentation] Delete VMI IPv4 address. |
| 83 | [Arguments] ${delete_param}=IPv4StaticAddresses ${valid_status_code}=${HTTP_ACCEPTED} |
shrsuman123 | a035578 | 2021-10-18 05:56:56 -0500 | [diff] [blame] | 84 | ... ${interface}=${ethernet_interface} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 85 | |
| 86 | # Description of argument(s): |
| 87 | # delete_param Parameter to be deleted eg. IPv4StaticAddresses or IPv4Addresses. |
| 88 | # Default is IPv4StaticAddresses. |
| 89 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK. |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 90 | # interface VMI interface (eg. eth0 or eth1). |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 91 | |
| 92 | ${data}= Set Variable {"${delete_param}": [${Null}]} |
| 93 | ${resp}= Redfish.Patch |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 94 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 95 | ... body=${data} valid_status_codes=[${valid_status_code}] |
| 96 | |
| 97 | Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED} |
shrsuman123 | a3759b3 | 2021-11-02 02:50:42 -0500 | [diff] [blame] | 98 | |
| 99 | # Wait few seconds for configuration to get effective. |
| 100 | Sleep ${wait_time} |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 101 | ${vmi_ip}= Get VMI Network Interface Details ${interface} |
Megha GN | 80ef5ca | 2022-06-09 00:29:57 -0500 | [diff] [blame] | 102 | ${default}= Set Variable 0.0.0.0 |
| 103 | Verify VMI Network Interface Details ${default} Static ${default} ${default} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 104 | |
| 105 | Set VMI IPv4 Origin |
| 106 | [Documentation] Set VMI IPv4 origin. |
| 107 | [Arguments] ${dhcp_enabled}=${False} ${valid_status_code}=${HTTP_ACCEPTED} |
shrsuman123 | a035578 | 2021-10-18 05:56:56 -0500 | [diff] [blame] | 108 | ... ${interface}=${ethernet_interface} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 109 | |
| 110 | # Description of argument(s): |
| 111 | # dhcp_enabled True if user wants to enable DHCP. Default is Static, hence value is set to False. |
| 112 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK. |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 113 | # interface VMI interface (eg. eth0 or eth1). |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 114 | |
| 115 | ${data}= Set Variable If ${dhcp_enabled} == ${False} ${DISABLE_DHCP} ${ENABLE_DHCP} |
| 116 | ${resp}= Redfish.Patch |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 117 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 118 | ... body=${data} valid_status_codes=[${valid_status_code}] |
| 119 | |
| 120 | Sleep ${wait_time} |
| 121 | Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED} |
| 122 | ${resp}= Redfish.Get |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 123 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 124 | Should Be Equal ${resp.dict["DHCPv4"]["DHCPEnabled"]} ${dhcp_enabled} |
| 125 | |
Megha G N | a9cf2d8 | 2023-10-09 07:41:11 -0500 | [diff] [blame] | 126 | |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 127 | Get VMI Network Interface Details |
| 128 | [Documentation] Get VMI network interface details. |
shrsuman123 | a035578 | 2021-10-18 05:56:56 -0500 | [diff] [blame] | 129 | [Arguments] ${interface}=${ethernet_interface} ${valid_status_code}=${HTTP_OK} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 130 | |
| 131 | # Description of argument(s): |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 132 | # interface VMI interface (eg. eth0 or eth1). |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 133 | # valid_status_code Expected valid status code from GET request. |
| 134 | |
| 135 | # Note: It returns a dictionary of VMI ethernet interface parameters. |
| 136 | |
| 137 | ${resp}= Redfish.Get |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 138 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 139 | ... valid_status_codes=[${valid_status_code}] |
| 140 | |
| 141 | ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json |
| 142 | |
| 143 | ${ip_exists}= Set Variable If ${ip_resp["IPv4Addresses"]} == @{empty} ${False} ${True} |
| 144 | ${static_exists}= Set Variable If ${ip_resp["IPv4StaticAddresses"]} == @{empty} ${False} ${True} |
| 145 | |
| 146 | ${vmi_ip}= Run Keyword If ${ip_exists} == ${True} |
| 147 | ... Create Dictionary DHCPv4=${${ip_resp["DHCPv4"]["DHCPEnabled"]}} Id=${ip_resp["Id"]} |
| 148 | ... Description=${ip_resp["Description"]} IPv4_Address=${ip_resp["IPv4Addresses"][0]["Address"]} |
| 149 | ... IPv4_AddressOrigin=${ip_resp["IPv4Addresses"][0]["AddressOrigin"]} Name=${ip_resp["Name"]} |
| 150 | ... IPv4_Gateway=${ip_resp["IPv4Addresses"][0]["Gateway"]} |
| 151 | ... InterfaceEnabled=${${ip_resp["InterfaceEnabled"]}} |
| 152 | ... IPv4_SubnetMask=${ip_resp["IPv4Addresses"][0]["SubnetMask"]} |
| 153 | ... IPv4StaticAddresses=${${static_exists}} |
| 154 | ... ELSE |
| 155 | ... Create Dictionary DHCPv4=${${ip_resp["DHCPv4"]["DHCPEnabled"]}} Id=${ip_resp["Id"]} |
| 156 | ... Description=${ip_resp["Description"]} IPv4StaticAddresses=${ip_resp["IPv4StaticAddresses"]} |
| 157 | ... IPv4_Address=${ip_resp["IPv4Addresses"]} Name=${ip_resp["Name"]} |
| 158 | ... InterfaceEnabled=${${ip_resp["InterfaceEnabled"]}} |
| 159 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 160 | RETURN &{vmi_ip} |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 161 | |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 162 | |
| 163 | Get VMI Interfaces |
| 164 | [Documentation] Get VMI network interface. |
| 165 | [Arguments] ${valid_status_code}=${HTTP_OK} |
| 166 | |
| 167 | # Description of argument(s): |
| 168 | # valid_status_code Expected valid status code from GET request. |
| 169 | # By default set to ${HTTP_OK}. |
| 170 | |
| 171 | ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces |
| 172 | ... valid_status_codes=[${valid_status_code}] |
| 173 | |
| 174 | ${resp}= Evaluate json.loads(r'''${resp.text}''') json |
| 175 | ${interfaces_uri}= Set Variable ${resp["Members"]} |
| 176 | ${interface_list}= Create List |
| 177 | ${number_of_interfaces}= Get Length ${interfaces_uri} |
| 178 | FOR ${interface} IN RANGE ${number_of_interfaces} |
| 179 | ${_} ${interface_value}= Split String From Right ${interfaces_uri[${interface}]}[@odata.id] / 1 |
| 180 | Append To List ${interface_list} ${interface_value} |
| 181 | END |
| 182 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 183 | RETURN @{interface_list} |
shrsuman123 | 298e804 | 2021-08-20 07:36:21 -0500 | [diff] [blame] | 184 | |
| 185 | |
Sweta Potthuri | d52b273 | 2021-08-12 12:48:24 -0500 | [diff] [blame] | 186 | Verify VMI EthernetInterfaces |
| 187 | [Documentation] Verify VMI ethernet interfaces. |
| 188 | [Arguments] ${valid_status_code}=${HTTP_OK} |
| 189 | |
| 190 | # Description of argument(s): |
| 191 | # valid_status_code Expected valid status code from GET request. |
| 192 | |
| 193 | ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces |
| 194 | ... valid_status_codes=[${valid_status_code}] |
| 195 | |
| 196 | ${resp}= Evaluate json.loads(r'''${resp.text}''') json |
| 197 | ${interfaces}= Set Variable ${resp["Members"]} |
| 198 | |
| 199 | ${number_of_interfaces}= Get Length ${interfaces} |
| 200 | FOR ${i} IN RANGE ${number_of_interfaces} |
| 201 | Should Be Equal As Strings ${interfaces[${i}]}[@odata.id] |
| 202 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth${i} |
| 203 | END |
| 204 | Should Be Equal ${resp["Members@odata.count"]} ${number_of_interfaces} |
shrsuman123 | 7ba02f3 | 2021-08-26 04:50:56 -0500 | [diff] [blame] | 205 | |
| 206 | Get And Set Static VMI IP |
| 207 | [Documentation] Get a suitable VMI IP and set it. |
| 208 | [Arguments] ${host}=${OPENBMC_HOST} ${network_active_channel}=${CHANNEL_NUMBER} |
| 209 | ... ${interface}=eth0 ${valid_status_code}=${HTTP_ACCEPTED} |
| 210 | |
| 211 | # Description of argument(s): |
| 212 | # host BMC host name or IP address. |
| 213 | # network_active_channel Ethernet channel number (e.g.1 or 2). |
| 214 | # interface VMI interface (eg. eth0 or eth1). |
| 215 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_ACCEPTED. |
| 216 | |
| 217 | ${vmi_ip}= Get First Non Pingable IP From Subnet ${host} |
| 218 | ${bmc_ip_data}= Get Network Configuration ${network_active_channel} |
| 219 | |
| 220 | Set Static IPv4 Address To VMI And Verify ${vmi_ip} ${bmc_ip_data[0]['Gateway']} |
| 221 | ... ${bmc_ip_data[0]['SubnetMask']} ${valid_status_code} ${interface} |
| 222 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 223 | RETURN ${vmi_ip} ${bmc_ip_data} |
Megha G N | a214833 | 2025-03-06 07:28:15 -0600 | [diff] [blame] | 224 | |
| 225 | |
| 226 | Set VMI SLAACv6 Origin |
| 227 | [Documentation] Set VMI SLAACv6 origin. |
| 228 | [Arguments] ${slaac_enabled}=${False} ${valid_status_code}=${HTTP_ACCEPTED} |
| 229 | ... ${interface}=${ethernet_interface} |
| 230 | |
| 231 | # Description of argument(s): |
| 232 | # slaacv6_enabled True if user wants to enable SLAACv6. Default is Static, hence value is set to False. |
| 233 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK. |
| 234 | # interface VMI interface (eg. eth0 or eth1). |
| 235 | |
| 236 | ${data}= Set Variable If ${slaac_enabled} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC} |
| 237 | ${resp}= Redfish.Patch |
| 238 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
| 239 | ... body=${data} valid_status_codes=[${valid_status_code}] |
| 240 | |
| 241 | Sleep ${wait_time} |
| 242 | Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED} |
| 243 | ${resp}= Redfish.Get |
| 244 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
| 245 | Should Be Equal ${resp.dict["StatelessAddressAutoConfig"]["IPv6AutoConfigEnabled"]} ${slaac_enabled} |
| 246 | |
| 247 | |
| 248 | Verify VMI IPv6 Address |
| 249 | [Documentation] Verify VMI IPv6 address configurations. |
| 250 | [Arguments] ${ipv6_origin} ${interface}=${ethernet_interface} |
| 251 | |
| 252 | # Description of argument(s): |
| 253 | # ipv6_origin Origin of IPv6 address eg. Static or DHCPv6 or SLAAC. |
| 254 | # interface VMI interface (eg. eth0 or eth1). |
| 255 | |
| 256 | ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
| 257 | |
| 258 | @{vmi_ipv6_configurations}= Get From Dictionary ${resp.dict} IPv6Addresses |
| 259 | ${vmi_ipv6_config}= Get From List ${vmi_ipv6_configurations} 0 |
| 260 | Should Not Be Empty ${vmi_ipv6_config["Address"]} |
| 261 | Should Be Equal As Strings ${vmi_ipv6_config["AddressOrigin"]} ${ipv6_origin} |
| 262 | RETURN &{vmi_ipv6_config} |
| 263 | |
| 264 | |
| 265 | Set VMI DHCPv6 Property |
| 266 | [Documentation] Set VMI DHCPv6 attribute. |
| 267 | [Arguments] ${dhcpv6_operatingmode}=${Disabled} ${valid_status_code}=${HTTP_ACCEPTED} |
| 268 | ... ${interface}=${ethernet_interface} |
| 269 | |
| 270 | # Description of argument(s): |
| 271 | # dhcpv6_operatingmode Enabled if user wants to enable DHCPv6. |
| 272 | # ... Default is Static, hence value is set to Disabled. |
| 273 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK. |
| 274 | # interface VMI interface (eg. eth0 or eth1). |
| 275 | |
| 276 | ${data}= Set Variable If '${dhcpv6_operatingmode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6} |
| 277 | ${resp}= Redfish.Patch |
| 278 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
| 279 | ... body=${data} valid_status_codes=[${valid_status_code}] |
| 280 | |
| 281 | Sleep ${wait_time} |
| 282 | Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED} |
| 283 | ${resp}= Redfish.Get |
| 284 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
| 285 | Should Be Equal ${resp.dict["DHCPv6"]["OperatingMode"]} ${dhcpv6_operatingmode} |
| 286 | |
| 287 | |
| 288 | Set Static VMI IPv6 Address |
| 289 | [Documentation] Add static VMI IPv6 address. |
| 290 | [Arguments] ${vmi_ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_ACCEPTED} |
| 291 | ... ${interface}=${ethernet_interface} |
| 292 | |
| 293 | # Description of argument(s): |
| 294 | # vmi_ipv6_addr VMI IPv6 address to be added. |
| 295 | # prefix_len Prefix length for the VMI IPv6 to be added. |
| 296 | # valid_status_codes Expected valid status code from PATCH request. |
| 297 | # interface VMI interface (eg. eth0 or eth1). |
| 298 | |
| 299 | ${prefix_length}= Convert To Integer ${prefix_len} |
| 300 | ${empty_dict}= Create Dictionary |
| 301 | ${vmi_ipv6_data}= Create Dictionary Address=${vmi_ipv6_addr} |
| 302 | ... PrefixLength=${prefix_length} |
| 303 | |
| 304 | ${patch_list}= Create List |
| 305 | |
| 306 | Append To List ${patch_list} ${vmi_ipv6_data} |
| 307 | ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} |
| 308 | |
| 309 | ${active_channel_config}= Get Active Channel Config |
| 310 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 311 | |
| 312 | Redfish.patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
| 313 | ... body=&{data} valid_status_codes=[${valid_status_codes}] |
| 314 | |
Megha G N | 1361edf | 2025-03-18 03:09:41 -0500 | [diff] [blame] | 315 | Sleep 5s |
Megha G N | a214833 | 2025-03-06 07:28:15 -0600 | [diff] [blame] | 316 | |
| 317 | Set VMI IPv6 Static Default Gateway |
| 318 | [Documentation] Set VMI IPv6 static default gateway address. |
| 319 | [Arguments] ${vmi_staticipv6_gateway} ${valid_status_codes}=${HTTP_ACCEPTED} |
| 320 | ... ${interface}=${ethernet_interface} |
| 321 | |
| 322 | # Description of argument(s): |
| 323 | # vmi_staticipv6_gateway VMI static IPv6 default gateway address. |
| 324 | # valid_status_codes Expected valid status code from PATCH request. |
| 325 | # interface VMI interface (eg. eth0 or eth1). |
| 326 | |
| 327 | ${patch_list}= Create List ${vmi_staticipv6_gateway} |
| 328 | ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} |
| 329 | |
| 330 | Redfish.patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
| 331 | ... body=&{data} valid_status_codes=[${valid_status_codes}] |
| 332 | |
| 333 | |
| 334 | Delete VMI IPv6 Static Address |
| 335 | [Documentation] Delete VMI IPv6 static address. |
| 336 | [Arguments] ${valid_status_codes}=${HTTP_ACCEPTED} |
| 337 | ... ${interface}=${ethernet_interface} |
| 338 | |
| 339 | # Description of argument(s): |
| 340 | # valid_status_codes Expected valid status code from PATCH request. |
| 341 | # interface VMI interface (eg. eth0 or eth1). |
| 342 | |
| 343 | ${data}= Set Variable {"IPv6StaticAddresses": [${Null}]} |
| 344 | Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
| 345 | ... body=${data} valid_status_codes=[${valid_status_codes}] |
| 346 | |
| 347 | Sleep 5s |