blob: f5c13a5617526b0b81ab2fd06f3009a6f0b1500f [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
Anves Kumar rayankula7a68d892020-07-10 00:30:13 -050012*** 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 rayankula5a57faf2020-05-19 05:47:44 -050034*** Test Cases ***
35
Anves Kumar rayankula7a68d892020-07-10 00:30:13 -050036Set 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 rayankula5a57faf2020-05-19 05:47:44 -050040
Anves Kumar rayankula7a68d892020-07-10 00:30:13 -050041 # 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 Kattif312d202020-05-28 10:56:10 -050052
53
Anves Kumar rayankula5a57faf2020-05-19 05:47:44 -050054*** Keywords ***
55
56Suite Setup Execution
57 [Documentation] Suite Setup Execution.
58
59 Redfish.Login
60
Anves Kumar rayankula22056312021-01-06 03:28:40 -060061 Redfish Power On
Anves Kumar rayankula5a57faf2020-05-19 05:47:44 -050062 # 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
80Set 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
99Restore 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 rayankula8115e1e2020-07-03 01:22:09 -0500108
109Apply Ethernet Config
Anves Kumar rayankula7a68d892020-07-10 00:30:13 -0500110 [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 rayankula8115e1e2020-07-03 01:22:09 -0500114
Anves Kumar rayankula7a68d892020-07-10 00:30:13 -0500115 # Description of argument(s):
116 # property Ethernet property to be set..
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -0500117
Anves Kumar rayankula7a68d892020-07-10 00:30:13 -0500118 ${active_channel_config}= Get Active Channel Config
119 Redfish.Patch
120 ... /redfish/v1/Managers/bmc/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}/
121 ... body={"DHCPv4":${property}} valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
Anves Kumar rayankula8115e1e2020-07-03 01:22:09 -0500122
Anves Kumar rayankula7a68d892020-07-10 00:30:13 -0500123 ${resp}= Redfish.Get
124 ... /redfish/v1/Managers/bmc/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
125 Verify Ethernet Config Property ${property} ${resp.dict["DHCPv4"]}
126
127
128Verify 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 rayankula8115e1e2020-07-03 01:22:09 -0500152