sailesh1993 / rpms / cloud-init

Forked from rpms/cloud-init a year ago
Clone
550f14
From dc7315345b42b6f913191d1b52ed459d3ec5068b Mon Sep 17 00:00:00 2001
550f14
From: Eduardo Otubo <otubo@redhat.com>
550f14
Date: Tue, 23 Feb 2021 12:16:27 +0100
550f14
Subject: [PATCH] sysconfig: distro-specific config rendering for BOOTPROTO
550f14
 option (#162)
550f14
550f14
RH-Author: Eduardo Terrell Ferrari Otubo (eterrell)
550f14
RH-MergeRequest: 1: sysconfig: distro-specific config rendering for BOOTPROTO option (#162)
550f14
RH-Commit: [1/1] d88e3e93e2d23c8b90191cf6c5d0e8b7733fcce2 (eterrell/cloud-init)
550f14
RH-Bugzilla: 1931835
550f14
550f14
commit 06e324ff8edb3126e5a8060757a48ceab2b1a121
550f14
Author: Robert Schweikert <rjschwei@suse.com>
550f14
Date:   Mon Feb 3 14:56:51 2020 -0500
550f14
550f14
    sysconfig: distro-specific config rendering for BOOTPROTO option (#162)
550f14
550f14
    - Introduce the "flavor" configuration option for the sysconfig renderer
550f14
      this is necessary to account for differences in the handling of the
550f14
      BOOTPROTO setting between distributions (lp#1858808)
550f14
      + Thanks to Petr Pavlu for the idea
550f14
    - Network config clean up for sysconfig renderer
550f14
      + The introduction of the "flavor" renderer configuration allows us
550f14
        to only write values that are pertinent for the given distro
550f14
    - Set the DHCPv6 client mode on SUSE (lp#1800854)
550f14
550f14
    Co-authored-by: Chad Smith <chad.smith@canonical.com>
550f14
550f14
    LP: #1800854
550f14
550f14
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
550f14
---
550f14
 cloudinit/distros/opensuse.py                 |   1 +
550f14
 cloudinit/net/sysconfig.py                    | 329 +++++++---
550f14
 .../unittests/test_distros/test_netconfig.py  |  34 +-
550f14
 tests/unittests/test_net.py                   | 596 +++++++++++-------
550f14
 4 files changed, 592 insertions(+), 368 deletions(-)
550f14
550f14
diff --git a/cloudinit/distros/opensuse.py b/cloudinit/distros/opensuse.py
550f14
index e41e2f7b..dd56a3f4 100644
550f14
--- a/cloudinit/distros/opensuse.py
550f14
+++ b/cloudinit/distros/opensuse.py
550f14
@@ -37,6 +37,7 @@ class Distro(distros.Distro):
550f14
     renderer_configs = {
550f14
         'sysconfig': {
550f14
             'control': 'etc/sysconfig/network/config',
550f14
+            'flavor': 'suse',
550f14
             'iface_templates': '%(base)s/network/ifcfg-%(name)s',
550f14
             'netrules_path': (
550f14
                 'etc/udev/rules.d/85-persistent-net-cloud-init.rules'),
550f14
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
550f14
index 1989d014..1e8a547e 100644
550f14
--- a/cloudinit/net/sysconfig.py
550f14
+++ b/cloudinit/net/sysconfig.py
550f14
@@ -1,5 +1,6 @@
550f14
 # This file is part of cloud-init. See LICENSE file for license information.
550f14
 
550f14
+import copy
550f14
 import os
550f14
 import re
550f14
 
550f14
@@ -86,6 +87,9 @@ class ConfigMap(object):
550f14
     def __getitem__(self, key):
550f14
         return self._conf[key]
550f14
 
550f14
+    def get(self, key):
550f14
+        return self._conf.get(key)
550f14
+
550f14
     def __contains__(self, key):
550f14
         return key in self._conf
550f14
 
550f14
@@ -115,6 +119,9 @@ class ConfigMap(object):
550f14
             buf.write("%s=%s\n" % (key, _quote_value(value)))
550f14
         return buf.getvalue()
550f14
 
550f14
+    def update(self, updates):
550f14
+        self._conf.update(updates)
550f14
+
550f14
 
550f14
 class Route(ConfigMap):
550f14
     """Represents a route configuration."""
550f14
@@ -281,12 +288,28 @@ class Renderer(renderer.Renderer):
550f14
     #      s1-networkscripts-interfaces.html (or other docs for
550f14
     #                                         details about this)
550f14
 
550f14
-    iface_defaults = tuple([
550f14
-        ('ONBOOT', True),
550f14
-        ('USERCTL', False),
550f14
-        ('BOOTPROTO', 'none'),
550f14
-        ('STARTMODE', 'auto'),
550f14
-    ])
550f14
+    iface_defaults = {
550f14
+        'rhel': {'ONBOOT': True, 'USERCTL': False, 'BOOTPROTO': 'none'},
550f14
+        'suse': {'BOOTPROTO': 'static', 'STARTMODE': 'auto'},
550f14
+    }
550f14
+
550f14
+    cfg_key_maps = {
550f14
+        'rhel': {
550f14
+            'accept-ra': 'IPV6_FORCE_ACCEPT_RA',
550f14
+            'bridge_stp': 'STP',
550f14
+            'bridge_ageing': 'AGEING',
550f14
+            'bridge_bridgeprio': 'PRIO',
550f14
+            'mac_address': 'HWADDR',
550f14
+            'mtu': 'MTU',
550f14
+        },
550f14
+        'suse': {
550f14
+            'bridge_stp': 'BRIDGE_STP',
550f14
+            'bridge_ageing': 'BRIDGE_AGEINGTIME',
550f14
+            'bridge_bridgeprio': 'BRIDGE_PRIORITY',
550f14
+            'mac_address': 'LLADDR',
550f14
+            'mtu': 'MTU',
550f14
+        },
550f14
+    }
550f14
 
550f14
     # If these keys exist, then their values will be used to form
550f14
     # a BONDING_OPTS grouping; otherwise no grouping will be set.
550f14
@@ -308,12 +331,6 @@ class Renderer(renderer.Renderer):
550f14
         ('bond_primary_reselect', "primary_reselect=%s"),
550f14
     ])
550f14
 
550f14
-    bridge_opts_keys = tuple([
550f14
-        ('bridge_stp', 'STP'),
550f14
-        ('bridge_ageing', 'AGEING'),
550f14
-        ('bridge_bridgeprio', 'PRIO'),
550f14
-    ])
550f14
-
550f14
     templates = {}
550f14
 
550f14
     def __init__(self, config=None):
550f14
@@ -331,65 +348,101 @@ class Renderer(renderer.Renderer):
550f14
             'iface_templates': config.get('iface_templates'),
550f14
             'route_templates': config.get('route_templates'),
550f14
         }
550f14
+        self.flavor = config.get('flavor', 'rhel')
550f14
 
550f14
     @classmethod
550f14
-    def _render_iface_shared(cls, iface, iface_cfg):
550f14
-        for k, v in cls.iface_defaults:
550f14
-            iface_cfg[k] = v
550f14
+    def _render_iface_shared(cls, iface, iface_cfg, flavor):
550f14
+        flavor_defaults = copy.deepcopy(cls.iface_defaults.get(flavor, {}))
550f14
+        iface_cfg.update(flavor_defaults)
550f14
 
550f14
-        for (old_key, new_key) in [('mac_address', 'HWADDR'), ('mtu', 'MTU')]:
550f14
+        for old_key in ('mac_address', 'mtu', 'accept-ra'):
550f14
             old_value = iface.get(old_key)
550f14
             if old_value is not None:
550f14
                 # only set HWADDR on physical interfaces
550f14
                 if (old_key == 'mac_address' and
550f14
                    iface['type'] not in ['physical', 'infiniband']):
550f14
                     continue
550f14
-                iface_cfg[new_key] = old_value
550f14
-
550f14
-        if iface['accept-ra'] is not None:
550f14
-            iface_cfg['IPV6_FORCE_ACCEPT_RA'] = iface['accept-ra']
550f14
+                new_key = cls.cfg_key_maps[flavor].get(old_key)
550f14
+                if new_key:
550f14
+                    iface_cfg[new_key] = old_value
550f14
 
550f14
     @classmethod
550f14
-    def _render_subnets(cls, iface_cfg, subnets, has_default_route):
550f14
+    def _render_subnets(cls, iface_cfg, subnets, has_default_route, flavor):
550f14
         # setting base values
550f14
-        iface_cfg['BOOTPROTO'] = 'none'
550f14
+        if flavor == 'suse':
550f14
+            iface_cfg['BOOTPROTO'] = 'static'
550f14
+            if 'BRIDGE' in iface_cfg:
550f14
+                iface_cfg['BOOTPROTO'] = 'dhcp'
550f14
+                iface_cfg.drop('BRIDGE')
550f14
+        else:
550f14
+            iface_cfg['BOOTPROTO'] = 'none'
550f14
 
550f14
         # modifying base values according to subnets
550f14
         for i, subnet in enumerate(subnets, start=len(iface_cfg.children)):
550f14
             mtu_key = 'MTU'
550f14
             subnet_type = subnet.get('type')
550f14
             if subnet_type == 'dhcp6' or subnet_type == 'ipv6_dhcpv6-stateful':
550f14
-                # TODO need to set BOOTPROTO to dhcp6 on SUSE
550f14
-                iface_cfg['IPV6INIT'] = True
550f14
-                # Configure network settings using DHCPv6
550f14
-                iface_cfg['DHCPV6C'] = True
550f14
+                if flavor == 'suse':
550f14
+                    # User wants dhcp for both protocols
550f14
+                    if iface_cfg['BOOTPROTO'] == 'dhcp4':
550f14
+                        iface_cfg['BOOTPROTO'] = 'dhcp'
550f14
+                    else:
550f14
+                        # Only IPv6 is DHCP, IPv4 may be static
550f14
+                        iface_cfg['BOOTPROTO'] = 'dhcp6'
550f14
+                    iface_cfg['DHCLIENT6_MODE'] = 'managed'
550f14
+                else:
550f14
+                    iface_cfg['IPV6INIT'] = True
550f14
+                    # Configure network settings using DHCPv6
550f14
+                    iface_cfg['DHCPV6C'] = True
550f14
             elif subnet_type == 'ipv6_dhcpv6-stateless':
550f14
-                iface_cfg['IPV6INIT'] = True
550f14
-                # Configure network settings using SLAAC from RAs and optional
550f14
-                # info from dhcp server using DHCPv6
550f14
-                iface_cfg['IPV6_AUTOCONF'] = True
550f14
-                iface_cfg['DHCPV6C'] = True
550f14
-                # Use Information-request to get only stateless configuration
550f14
-                # parameters (i.e., without address).
550f14
-                iface_cfg['DHCPV6C_OPTIONS'] = '-S'
550f14
+                if flavor == 'suse':
550f14
+                    # User wants dhcp for both protocols
550f14
+                    if iface_cfg['BOOTPROTO'] == 'dhcp4':
550f14
+                        iface_cfg['BOOTPROTO'] = 'dhcp'
550f14
+                    else:
550f14
+                        # Only IPv6 is DHCP, IPv4 may be static
550f14
+                        iface_cfg['BOOTPROTO'] = 'dhcp6'
550f14
+                    iface_cfg['DHCLIENT6_MODE'] = 'info'
550f14
+                else:
550f14
+                    iface_cfg['IPV6INIT'] = True
550f14
+                    # Configure network settings using SLAAC from RAs and
550f14
+                    # optional info from dhcp server using DHCPv6
550f14
+                    iface_cfg['IPV6_AUTOCONF'] = True
550f14
+                    iface_cfg['DHCPV6C'] = True
550f14
+                    # Use Information-request to get only stateless
550f14
+                    # configuration parameters (i.e., without address).
550f14
+                    iface_cfg['DHCPV6C_OPTIONS'] = '-S'
550f14
             elif subnet_type == 'ipv6_slaac':
550f14
-                iface_cfg['IPV6INIT'] = True
550f14
-                # Configure network settings using SLAAC from RAs
550f14
-                iface_cfg['IPV6_AUTOCONF'] = True
550f14
+                if flavor == 'suse':
550f14
+                    # User wants dhcp for both protocols
550f14
+                    if iface_cfg['BOOTPROTO'] == 'dhcp4':
550f14
+                        iface_cfg['BOOTPROTO'] = 'dhcp'
550f14
+                    else:
550f14
+                        # Only IPv6 is DHCP, IPv4 may be static
550f14
+                        iface_cfg['BOOTPROTO'] = 'dhcp6'
550f14
+                    iface_cfg['DHCLIENT6_MODE'] = 'info'
550f14
+                else:
550f14
+                    iface_cfg['IPV6INIT'] = True
550f14
+                    # Configure network settings using SLAAC from RAs
550f14
+                    iface_cfg['IPV6_AUTOCONF'] = True
550f14
             elif subnet_type in ['dhcp4', 'dhcp']:
550f14
+                bootproto_in = iface_cfg['BOOTPROTO']
550f14
                 iface_cfg['BOOTPROTO'] = 'dhcp'
550f14
+                if flavor == 'suse' and subnet_type == 'dhcp4':
550f14
+                    # If dhcp6 is already specified the user wants dhcp
550f14
+                    # for both protocols
550f14
+                    if bootproto_in != 'dhcp6':
550f14
+                        # Only IPv4 is DHCP, IPv6 may be static
550f14
+                        iface_cfg['BOOTPROTO'] = 'dhcp4'
550f14
             elif subnet_type in ['static', 'static6']:
550f14
+                # RH info
550f14
                 # grep BOOTPROTO sysconfig.txt -A2 | head -3
550f14
                 # BOOTPROTO=none|bootp|dhcp
550f14
                 # 'bootp' or 'dhcp' cause a DHCP client
550f14
                 # to run on the device. Any other
550f14
                 # value causes any static configuration
550f14
                 # in the file to be applied.
550f14
-                # ==> the following should not be set to 'static'
550f14
-                # but should remain 'none'
550f14
-                # if iface_cfg['BOOTPROTO'] == 'none':
550f14
-                #    iface_cfg['BOOTPROTO'] = 'static'
550f14
-                if subnet_is_ipv6(subnet):
550f14
+                if subnet_is_ipv6(subnet) and flavor != 'suse':
550f14
                     mtu_key = 'IPV6_MTU'
550f14
                     iface_cfg['IPV6INIT'] = True
550f14
                 if 'mtu' in subnet:
550f14
@@ -406,16 +459,21 @@ class Renderer(renderer.Renderer):
550f14
                     iface_cfg['IPV6_FORCE_ACCEPT_RA'] = False
550f14
                     iface_cfg['IPV6_AUTOCONF'] = False
550f14
             elif subnet_type == 'manual':
550f14
-                # If the subnet has an MTU setting, then ONBOOT=True
550f14
-                # to apply the setting
550f14
-                iface_cfg['ONBOOT'] = mtu_key in iface_cfg
550f14
+                if flavor == 'suse':
550f14
+                    LOG.debug('Unknown subnet type setting "%s"', subnet_type)
550f14
+                else:
550f14
+                    # If the subnet has an MTU setting, then ONBOOT=True
550f14
+                    # to apply the setting
550f14
+                    iface_cfg['ONBOOT'] = mtu_key in iface_cfg
550f14
             else:
550f14
                 raise ValueError("Unknown subnet type '%s' found"
550f14
                                  " for interface '%s'" % (subnet_type,
550f14
                                                           iface_cfg.name))
550f14
             if subnet.get('control') == 'manual':
550f14
-                iface_cfg['ONBOOT'] = False
550f14
-                iface_cfg['STARTMODE'] = 'manual'
550f14
+                if flavor == 'suse':
550f14
+                    iface_cfg['STARTMODE'] = 'manual'
550f14
+                else:
550f14
+                    iface_cfg['ONBOOT'] = False
550f14
 
550f14
         # set IPv4 and IPv6 static addresses
550f14
         ipv4_index = -1
550f14
@@ -424,13 +482,14 @@ class Renderer(renderer.Renderer):
550f14
             subnet_type = subnet.get('type')
550f14
             # metric may apply to both dhcp and static config
550f14
             if 'metric' in subnet:
550f14
-                iface_cfg['METRIC'] = subnet['metric']
550f14
-            # TODO(hjensas): Including dhcp6 here is likely incorrect. DHCPv6
550f14
-            # does not ever provide a default gateway, the default gateway
550f14
-            # come from RA's. (https://github.com/openSUSE/wicked/issues/570)
550f14
-            if subnet_type in ['dhcp', 'dhcp4', 'dhcp6']:
550f14
-                if has_default_route and iface_cfg['BOOTPROTO'] != 'none':
550f14
-                    iface_cfg['DHCLIENT_SET_DEFAULT_ROUTE'] = False
550f14
+                if flavor != 'suse':
550f14
+                    iface_cfg['METRIC'] = subnet['metric']
550f14
+            if subnet_type in ['dhcp', 'dhcp4']:
550f14
+                # On SUSE distros 'DHCLIENT_SET_DEFAULT_ROUTE' is a global
550f14
+                # setting in /etc/sysconfig/network/dhcp
550f14
+                if flavor != 'suse':
550f14
+                    if has_default_route and iface_cfg['BOOTPROTO'] != 'none':
550f14
+                        iface_cfg['DHCLIENT_SET_DEFAULT_ROUTE'] = False
550f14
                 continue
550f14
             elif subnet_type in IPV6_DYNAMIC_TYPES:
550f14
                 continue
550f14
@@ -439,14 +498,21 @@ class Renderer(renderer.Renderer):
550f14
                     ipv6_index = ipv6_index + 1
550f14
                     ipv6_cidr = "%s/%s" % (subnet['address'], subnet['prefix'])
550f14
                     if ipv6_index == 0:
550f14
-                        iface_cfg['IPV6ADDR'] = ipv6_cidr
550f14
-                        iface_cfg['IPADDR6'] = ipv6_cidr
550f14
+                        if flavor == 'suse':
550f14
+                            iface_cfg['IPADDR6'] = ipv6_cidr
550f14
+                        else:
550f14
+                            iface_cfg['IPV6ADDR'] = ipv6_cidr
550f14
                     elif ipv6_index == 1:
550f14
-                        iface_cfg['IPV6ADDR_SECONDARIES'] = ipv6_cidr
550f14
-                        iface_cfg['IPADDR6_0'] = ipv6_cidr
550f14
+                        if flavor == 'suse':
550f14
+                            iface_cfg['IPADDR6_1'] = ipv6_cidr
550f14
+                        else:
550f14
+                            iface_cfg['IPV6ADDR_SECONDARIES'] = ipv6_cidr
550f14
                     else:
550f14
-                        iface_cfg['IPV6ADDR_SECONDARIES'] += " " + ipv6_cidr
550f14
-                        iface_cfg['IPADDR6_%d' % ipv6_index] = ipv6_cidr
550f14
+                        if flavor == 'suse':
550f14
+                            iface_cfg['IPADDR6_%d' % ipv6_index] = ipv6_cidr
550f14
+                        else:
550f14
+                            iface_cfg['IPV6ADDR_SECONDARIES'] += \
550f14
+                                                        " " + ipv6_cidr
550f14
                 else:
550f14
                     ipv4_index = ipv4_index + 1
550f14
                     suff = "" if ipv4_index == 0 else str(ipv4_index)
550f14
@@ -454,17 +520,17 @@ class Renderer(renderer.Renderer):
550f14
                     iface_cfg['NETMASK' + suff] = \
550f14
                         net_prefix_to_ipv4_mask(subnet['prefix'])
550f14
 
550f14
-                if 'gateway' in subnet:
550f14
+                if 'gateway' in subnet and flavor != 'suse':
550f14
                     iface_cfg['DEFROUTE'] = True
550f14
                     if is_ipv6_addr(subnet['gateway']):
550f14
                         iface_cfg['IPV6_DEFAULTGW'] = subnet['gateway']
550f14
                     else:
550f14
                         iface_cfg['GATEWAY'] = subnet['gateway']
550f14
 
550f14
-                if 'dns_search' in subnet:
550f14
+                if 'dns_search' in subnet and flavor != 'suse':
550f14
                     iface_cfg['DOMAIN'] = ' '.join(subnet['dns_search'])
550f14
 
550f14
-                if 'dns_nameservers' in subnet:
550f14
+                if 'dns_nameservers' in subnet and flavor != 'suse':
550f14
                     if len(subnet['dns_nameservers']) > 3:
550f14
                         # per resolv.conf(5) MAXNS sets this to 3.
550f14
                         LOG.debug("%s has %d entries in dns_nameservers. "
550f14
@@ -474,7 +540,12 @@ class Renderer(renderer.Renderer):
550f14
                         iface_cfg['DNS' + str(i)] = k
550f14
 
550f14
     @classmethod
550f14
-    def _render_subnet_routes(cls, iface_cfg, route_cfg, subnets):
550f14
+    def _render_subnet_routes(cls, iface_cfg, route_cfg, subnets, flavor):
550f14
+        # TODO(rjschwei): route configuration on SUSE distro happens via
550f14
+        # ifroute-* files, see lp#1812117. SUSE currently carries a local
550f14
+        # patch in their package.
550f14
+        if flavor == 'suse':
550f14
+            return
550f14
         for _, subnet in enumerate(subnets, start=len(iface_cfg.children)):
550f14
             subnet_type = subnet.get('type')
550f14
             for route in subnet.get('routes', []):
550f14
@@ -502,14 +573,7 @@ class Renderer(renderer.Renderer):
550f14
                     # TODO(harlowja): add validation that no other iface has
550f14
                     # also provided the default route?
550f14
                     iface_cfg['DEFROUTE'] = True
550f14
-                    # TODO(hjensas): Including dhcp6 here is likely incorrect.
550f14
-                    # DHCPv6 does not ever provide a default gateway, the
550f14
-                    # default gateway come from RA's.
550f14
-                    # (https://github.com/openSUSE/wicked/issues/570)
550f14
-                    if iface_cfg['BOOTPROTO'] in ('dhcp', 'dhcp4', 'dhcp6'):
550f14
-                        # NOTE(hjensas): DHCLIENT_SET_DEFAULT_ROUTE is SuSE
550f14
-                        # only. RHEL, CentOS, Fedora does not implement this
550f14
-                        # option.
550f14
+                    if iface_cfg['BOOTPROTO'] in ('dhcp', 'dhcp4'):
550f14
                         iface_cfg['DHCLIENT_SET_DEFAULT_ROUTE'] = True
550f14
                     if 'gateway' in route:
550f14
                         if is_ipv6:
550f14
@@ -553,7 +617,9 @@ class Renderer(renderer.Renderer):
550f14
             iface_cfg['BONDING_OPTS'] = " ".join(bond_opts)
550f14
 
550f14
     @classmethod
550f14
-    def _render_physical_interfaces(cls, network_state, iface_contents):
550f14
+    def _render_physical_interfaces(
550f14
+            cls, network_state, iface_contents, flavor
550f14
+    ):
550f14
         physical_filter = renderer.filter_by_physical
550f14
         for iface in network_state.iter_interfaces(physical_filter):
550f14
             iface_name = iface['name']
550f14
@@ -562,12 +628,15 @@ class Renderer(renderer.Renderer):
550f14
             route_cfg = iface_cfg.routes
550f14
 
550f14
             cls._render_subnets(
550f14
-                iface_cfg, iface_subnets, network_state.has_default_route
550f14
+                iface_cfg, iface_subnets, network_state.has_default_route,
550f14
+                flavor
550f14
+            )
550f14
+            cls._render_subnet_routes(
550f14
+                iface_cfg, route_cfg, iface_subnets, flavor
550f14
             )
550f14
-            cls._render_subnet_routes(iface_cfg, route_cfg, iface_subnets)
550f14
 
550f14
     @classmethod
550f14
-    def _render_bond_interfaces(cls, network_state, iface_contents):
550f14
+    def _render_bond_interfaces(cls, network_state, iface_contents, flavor):
550f14
         bond_filter = renderer.filter_by_type('bond')
550f14
         slave_filter = renderer.filter_by_attr('bond-master')
550f14
         for iface in network_state.iter_interfaces(bond_filter):
550f14
@@ -581,17 +650,24 @@ class Renderer(renderer.Renderer):
550f14
             master_cfgs.extend(iface_cfg.children)
550f14
             for master_cfg in master_cfgs:
550f14
                 master_cfg['BONDING_MASTER'] = True
550f14
-                master_cfg.kind = 'bond'
550f14
+                if flavor != 'suse':
550f14
+                    master_cfg.kind = 'bond'
550f14
 
550f14
             if iface.get('mac_address'):
550f14
-                iface_cfg['MACADDR'] = iface.get('mac_address')
550f14
+                if flavor == 'suse':
550f14
+                    iface_cfg['LLADDR'] = iface.get('mac_address')
550f14
+                else:
550f14
+                    iface_cfg['MACADDR'] = iface.get('mac_address')
550f14
 
550f14
             iface_subnets = iface.get("subnets", [])
550f14
             route_cfg = iface_cfg.routes
550f14
             cls._render_subnets(
550f14
-                iface_cfg, iface_subnets, network_state.has_default_route
550f14
+                iface_cfg, iface_subnets, network_state.has_default_route,
550f14
+                flavor
550f14
+            )
550f14
+            cls._render_subnet_routes(
550f14
+                iface_cfg, route_cfg, iface_subnets, flavor
550f14
             )
550f14
-            cls._render_subnet_routes(iface_cfg, route_cfg, iface_subnets)
550f14
 
550f14
             # iter_interfaces on network-state is not sorted to produce
550f14
             # consistent numbers we need to sort.
550f14
@@ -601,15 +677,22 @@ class Renderer(renderer.Renderer):
550f14
                  if slave_iface['bond-master'] == iface_name])
550f14
 
550f14
             for index, bond_slave in enumerate(bond_slaves):
550f14
-                slavestr = 'BONDING_SLAVE%s' % index
550f14
+                if flavor == 'suse':
550f14
+                    slavestr = 'BONDING_SLAVE_%s' % index
550f14
+                else:
550f14
+                    slavestr = 'BONDING_SLAVE%s' % index
550f14
                 iface_cfg[slavestr] = bond_slave
550f14
 
550f14
                 slave_cfg = iface_contents[bond_slave]
550f14
-                slave_cfg['MASTER'] = iface_name
550f14
-                slave_cfg['SLAVE'] = True
550f14
+                if flavor == 'suse':
550f14
+                    slave_cfg['BOOTPROTO'] = 'none'
550f14
+                    slave_cfg['STARTMODE'] = 'hotplug'
550f14
+                else:
550f14
+                    slave_cfg['MASTER'] = iface_name
550f14
+                    slave_cfg['SLAVE'] = True
550f14
 
550f14
     @classmethod
550f14
-    def _render_vlan_interfaces(cls, network_state, iface_contents):
550f14
+    def _render_vlan_interfaces(cls, network_state, iface_contents, flavor):
550f14
         vlan_filter = renderer.filter_by_type('vlan')
550f14
         for iface in network_state.iter_interfaces(vlan_filter):
550f14
             iface_name = iface['name']
550f14
@@ -629,9 +712,12 @@ class Renderer(renderer.Renderer):
550f14
             iface_subnets = iface.get("subnets", [])
550f14
             route_cfg = iface_cfg.routes
550f14
             cls._render_subnets(
550f14
-                iface_cfg, iface_subnets, network_state.has_default_route
550f14
+                iface_cfg, iface_subnets, network_state.has_default_route,
550f14
+                flavor
550f14
+            )
550f14
+            cls._render_subnet_routes(
550f14
+                iface_cfg, route_cfg, iface_subnets, flavor
550f14
             )
550f14
-            cls._render_subnet_routes(iface_cfg, route_cfg, iface_subnets)
550f14
 
550f14
     @staticmethod
550f14
     def _render_dns(network_state, existing_dns_path=None):
550f14
@@ -668,19 +754,39 @@ class Renderer(renderer.Renderer):
550f14
         return out
550f14
 
550f14
     @classmethod
550f14
-    def _render_bridge_interfaces(cls, network_state, iface_contents):
550f14
+    def _render_bridge_interfaces(cls, network_state, iface_contents, flavor):
550f14
+        bridge_key_map = {
550f14
+            old_k: new_k for old_k, new_k in cls.cfg_key_maps[flavor].items()
550f14
+            if old_k.startswith('bridge')}
550f14
         bridge_filter = renderer.filter_by_type('bridge')
550f14
+
550f14
         for iface in network_state.iter_interfaces(bridge_filter):
550f14
             iface_name = iface['name']
550f14
             iface_cfg = iface_contents[iface_name]
550f14
-            iface_cfg.kind = 'bridge'
550f14
-            for old_key, new_key in cls.bridge_opts_keys:
550f14
+            if flavor != 'suse':
550f14
+                iface_cfg.kind = 'bridge'
550f14
+            for old_key, new_key in bridge_key_map.items():
550f14
                 if old_key in iface:
550f14
                     iface_cfg[new_key] = iface[old_key]
550f14
 
550f14
-            if iface.get('mac_address'):
550f14
-                iface_cfg['MACADDR'] = iface.get('mac_address')
550f14
+            if flavor == 'suse':
550f14
+                if 'BRIDGE_STP' in iface_cfg:
550f14
+                    if iface_cfg.get('BRIDGE_STP'):
550f14
+                        iface_cfg['BRIDGE_STP'] = 'on'
550f14
+                    else:
550f14
+                        iface_cfg['BRIDGE_STP'] = 'off'
550f14
 
550f14
+            if iface.get('mac_address'):
550f14
+                key = 'MACADDR'
550f14
+                if flavor == 'suse':
550f14
+                    key = 'LLADDRESS'
550f14
+                iface_cfg[key] = iface.get('mac_address')
550f14
+
550f14
+            if flavor == 'suse':
550f14
+                if iface.get('bridge_ports', []):
550f14
+                    iface_cfg['BRIDGE_PORTS'] = '%s' % " ".join(
550f14
+                        iface.get('bridge_ports')
550f14
+                    )
550f14
             # Is this the right key to get all the connected interfaces?
550f14
             for bridged_iface_name in iface.get('bridge_ports', []):
550f14
                 # Ensure all bridged interfaces are correctly tagged
550f14
@@ -689,17 +795,23 @@ class Renderer(renderer.Renderer):
550f14
                 bridged_cfgs = [bridged_cfg]
550f14
                 bridged_cfgs.extend(bridged_cfg.children)
550f14
                 for bridge_cfg in bridged_cfgs:
550f14
-                    bridge_cfg['BRIDGE'] = iface_name
550f14
+                    bridge_value = iface_name
550f14
+                    if flavor == 'suse':
550f14
+                        bridge_value = 'yes'
550f14
+                    bridge_cfg['BRIDGE'] = bridge_value
550f14
 
550f14
             iface_subnets = iface.get("subnets", [])
550f14
             route_cfg = iface_cfg.routes
550f14
             cls._render_subnets(
550f14
-                iface_cfg, iface_subnets, network_state.has_default_route
550f14
+                iface_cfg, iface_subnets, network_state.has_default_route,
550f14
+                flavor
550f14
+            )
550f14
+            cls._render_subnet_routes(
550f14
+                iface_cfg, route_cfg, iface_subnets, flavor
550f14
             )
550f14
-            cls._render_subnet_routes(iface_cfg, route_cfg, iface_subnets)
550f14
 
550f14
     @classmethod
550f14
-    def _render_ib_interfaces(cls, network_state, iface_contents):
550f14
+    def _render_ib_interfaces(cls, network_state, iface_contents, flavor):
550f14
         ib_filter = renderer.filter_by_type('infiniband')
550f14
         for iface in network_state.iter_interfaces(ib_filter):
550f14
             iface_name = iface['name']
550f14
@@ -708,12 +820,15 @@ class Renderer(renderer.Renderer):
550f14
             iface_subnets = iface.get("subnets", [])
550f14
             route_cfg = iface_cfg.routes
550f14
             cls._render_subnets(
550f14
-                iface_cfg, iface_subnets, network_state.has_default_route
550f14
+                iface_cfg, iface_subnets, network_state.has_default_route,
550f14
+                flavor
550f14
+            )
550f14
+            cls._render_subnet_routes(
550f14
+                iface_cfg, route_cfg, iface_subnets, flavor
550f14
             )
550f14
-            cls._render_subnet_routes(iface_cfg, route_cfg, iface_subnets)
550f14
 
550f14
     @classmethod
550f14
-    def _render_sysconfig(cls, base_sysconf_dir, network_state,
550f14
+    def _render_sysconfig(cls, base_sysconf_dir, network_state, flavor,
550f14
                           templates=None):
550f14
         '''Given state, return /etc/sysconfig files + contents'''
550f14
         if not templates:
550f14
@@ -724,13 +839,17 @@ class Renderer(renderer.Renderer):
550f14
                 continue
550f14
             iface_name = iface['name']
550f14
             iface_cfg = NetInterface(iface_name, base_sysconf_dir, templates)
550f14
-            cls._render_iface_shared(iface, iface_cfg)
550f14
+            if flavor == 'suse':
550f14
+                iface_cfg.drop('DEVICE')
550f14
+                # If type detection fails it is considered a bug in SUSE
550f14
+                iface_cfg.drop('TYPE')
550f14
+            cls._render_iface_shared(iface, iface_cfg, flavor)
550f14
             iface_contents[iface_name] = iface_cfg
550f14
-        cls._render_physical_interfaces(network_state, iface_contents)
550f14
-        cls._render_bond_interfaces(network_state, iface_contents)
550f14
-        cls._render_vlan_interfaces(network_state, iface_contents)
550f14
-        cls._render_bridge_interfaces(network_state, iface_contents)
550f14
-        cls._render_ib_interfaces(network_state, iface_contents)
550f14
+        cls._render_physical_interfaces(network_state, iface_contents, flavor)
550f14
+        cls._render_bond_interfaces(network_state, iface_contents, flavor)
550f14
+        cls._render_vlan_interfaces(network_state, iface_contents, flavor)
550f14
+        cls._render_bridge_interfaces(network_state, iface_contents, flavor)
550f14
+        cls._render_ib_interfaces(network_state, iface_contents, flavor)
550f14
         contents = {}
550f14
         for iface_name, iface_cfg in iface_contents.items():
550f14
             if iface_cfg or iface_cfg.children:
550f14
@@ -752,7 +871,7 @@ class Renderer(renderer.Renderer):
550f14
         file_mode = 0o644
550f14
         base_sysconf_dir = util.target_path(target, self.sysconf_dir)
550f14
         for path, data in self._render_sysconfig(base_sysconf_dir,
550f14
-                                                 network_state,
550f14
+                                                 network_state, self.flavor,
550f14
                                                  templates=templates).items():
550f14
             util.write_file(path, data, file_mode)
550f14
         if self.dns_path:
550f14
diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py
550f14
index e277bca2..905e8281 100644
550f14
--- a/tests/unittests/test_distros/test_netconfig.py
550f14
+++ b/tests/unittests/test_distros/test_netconfig.py
550f14
@@ -521,7 +521,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
550f14
                 NETMASK=255.255.255.0
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -530,7 +529,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
550f14
                 DEVICE=eth1
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -549,13 +547,11 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
550f14
                 BOOTPROTO=none
550f14
                 DEFROUTE=yes
550f14
                 DEVICE=eth0
550f14
-                IPADDR6=2607:f0d0:1002:0011::2/64
550f14
                 IPV6ADDR=2607:f0d0:1002:0011::2/64
550f14
                 IPV6INIT=yes
550f14
                 IPV6_DEFAULTGW=2607:f0d0:1002:0011::1
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -564,7 +560,6 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
550f14
                 DEVICE=eth1
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -690,26 +685,14 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
550f14
         """Opensuse uses apply_network_config and renders sysconfig"""
550f14
         expected_cfgs = {
550f14
             self.ifcfg_path('eth0'): dedent("""\
550f14
-                BOOTPROTO=none
550f14
-                DEFROUTE=yes
550f14
-                DEVICE=eth0
550f14
-                GATEWAY=192.168.1.254
550f14
+                BOOTPROTO=static
550f14
                 IPADDR=192.168.1.5
550f14
                 NETMASK=255.255.255.0
550f14
-                NM_CONTROLLED=no
550f14
-                ONBOOT=yes
550f14
                 STARTMODE=auto
550f14
-                TYPE=Ethernet
550f14
-                USERCTL=no
550f14
                 """),
550f14
             self.ifcfg_path('eth1'): dedent("""\
550f14
-                BOOTPROTO=dhcp
550f14
-                DEVICE=eth1
550f14
-                NM_CONTROLLED=no
550f14
-                ONBOOT=yes
550f14
+                BOOTPROTO=dhcp4
550f14
                 STARTMODE=auto
550f14
-                TYPE=Ethernet
550f14
-                USERCTL=no
550f14
                 """),
550f14
         }
550f14
         self._apply_and_verify(self.distro.apply_network_config,
550f14
@@ -720,9 +703,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
550f14
         """Opensuse uses apply_network_config and renders sysconfig w/ipv6"""
550f14
         expected_cfgs = {
550f14
             self.ifcfg_path('eth0'): dedent("""\
550f14
-                BOOTPROTO=none
550f14
-                DEFROUTE=yes
550f14
-                DEVICE=eth0
550f14
+                BOOTPROTO=static
550f14
                 IPADDR6=2607:f0d0:1002:0011::2/64
550f14
                 IPV6ADDR=2607:f0d0:1002:0011::2/64
550f14
                 IPV6INIT=yes
550f14
@@ -732,17 +713,10 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
                 STARTMODE=auto
550f14
-                TYPE=Ethernet
550f14
-                USERCTL=no
550f14
             """),
550f14
             self.ifcfg_path('eth1'): dedent("""\
550f14
-                BOOTPROTO=dhcp
550f14
-                DEVICE=eth1
550f14
-                NM_CONTROLLED=no
550f14
-                ONBOOT=yes
550f14
+                BOOTPROTO=dhcp4
550f14
                 STARTMODE=auto
550f14
-                TYPE=Ethernet
550f14
-                USERCTL=no
550f14
             """),
550f14
         }
550f14
         self._apply_and_verify(self.distro.apply_network_config,
550f14
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
550f14
index b2b7c4b2..7e598411 100644
550f14
--- a/tests/unittests/test_net.py
550f14
+++ b/tests/unittests/test_net.py
550f14
@@ -489,18 +489,11 @@ OS_SAMPLES = [
550f14
              """
550f14
 # Created by cloud-init on instance boot automatically, do not edit.
550f14
 #
550f14
-BOOTPROTO=none
550f14
-DEFROUTE=yes
550f14
-DEVICE=eth0
550f14
-GATEWAY=172.19.3.254
550f14
-HWADDR=fa:16:3e:ed:9a:59
550f14
+BOOTPROTO=static
550f14
 IPADDR=172.19.1.34
550f14
+LLADDR=fa:16:3e:ed:9a:59
550f14
 NETMASK=255.255.252.0
550f14
-NM_CONTROLLED=no
550f14
-ONBOOT=yes
550f14
 STARTMODE=auto
550f14
-TYPE=Ethernet
550f14
-USERCTL=no
550f14
 """.lstrip()),
550f14
             ('etc/resolv.conf',
550f14
              """
550f14
@@ -531,7 +524,6 @@ HWADDR=fa:16:3e:ed:9a:59
550f14
 IPADDR=172.19.1.34
550f14
 NETMASK=255.255.252.0
550f14
 ONBOOT=yes
550f14
-STARTMODE=auto
550f14
 TYPE=Ethernet
550f14
 USERCTL=no
550f14
 """.lstrip()),
550f14
@@ -590,20 +582,13 @@ dns = none
550f14
              """
550f14
 # Created by cloud-init on instance boot automatically, do not edit.
550f14
 #
550f14
-BOOTPROTO=none
550f14
-DEFROUTE=yes
550f14
-DEVICE=eth0
550f14
-GATEWAY=172.19.3.254
550f14
-HWADDR=fa:16:3e:ed:9a:59
550f14
+BOOTPROTO=static
550f14
 IPADDR=172.19.1.34
550f14
 IPADDR1=10.0.0.10
550f14
+LLADDR=fa:16:3e:ed:9a:59
550f14
 NETMASK=255.255.252.0
550f14
 NETMASK1=255.255.255.0
550f14
-NM_CONTROLLED=no
550f14
-ONBOOT=yes
550f14
 STARTMODE=auto
550f14
-TYPE=Ethernet
550f14
-USERCTL=no
550f14
 """.lstrip()),
550f14
             ('etc/resolv.conf',
550f14
              """
550f14
@@ -636,7 +621,6 @@ IPADDR1=10.0.0.10
550f14
 NETMASK=255.255.252.0
550f14
 NETMASK1=255.255.255.0
550f14
 ONBOOT=yes
550f14
-STARTMODE=auto
550f14
 TYPE=Ethernet
550f14
 USERCTL=no
550f14
 """.lstrip()),
550f14
@@ -715,25 +699,14 @@ dns = none
550f14
              """
550f14
 # Created by cloud-init on instance boot automatically, do not edit.
550f14
 #
550f14
-BOOTPROTO=none
550f14
-DEFROUTE=yes
550f14
-DEVICE=eth0
550f14
-GATEWAY=172.19.3.254
550f14
-HWADDR=fa:16:3e:ed:9a:59
550f14
+BOOTPROTO=static
550f14
 IPADDR=172.19.1.34
550f14
 IPADDR6=2001:DB8::10/64
550f14
-IPADDR6_0=2001:DB9::10/64
550f14
+IPADDR6_1=2001:DB9::10/64
550f14
 IPADDR6_2=2001:DB10::10/64
550f14
-IPV6ADDR=2001:DB8::10/64
550f14
-IPV6ADDR_SECONDARIES="2001:DB9::10/64 2001:DB10::10/64"
550f14
-IPV6INIT=yes
550f14
-IPV6_DEFAULTGW=2001:DB8::1
550f14
+LLADDR=fa:16:3e:ed:9a:59
550f14
 NETMASK=255.255.252.0
550f14
-NM_CONTROLLED=no
550f14
-ONBOOT=yes
550f14
 STARTMODE=auto
550f14
-TYPE=Ethernet
550f14
-USERCTL=no
550f14
 """.lstrip()),
550f14
             ('etc/resolv.conf',
550f14
              """
550f14
@@ -762,9 +735,6 @@ DEVICE=eth0
550f14
 GATEWAY=172.19.3.254
550f14
 HWADDR=fa:16:3e:ed:9a:59
550f14
 IPADDR=172.19.1.34
550f14
-IPADDR6=2001:DB8::10/64
550f14
-IPADDR6_0=2001:DB9::10/64
550f14
-IPADDR6_2=2001:DB10::10/64
550f14
 IPV6ADDR=2001:DB8::10/64
550f14
 IPV6ADDR_SECONDARIES="2001:DB9::10/64 2001:DB10::10/64"
550f14
 IPV6INIT=yes
550f14
@@ -773,7 +743,6 @@ IPV6_DEFAULTGW=2001:DB8::1
550f14
 IPV6_FORCE_ACCEPT_RA=no
550f14
 NETMASK=255.255.252.0
550f14
 ONBOOT=yes
550f14
-STARTMODE=auto
550f14
 TYPE=Ethernet
550f14
 USERCTL=no
550f14
 """.lstrip()),
550f14
@@ -883,13 +852,24 @@ NETWORK_CONFIGS = {
550f14
                             via: 65.61.151.37
550f14
                         set-name: eth99
550f14
         """).rstrip(' '),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-eth1': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                LLADDR=cf:d6:af:48:e8:80
550f14
+                STARTMODE=auto"""),
550f14
+            'ifcfg-eth99': textwrap.dedent("""\
550f14
+                BOOTPROTO=dhcp4
550f14
+                LLADDR=c0:d6:9f:2c:e8:80
550f14
+                IPADDR=192.168.21.3
550f14
+                NETMASK=255.255.255.0
550f14
+                STARTMODE=auto"""),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-eth1': textwrap.dedent("""\
550f14
                 BOOTPROTO=none
550f14
                 DEVICE=eth1
550f14
                 HWADDR=cf:d6:af:48:e8:80
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no"""),
550f14
             'ifcfg-eth99': textwrap.dedent("""\
550f14
@@ -906,7 +886,6 @@ NETWORK_CONFIGS = {
550f14
                 NETMASK=255.255.255.0
550f14
                 METRIC=10000
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no"""),
550f14
         },
550f14
@@ -960,6 +939,12 @@ NETWORK_CONFIGS = {
550f14
                         dhcp4: true
550f14
                         dhcp6: true
550f14
         """).rstrip(' '),
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-iface0':  textwrap.dedent("""\
550f14
+                BOOTPROTO=dhcp
550f14
+                DHCLIENT6_MODE=managed
550f14
+                STARTMODE=auto""")
550f14
+        },
550f14
         'yaml': textwrap.dedent("""\
550f14
             version: 1
550f14
             config:
550f14
@@ -1010,19 +995,27 @@ NETWORK_CONFIGS = {
550f14
                     address: 2001:1::1/64
550f14
                     mtu: 1500
550f14
         """).rstrip(' '),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-iface0': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                IPADDR=192.168.14.2
550f14
+                IPADDR6=2001:1::1/64
550f14
+                NETMASK=255.255.255.0
550f14
+                STARTMODE=auto
550f14
+                MTU=9000
550f14
+                """),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-iface0': textwrap.dedent("""\
550f14
                 BOOTPROTO=none
550f14
                 DEVICE=iface0
550f14
                 IPADDR=192.168.14.2
550f14
-                IPADDR6=2001:1::1/64
550f14
                 IPV6ADDR=2001:1::1/64
550f14
                 IPV6INIT=yes
550f14
                 IPV6_AUTOCONF=no
550f14
                 IPV6_FORCE_ACCEPT_RA=no
550f14
                 NETMASK=255.255.255.0
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 MTU=9000
550f14
@@ -1030,6 +1023,23 @@ NETWORK_CONFIGS = {
550f14
                 """),
550f14
         },
550f14
     },
550f14
+    'v6_and_v4': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-iface0':  textwrap.dedent("""\
550f14
+                BOOTPROTO=dhcp
550f14
+                DHCLIENT6_MODE=managed
550f14
+                STARTMODE=auto""")
550f14
+        },
550f14
+        'yaml': textwrap.dedent("""\
550f14
+            version: 1
550f14
+            config:
550f14
+              - type: 'physical'
550f14
+                name: 'iface0'
550f14
+                subnets:
550f14
+                  - type: dhcp6
550f14
+                  - type: dhcp4
550f14
+        """).rstrip(' '),
550f14
+    },
550f14
     'dhcpv6_only': {
550f14
         'expected_eni': textwrap.dedent("""\
550f14
             auto lo
550f14
@@ -1053,7 +1063,14 @@ NETWORK_CONFIGS = {
550f14
                 subnets:
550f14
                 - {'type': 'dhcp6'}
550f14
         """).rstrip(' '),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-iface0': textwrap.dedent("""\
550f14
+                BOOTPROTO=dhcp6
550f14
+                DHCLIENT6_MODE=managed
550f14
+                STARTMODE=auto
550f14
+                """),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-iface0': textwrap.dedent("""\
550f14
                 BOOTPROTO=none
550f14
                 DEVICE=iface0
550f14
@@ -1062,7 +1079,6 @@ NETWORK_CONFIGS = {
550f14
                 DEVICE=iface0
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -1101,7 +1117,14 @@ NETWORK_CONFIGS = {
550f14
                     dhcp6: true
550f14
                     accept-ra: true
550f14
         """).rstrip(' '),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-iface0': textwrap.dedent("""\
550f14
+                BOOTPROTO=dhcp6
550f14
+                DHCLIENT6_MODE=managed
550f14
+                STARTMODE=auto
550f14
+            """),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-iface0': textwrap.dedent("""\
550f14
                 BOOTPROTO=none
550f14
                 DEVICE=iface0
550f14
@@ -1111,7 +1134,6 @@ NETWORK_CONFIGS = {
550f14
                 DEVICE=iface0
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
             """),
550f14
@@ -1150,7 +1172,14 @@ NETWORK_CONFIGS = {
550f14
                     dhcp6: true
550f14
                     accept-ra: false
550f14
         """).rstrip(' '),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-iface0': textwrap.dedent("""\
550f14
+                BOOTPROTO=dhcp6
550f14
+                DHCLIENT6_MODE=managed
550f14
+                STARTMODE=auto
550f14
+            """),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-iface0': textwrap.dedent("""\
550f14
                 BOOTPROTO=none
550f14
                 DEVICE=iface0
550f14
@@ -1160,7 +1189,6 @@ NETWORK_CONFIGS = {
550f14
                 DEVICE=iface0
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
             """),
550f14
@@ -1190,7 +1218,14 @@ NETWORK_CONFIGS = {
550f14
               subnets:
550f14
               - {'type': 'ipv6_slaac'}
550f14
         """).rstrip(' '),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-iface0': textwrap.dedent("""\
550f14
+                BOOTPROTO=dhcp6
550f14
+                DHCLIENT6_MODE=info
550f14
+                STARTMODE=auto
550f14
+            """),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-iface0': textwrap.dedent("""\
550f14
                 BOOTPROTO=none
550f14
                 DEVICE=iface0
550f14
@@ -1199,7 +1234,6 @@ NETWORK_CONFIGS = {
550f14
                 DEVICE=iface0
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
             """),
550f14
@@ -1256,7 +1290,14 @@ NETWORK_CONFIGS = {
550f14
             subnets:
550f14
             - {'type': 'ipv6_dhcpv6-stateless'}
550f14
     """).rstrip(' '),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-iface0': textwrap.dedent("""\
550f14
+            BOOTPROTO=dhcp6
550f14
+            DHCLIENT6_MODE=info
550f14
+            STARTMODE=auto
550f14
+            """),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-iface0': textwrap.dedent("""\
550f14
             BOOTPROTO=none
550f14
             DEVICE=iface0
550f14
@@ -1267,7 +1308,6 @@ NETWORK_CONFIGS = {
550f14
             DEVICE=iface0
550f14
             NM_CONTROLLED=no
550f14
             ONBOOT=yes
550f14
-            STARTMODE=auto
550f14
             TYPE=Ethernet
550f14
             USERCTL=no
550f14
             """),
550f14
@@ -1298,7 +1338,14 @@ NETWORK_CONFIGS = {
550f14
             - {'type': 'ipv6_dhcpv6-stateful'}
550f14
             accept-ra: true
550f14
     """).rstrip(' '),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-iface0': textwrap.dedent("""\
550f14
+            BOOTPROTO=dhcp6
550f14
+            DHCLIENT6_MODE=managed
550f14
+            STARTMODE=auto
550f14
+            """),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-iface0': textwrap.dedent("""\
550f14
             BOOTPROTO=none
550f14
             DEVICE=iface0
550f14
@@ -1308,7 +1355,6 @@ NETWORK_CONFIGS = {
550f14
             DEVICE=iface0
550f14
             NM_CONTROLLED=no
550f14
             ONBOOT=yes
550f14
-            STARTMODE=auto
550f14
             TYPE=Ethernet
550f14
             USERCTL=no
550f14
             """),
550f14
@@ -1503,7 +1549,80 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                             - sacchromyces.maas
550f14
                             - brettanomyces.maas
550f14
         """).rstrip(' '),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-bond0': textwrap.dedent("""\
550f14
+                BONDING_MASTER=yes
550f14
+                BONDING_OPTS="mode=active-backup """
550f14
+                                           """xmit_hash_policy=layer3+4 """
550f14
+                                           """miimon=100"
550f14
+                BONDING_SLAVE_0=eth1
550f14
+                BONDING_SLAVE_1=eth2
550f14
+                BOOTPROTO=dhcp6
550f14
+                DHCLIENT6_MODE=managed
550f14
+                LLADDR=aa:bb:cc:dd:ee:ff
550f14
+                STARTMODE=auto"""),
550f14
+            'ifcfg-bond0.200': textwrap.dedent("""\
550f14
+                BOOTPROTO=dhcp4
550f14
+                ETHERDEVICE=bond0
550f14
+                STARTMODE=auto
550f14
+                VLAN_ID=200"""),
550f14
+            'ifcfg-br0': textwrap.dedent("""\
550f14
+                BRIDGE_AGEINGTIME=250
550f14
+                BOOTPROTO=static
550f14
+                IPADDR=192.168.14.2
550f14
+                IPADDR6=2001:1::1/64
550f14
+                LLADDRESS=bb:bb:bb:bb:bb:aa
550f14
+                NETMASK=255.255.255.0
550f14
+                BRIDGE_PRIORITY=22
550f14
+                BRIDGE_PORTS='eth3 eth4'
550f14
+                STARTMODE=auto
550f14
+                BRIDGE_STP=off"""),
550f14
+            'ifcfg-eth0': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                LLADDR=c0:d6:9f:2c:e8:80
550f14
+                STARTMODE=auto"""),
550f14
+            'ifcfg-eth0.101': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                IPADDR=192.168.0.2
550f14
+                IPADDR1=192.168.2.10
550f14
+                MTU=1500
550f14
+                NETMASK=255.255.255.0
550f14
+                NETMASK1=255.255.255.0
550f14
+                ETHERDEVICE=eth0
550f14
+                STARTMODE=auto
550f14
+                VLAN_ID=101"""),
550f14
+            'ifcfg-eth1': textwrap.dedent("""\
550f14
+                BOOTPROTO=none
550f14
+                LLADDR=aa:d6:9f:2c:e8:80
550f14
+                STARTMODE=hotplug"""),
550f14
+            'ifcfg-eth2': textwrap.dedent("""\
550f14
+                BOOTPROTO=none
550f14
+                LLADDR=c0:bb:9f:2c:e8:80
550f14
+                STARTMODE=hotplug"""),
550f14
+            'ifcfg-eth3': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                BRIDGE=yes
550f14
+                LLADDR=66:bb:9f:2c:e8:80
550f14
+                STARTMODE=auto"""),
550f14
+            'ifcfg-eth4': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                BRIDGE=yes
550f14
+                LLADDR=98:bb:9f:2c:e8:80
550f14
+                STARTMODE=auto"""),
550f14
+            'ifcfg-eth5': textwrap.dedent("""\
550f14
+                BOOTPROTO=dhcp
550f14
+                LLADDR=98:bb:9f:2c:e8:8a
550f14
+                STARTMODE=manual"""),
550f14
+            'ifcfg-ib0': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                LLADDR=a0:00:02:20:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:15:e2:c1
550f14
+                IPADDR=192.168.200.7
550f14
+                MTU=9000
550f14
+                NETMASK=255.255.255.0
550f14
+                STARTMODE=auto
550f14
+                TYPE=InfiniBand"""),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-bond0': textwrap.dedent("""\
550f14
                 BONDING_MASTER=yes
550f14
                 BONDING_OPTS="mode=active-backup """
550f14
@@ -1517,7 +1636,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 IPV6INIT=yes
550f14
                 MACADDR=aa:bb:cc:dd:ee:ff
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Bond
550f14
                 USERCTL=no"""),
550f14
             'ifcfg-bond0.200': textwrap.dedent("""\
550f14
@@ -1527,6 +1645,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 ONBOOT=yes
550f14
                 PHYSDEV=bond0
550f14
                 STARTMODE=auto
550f14
+                TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 VLAN=yes"""),
550f14
             'ifcfg-br0': textwrap.dedent("""\
550f14
@@ -1535,7 +1654,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 DEFROUTE=yes
550f14
                 DEVICE=br0
550f14
                 IPADDR=192.168.14.2
550f14
-                IPADDR6=2001:1::1/64
550f14
                 IPV6ADDR=2001:1::1/64
550f14
                 IPV6INIT=yes
550f14
                 IPV6_AUTOCONF=no
550f14
@@ -1545,7 +1663,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 NETMASK=255.255.255.0
550f14
                 ONBOOT=yes
550f14
                 PRIO=22
550f14
-                STARTMODE=auto
550f14
                 STP=no
550f14
                 TYPE=Bridge
550f14
                 USERCTL=no"""),
550f14
@@ -1554,7 +1671,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 DEVICE=eth0
550f14
                 HWADDR=c0:d6:9f:2c:e8:80
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no"""),
550f14
             'ifcfg-eth0.101': textwrap.dedent("""\
550f14
@@ -1573,6 +1689,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 ONBOOT=yes
550f14
                 PHYSDEV=eth0
550f14
                 STARTMODE=auto
550f14
+                TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 VLAN=yes"""),
550f14
             'ifcfg-eth1': textwrap.dedent("""\
550f14
@@ -1581,7 +1698,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 HWADDR=aa:d6:9f:2c:e8:80
550f14
                 MASTER=bond0
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 SLAVE=yes
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no"""),
550f14
@@ -1591,7 +1707,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 HWADDR=c0:bb:9f:2c:e8:80
550f14
                 MASTER=bond0
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 SLAVE=yes
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no"""),
550f14
@@ -1601,7 +1716,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 DEVICE=eth3
550f14
                 HWADDR=66:bb:9f:2c:e8:80
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no"""),
550f14
             'ifcfg-eth4': textwrap.dedent("""\
550f14
@@ -1610,7 +1724,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 DEVICE=eth4
550f14
                 HWADDR=98:bb:9f:2c:e8:80
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no"""),
550f14
             'ifcfg-eth5': textwrap.dedent("""\
550f14
@@ -1619,7 +1732,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 DHCLIENT_SET_DEFAULT_ROUTE=no
550f14
                 HWADDR=98:bb:9f:2c:e8:8a
550f14
                 ONBOOT=no
550f14
-                STARTMODE=manual
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no"""),
550f14
             'ifcfg-ib0': textwrap.dedent("""\
550f14
@@ -1631,7 +1743,6 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
550f14
                 NETMASK=255.255.255.0
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=InfiniBand
550f14
                 USERCTL=no"""),
550f14
         },
550f14
@@ -2027,58 +2138,29 @@ iface bond0 inet6 static
550f14
                                            """fail_over_mac=active """
550f14
                                            """primary=bond0s0 """
550f14
                                            """primary_reselect=always"
550f14
-        BONDING_SLAVE0=bond0s0
550f14
-        BONDING_SLAVE1=bond0s1
550f14
-        BOOTPROTO=none
550f14
-        DEFROUTE=yes
550f14
-        DEVICE=bond0
550f14
-        GATEWAY=192.168.0.1
550f14
-        MACADDR=aa:bb:cc:dd:e8:ff
550f14
+        BONDING_SLAVE_0=bond0s0
550f14
+        BONDING_SLAVE_1=bond0s1
550f14
+        BOOTPROTO=static
550f14
+        LLADDR=aa:bb:cc:dd:e8:ff
550f14
         IPADDR=192.168.0.2
550f14
         IPADDR1=192.168.1.2
550f14
         IPADDR6=2001:1::1/92
550f14
-        IPV6ADDR=2001:1::1/92
550f14
-        IPV6INIT=yes
550f14
         MTU=9000
550f14
         NETMASK=255.255.255.0
550f14
         NETMASK1=255.255.255.0
550f14
-        NM_CONTROLLED=no
550f14
-        ONBOOT=yes
550f14
         STARTMODE=auto
550f14
-        TYPE=Bond
550f14
-        USERCTL=no
550f14
         """),
550f14
             'ifcfg-bond0s0': textwrap.dedent("""\
550f14
         BOOTPROTO=none
550f14
-        DEVICE=bond0s0
550f14
-        HWADDR=aa:bb:cc:dd:e8:00
550f14
-        MASTER=bond0
550f14
-        NM_CONTROLLED=no
550f14
-        ONBOOT=yes
550f14
-        SLAVE=yes
550f14
-        STARTMODE=auto
550f14
-        TYPE=Ethernet
550f14
-        USERCTL=no
550f14
-        """),
550f14
-            'ifroute-bond0': textwrap.dedent("""\
550f14
-        ADDRESS0=10.1.3.0
550f14
-        GATEWAY0=192.168.0.3
550f14
-        NETMASK0=255.255.255.0
550f14
+        LLADDR=aa:bb:cc:dd:e8:00
550f14
+        STARTMODE=hotplug
550f14
         """),
550f14
             'ifcfg-bond0s1': textwrap.dedent("""\
550f14
         BOOTPROTO=none
550f14
-        DEVICE=bond0s1
550f14
-        HWADDR=aa:bb:cc:dd:e8:01
550f14
-        MASTER=bond0
550f14
-        NM_CONTROLLED=no
550f14
-        ONBOOT=yes
550f14
-        SLAVE=yes
550f14
-        STARTMODE=auto
550f14
-        TYPE=Ethernet
550f14
-        USERCTL=no
550f14
+        LLADDR=aa:bb:cc:dd:e8:01
550f14
+        STARTMODE=hotplug
550f14
         """),
550f14
         },
550f14
-
550f14
         'expected_sysconfig_rhel': {
550f14
             'ifcfg-bond0': textwrap.dedent("""\
550f14
         BONDING_MASTER=yes
550f14
@@ -2097,7 +2179,6 @@ iface bond0 inet6 static
550f14
         MACADDR=aa:bb:cc:dd:e8:ff
550f14
         IPADDR=192.168.0.2
550f14
         IPADDR1=192.168.1.2
550f14
-        IPADDR6=2001:1::1/92
550f14
         IPV6ADDR=2001:1::1/92
550f14
         IPV6INIT=yes
550f14
         IPV6_AUTOCONF=no
550f14
@@ -2106,7 +2187,6 @@ iface bond0 inet6 static
550f14
         NETMASK=255.255.255.0
550f14
         NETMASK1=255.255.255.0
550f14
         ONBOOT=yes
550f14
-        STARTMODE=auto
550f14
         TYPE=Bond
550f14
         USERCTL=no
550f14
         """),
550f14
@@ -2117,7 +2197,6 @@ iface bond0 inet6 static
550f14
         MASTER=bond0
550f14
         ONBOOT=yes
550f14
         SLAVE=yes
550f14
-        STARTMODE=auto
550f14
         TYPE=Ethernet
550f14
         USERCTL=no
550f14
         """),
550f14
@@ -2139,7 +2218,6 @@ iface bond0 inet6 static
550f14
         MASTER=bond0
550f14
         ONBOOT=yes
550f14
         SLAVE=yes
550f14
-        STARTMODE=auto
550f14
         TYPE=Ethernet
550f14
         USERCTL=no
550f14
         """),
550f14
@@ -2170,13 +2248,31 @@ iface bond0 inet6 static
550f14
                        netmask: '::'
550f14
                        network: '::'
550f14
             """),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            # TODO RJS: unknown proper BOOTPROTO setting ask Marius
550f14
+            'ifcfg-en0': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                LLADDR=aa:bb:cc:dd:e8:00
550f14
+                STARTMODE=auto"""),
550f14
+            'ifcfg-en0.99': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                IPADDR=192.168.2.2
550f14
+                IPADDR1=192.168.1.2
550f14
+                IPADDR6=2001:1::bbbb/96
550f14
+                MTU=2222
550f14
+                NETMASK=255.255.255.0
550f14
+                NETMASK1=255.255.255.0
550f14
+                STARTMODE=auto
550f14
+                ETHERDEVICE=en0
550f14
+                VLAN_ID=99
550f14
+            """),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-en0': textwrap.dedent("""\
550f14
                 BOOTPROTO=none
550f14
                 DEVICE=en0
550f14
                 HWADDR=aa:bb:cc:dd:e8:00
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no"""),
550f14
             'ifcfg-en0.99': textwrap.dedent("""\
550f14
@@ -2186,7 +2282,6 @@ iface bond0 inet6 static
550f14
                 GATEWAY=192.168.1.1
550f14
                 IPADDR=192.168.2.2
550f14
                 IPADDR1=192.168.1.2
550f14
-                IPADDR6=2001:1::bbbb/96
550f14
                 IPV6ADDR=2001:1::bbbb/96
550f14
                 IPV6INIT=yes
550f14
                 IPV6_AUTOCONF=no
550f14
@@ -2198,6 +2293,7 @@ iface bond0 inet6 static
550f14
                 ONBOOT=yes
550f14
                 PHYSDEV=en0
550f14
                 STARTMODE=auto
550f14
+                TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 VLAN=yes"""),
550f14
         },
550f14
@@ -2229,7 +2325,32 @@ iface bond0 inet6 static
550f14
                 subnets:
550f14
                   - type: static
550f14
                     address: 192.168.2.2/24"""),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-br0': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                IPADDR=192.168.2.2
550f14
+                NETMASK=255.255.255.0
550f14
+                STARTMODE=auto
550f14
+                BRIDGE_STP=off
550f14
+                BRIDGE_PRIORITY=22
550f14
+                BRIDGE_PORTS='eth0 eth1'
550f14
+                """),
550f14
+            'ifcfg-eth0': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                BRIDGE=yes
550f14
+                LLADDR=52:54:00:12:34:00
550f14
+                IPADDR6=2001:1::100/96
550f14
+                STARTMODE=auto
550f14
+                """),
550f14
+            'ifcfg-eth1': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                BRIDGE=yes
550f14
+                LLADDR=52:54:00:12:34:01
550f14
+                IPADDR6=2001:1::101/96
550f14
+                STARTMODE=auto
550f14
+                """),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-br0': textwrap.dedent("""\
550f14
                 BOOTPROTO=none
550f14
                 DEVICE=br0
550f14
@@ -2237,7 +2358,6 @@ iface bond0 inet6 static
550f14
                 NETMASK=255.255.255.0
550f14
                 ONBOOT=yes
550f14
                 PRIO=22
550f14
-                STARTMODE=auto
550f14
                 STP=no
550f14
                 TYPE=Bridge
550f14
                 USERCTL=no
550f14
@@ -2247,14 +2367,12 @@ iface bond0 inet6 static
550f14
                 BRIDGE=br0
550f14
                 DEVICE=eth0
550f14
                 HWADDR=52:54:00:12:34:00
550f14
-                IPADDR6=2001:1::100/96
550f14
                 IPV6ADDR=2001:1::100/96
550f14
                 IPV6INIT=yes
550f14
                 IPV6_AUTOCONF=no
550f14
                 IPV6_FORCE_ACCEPT_RA=no
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -2263,14 +2381,12 @@ iface bond0 inet6 static
550f14
                 BRIDGE=br0
550f14
                 DEVICE=eth1
550f14
                 HWADDR=52:54:00:12:34:01
550f14
-                IPADDR6=2001:1::101/96
550f14
                 IPV6ADDR=2001:1::101/96
550f14
                 IPV6INIT=yes
550f14
                 IPV6_AUTOCONF=no
550f14
                 IPV6_FORCE_ACCEPT_RA=no
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -2336,7 +2452,27 @@ iface bond0 inet6 static
550f14
                             macaddress: 52:54:00:12:34:ff
550f14
                         set-name: eth2
550f14
             """),
550f14
-        'expected_sysconfig': {
550f14
+        'expected_sysconfig_opensuse': {
550f14
+            'ifcfg-eth0': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                LLADDR=52:54:00:12:34:00
550f14
+                IPADDR=192.168.1.2
550f14
+                NETMASK=255.255.255.0
550f14
+                STARTMODE=manual
550f14
+                """),
550f14
+            'ifcfg-eth1': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                LLADDR=52:54:00:12:34:aa
550f14
+                MTU=1480
550f14
+                STARTMODE=auto
550f14
+                """),
550f14
+            'ifcfg-eth2': textwrap.dedent("""\
550f14
+                BOOTPROTO=static
550f14
+                LLADDR=52:54:00:12:34:ff
550f14
+                STARTMODE=manual
550f14
+                """),
550f14
+        },
550f14
+        'expected_sysconfig_rhel': {
550f14
             'ifcfg-eth0': textwrap.dedent("""\
550f14
                 BOOTPROTO=none
550f14
                 DEVICE=eth0
550f14
@@ -2344,7 +2480,6 @@ iface bond0 inet6 static
550f14
                 IPADDR=192.168.1.2
550f14
                 NETMASK=255.255.255.0
550f14
                 ONBOOT=no
550f14
-                STARTMODE=manual
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -2354,7 +2489,6 @@ iface bond0 inet6 static
550f14
                 HWADDR=52:54:00:12:34:aa
550f14
                 MTU=1480
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -2363,7 +2497,6 @@ iface bond0 inet6 static
550f14
                 DEVICE=eth2
550f14
                 HWADDR=52:54:00:12:34:ff
550f14
                 ONBOOT=no
550f14
-                STARTMODE=manual
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -2694,7 +2827,7 @@ class TestRhelSysConfigRendering(CiTestCase):
550f14
     header = ('# Created by cloud-init on instance boot automatically, '
550f14
               'do not edit.\n#\n')
550f14
 
550f14
-    expected_name = 'expected_sysconfig'
550f14
+    expected_name = 'expected_sysconfig_rhel'
550f14
 
550f14
     def _get_renderer(self):
550f14
         distro_cls = distros.fetch('rhel')
550f14
@@ -2780,7 +2913,6 @@ BOOTPROTO=dhcp
550f14
 DEVICE=eth1000
550f14
 HWADDR=07-1c-c6-75-a4-be
550f14
 ONBOOT=yes
550f14
-STARTMODE=auto
550f14
 TYPE=Ethernet
550f14
 USERCTL=no
550f14
 """.lstrip()
550f14
@@ -2901,7 +3033,6 @@ HWADDR=52:54:00:12:34:00
550f14
 IPADDR=10.0.2.15
550f14
 NETMASK=255.255.255.0
550f14
 ONBOOT=yes
550f14
-STARTMODE=auto
550f14
 TYPE=Ethernet
550f14
 USERCTL=no
550f14
 """
550f14
@@ -2933,7 +3064,6 @@ MTU=1500
550f14
 NETMASK=255.255.240.0
550f14
 NM_CONTROLLED=no
550f14
 ONBOOT=yes
550f14
-STARTMODE=auto
550f14
 TYPE=Ethernet
550f14
 USERCTL=no
550f14
 """
550f14
@@ -2948,7 +3078,6 @@ HWADDR=fa:16:3e:b1:ca:29
550f14
 MTU=9000
550f14
 NM_CONTROLLED=no
550f14
 ONBOOT=yes
550f14
-STARTMODE=auto
550f14
 TYPE=Ethernet
550f14
 USERCTL=no
550f14
 """
550f14
@@ -2973,7 +3102,6 @@ USERCTL=no
550f14
 BOOTPROTO=dhcp
550f14
 DEVICE=eth0
550f14
 ONBOOT=yes
550f14
-STARTMODE=auto
550f14
 TYPE=Ethernet
550f14
 USERCTL=no
550f14
 """
550f14
@@ -2982,10 +3110,9 @@ USERCTL=no
550f14
         self.assertEqual(resolvconf_content, found['/etc/resolv.conf'])
550f14
 
550f14
     def test_bond_config(self):
550f14
-        expected_name = 'expected_sysconfig_rhel'
550f14
         entry = NETWORK_CONFIGS['bond']
550f14
         found = self._render_and_read(network_config=yaml.load(entry['yaml']))
550f14
-        self._compare_files_to_expected(entry[expected_name], found)
550f14
+        self._compare_files_to_expected(entry[self.expected_name], found)
550f14
         self._assert_headers(found)
550f14
 
550f14
     def test_vlan_config(self):
550f14
@@ -3228,7 +3355,6 @@ USERCTL=no
550f14
                    GATEWAY=192.168.42.1
550f14
                    HWADDR=52:54:00:ab:cd:ef
550f14
                    IPADDR=192.168.42.100
550f14
-                   IPADDR6=2001:db8::100/32
550f14
                    IPV6ADDR=2001:db8::100/32
550f14
                    IPV6INIT=yes
550f14
                    IPV6_AUTOCONF=no
550f14
@@ -3237,7 +3363,6 @@ USERCTL=no
550f14
                    NETMASK=255.255.255.0
550f14
                    NM_CONTROLLED=no
550f14
                    ONBOOT=yes
550f14
-                   STARTMODE=auto
550f14
                    TYPE=Ethernet
550f14
                    USERCTL=no
550f14
                    """),
550f14
@@ -3263,7 +3388,6 @@ USERCTL=no
550f14
                 DEVICE=eno1
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -3277,6 +3401,7 @@ USERCTL=no
550f14
                 ONBOOT=yes
550f14
                 PHYSDEV=eno1
550f14
                 STARTMODE=auto
550f14
+                TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 VLAN=yes
550f14
                 """)
550f14
@@ -3306,7 +3431,6 @@ USERCTL=no
550f14
                 NETMASK=255.255.255.192
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Bond
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -3318,7 +3442,6 @@ USERCTL=no
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
                 SLAVE=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Bond
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -3330,7 +3453,6 @@ USERCTL=no
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
                 SLAVE=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Bond
550f14
                 USERCTL=no
550f14
                 """)
550f14
@@ -3354,7 +3476,6 @@ USERCTL=no
550f14
                 METRIC=100
550f14
                 NM_CONTROLLED=no
550f14
                 ONBOOT=yes
550f14
-                STARTMODE=auto
550f14
                 TYPE=Ethernet
550f14
                 USERCTL=no
550f14
                 """),
550f14
@@ -3377,7 +3498,7 @@ class TestOpenSuseSysConfigRendering(CiTestCase):
550f14
     header = ('# Created by cloud-init on instance boot automatically, '
550f14
               'do not edit.\n#\n')
550f14
 
550f14
-    expected_name = 'expected_sysconfig'
550f14
+    expected_name = 'expected_sysconfig_opensuse'
550f14
 
550f14
     def _get_renderer(self):
550f14
         distro_cls = distros.fetch('opensuse')
550f14
@@ -3449,92 +3570,89 @@ class TestOpenSuseSysConfigRendering(CiTestCase):
550f14
             expected_content = """
550f14
 # Created by cloud-init on instance boot automatically, do not edit.
550f14
 #
550f14
-BOOTPROTO=dhcp
550f14
-DEVICE=eth1000
550f14
-HWADDR=07-1c-c6-75-a4-be
550f14
-NM_CONTROLLED=no
550f14
-ONBOOT=yes
550f14
+BOOTPROTO=dhcp4
550f14
+LLADDR=07-1c-c6-75-a4-be
550f14
 STARTMODE=auto
550f14
-TYPE=Ethernet
550f14
-USERCTL=no
550f14
 """.lstrip()
550f14
             self.assertEqual(expected_content, content)
550f14
 
550f14
-    def test_multiple_ipv4_default_gateways(self):
550f14
-        """ValueError is raised when duplicate ipv4 gateways exist."""
550f14
-        net_json = {
550f14
-            "services": [{"type": "dns", "address": "172.19.0.12"}],
550f14
-            "networks": [{
550f14
-                "network_id": "dacd568d-5be6-4786-91fe-750c374b78b4",
550f14
-                "type": "ipv4", "netmask": "255.255.252.0",
550f14
-                "link": "tap1a81968a-79",
550f14
-                "routes": [{
550f14
-                    "netmask": "0.0.0.0",
550f14
-                    "network": "0.0.0.0",
550f14
-                    "gateway": "172.19.3.254",
550f14
-                }, {
550f14
-                    "netmask": "0.0.0.0",  # A second default gateway
550f14
-                    "network": "0.0.0.0",
550f14
-                    "gateway": "172.20.3.254",
550f14
-                }],
550f14
-                "ip_address": "172.19.1.34", "id": "network0"
550f14
-            }],
550f14
-            "links": [
550f14
-                {
550f14
-                    "ethernet_mac_address": "fa:16:3e:ed:9a:59",
550f14
-                    "mtu": None, "type": "bridge", "id":
550f14
-                    "tap1a81968a-79",
550f14
-                    "vif_id": "1a81968a-797a-400f-8a80-567f997eb93f"
550f14
-                },
550f14
-            ],
550f14
-        }
550f14
-        macs = {'fa:16:3e:ed:9a:59': 'eth0'}
550f14
-        render_dir = self.tmp_dir()
550f14
-        network_cfg = openstack.convert_net_json(net_json, known_macs=macs)
550f14
-        ns = network_state.parse_net_config_data(network_cfg,
550f14
-                                                 skip_broken=False)
550f14
-        renderer = self._get_renderer()
550f14
-        with self.assertRaises(ValueError):
550f14
-            renderer.render_network_state(ns, target=render_dir)
550f14
-        self.assertEqual([], os.listdir(render_dir))
550f14
-
550f14
-    def test_multiple_ipv6_default_gateways(self):
550f14
-        """ValueError is raised when duplicate ipv6 gateways exist."""
550f14
-        net_json = {
550f14
-            "services": [{"type": "dns", "address": "172.19.0.12"}],
550f14
-            "networks": [{
550f14
-                "network_id": "public-ipv6",
550f14
-                "type": "ipv6", "netmask": "",
550f14
-                "link": "tap1a81968a-79",
550f14
-                "routes": [{
550f14
-                    "gateway": "2001:DB8::1",
550f14
-                    "netmask": "::",
550f14
-                    "network": "::"
550f14
-                }, {
550f14
-                    "gateway": "2001:DB9::1",
550f14
-                    "netmask": "::",
550f14
-                    "network": "::"
550f14
-                }],
550f14
-                "ip_address": "2001:DB8::10", "id": "network1"
550f14
-            }],
550f14
-            "links": [
550f14
-                {
550f14
-                    "ethernet_mac_address": "fa:16:3e:ed:9a:59",
550f14
-                    "mtu": None, "type": "bridge", "id":
550f14
-                    "tap1a81968a-79",
550f14
-                    "vif_id": "1a81968a-797a-400f-8a80-567f997eb93f"
550f14
-                },
550f14
-            ],
550f14
-        }
550f14
-        macs = {'fa:16:3e:ed:9a:59': 'eth0'}
550f14
-        render_dir = self.tmp_dir()
550f14
-        network_cfg = openstack.convert_net_json(net_json, known_macs=macs)
550f14
-        ns = network_state.parse_net_config_data(network_cfg,
550f14
-                                                 skip_broken=False)
550f14
-        renderer = self._get_renderer()
550f14
-        with self.assertRaises(ValueError):
550f14
-            renderer.render_network_state(ns, target=render_dir)
550f14
-        self.assertEqual([], os.listdir(render_dir))
550f14
+    # TODO(rjschwei): re-enable test once route writing is implemented
550f14
+    # for SUSE distros
550f14
+#    def test_multiple_ipv4_default_gateways(self):
550f14
+#        """ValueError is raised when duplicate ipv4 gateways exist."""
550f14
+#        net_json = {
550f14
+#            "services": [{"type": "dns", "address": "172.19.0.12"}],
550f14
+#            "networks": [{
550f14
+#                "network_id": "dacd568d-5be6-4786-91fe-750c374b78b4",
550f14
+#                "type": "ipv4", "netmask": "255.255.252.0",
550f14
+#                "link": "tap1a81968a-79",
550f14
+#                "routes": [{
550f14
+#                    "netmask": "0.0.0.0",
550f14
+#                    "network": "0.0.0.0",
550f14
+#                    "gateway": "172.19.3.254",
550f14
+#                }, {
550f14
+#                    "netmask": "0.0.0.0",  # A second default gateway
550f14
+#                    "network": "0.0.0.0",
550f14
+#                    "gateway": "172.20.3.254",
550f14
+#                }],
550f14
+#                "ip_address": "172.19.1.34", "id": "network0"
550f14
+#            }],
550f14
+#            "links": [
550f14
+#                {
550f14
+#                    "ethernet_mac_address": "fa:16:3e:ed:9a:59",
550f14
+#                    "mtu": None, "type": "bridge", "id":
550f14
+#                    "tap1a81968a-79",
550f14
+#                    "vif_id": "1a81968a-797a-400f-8a80-567f997eb93f"
550f14
+#                },
550f14
+#            ],
550f14
+#        }
550f14
+#        macs = {'fa:16:3e:ed:9a:59': 'eth0'}
550f14
+#        render_dir = self.tmp_dir()
550f14
+#        network_cfg = openstack.convert_net_json(net_json, known_macs=macs)
550f14
+#        ns = network_state.parse_net_config_data(network_cfg,
550f14
+#                                                 skip_broken=False)
550f14
+#        renderer = self._get_renderer()
550f14
+#        with self.assertRaises(ValueError):
550f14
+#            renderer.render_network_state(ns, target=render_dir)
550f14
+#        self.assertEqual([], os.listdir(render_dir))
550f14
+#
550f14
+#    def test_multiple_ipv6_default_gateways(self):
550f14
+#        """ValueError is raised when duplicate ipv6 gateways exist."""
550f14
+#        net_json = {
550f14
+#            "services": [{"type": "dns", "address": "172.19.0.12"}],
550f14
+#            "networks": [{
550f14
+#                "network_id": "public-ipv6",
550f14
+#                "type": "ipv6", "netmask": "",
550f14
+#                "link": "tap1a81968a-79",
550f14
+#                "routes": [{
550f14
+#                    "gateway": "2001:DB8::1",
550f14
+#                    "netmask": "::",
550f14
+#                    "network": "::"
550f14
+#                }, {
550f14
+#                    "gateway": "2001:DB9::1",
550f14
+#                    "netmask": "::",
550f14
+#                    "network": "::"
550f14
+#                }],
550f14
+#                "ip_address": "2001:DB8::10", "id": "network1"
550f14
+#            }],
550f14
+#            "links": [
550f14
+#                {
550f14
+#                    "ethernet_mac_address": "fa:16:3e:ed:9a:59",
550f14
+#                    "mtu": None, "type": "bridge", "id":
550f14
+#                    "tap1a81968a-79",
550f14
+#                    "vif_id": "1a81968a-797a-400f-8a80-567f997eb93f"
550f14
+#                },
550f14
+#            ],
550f14
+#        }
550f14
+#        macs = {'fa:16:3e:ed:9a:59': 'eth0'}
550f14
+#        render_dir = self.tmp_dir()
550f14
+#        network_cfg = openstack.convert_net_json(net_json, known_macs=macs)
550f14
+#        ns = network_state.parse_net_config_data(network_cfg,
550f14
+#                                                 skip_broken=False)
550f14
+#        renderer = self._get_renderer()
550f14
+#        with self.assertRaises(ValueError):
550f14
+#            renderer.render_network_state(ns, target=render_dir)
550f14
+#        self.assertEqual([], os.listdir(render_dir))
550f14
 
550f14
     def test_openstack_rendering_samples(self):
550f14
         for os_sample in OS_SAMPLES:
550f14
@@ -3567,18 +3685,11 @@ USERCTL=no
550f14
         expected = """\
550f14
 # Created by cloud-init on instance boot automatically, do not edit.
550f14
 #
550f14
-BOOTPROTO=none
550f14
-DEFROUTE=yes
550f14
-DEVICE=interface0
550f14
-GATEWAY=10.0.2.2
550f14
-HWADDR=52:54:00:12:34:00
550f14
+BOOTPROTO=static
550f14
 IPADDR=10.0.2.15
550f14
+LLADDR=52:54:00:12:34:00
550f14
 NETMASK=255.255.255.0
550f14
-NM_CONTROLLED=no
550f14
-ONBOOT=yes
550f14
 STARTMODE=auto
550f14
-TYPE=Ethernet
550f14
-USERCTL=no
550f14
 """
550f14
         self.assertEqual(expected, found[nspath + 'ifcfg-interface0'])
550f14
         # The configuration has no nameserver information make sure we
550f14
@@ -3603,12 +3714,7 @@ USERCTL=no
550f14
 # Created by cloud-init on instance boot automatically, do not edit.
550f14
 #
550f14
 BOOTPROTO=dhcp
550f14
-DEVICE=eth0
550f14
-NM_CONTROLLED=no
550f14
-ONBOOT=yes
550f14
 STARTMODE=auto
550f14
-TYPE=Ethernet
550f14
-USERCTL=no
550f14
 """
550f14
         self.assertEqual(expected, found[nspath + 'ifcfg-eth0'])
550f14
         # a dhcp only config should not modify resolv.conf
550f14
@@ -3679,6 +3785,30 @@ USERCTL=no
550f14
         self._compare_files_to_expected(entry[self.expected_name], found)
550f14
         self._assert_headers(found)
550f14
 
550f14
+    def test_simple_render_ipv6_slaac(self):
550f14
+        entry = NETWORK_CONFIGS['ipv6_slaac']
550f14
+        found = self._render_and_read(network_config=yaml.load(entry['yaml']))
550f14
+        self._compare_files_to_expected(entry[self.expected_name], found)
550f14
+        self._assert_headers(found)
550f14
+
550f14
+    def test_dhcpv6_stateless_config(self):
550f14
+        entry = NETWORK_CONFIGS['dhcpv6_stateless']
550f14
+        found = self._render_and_read(network_config=yaml.load(entry['yaml']))
550f14
+        self._compare_files_to_expected(entry[self.expected_name], found)
550f14
+        self._assert_headers(found)
550f14
+
550f14
+    def test_render_v4_and_v6(self):
550f14
+        entry = NETWORK_CONFIGS['v4_and_v6']
550f14
+        found = self._render_and_read(network_config=yaml.load(entry['yaml']))
550f14
+        self._compare_files_to_expected(entry[self.expected_name], found)
550f14
+        self._assert_headers(found)
550f14
+
550f14
+    def test_render_v6_and_v4(self):
550f14
+        entry = NETWORK_CONFIGS['v6_and_v4']
550f14
+        found = self._render_and_read(network_config=yaml.load(entry['yaml']))
550f14
+        self._compare_files_to_expected(entry[self.expected_name], found)
550f14
+        self._assert_headers(found)
550f14
+
550f14
 
550f14
 class TestEniNetRendering(CiTestCase):
550f14
 
550f14
-- 
550f14
2.27.0
550f14