Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation DHCP Network to test suite functionality. |
| 3 | |
| 4 | Resource ../lib/openbmc_ffdc.robot |
| 5 | Resource ../lib/bmc_network_utils.robot |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 6 | Library ../lib/bmc_network_utils.py |
| 7 | |
| 8 | Suite Setup Suite Setup Execution |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 9 | Suite Teardown Run Keywords Restore Configuration AND Redfish.Logout |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 10 | |
Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 11 | Test Tags BMC_DHCP_Conf |
George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame] | 12 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 13 | *** Variables *** |
| 14 | |
| 15 | &{dhcp_enable_dict} DHCPEnabled=${True} |
| 16 | &{dhcp_disable_dict} DHCPEnabled=${False} |
| 17 | |
| 18 | &{dns_enable_dict} UseDNSServers=${True} |
| 19 | &{dns_disable_dict} UseDNSServers=${False} |
| 20 | |
| 21 | &{ntp_enable_dict} UseNTPServers=${True} |
| 22 | &{ntp_disable_dict} UseNTPServers=${False} |
| 23 | |
| 24 | &{domain_name_enable_dict} UseDomainName=${True} |
| 25 | &{domain_name_disable_dict} UseDomainName=${False} |
| 26 | |
| 27 | &{enable_multiple_properties} UseDomainName=${True} |
| 28 | ... UseNTPServers=${True} |
| 29 | ... UseDNSServers=${True} |
| 30 | |
| 31 | &{disable_multiple_properties} UseDomainName=${False} |
| 32 | ... UseNTPServers=${False} |
| 33 | ... UseDNSServers=${False} |
| 34 | |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 35 | *** Test Cases *** |
| 36 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 37 | Set Network Property via Redfish And Verify |
| 38 | [Documentation] Set network property via Redfish and verify. |
| 39 | [Tags] Set_Network_Property_via_Redfish_And_Verify |
| 40 | [Template] Apply Ethernet Config |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 41 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 42 | # property |
| 43 | ${dhcp_enable_dict} |
| 44 | ${dhcp_disable_dict} |
| 45 | ${dns_enable_dict} |
| 46 | ${dns_disable_dict} |
| 47 | ${domain_name_enable_dict} |
| 48 | ${domain_name_disable_dict} |
| 49 | ${ntp_enable_dict} |
| 50 | ${ntp_disable_dict} |
| 51 | ${enable_multiple_properties} |
| 52 | ${disable_multiple_properties} |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 53 | |
| 54 | |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 55 | *** Keywords *** |
| 56 | |
| 57 | Suite Setup Execution |
| 58 | [Documentation] Suite Setup Execution. |
| 59 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 60 | Ping Host ${OPENBMC_HOST} |
| 61 | Ping Host ${OPENBMC_HOST_1} |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 62 | Redfish.Login |
| 63 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 64 | ${network_configurations}= Get Network Configuration Using Channel Number ${2} |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 65 | FOR ${network_configuration} IN @{network_configurations} |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 66 | Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST_1}' |
| 67 | ... Run Keywords Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']} |
| 68 | ... AND Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']} |
| 69 | ... AND Exit For Loop |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 70 | END |
| 71 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 72 | ${network_configurations}= Get Network Configuration Using Channel Number ${1} |
| 73 | FOR ${network_configuration} IN @{network_configurations} |
| 74 | Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST}' |
| 75 | ... Run Keywords Set Suite Variable ${eth0_subnet_mask} ${network_configuration['SubnetMask']} |
| 76 | ... AND Set Suite Variable ${eth0_gateway} ${network_configuration['Gateway']} |
| 77 | ... AND Exit For Loop |
| 78 | END |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 79 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 80 | Get Network Configuration Using Channel Number |
| 81 | [Documentation] Get ethernet interface. |
| 82 | [Arguments] ${channel_number} |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 83 | |
| 84 | # Description of argument(s): |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 85 | # channel_number Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1"). |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 86 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 87 | ${active_channel_config}= Get Active Channel Config |
| 88 | ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} |
| 89 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 90 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 91 | @{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 92 | RETURN @{network_configurations} |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 93 | |
| 94 | Apply Ethernet Config |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 95 | [Documentation] Set the given Ethernet config property. |
| 96 | [Arguments] ${property} |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 97 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 98 | # Description of argument(s): |
| 99 | # property Ethernet property to be set.. |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 100 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 101 | ${active_channel_config}= Get Active Channel Config |
| 102 | Redfish.Patch |
ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 103 | ... /redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}/ |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 104 | ... body={"DHCPv4":${property}} valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 105 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 106 | ${resp}= Redfish.Get |
ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 107 | ... /redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 108 | Verify Ethernet Config Property ${property} ${resp.dict["DHCPv4"]} |
| 109 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 110 | Restore Configuration |
| 111 | [Documentation] Restore the configuration to Both Static Network |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 112 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 113 | Run Keyword If '${CHANNEL_NUMBER}' == '1' Add IP Address ${OPENBMC_HOST} ${eth0_subnet_mask} ${eth0_gateway} |
| 114 | ... ELSE IF '${CHANNEL_NUMBER}' == '2' Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway} |
George Keishing | 7d92d07 | 2023-07-12 08:51:22 -0500 | [diff] [blame] | 115 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 116 | Verify Ethernet Config Property |
| 117 | [Documentation] verify ethernet config properties. |
| 118 | [Arguments] ${property} ${response_data} |
| 119 | |
| 120 | # Description of argument(s): |
| 121 | # ${property} DHCP Properties in dictionary. |
| 122 | # Example: |
| 123 | # property value |
| 124 | # DHCPEnabled :False |
| 125 | # UseDomainName :True |
| 126 | # UseNTPServers :True |
| 127 | # UseDNSServers :True |
| 128 | # ${response_data} DHCP Response data in dictionary. |
| 129 | # Example: |
| 130 | # property value |
| 131 | # DHCPEnabled :False |
| 132 | # UseDomainName :True |
| 133 | # UseNTPServers :True |
| 134 | # UseDNSServers :True |
| 135 | |
| 136 | ${key_map}= Get Dictionary Items ${property} |
| 137 | FOR ${key} ${value} IN @{key_map} |
| 138 | Should Be Equal As Strings ${response_data['${key}']} ${value} |
| 139 | END |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 140 | |