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