diff options
author | Scott Moser <smoser@brickies.net> | 2017-05-26 15:53:48 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-05-26 15:53:48 -0400 |
commit | cc9748215f612b8c600c1080c60af71fe7624c47 (patch) | |
tree | 3f008cb6350adf6bc003d2d5ad2d851c9506b81e /tests/unittests/test_datasource/test_digitalocean.py | |
parent | 3dd56b4504003928bace87a7e67b08e9376fc6c1 (diff) | |
parent | 16a7302f6acb69adb0aee75eaf12392fa3688853 (diff) | |
download | vyos-cloud-init-cc9748215f612b8c600c1080c60af71fe7624c47.tar.gz vyos-cloud-init-cc9748215f612b8c600c1080c60af71fe7624c47.zip |
merge from master at 0.7.9-153-g16a7302f
Diffstat (limited to 'tests/unittests/test_datasource/test_digitalocean.py')
-rw-r--r-- | tests/unittests/test_datasource/test_digitalocean.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_digitalocean.py b/tests/unittests/test_datasource/test_digitalocean.py index a11166a9..e97a679a 100644 --- a/tests/unittests/test_datasource/test_digitalocean.py +++ b/tests/unittests/test_datasource/test_digitalocean.py @@ -1,6 +1,8 @@ # Copyright (C) 2014 Neal Shrader # # Author: Neal Shrader <neal@digitalocean.com> +# Author: Ben Howard <bh@digitalocean.com> +# Author: Scott Moser <smoser@ubuntu.com> # # This file is part of cloud-init. See LICENSE file for license information. @@ -262,6 +264,29 @@ class TestNetworkConvert(TestCase): print(json.dumps(subn, indent=3)) return subn + def test_correct_gateways_defined(self): + """test to make sure the eth0 ipv4 and ipv6 gateways are defined""" + netcfg = self._get_networking() + gateways = [] + for nic_def in netcfg.get('config'): + if nic_def.get('type') != 'physical': + continue + for subn in nic_def.get('subnets'): + if 'gateway' in subn: + gateways.append(subn.get('gateway')) + + # we should have two gateways, one ipv4 and ipv6 + self.assertEqual(len(gateways), 2) + + # make that the ipv6 gateway is there + (nic_def, meta_def) = self._get_nic_definition('public', 'eth0') + ipv4_def = meta_def.get('ipv4') + self.assertIn(ipv4_def.get('gateway'), gateways) + + # make sure the the ipv6 gateway is there + ipv6_def = meta_def.get('ipv6') + self.assertIn(ipv6_def.get('gateway'), gateways) + def test_public_interface_defined(self): """test that the public interface is defined as eth0""" (nic_def, meta_def) = self._get_nic_definition('public', 'eth0') |