Skip to content

Commit 7098c97

Browse files
prkatti1gkeishin
authored andcommitted
Added DNS test cases.
Signed-off-by: Prashanth Katti <[email protected]> Change-Id: Ib3aeedeae8e824a1532b164b08baafc93227ebd4
1 parent 60b5e61 commit 7098c97

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

redfish/managers/test_bmc_network_conf.robot

+56
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ ${network_id} 10.7.7.0
4747
${hex_ip} 0xa.0xb.0xc.0xd
4848
${negative_ip} 10.-7.-7.7
4949
${hex_ip} 0xa.0xb.0xc.0xd
50+
@{static_name_servers} 10.5.5.5
5051

5152
*** Test Cases ***
5253

@@ -351,6 +352,26 @@ Configure Hexadecimal IP For Gateway
351352
# ip subnet_mask gateway valid_status_codes
352353
${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST}
353354

355+
Get DNS Server And Verify
356+
[Documentation] Get DNS server via Redfish and verify.
357+
[Tags] Get_DNS_Server_And_Verify
358+
359+
Verify CLI and Redfish Nameservers
360+
361+
Configure DNS Server And Verify
362+
[Documentation] Configure DNS server and verify.
363+
[Tags] Configure_DNS_Server_And_Verify
364+
[Teardown] Run Keywords
365+
... Configure Static Name Servers AND Test Teardown Execution
366+
367+
${original_redfish_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} StaticNameServers
368+
Rprint Vars original_redfish_nameservers
369+
# Set suite variables to trigger restoration during teardown.
370+
Set Suite Variable ${original_redfish_nameservers}
371+
372+
Configure Static Name Servers ${static_name_servers}
373+
Verify CLI and Redfish Nameservers
374+
354375
*** Keywords ***
355376

356377
Test Setup Execution
@@ -585,3 +606,38 @@ Clear IP Settings On Fail
585606

586607
Test Teardown Execution
587608

609+
Verify CLI and Redfish Nameservers
610+
[Documentation] Verify that nameservers obtained via Redfish do not
611+
... match those found in /etc/resolv.conf.
612+
613+
${redfish_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} StaticNameServers
614+
${resolve_conf_nameservers}= CLI Get Nameservers
615+
Rqprint Vars redfish_nameservers resolve_conf_nameservers fmt=terse
616+
617+
# Check that the 2 lists are equivalent.
618+
${match}= Evaluate set($redfish_nameservers) == set($resolve_conf_nameservers)
619+
Should Be True ${match}
620+
... The nameservers obtained via Redfish do not match those found in /etc/resolv.conf.
621+
622+
CLI Get Nameservers
623+
[Documentation] Get the nameserver IPs from /etc/resolv.conf and return as a list.
624+
625+
# Example of /etc/resolv.conf data:
626+
# nameserver x.x.x.x
627+
# nameserver y.y.y.y
628+
629+
${stdout} ${stderr} ${rc}= BMC Execute Command egrep nameserver /etc/resolv.conf | cut -f2- -d ' '
630+
${nameservers}= Split String ${stdout}
631+
632+
[Return] ${nameservers}
633+
634+
635+
Configure Static Name Servers
636+
[Documentation] Configure DNS server on BMC.
637+
[Arguments] ${static_name_servers}=${original_redfish_nameservers}
638+
639+
# Descripton of the argument(s):
640+
# static_name_servers A list of static name server IPs to be
641+
# configured on the BMC.
642+
643+
Redfish.Patch ${REDFISH_NW_ETH0_URI} body={'StaticNameServers': ${static_name_servers}}

0 commit comments

Comments
 (0)