aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/tests
diff options
context:
space:
mode:
Diffstat (limited to 'os_net_config/tests')
-rw-r--r--os_net_config/tests/test_impl_ifcfg.py13
-rw-r--r--os_net_config/tests/test_objects.py11
2 files changed, 24 insertions, 0 deletions
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index 92ce828..e32aff2 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -318,6 +318,19 @@ DEFROUTE=no
self.assertEqual(em1_config, self.get_interface_config('em1'))
self.assertEqual(em2_config, self.get_interface_config('em2'))
+ def test_interface_dhclient_opts(self):
+ interface1 = objects.Interface('em1', dhclient_args='--foobar')
+ 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
+DHCLIENTARGS=--foobar
+"""
+ self.assertEqual(em1_config, self.get_interface_config('em1'))
+
class TestIfcfgNetConfigApply(base.TestCase):
diff --git a/os_net_config/tests/test_objects.py b/os_net_config/tests/test_objects.py
index 2e545d0..c824ba8 100644
--- a/os_net_config/tests/test_objects.py
+++ b/os_net_config/tests/test_objects.py
@@ -108,6 +108,17 @@ class TestInterface(base.TestCase):
self.assertEqual(True, interface1.defroute)
self.assertEqual(False, interface2.defroute)
+ def test_from_json_dhclient_args(self):
+ data = """{
+"type": "interface",
+"name": "em1",
+"use_dhcp": true,
+"dhclient_args": "--foobar"
+}
+"""
+ interface1 = objects.object_from_json(json.loads(data))
+ self.assertEqual("--foobar", interface1.dhclient_args)
+
def test_from_json_dhcp_nic1(self):
def dummy_numbered_nics(nic_mapping=None):
return {"nic1": "em3"}