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