1*** Settings *** 2Documentation DHCP Network to test suite functionality. 3 4Resource ../lib/openbmc_ffdc.robot 5Resource ../lib/bmc_network_utils.robot 6Library ../lib/ipmi_utils.py 7Library ../lib/bmc_network_utils.py 8 9Suite Setup Suite Setup Execution 10Suite Teardown Redfish.Logout 11 12*** Test Cases *** 13 14Enable 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 19 [Template] Apply Ethernet Config 20 21 # property Value 22 DHCPEnabled ${True} 23 24 25Disable 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 30 [Template] Apply Ethernet Config 31 32 # property Value 33 DHCPEnabled ${False} 34 35 36Enable 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 41 [Template] Apply Ethernet Config 42 43 # property Value 44 UseDNSServers ${True} 45 46 47Disable 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 52 [Template] Apply Ethernet Config 53 54 # property Value 55 UseDNSServers ${False} 56 57 58Enable 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 63 [Template] Apply Ethernet Config 64 65 # property Value 66 UseDomainName ${True} 67 68 69 70Disable 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 75 [Template] Apply Ethernet Config 76 77 # property Value 78 UseDomainName ${False} 79 80 81Enable 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 86 [Template] Apply Ethernet Config 87 88 # property Value 89 UseNTPServers ${True} 90 91 92Disable 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 97 [Template] Apply Ethernet Config 98 99 # property Value 100 UseNTPServers ${False} 101 102 103*** Keywords *** 104 105Suite 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 128Set 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 147Restore 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 156 157Apply 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 174