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 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [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 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 15 | &{DHCP_ENABLE_DICT} DHCPEnabled=${True} |
| 16 | &{DHCP_DISABLE_DICT} DHCPEnabled=${False} |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 17 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 18 | &{DNS_ENABLE_DICT} UseDNSServers=${True} |
| 19 | &{DNS_DISABLE_DICT} UseDNSServers=${False} |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 20 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 21 | &{NTP_ENABLE_DICT} UseNTPServers=${True} |
| 22 | &{NTP_DISABLE_DICT} UseNTPServers=${False} |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 23 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 24 | &{DOMAIN_NAME_ENABLE_DICT} UseDomainName=${True} |
| 25 | &{DOMAIN_NAME_DISABLE_DICT} UseDomainName=${False} |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 26 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 27 | &{ENABLE_MULTIPLE_PROPRETIES} UseDomainName=${True} |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 28 | ... UseNTPServers=${True} |
| 29 | ... UseDNSServers=${True} |
| 30 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 31 | &{DISABLE_MULTIPLE_PROPERTIES} UseDomainName=${False} |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 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 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 42 | # property |
| 43 | ${DHCP_ENABLE_DICT} |
| 44 | ${DHCP_DISABLE_DICT} |
| 45 | ${DNS_ENABLE_DICT} |
| 46 | $NTP_ENABLE_DICT{DNS_DISABLE_DICT} |
| 47 | ${DOMAIN_NAME_ENABLE_DICT} |
| 48 | ${DOMAIN_NAME_DISABLE_DICT} |
| 49 | ${NTP_ENABLE_DICT} |
| 50 | ${NTP_DISABLE_DICT} |
| 51 | ${ENABLE_MULTIPLE_PROPRETIES} |
| 52 | ${DISABLE_MULTIPLE_PROPERTIES} |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 53 | |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 54 | *** Keywords *** |
| 55 | |
| 56 | Suite Setup Execution |
| 57 | [Documentation] Suite Setup Execution. |
| 58 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 59 | Ping Host ${OPENBMC_HOST} |
George Keishing | f7b4e6d | 2025-02-24 15:20:36 +0530 | [diff] [blame] | 60 | Ping Host ${OPENBMC_HOST_ETH1} |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 61 | Redfish.Login |
| 62 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 63 | ${network_configurations}= |
| 64 | ... 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} |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 66 | IF '${network_configuration['Address']}' == '${OPENBMC_HOST_ETH1}' |
| 67 | Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']} |
| 68 | Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']} |
| 69 | BREAK |
| 70 | END |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 71 | END |
| 72 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 73 | ${network_configurations}= |
| 74 | ... Get Network Configuration Using Channel Number ${1} |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 75 | FOR ${network_configuration} IN @{network_configurations} |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 76 | IF '${network_configuration['Address']}' == '${OPENBMC_HOST}' |
| 77 | Set Suite Variable ${eth0_subnet_mask} ${network_configuration['SubnetMask']} |
| 78 | Set Suite Variable ${eth0_gateway} ${network_configuration['Gateway']} |
| 79 | BREAK |
| 80 | END |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 81 | END |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 82 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 83 | Get Network Configuration Using Channel Number |
| 84 | [Documentation] Get ethernet interface. |
| 85 | [Arguments] ${channel_number} |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 86 | |
| 87 | # Description of argument(s): |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 88 | # channel_number Ethernet channel number, 1 is for eth0 and 2 is for |
| 89 | # eth1 (e.g. "1"). |
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 | ${active_channel_config}= Get Active Channel Config |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 92 | ${ethernet_interface}= |
| 93 | ... Set Variable ${active_channel_config['${channel_number}']['name']} |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 94 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 95 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 96 | @{network_configurations}= |
| 97 | ... Get From Dictionary ${resp.dict} IPv4StaticAddresses |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 98 | RETURN @{network_configurations} |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 99 | |
| 100 | Apply Ethernet Config |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 101 | [Documentation] Set the given Ethernet config property. |
| 102 | [Arguments] ${property} |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 103 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 104 | # Description of argument(s): |
| 105 | # property Ethernet property to be set.. |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 106 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 107 | ${active_channel_config}= Get Active Channel Config |
| 108 | Redfish.Patch |
ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 109 | ... /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] | 110 | ... body={"DHCPv4":${property}} valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 111 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 112 | ${resp}= Redfish.Get |
ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 113 | ... /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] | 114 | Verify Ethernet Config Property ${property} ${resp.dict["DHCPv4"]} |
| 115 | |
Sweta Potthuri | dda695e | 2023-04-26 02:10:38 -0500 | [diff] [blame] | 116 | Restore Configuration |
| 117 | [Documentation] Restore the configuration to Both Static Network |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 118 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 119 | IF '${CHANNEL_NUMBER}' == '1' |
| 120 | Add IP Address ${OPENBMC_HOST} ${eth0_subnet_mask} ${eth0_gateway} |
| 121 | ELSE IF '${CHANNEL_NUMBER}' == '2' |
| 122 | Add IP Address |
| 123 | ... ${OPENBMC_HOST_ETH1} ${eth1_subnet_mask} ${eth1_gateway} |
| 124 | END |
George Keishing | 7d92d07 | 2023-07-12 08:51:22 -0500 | [diff] [blame] | 125 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 126 | Verify Ethernet Config Property |
| 127 | [Documentation] verify ethernet config properties. |
| 128 | [Arguments] ${property} ${response_data} |
| 129 | |
| 130 | # Description of argument(s): |
| 131 | # ${property} DHCP Properties in dictionary. |
| 132 | # Example: |
| 133 | # property value |
| 134 | # DHCPEnabled :False |
| 135 | # UseDomainName :True |
| 136 | # UseNTPServers :True |
| 137 | # UseDNSServers :True |
| 138 | # ${response_data} DHCP Response data in dictionary. |
| 139 | # Example: |
| 140 | # property value |
| 141 | # DHCPEnabled :False |
| 142 | # UseDomainName :True |
| 143 | # UseNTPServers :True |
| 144 | # UseDNSServers :True |
| 145 | |
George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 146 | ${key_map}= Get Dictionary Items ${property} |
| 147 | FOR ${key} ${value} IN @{key_map} |
| 148 | Should Be Equal As Strings ${response_data['${key}']} ${value} |
| 149 | END |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 150 | |