From d788652276344c8dbe5a97d629f19a66c9de97f4 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 23 Sep 2015 15:59:44 -0400 Subject: ifcfg: Add support for dns_servers Adds in the ability to optionally configure DNS server settings via the ifcfg file formats. The dns_servers JSON is an array which currently supports either 1 or 2 DNS servers (per limitations of the ifcfg format). Change-Id: I9edecfdd4e1d0f39883b72be554cd92c5685881d --- os_net_config/tests/test_impl_ifcfg.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'os_net_config/tests/test_impl_ifcfg.py') diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py index e32aff2..ec2a36c 100644 --- a/os_net_config/tests/test_impl_ifcfg.py +++ b/os_net_config/tests/test_impl_ifcfg.py @@ -328,6 +328,34 @@ HOTPLUG=no NM_CONTROLLED=no BOOTPROTO=none DHCLIENTARGS=--foobar +""" + self.assertEqual(em1_config, self.get_interface_config('em1')) + + def test_interface_single_dns_server(self): + interface1 = objects.Interface('em1', dns_servers=['1.2.3.4']) + self.provider.add_interface(interface1) + em1_config = """# This file is autogenerated by os-net-config +DEVICE=em1 +ONBOOT=yes +HOTPLUG=no +NM_CONTROLLED=no +BOOTPROTO=none +DNS1=1.2.3.4 +""" + self.assertEqual(em1_config, self.get_interface_config('em1')) + + def test_interface_dns_servers(self): + interface1 = objects.Interface('em1', dns_servers=['1.2.3.4', + '5.6.7.8']) + self.provider.add_interface(interface1) + em1_config = """# This file is autogenerated by os-net-config +DEVICE=em1 +ONBOOT=yes +HOTPLUG=no +NM_CONTROLLED=no +BOOTPROTO=none +DNS1=1.2.3.4 +DNS2=5.6.7.8 """ self.assertEqual(em1_config, self.get_interface_config('em1')) -- cgit 1.2.3-korg