@@ -47,6 +47,7 @@ ${network_id} 10.7.7.0
47
47
${hex_ip } 0xa.0xb.0xc.0xd
48
48
${negative_ip } 10 .-7.-7.7
49
49
${hex_ip } 0xa.0xb.0xc.0xd
50
+ @{static_name_servers } 10.5.5.5
50
51
51
52
*** Test Cases ***
52
53
@@ -351,6 +352,26 @@ Configure Hexadecimal IP For Gateway
351
352
# ip subnet_mask gateway valid_status_codes
352
353
${test_ipv4_addr } ${test_subnet_mask } ${hex_ip } ${HTTP_BAD_REQUEST }
353
354
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
+
354
375
*** Keywords ***
355
376
356
377
Test Setup Execution
@@ -585,3 +606,38 @@ Clear IP Settings On Fail
585
606
586
607
Test Teardown Execution
587
608
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