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 |
| 6 | Library ../lib/ipmi_utils.py |
| 7 | Library ../lib/bmc_network_utils.py |
| 8 | |
| 9 | Suite Setup Suite Setup Execution |
| 10 | Suite Teardown Redfish.Logout |
| 11 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 12 | *** Variables *** |
| 13 | |
| 14 | &{dhcp_enable_dict} DHCPEnabled=${True} |
| 15 | &{dhcp_disable_dict} DHCPEnabled=${False} |
| 16 | |
| 17 | &{dns_enable_dict} UseDNSServers=${True} |
| 18 | &{dns_disable_dict} UseDNSServers=${False} |
| 19 | |
| 20 | &{ntp_enable_dict} UseNTPServers=${True} |
| 21 | &{ntp_disable_dict} UseNTPServers=${False} |
| 22 | |
| 23 | &{domain_name_enable_dict} UseDomainName=${True} |
| 24 | &{domain_name_disable_dict} UseDomainName=${False} |
| 25 | |
| 26 | &{enable_multiple_properties} UseDomainName=${True} |
| 27 | ... UseNTPServers=${True} |
| 28 | ... UseDNSServers=${True} |
| 29 | |
| 30 | &{disable_multiple_properties} UseDomainName=${False} |
| 31 | ... UseNTPServers=${False} |
| 32 | ... UseDNSServers=${False} |
| 33 | |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 34 | *** Test Cases *** |
| 35 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 36 | Set Network Property via Redfish And Verify |
| 37 | [Documentation] Set network property via Redfish and verify. |
| 38 | [Tags] Set_Network_Property_via_Redfish_And_Verify |
| 39 | [Template] Apply Ethernet Config |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 40 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 41 | # property |
| 42 | ${dhcp_enable_dict} |
| 43 | ${dhcp_disable_dict} |
| 44 | ${dns_enable_dict} |
| 45 | ${dns_disable_dict} |
| 46 | ${domain_name_enable_dict} |
| 47 | ${domain_name_disable_dict} |
| 48 | ${ntp_enable_dict} |
| 49 | ${ntp_disable_dict} |
| 50 | ${enable_multiple_properties} |
| 51 | ${disable_multiple_properties} |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 52 | |
| 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 | |
| 59 | Redfish.Login |
| 60 | |
Anves Kumar rayankula | 2205631 | 2021-01-06 03:28:40 -0600 | [diff] [blame] | 61 | Redfish Power On |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 62 | # This keyword should login to host OS. |
| 63 | Run Inband IPMI Standard Command |
| 64 | ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${1} |
| 65 | |
| 66 | ${host_name} ${ip_address}= Get Host Name IP host=${OPENBMC_HOST} |
| 67 | |
| 68 | Set Suite Variable ${ip_address} |
| 69 | |
| 70 | @{network_configurations}= Get Network Configuration |
| 71 | FOR ${network_configuration} IN @{network_configurations} |
| 72 | Run Keyword If '${network_configuration['Address']}' == '${ip_address}' |
| 73 | ... Set Suite Variable ${subnet_mask} ${network_configuration['SubnetMask']} |
| 74 | END |
| 75 | |
| 76 | ${initial_lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
| 77 | Set Suite Variable ${initial_lan_config} |
| 78 | |
| 79 | |
| 80 | Set IPMI Inband Network Configuration |
| 81 | [Documentation] Run sequence of standard in-band IPMI command and set |
| 82 | ... the IP configuration. |
| 83 | [Arguments] ${ip} ${netmask} ${gateway} |
| 84 | |
| 85 | # Description of argument(s): |
| 86 | # ip The IP address to be set using ipmitool-inband. |
| 87 | # netmask The Netmask to be set using ipmitool-inband. |
| 88 | # gateway The Gateway address to be set using ipmitool-inband. |
| 89 | # login Indicates that this keyword should login to host OS. |
| 90 | |
| 91 | Run Inband IPMI Standard Command |
| 92 | ... lan set ${CHANNEL_NUMBER} ipaddr ${ip} login_host=${0} |
| 93 | Run Inband IPMI Standard Command |
| 94 | ... lan set ${CHANNEL_NUMBER} netmask ${netmask} login_host=${0} |
| 95 | Run Inband IPMI Standard Command |
| 96 | ... lan set ${CHANNEL_NUMBER} defgw ipaddr ${gateway} login_host=${0} |
| 97 | |
| 98 | |
| 99 | Restore Configuration |
| 100 | [Documentation] Restore the configuration to its pre-test state. |
| 101 | |
| 102 | ${length}= Get Length ${initial_lan_config} |
| 103 | Return From Keyword If ${length} == ${0} |
| 104 | |
| 105 | Set IPMI Inband Network Configuration ${ip_address} ${subnet_mask} |
| 106 | ... ${initial_lan_config['Default Gateway IP']} |
| 107 | |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 108 | |
| 109 | Apply Ethernet Config |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 110 | [Documentation] Set the given Ethernet config property. |
| 111 | [Arguments] ${property} |
| 112 | [Teardown] Run Keywords Restore Configuration AND |
| 113 | ... Set Global Variable ${TEST_STATUS} ${KEYWORD STATUS} AND FFDC On Test Case Fail |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 114 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 115 | # Description of argument(s): |
| 116 | # property Ethernet property to be set.. |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 117 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 118 | ${active_channel_config}= Get Active Channel Config |
| 119 | Redfish.Patch |
ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 120 | ... /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] | 121 | ... body={"DHCPv4":${property}} valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 122 | |
Anves Kumar rayankula | 7a68d89 | 2020-07-10 00:30:13 -0500 | [diff] [blame] | 123 | ${resp}= Redfish.Get |
ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 124 | ... /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] | 125 | Verify Ethernet Config Property ${property} ${resp.dict["DHCPv4"]} |
| 126 | |
| 127 | |
| 128 | Verify Ethernet Config Property |
| 129 | [Documentation] verify ethernet config properties. |
| 130 | [Arguments] ${property} ${response_data} |
| 131 | |
| 132 | # Description of argument(s): |
| 133 | # ${property} DHCP Properties in dictionary. |
| 134 | # Example: |
| 135 | # property value |
| 136 | # DHCPEnabled :False |
| 137 | # UseDomainName :True |
| 138 | # UseNTPServers :True |
| 139 | # UseDNSServers :True |
| 140 | # ${response_data} DHCP Response data in dictionary. |
| 141 | # Example: |
| 142 | # property value |
| 143 | # DHCPEnabled :False |
| 144 | # UseDomainName :True |
| 145 | # UseNTPServers :True |
| 146 | # UseDNSServers :True |
| 147 | |
| 148 | ${key_map}= Get Dictionary Items ${property} |
| 149 | FOR ${key} ${value} IN @{key_map} |
| 150 | Should Be Equal As Strings ${response_data['${key}']} ${value} |
| 151 | END |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 152 | |