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 | |
| 12 | *** Test Cases *** |
| 13 | |
| 14 | Enable DHCP Via Redfish And Verify |
| 15 | [Documentation] Enable DHCP via Redfish and verify. |
| 16 | [Tags] Enable_DHCP_Via_Redfish_And_Verify |
| 17 | [Teardown] Run Keywords Restore Configuration |
| 18 | ... AND FFDC On Test Case Fail |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 19 | [Template] Apply Ethernet Config |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 20 | |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 21 | # property Value |
| 22 | DHCPEnabled ${True} |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 23 | |
| 24 | |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 25 | Disable DHCP Via Redfish And Verify |
| 26 | [Documentation] Disable DHCP via Redfish and verify. |
| 27 | [Tags] Disable_DHCP_Via_Redfish_And_Verify |
| 28 | [Teardown] Run Keywords Restore Configuration |
| 29 | ... AND FFDC On Test Case Fail |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 30 | [Template] Apply Ethernet Config |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 31 | |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 32 | # property Value |
| 33 | DHCPEnabled ${False} |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 34 | |
| 35 | |
| 36 | Enable UseDNSServers Via Redfish And Verify |
| 37 | [Documentation] Enable UseDNSServers via Redfish and verify. |
| 38 | [Tags] Enable_UseDNSServers_Via_Redfish_And_Verify |
| 39 | [Teardown] Run Keywords Restore Configuration |
| 40 | ... AND FFDC On Test Case Fail |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 41 | [Template] Apply Ethernet Config |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 42 | |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 43 | # property Value |
| 44 | UseDNSServers ${True} |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 45 | |
| 46 | |
| 47 | Disable UseDNSServers Via Redfish And Verify |
| 48 | [Documentation] Disable UseDNSServers via Redfish and verify. |
| 49 | [Tags] Disable_UseDNSServers_Via_Redfish_And_Verify |
| 50 | [Teardown] Run Keywords Restore Configuration |
| 51 | ... AND FFDC On Test Case Fail |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 52 | [Template] Apply Ethernet Config |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 53 | |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 54 | # property Value |
| 55 | UseDNSServers ${False} |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 56 | |
| 57 | |
| 58 | Enable UseDomainName Via Redfish And Verify |
| 59 | [Documentation] Enable UseDomainName via Redfish and verify. |
| 60 | [Tags] Enable_UseDomainName_Via_Redfish_And_Verify |
| 61 | [Teardown] Run Keywords Restore Configuration |
| 62 | ... AND FFDC On Test Case Fail |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 63 | [Template] Apply Ethernet Config |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 64 | |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 65 | # property Value |
| 66 | UseDomainName ${True} |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 67 | |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 68 | |
| 69 | |
| 70 | Disable UseDomainName Via Redfish And Verify |
| 71 | [Documentation] Disable UseDomainName via Redfish and verify. |
| 72 | [Tags] Disable_UseDomainName_Via_Redfish_And_Verify |
| 73 | [Teardown] Run Keywords Restore Configuration |
| 74 | ... AND FFDC On Test Case Fail |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 75 | [Template] Apply Ethernet Config |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 76 | |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 77 | # property Value |
| 78 | UseDomainName ${False} |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 79 | |
| 80 | |
| 81 | Enable UseNTPServers Via Redfish And Verify |
| 82 | [Documentation] Enable UseNTPServers via Redfish and verify. |
| 83 | [Tags] Enable_UseNTPServers_Via_Redfish_And_Verify |
| 84 | [Teardown] Run Keywords Restore Configuration |
| 85 | ... AND FFDC On Test Case Fail |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 86 | [Template] Apply Ethernet Config |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 87 | |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 88 | # property Value |
| 89 | UseNTPServers ${True} |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 90 | |
| 91 | |
| 92 | Disable UseNTPServers Via Redfish And Verify |
| 93 | [Documentation] Disable UseNTPServers via Redfish and verify. |
| 94 | [Tags] Disable_UseNTPServers_Via_Redfish_And_Verify |
| 95 | [Teardown] Run Keywords Restore Configuration |
| 96 | ... AND FFDC On Test Case Fail |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 97 | [Template] Apply Ethernet Config |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 98 | |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 99 | # property Value |
| 100 | UseNTPServers ${False} |
Prashanth Katti | f312d20 | 2020-05-28 10:56:10 -0500 | [diff] [blame] | 101 | |
| 102 | |
Anves Kumar rayankula | 5a57faf | 2020-05-19 05:47:44 -0500 | [diff] [blame] | 103 | *** Keywords *** |
| 104 | |
| 105 | Suite Setup Execution |
| 106 | [Documentation] Suite Setup Execution. |
| 107 | |
| 108 | Redfish.Login |
| 109 | |
| 110 | # This keyword should login to host OS. |
| 111 | Run Inband IPMI Standard Command |
| 112 | ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${1} |
| 113 | |
| 114 | ${host_name} ${ip_address}= Get Host Name IP host=${OPENBMC_HOST} |
| 115 | |
| 116 | Set Suite Variable ${ip_address} |
| 117 | |
| 118 | @{network_configurations}= Get Network Configuration |
| 119 | FOR ${network_configuration} IN @{network_configurations} |
| 120 | Run Keyword If '${network_configuration['Address']}' == '${ip_address}' |
| 121 | ... Set Suite Variable ${subnet_mask} ${network_configuration['SubnetMask']} |
| 122 | END |
| 123 | |
| 124 | ${initial_lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
| 125 | Set Suite Variable ${initial_lan_config} |
| 126 | |
| 127 | |
| 128 | Set IPMI Inband Network Configuration |
| 129 | [Documentation] Run sequence of standard in-band IPMI command and set |
| 130 | ... the IP configuration. |
| 131 | [Arguments] ${ip} ${netmask} ${gateway} |
| 132 | |
| 133 | # Description of argument(s): |
| 134 | # ip The IP address to be set using ipmitool-inband. |
| 135 | # netmask The Netmask to be set using ipmitool-inband. |
| 136 | # gateway The Gateway address to be set using ipmitool-inband. |
| 137 | # login Indicates that this keyword should login to host OS. |
| 138 | |
| 139 | Run Inband IPMI Standard Command |
| 140 | ... lan set ${CHANNEL_NUMBER} ipaddr ${ip} login_host=${0} |
| 141 | Run Inband IPMI Standard Command |
| 142 | ... lan set ${CHANNEL_NUMBER} netmask ${netmask} login_host=${0} |
| 143 | Run Inband IPMI Standard Command |
| 144 | ... lan set ${CHANNEL_NUMBER} defgw ipaddr ${gateway} login_host=${0} |
| 145 | |
| 146 | |
| 147 | Restore Configuration |
| 148 | [Documentation] Restore the configuration to its pre-test state. |
| 149 | |
| 150 | ${length}= Get Length ${initial_lan_config} |
| 151 | Return From Keyword If ${length} == ${0} |
| 152 | |
| 153 | Set IPMI Inband Network Configuration ${ip_address} ${subnet_mask} |
| 154 | ... ${initial_lan_config['Default Gateway IP']} |
| 155 | |
Anves Kumar rayankula | 8115e1e | 2020-07-03 01:22:09 -0500 | [diff] [blame] | 156 | |
| 157 | Apply Ethernet Config |
| 158 | [Documentation] Set the given Ethernet config property. |
| 159 | [Arguments] ${property} ${value} |
| 160 | |
| 161 | # Description of argument(s): |
| 162 | # property Ethernet property to be set.. |
| 163 | # value Value to be set. E.g. True or False. |
| 164 | |
| 165 | ${active_channel_config}= Get Active Channel Config |
| 166 | Redfish.Patch |
| 167 | ... /redfish/v1/Managers/bmc/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}/ |
| 168 | ... body={"DHCPv4":{"${property}":${value}}} |
| 169 | |
| 170 | ${resp}= Redfish.Get |
| 171 | ... /redfish/v1/Managers/bmc/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 172 | Should Be Equal As Strings ${resp.dict["DHCPv4"]["${property}"]} ${value} |
| 173 | |