diff options
| author | Kim Hagen <kim.sidney@gmail.com> | 2019-01-23 13:20:25 +0100 | 
|---|---|---|
| committer | Kim Hagen <kim.sidney@gmail.com> | 2019-01-23 13:20:25 +0100 | 
| commit | c4da1a5cddacaa7c2a15df9170f21c3fce78fb15 (patch) | |
| tree | b6abeebd0789141fea8696e2df9aa3db5663ebf0 /tests/unittests/test_vmware_config_file.py | |
| parent | b120f4f7a670674779a93f8c882c81f44a993888 (diff) | |
| parent | 45d731a61a07447521d56e8ce4f19ebfeba2aa78 (diff) | |
| download | vyos-cloud-init-c4da1a5cddacaa7c2a15df9170f21c3fce78fb15.tar.gz vyos-cloud-init-c4da1a5cddacaa7c2a15df9170f21c3fce78fb15.zip  | |
Merge tag '18.5' into current
release 18.5
Bump the version on cloudinit/version.py to be 18.5 and update ChangeLog
LP: #1808380
Conflicts:
	config/cloud.cfg.tmpl
Diffstat (limited to 'tests/unittests/test_vmware_config_file.py')
| -rw-r--r-- | tests/unittests/test_vmware_config_file.py | 58 | 
1 files changed, 52 insertions, 6 deletions
diff --git a/tests/unittests/test_vmware_config_file.py b/tests/unittests/test_vmware_config_file.py index 602dedb0..f47335ea 100644 --- a/tests/unittests/test_vmware_config_file.py +++ b/tests/unittests/test_vmware_config_file.py @@ -263,7 +263,7 @@ class TestVmwareConfigFile(CiTestCase):          nicConfigurator = NicConfigurator(config.nics, False)          nics_cfg_list = nicConfigurator.generate() -        self.assertEqual(5, len(nics_cfg_list), "number of elements") +        self.assertEqual(2, len(nics_cfg_list), "number of elements")          nic1 = {'name': 'NIC1'}          nic2 = {'name': 'NIC2'} @@ -275,8 +275,6 @@ class TestVmwareConfigFile(CiTestCase):                      nic1.update(cfg)                  elif cfg.get('name') == nic2.get('name'):                      nic2.update(cfg) -            elif cfg_type == 'route': -                route_list.append(cfg)          self.assertEqual('physical', nic1.get('type'), 'type of NIC1')          self.assertEqual('NIC1', nic1.get('name'), 'name of NIC1') @@ -297,6 +295,9 @@ class TestVmwareConfigFile(CiTestCase):                  static6_subnet.append(subnet)              else:                  self.assertEqual(True, False, 'Unknown type') +            if 'route' in subnet: +                for route in subnet.get('routes'): +                    route_list.append(route)          self.assertEqual(1, len(static_subnet), 'Number of static subnet')          self.assertEqual(1, len(static6_subnet), 'Number of static6 subnet') @@ -351,6 +352,8 @@ class TestVmwareConfigFile(CiTestCase):  class TestVmwareNetConfig(CiTestCase):      """Test conversion of vmware config to cloud-init config.""" +    maxDiff = None +      def _get_NicConfigurator(self, text):          fp = None          try: @@ -420,9 +423,52 @@ class TestVmwareNetConfig(CiTestCase):                'mac_address': '00:50:56:a6:8c:08',                'subnets': [                    {'control': 'auto', 'type': 'static', -                   'address': '10.20.87.154', 'netmask': '255.255.252.0'}]}, -             {'type': 'route', 'destination': '10.20.84.0/22', -              'gateway': '10.20.87.253', 'metric': 10000}], +                   'address': '10.20.87.154', 'netmask': '255.255.252.0', +                   'routes': +                       [{'type': 'route', 'destination': '10.20.84.0/22', +                         'gateway': '10.20.87.253', 'metric': 10000}]}]}], +            nc.generate()) + +    def test_cust_non_primary_nic_with_gateway_(self): +        """A customer non primary nic set can have a gateway.""" +        config = textwrap.dedent("""\ +            [NETWORK] +            NETWORKING = yes +            BOOTPROTO = dhcp +            HOSTNAME = static-debug-vm +            DOMAINNAME = cluster.local + +            [NIC-CONFIG] +            NICS = NIC1 + +            [NIC1] +            MACADDR = 00:50:56:ac:d1:8a +            ONBOOT = yes +            IPv4_MODE = BACKWARDS_COMPATIBLE +            BOOTPROTO = static +            IPADDR = 100.115.223.75 +            NETMASK = 255.255.255.0 +            GATEWAY = 100.115.223.254 + + +            [DNS] +            DNSFROMDHCP=no + +            NAMESERVER|1 = 8.8.8.8 + +            [DATETIME] +            UTC = yes +            """) +        nc = self._get_NicConfigurator(config) +        self.assertEqual( +            [{'type': 'physical', 'name': 'NIC1', +              'mac_address': '00:50:56:ac:d1:8a', +              'subnets': [ +                  {'control': 'auto', 'type': 'static', +                   'address': '100.115.223.75', 'netmask': '255.255.255.0', +                   'routes': +                       [{'type': 'route', 'destination': '100.115.223.0/24', +                         'gateway': '100.115.223.254', 'metric': 10000}]}]}],              nc.generate())      def test_a_primary_nic_with_gateway(self):  | 
