blob: 91563378a3c07f801d2532685dde722fd566883d [file] [log] [blame]
Anves Kumar rayankula5a57faf2020-05-19 05:47:44 -05001*** 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
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050019 [Template] Apply Ethernet Config
Anves Kumar rayankula5a57faf2020-05-19 05:47:44 -050020
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050021 # property Value
22 DHCPEnabled ${True}
Anves Kumar rayankula5a57faf2020-05-19 05:47:44 -050023
24
Prashanth Kattif312d202020-05-28 10:56:10 -050025Disable 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 rayankula8115e1e2020-07-03 01:22:09 -050030 [Template] Apply Ethernet Config
Prashanth Kattif312d202020-05-28 10:56:10 -050031
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050032 # property Value
33 DHCPEnabled ${False}
Prashanth Kattif312d202020-05-28 10:56:10 -050034
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
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050041 [Template] Apply Ethernet Config
Prashanth Kattif312d202020-05-28 10:56:10 -050042
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050043 # property Value
44 UseDNSServers ${True}
Prashanth Kattif312d202020-05-28 10:56:10 -050045
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
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050052 [Template] Apply Ethernet Config
Prashanth Kattif312d202020-05-28 10:56:10 -050053
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050054 # property Value
55 UseDNSServers ${False}
Prashanth Kattif312d202020-05-28 10:56:10 -050056
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
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050063 [Template] Apply Ethernet Config
Prashanth Kattif312d202020-05-28 10:56:10 -050064
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050065 # property Value
66 UseDomainName ${True}
Prashanth Kattif312d202020-05-28 10:56:10 -050067
Prashanth Kattif312d202020-05-28 10:56:10 -050068
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
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050075 [Template] Apply Ethernet Config
Prashanth Kattif312d202020-05-28 10:56:10 -050076
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050077 # property Value
78 UseDomainName ${False}
Prashanth Kattif312d202020-05-28 10:56:10 -050079
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
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050086 [Template] Apply Ethernet Config
Prashanth Kattif312d202020-05-28 10:56:10 -050087
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050088 # property Value
89 UseNTPServers ${True}
Prashanth Kattif312d202020-05-28 10:56:10 -050090
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
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050097 [Template] Apply Ethernet Config
Prashanth Kattif312d202020-05-28 10:56:10 -050098
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -050099 # property Value
100 UseNTPServers ${False}
Prashanth Kattif312d202020-05-28 10:56:10 -0500101
102
Anves Kumar rayankula5a57faf2020-05-19 05:47:44 -0500103*** 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
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -0500156
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