diff options
author | Dan Sneddon <dsneddon@redhat.com> | 2015-04-27 18:39:37 -0700 |
---|---|---|
committer | Dan Sneddon <dsneddon@redhat.com> | 2015-05-11 15:23:10 -0700 |
commit | fa4966f4dba8aab9fe17ac5711071e9e56384079 (patch) | |
tree | aa4f4f415d2611ab8ef82bee09e2192397570130 /os_net_config/tests/test_objects.py | |
parent | 54ae015bba1584c4150fe4dc4ba16b74a3b349b1 (diff) |
Add flag for DEFROUTE=no in ifcfg files to ignore DHCP gateway
When multiple interfaces are configured with DHCP, and more than
one interface receives a gateway from the DHCP server(s), the
resulting default gateway on the system is unpredictable. This
change adds the "defroute" boolean to the configuration syntax
for os-net-config. Any interface type may be marked so that the
gateway received from the DHCP server will not be eligible as a
default gateway for the system. This only works for ifcfg files,
/etc/network/interfaces lacks an equivalent option.
Change-Id: Id775f3506b2ec60c9a2833efd49fb8319151c00d
Closes-Bug: 1449288
Diffstat (limited to 'os_net_config/tests/test_objects.py')
-rw-r--r-- | os_net_config/tests/test_objects.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/os_net_config/tests/test_objects.py b/os_net_config/tests/test_objects.py index 268a48b..2e545d0 100644 --- a/os_net_config/tests/test_objects.py +++ b/os_net_config/tests/test_objects.py @@ -94,6 +94,20 @@ class TestInterface(base.TestCase): self.assertEqual("em1", interface.name) self.assertEqual(True, interface.use_dhcp) + def test_from_json_defroute(self): + data = '{"type": "interface", "name": "em1", "use_dhcp": true}' + interface1 = objects.object_from_json(json.loads(data)) + data = """{ +"type": "interface", +"name": "em1", +"use_dhcp": true, +"defroute": false +} +""" + interface2 = objects.object_from_json(json.loads(data)) + self.assertEqual(True, interface1.defroute) + self.assertEqual(False, interface2.defroute) + def test_from_json_dhcp_nic1(self): def dummy_numbered_nics(nic_mapping=None): return {"nic1": "em3"} |