Hello community,

here is the log from the commit of package yast2-network for openSUSE:Factory 
checked in at 2020-06-27 23:22:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-network (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-network.new.3060 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-network"

Sat Jun 27 23:22:12 2020 rev:426 rq:817203 version:4.3.10

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes      
2020-06-14 18:15:04.150795199 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-network.new.3060/yast2-network.changes    
2020-06-27 23:22:14.797756462 +0200
@@ -1,0 +2,34 @@
+Fri Jun 26 08:00:33 UTC 2020 - Knut Anderssen <[email protected]>
+
+- AutoYaST schema: add the setup_before_proposal element to the
+  schema (bsc#1171922)
+- 4.3.10
+
+-------------------------------------------------------------------
+Wed Jun 24 11:52:46 UTC 2020 - Josef Reidinger <[email protected]>
+
+- Do not export network when not requested (bsc#1172552)
+- 4.3.9
+
+-------------------------------------------------------------------
+Fri Jun 19 18:24:34 UTC 2020 - Knut Anderssen <[email protected]>
+
+- Do not export any settings when NetworkManager is the network
+  backend (bsc#1172822).
+- 4.3.8
+
+-------------------------------------------------------------------
+Fri Jun 19 08:52:54 UTC 2020 - Martin Vidner <[email protected]>
+
+- Save inst-sys memory by ending ag_udev_persistent after use
+  (bsc#1172139).
+- 4.3.7
+
+-------------------------------------------------------------------
+Mon Jun 15 11:53:03 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Do not export interfaces <aliases> section when there are no
+  aliases to export (bsc#1172922).
+- 4.3.6
+
+-------------------------------------------------------------------

Old:
----
  yast2-network-4.3.5.tar.bz2

New:
----
  yast2-network-4.3.10.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-network.spec ++++++
--- /var/tmp/diff_new_pack.6nKegG/_old  2020-06-27 23:22:15.877760014 +0200
+++ /var/tmp/diff_new_pack.6nKegG/_new  2020-06-27 23:22:15.881760026 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-network
-Version:        4.3.5
+Version:        4.3.10
 Release:        0
 Summary:        YaST2 - Network Configuration
 License:        GPL-2.0-only
@@ -33,8 +33,8 @@
 #for install task
 BuildRequires:  yast2-storage-ng
 BuildRequires:  rubygem(%rb_default_ruby_abi:yast-rake)
-# AutoYaST issue handling
-BuildRequires:  yast2 >= 4.3.3
+# NetworkService.use
+BuildRequires:  yast2 >= 4.3.9
 BuildRequires:  yast2-packager >= 4.0.18
 # Product control need xml agent
 BuildRequires:  yast2-xml
@@ -48,8 +48,8 @@
 Requires:       sysconfig >= 0.80.0
 Requires:       yast2-proxy
 Requires:       yast2-storage-ng
-# AutoYaST issue handling
-Requires:       yast2 >= 4.3.2
+# NetworkService.use
+Requires:       yast2 >= 4.3.9
 # Packages::vnc_packages
 Requires:       augeas-lenses
 Requires:       yast2-packager >= 4.0.18

++++++ yast2-network-4.3.5.tar.bz2 -> yast2-network-4.3.10.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/package/yast2-network.changes 
new/yast2-network-4.3.10/package/yast2-network.changes
--- old/yast2-network-4.3.5/package/yast2-network.changes       2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/package/yast2-network.changes      2020-06-26 
10:09:04.000000000 +0200
@@ -1,4 +1,38 @@
 -------------------------------------------------------------------
+Fri Jun 26 08:00:33 UTC 2020 - Knut Anderssen <[email protected]>
+
+- AutoYaST schema: add the setup_before_proposal element to the
+  schema (bsc#1171922)
+- 4.3.10
+
+-------------------------------------------------------------------
+Wed Jun 24 11:52:46 UTC 2020 - Josef Reidinger <[email protected]>
+
+- Do not export network when not requested (bsc#1172552)
+- 4.3.9
+
+-------------------------------------------------------------------
+Fri Jun 19 18:24:34 UTC 2020 - Knut Anderssen <[email protected]>
+
+- Do not export any settings when NetworkManager is the network
+  backend (bsc#1172822).
+- 4.3.8
+
+-------------------------------------------------------------------
+Fri Jun 19 08:52:54 UTC 2020 - Martin Vidner <[email protected]>
+
+- Save inst-sys memory by ending ag_udev_persistent after use
+  (bsc#1172139).
+- 4.3.7
+
+-------------------------------------------------------------------
+Mon Jun 15 11:53:03 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Do not export interfaces <aliases> section when there are no
+  aliases to export (bsc#1172922).
+- 4.3.6
+
+-------------------------------------------------------------------
 Thu Jun 11 08:24:34 UTC 2020 - Knut Anderssen <[email protected]>
 
 - Try to install the wireless-tools package when the package is
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/package/yast2-network.spec 
new/yast2-network-4.3.10/package/yast2-network.spec
--- old/yast2-network-4.3.5/package/yast2-network.spec  2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/package/yast2-network.spec 2020-06-26 
10:09:04.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-network
-Version:        4.3.5
+Version:        4.3.10
 Release:        0
 Summary:        YaST2 - Network Configuration
 License:        GPL-2.0-only
@@ -33,8 +33,8 @@
 #for install task
 BuildRequires:  rubygem(%rb_default_ruby_abi:yast-rake)
 BuildRequires:  yast2-storage-ng
-# AutoYaST issue handling
-BuildRequires:  yast2 >= 4.3.3
+# NetworkService.use
+BuildRequires:  yast2 >= 4.3.9
 BuildRequires:  yast2-packager >= 4.0.18
 # Product control need xml agent
 BuildRequires:  yast2-xml
@@ -48,8 +48,8 @@
 Requires:       sysconfig >= 0.80.0
 Requires:       yast2-proxy
 Requires:       yast2-storage-ng
-# AutoYaST issue handling
-Requires:       yast2 >= 4.3.2
+# NetworkService.use
+Requires:       yast2 >= 4.3.9
 # Packages::vnc_packages
 Requires:       yast2-packager >= 4.0.18
 Requires:       rubygem(%rb_default_ruby_abi:cfa) >= 0.6.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/src/autoyast-rnc/networking.rnc 
new/yast2-network-4.3.10/src/autoyast-rnc/networking.rnc
--- old/yast2-network-4.3.5/src/autoyast-rnc/networking.rnc     2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/autoyast-rnc/networking.rnc    2020-06-26 
10:09:04.000000000 +0200
@@ -9,6 +9,7 @@
   element networking {
     MAP,
     (
+      element setup_before_proposal { BOOLEAN }? &
       element start_immediately { BOOLEAN }? &
       element keep_install_network { BOOLEAN }? &
       ipv6? &
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/src/include/network/routines.rb 
new/yast2-network-4.3.10/src/include/network/routines.rb
--- old/yast2-network-4.3.5/src/include/network/routines.rb     2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/include/network/routines.rb    2020-06-26 
10:09:04.000000000 +0200
@@ -41,8 +41,6 @@
       Yast.import "Popup"
       Yast.import "Progress"
       Yast.import "String"
-      Yast.import "NetworkService"
-      Yast.import "NetworkInterfaces"
       Yast.import "Arch"
       Yast.import "Confirm"
       Yast.import "Map"
@@ -678,8 +676,9 @@
     end
 
     def unconfigureable_service?
-      return true if Mode.normal && NetworkService.is_network_manager
-      return true if NetworkService.is_disabled
+      Yast.import "Lan"
+      return true if Mode.normal && Lan.yast_config&.backend?(:network_manager)
+      return true unless Lan.yast_config&.backend
 
       false
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/include/network/services/dns.rb 
new/yast2-network-4.3.10/src/include/network/services/dns.rb
--- old/yast2-network-4.3.5/src/include/network/services/dns.rb 2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/include/network/services/dns.rb        
2020-06-26 10:09:04.000000000 +0200
@@ -36,10 +36,8 @@
       Yast.import "Hostname"
       Yast.import "IP"
       Yast.import "Label"
-      Yast.import "LanItems"
       Yast.import "Popup"
       Yast.import "Map"
-      Yast.import "NetworkService"
 
       Yast.include include_target, "network/routines.rb"
       Yast.include include_target, "network/widgets.rb"
@@ -386,7 +384,7 @@
 
     # Init handler for DHCP_HOSTNAME
     def InitDhcpHostname(_key)
-      UI.ChangeWidget(Id("DHCP_HOSTNAME"), :Enabled, dhcp? && 
NetworkService.is_wicked)
+      UI.ChangeWidget(Id("DHCP_HOSTNAME"), :Enabled, dhcp? && 
config&.backend?(:wicked))
       dhcp_hostname = DNS.dhcp_hostname
 
       items = [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/src/include/network/widgets.rb 
new/yast2-network-4.3.10/src/include/network/widgets.rb
--- old/yast2-network-4.3.5/src/include/network/widgets.rb      2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/include/network/widgets.rb     2020-06-26 
10:09:04.000000000 +0200
@@ -39,7 +39,6 @@
       Yast.import "NetworkInterfaces"
       Yast.import "NetworkService"
       Yast.import "Lan"
-      Yast.import "LanItems"
 
       Yast.include include_target, "network/complex.rb"
     end
@@ -60,28 +59,12 @@
     def ManagedInit(_key)
       items = []
 
-      if NetworkService.is_backend_available(:network_manager)
+      Y2Network::Backend.available.each do |backend|
         items << Item(
-          Id("managed"),
+          Id(backend.name),
           # the user can control the network with the NetworkManager program
-          _("NetworkManager Service"),
-          NetworkService.is_network_manager
-        )
-      end
-      if NetworkService.is_backend_available(:netconfig)
-        items << Item(
-          Id("ifup"),
-          # ifup is a program name
-          _("Traditional ifup"),
-          NetworkService.is_netconfig
-        )
-      end
-      if NetworkService.is_backend_available(:wicked)
-        items << Item(
-          Id("wicked"),
-          # wicked is network configuration backend like netconfig
-          _("Wicked Service"),
-          NetworkService.is_wicked
+          backend.label,
+          !!Lan.yast_config&.backend?(backend.id)
         )
       end
 
@@ -89,7 +72,7 @@
         Id("disabled"),
         # used when no network service is active or to disable network service
         _("Network Services Disabled"),
-        NetworkService.is_disabled
+        Lan.yast_config&.backend.nil?
       )
 
       UI.ChangeWidget(Id(:managed), :Items, items)
@@ -103,21 +86,10 @@
     def ManagedStore(_key, _event)
       new_backend = UI.QueryWidget(Id(:managed), :Value)
 
-      case new_backend
-      when "ifup"
-        NetworkService.use_netconfig
-      when "managed"
-        NetworkService.use_network_manager
-      when "wicked"
-        NetworkService.use_wicked
-      else
-        NetworkService.disable
-      end
-
-      if NetworkService.Modified
-        Lan.SetModified
+      Lan.yast_config.backend = new_backend.to_sym
 
-        if Stage.normal && NetworkService.is_network_manager
+      if Lan.system_config.backend != Lan.yast_config.backend
+        if Stage.normal && Lan.yast_config&.backend?(:network_manager)
           Popup.AnyMessage(
             _("Applet needed"),
             _(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/network/clients/inst_lan.rb 
new/yast2-network-4.3.10/src/lib/network/clients/inst_lan.rb
--- old/yast2-network-4.3.5/src/lib/network/clients/inst_lan.rb 2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/network/clients/inst_lan.rb        
2020-06-26 10:09:04.000000000 +0200
@@ -100,7 +100,7 @@
     end
 
     # It returns whether the network has been configured or not. It returns
-    # true in case NetworkManager is in use, otherwise returns whehter there is
+    # true in case NetworkManager is in use, otherwise returns whether there is
     # some connection configured
     #
     # @see connections_configured?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/network/network_autoyast.rb 
new/yast2-network-4.3.10/src/lib/network/network_autoyast.rb
--- old/yast2-network-4.3.5/src/lib/network/network_autoyast.rb 2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/network/network_autoyast.rb        
2020-06-26 10:09:04.000000000 +0200
@@ -78,22 +78,17 @@
 
       log.info("Setting network service according to AY profile")
 
-      use_network_manager = ay_networking_section["managed"]
-      use_network_manager = Lan.UseNetworkManager if use_network_manager.nil?
+      use_network_manager = Lan.yast_config&.backend?(:network_manager)
 
-      nm_available = NetworkService.is_backend_available(:network_manager) if 
use_network_manager
-
-      if use_network_manager && nm_available
+      if use_network_manager && Lan.yast_config.backend.available?
         log.info("- using NetworkManager")
-
-        NetworkService.use_network_manager
       else
         log.info("- using wicked")
         log.warn("- NetworkManager requested but not available") if 
use_network_manager
-
-        NetworkService.use_wicked
+        Lan.yast_config&.backend = :wicked
       end
 
+      NetworkService.use(Lan.yast_config&.backend&.id)
       NetworkService.EnableDisableNow
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/src/lib/network/wicked.rb 
new/yast2-network-4.3.10/src/lib/network/wicked.rb
--- old/yast2-network-4.3.5/src/lib/network/wicked.rb   2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/network/wicked.rb  2020-06-26 
10:09:04.000000000 +0200
@@ -64,6 +64,7 @@
     # @param query [String] xpath query. See man wicked for info what is 
supported there.
     # @return [String] result of the query
     def query_wicked(iface, query)
+      Yast.import "NetworkService"
       raise ArgumentError, "A network device has to be specified" if 
iface.nil? || iface.empty?
       raise "Parsing not supported for network service in use" if 
!NetworkService.is_wicked
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/autoinst_profile/dns_section.rb 
new/yast2-network-4.3.10/src/lib/y2network/autoinst_profile/dns_section.rb
--- old/yast2-network-4.3.5/src/lib/y2network/autoinst_profile/dns_section.rb   
2020-06-11 16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/y2network/autoinst_profile/dns_section.rb  
2020-06-26 10:09:04.000000000 +0200
@@ -103,7 +103,7 @@
       #
       # @return [Boolean] Result true on success or false otherwise
       def init_from_network(dns, hostname)
-        @dhcp_hostname = hostname.dhcp_hostname
+        @dhcp_hostname = hostname.dhcp_hostname == :any
         @hostname = hostname.hostname
         @nameservers = dns.nameservers.map(&:to_s)
         @resolv_conf_policy = dns.resolv_conf_policy
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/autoinst_profile/interface_section.rb 
new/yast2-network-4.3.10/src/lib/y2network/autoinst_profile/interface_section.rb
--- 
old/yast2-network-4.3.5/src/lib/y2network/autoinst_profile/interface_section.rb 
    2020-06-11 16:13:54.000000000 +0200
+++ 
new/yast2-network-4.3.10/src/lib/y2network/autoinst_profile/interface_section.rb
    2020-06-26 10:09:04.000000000 +0200
@@ -332,6 +332,13 @@
         true
       end
 
+      # @see SectionWithAttributes#to_hashes
+      def to_hashes
+        hash = super
+        hash.delete("aliases") if hash.key?("aliases") && 
hash["aliases"].empty?
+        hash
+      end
+
       # Helper to get wireless keys as array
       # @return [Array<String>]
       def wireless_keys
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/autoinst_profile/networking_section.rb
 
new/yast2-network-4.3.10/src/lib/y2network/autoinst_profile/networking_section.rb
--- 
old/yast2-network-4.3.5/src/lib/y2network/autoinst_profile/networking_section.rb
    2020-06-11 16:13:54.000000000 +0200
+++ 
new/yast2-network-4.3.10/src/lib/y2network/autoinst_profile/networking_section.rb
   2020-06-26 10:09:04.000000000 +0200
@@ -54,6 +54,8 @@
       attr_accessor :udev_rules
       # @return [S390DevicesSection]
       attr_accessor :s390_devices
+      # @return [Boolean]
+      attr_accessor :managed
 
       # Creates an instance based on the profile representation used by the 
AutoYaST modules
       # (hash with nested hashes and arrays).
@@ -62,6 +64,7 @@
       # @return [NetworkingSection]
       def self.new_from_hashes(hash)
         result = new
+        result.managed = hash["managed"]
         result.setup_before_proposal = hash.fetch("setup_before_proposal", 
false)
         result.start_immediately = hash.fetch("start_immediately", false)
         result.keep_install_network = hash.fetch("keep_install_network", true)
@@ -86,6 +89,7 @@
         result = new
         return result unless config
 
+        result.managed = config.backend?(:network_manager)
         build_dns = config.dns || config.hostname
 
         result.routing = RoutingSection.new_from_network(config.routing) if 
config.routing
@@ -100,13 +104,18 @@
       #
       # @return [Hash]
       def to_hashes
-        {
-          "routing"      => routing.to_hashes,
-          "dns"          => dns.to_hashes,
-          "interfaces"   => interfaces.to_hashes,
-          "net-udev"     => udev_rules.to_hashes,
-          "s390-devices" => s390_devices.to_hashes
-        }
+        result = {}
+        result["dns"] = dns&.to_hashes || {}
+        unless managed
+          result["routing"] = routing&.to_hashes || {}
+          result["net-udev"] = udev_rules&.udev_rules&.map(&:to_hashes) || []
+          result["interfaces"] = interfaces&.interfaces&.map(&:to_hashes) || []
+          result["s390-devices"] = s390_devices&.to_hashes&.fetch("devices", 
[]) || []
+        end
+
+        result.keys.each { |k| result.delete(k) if result[k].empty? }
+        result["managed"] = true if managed
+        result
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/src/lib/y2network/backend.rb 
new/yast2-network-4.3.10/src/lib/y2network/backend.rb
--- old/yast2-network-4.3.5/src/lib/y2network/backend.rb        1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-network-4.3.10/src/lib/y2network/backend.rb       2020-06-26 
10:09:04.000000000 +0200
@@ -0,0 +1,95 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require "yast"
+
+module Y2Network
+  # This class is the base class for the different network backends and also
+  # responsible of listing the supported ones.
+  class Backend
+    include Yast::I18n
+
+    # @return [Symbol] backend id
+    attr_reader :id
+
+    # Constructor
+    #
+    # @param id [Symbol]
+    def initialize(id)
+      textdomain "network"
+      Yast.import "NetworkService"
+
+      @id = id
+    end
+
+    # Return the backend short name
+    #
+    # @return [String]
+    def name
+      id.to_s
+    end
+
+    def ==(other)
+      return false unless other
+
+      id == other.id
+    end
+
+    alias_method :eql?, :==
+
+    # Return the translated backend label
+    #
+    # @return [String]
+    def label
+      raise NotImplementedError
+    end
+
+    alias_method :to_s, :name
+
+    # Return all the supported backends
+    #
+    # @return [Array<Backend>]
+    def self.all
+      require "y2network/backends"
+      @all ||= Backends.constants.map { |c| Backends.const_get(c).new }
+    end
+
+    # Return all the supported and installed backends
+    #
+    # @return [Array<Backend>]
+    def self.available
+      all.select(&:available?)
+    end
+
+    # Return the backend with the given id when supported
+    #
+    # @param id [Symbol] the backend id to be find
+    # @return [Backend, nil]
+    def self.by_id(id)
+      all.find { |b| b.id == id }
+    end
+
+    # Return whether the backend is available or not
+    #
+    # @return [Boolean]
+    def available?
+      Yast::NetworkService.is_backend_available(id)
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/backends/netconfig.rb 
new/yast2-network-4.3.10/src/lib/y2network/backends/netconfig.rb
--- old/yast2-network-4.3.5/src/lib/y2network/backends/netconfig.rb     
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-network-4.3.10/src/lib/y2network/backends/netconfig.rb    
2020-06-26 10:09:04.000000000 +0200
@@ -0,0 +1,36 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require "y2network/backend"
+
+module Y2Network
+  module Backends
+    # This class represents the Netconfig backend
+    class Netconfig < Backend
+      def initialize
+        textdomain "network"
+        super(:netconfig)
+      end
+
+      def label
+        _("Traditional ifup")
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/backends/network_manager.rb 
new/yast2-network-4.3.10/src/lib/y2network/backends/network_manager.rb
--- old/yast2-network-4.3.5/src/lib/y2network/backends/network_manager.rb       
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-network-4.3.10/src/lib/y2network/backends/network_manager.rb      
2020-06-26 10:09:04.000000000 +0200
@@ -0,0 +1,36 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require "y2network/backend"
+
+module Y2Network
+  module Backends
+    # This class represents the NetworkManager backend
+    class NetworkManager < Backend
+      def initialize
+        textdomain "network"
+        super(:network_manager)
+      end
+
+      def label
+        _("Network Manager")
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/backends/wicked.rb 
new/yast2-network-4.3.10/src/lib/y2network/backends/wicked.rb
--- old/yast2-network-4.3.5/src/lib/y2network/backends/wicked.rb        
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-network-4.3.10/src/lib/y2network/backends/wicked.rb       
2020-06-26 10:09:04.000000000 +0200
@@ -0,0 +1,36 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require "y2network/backend"
+
+module Y2Network
+  module Backends
+    # This class represents the wicked backend
+    class Wicked < Backend
+      def initialize
+        textdomain "network"
+        super(:wicked)
+      end
+
+      def label
+        _("Wicked Service")
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/src/lib/y2network/backends.rb 
new/yast2-network-4.3.10/src/lib/y2network/backends.rb
--- old/yast2-network-4.3.5/src/lib/y2network/backends.rb       1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-network-4.3.10/src/lib/y2network/backends.rb      2020-06-26 
10:09:04.000000000 +0200
@@ -0,0 +1,3 @@
+require "y2network/backends/network_manager"
+require "y2network/backends/wicked"
+require "y2network/backends/netconfig"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/clients/auto.rb 
new/yast2-network-4.3.10/src/lib/y2network/clients/auto.rb
--- old/yast2-network-4.3.5/src/lib/y2network/clients/auto.rb   2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/y2network/clients/auto.rb  2020-06-26 
10:09:04.000000000 +0200
@@ -96,11 +96,15 @@
       end
 
       def modified
-        Yast::Lan.SetModified
+        self.class.modified = true
       end
 
       def modified?
-        Yast::Lan.Modified
+        !!self.class.modified
+      end
+
+      class << self
+        attr_accessor :modified
       end
 
       def export
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/src/lib/y2network/config.rb 
new/yast2-network-4.3.10/src/lib/y2network/config.rb
--- old/yast2-network-4.3.5/src/lib/y2network/config.rb 2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/y2network/config.rb        2020-06-26 
10:09:04.000000000 +0200
@@ -26,6 +26,7 @@
 require "y2network/connection_configs_collection"
 require "y2network/physical_interface"
 require "y2network/can_be_copied"
+require "y2network/backend"
 
 module Y2Network
   # This class represents the current network configuration including 
interfaces,
@@ -44,6 +45,8 @@
     include CanBeCopied
     include Yast::Logger
 
+    # @return [Backend, Symbol, nil]
+    attr_reader :backend
     # @return [InterfacesCollection]
     attr_accessor :interfaces
     # @return [ConnectionConfigsCollection]
@@ -105,11 +108,13 @@
     # @param opts   [Hash] configuration options
     # @option opts  [InterfacesCollection] :interfaces List of interfaces
     # @option opts  [ConnectionConfigsCollection] :connections List of 
connection configurations
+    # @option opts  [S390GroupDevicesCollection] :s390_devices
     # @option opts  [Routing] :routing Object with routing configuration
     # @option opts  [DNS] :dns Object with DNS configuration
     # @option opts  [Hostname] :hostname Object with Hostname configuration
     # @option opts  [Array<Driver>] :drivers List of available drivers
     def initialize(source:, **opts)
+      @backend = opts.fetch(:backend, nil)
       @interfaces = opts.fetch(:interfaces, InterfacesCollection.new)
       @connections = opts.fetch(:connections, ConnectionConfigsCollection.new)
       @s390_devices = opts.fetch(:s390_devices, S390GroupDevicesCollection.new)
@@ -139,6 +144,7 @@
     # @return [Boolean] true if both configurations are equal; false otherwise
     def ==(other)
       source == other.source &&
+        backend == other.backend &&
         interfaces == other.interfaces &&
         routing == other.routing &&
         dns == other.dns &&
@@ -245,6 +251,17 @@
       ConnectionConfigsCollection.new(result)
     end
 
+    # Return whether the config backend is the one given or not
+    #
+    # @param name [Symbol]
+    def backend?(name)
+      backend&.id == name
+    end
+
+    def backend=(id)
+      @backend = Y2Network::Backend.all.find { |b| b.id == id }
+    end
+
     alias_method :eql?, :==
 
   private
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/src/lib/y2network/udev_rule.rb 
new/yast2-network-4.3.10/src/lib/y2network/udev_rule.rb
--- old/yast2-network-4.3.5/src/lib/y2network/udev_rule.rb      2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/y2network/udev_rule.rb     2020-06-26 
10:09:04.000000000 +0200
@@ -160,6 +160,7 @@
         Yast::SCR.Write(Yast::Path.new(".udev_persistent.rules"), 
udev_rules.map(&:to_s))
         # Writes changes to the rules file
         Yast::SCR.Write(Yast::Path.new(".udev_persistent.nil"), [])
+        Yast::SCR.UnmountAgent(Yast::Path.new(".udev_persistent"))
       end
 
       # Writes drivers specific udev rules to the filesystem
@@ -177,6 +178,7 @@
         Yast::SCR.Write(Yast::Path.new(".udev_persistent.drivers"), rules_hash)
         # Writes changes to the rules file
         Yast::SCR.Write(Yast::Path.new(".udev_persistent.nil"), [])
+        Yast::SCR.UnmountAgent(Yast::Path.new(".udev_persistent"))
       end
 
       # Clears rules cache map
@@ -191,6 +193,7 @@
         return @all[group] if @all[group]
 
         rules_map = 
Yast::SCR.Read(Yast::Path.new(".udev_persistent.#{group}")) || {}
+        Yast::SCR.UnmountAgent(Yast::Path.new(".udev_persistent"))
         @all[group] = rules_map.values.map do |parts|
           udev_parts = parts.map { |p| UdevRulePart.from_string(p) }.compact
           new(udev_parts)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/widgets/interfaces_table.rb 
new/yast2-network-4.3.10/src/lib/y2network/widgets/interfaces_table.rb
--- old/yast2-network-4.3.5/src/lib/y2network/widgets/interfaces_table.rb       
2020-06-11 16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/y2network/widgets/interfaces_table.rb      
2020-06-26 10:09:04.000000000 +0200
@@ -22,7 +22,6 @@
 require "y2network/presenters/interface_summary"
 require "y2network/presenters/s390_group_device_summary"
 
-Yast.import "NetworkService"
 Yast.import "Lan"
 Yast.import "Popup"
 Yast.import "UI"
@@ -65,7 +64,7 @@
 
       # Workaround for usage in old CWM which also cache content of cwm items
       def init
-        if Yast::NetworkService.is_network_manager
+        if config.backend?(:network_manager)
           Yast::Popup.Warning(
             _(
               "Network is currently handled by NetworkManager\n" \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/widgets/ip4_forwarding.rb 
new/yast2-network-4.3.10/src/lib/y2network/widgets/ip4_forwarding.rb
--- old/yast2-network-4.3.5/src/lib/y2network/widgets/ip4_forwarding.rb 
2020-06-11 16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/y2network/widgets/ip4_forwarding.rb        
2020-06-26 10:09:04.000000000 +0200
@@ -18,7 +18,6 @@
 # find current contact information at www.suse.com.
 
 require "cwm/common_widgets"
-Yast.import "NetworkService"
 
 module Y2Network
   module Widgets
@@ -31,7 +30,7 @@
 
       def init
         self.value = @config.routing.forward_ipv4
-        disable if Yast::NetworkService.network_manager?
+        disable if @config.backend?(:network_manager)
       end
 
       def store
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/widgets/ip6_forwarding.rb 
new/yast2-network-4.3.10/src/lib/y2network/widgets/ip6_forwarding.rb
--- old/yast2-network-4.3.5/src/lib/y2network/widgets/ip6_forwarding.rb 
2020-06-11 16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/y2network/widgets/ip6_forwarding.rb        
2020-06-26 10:09:04.000000000 +0200
@@ -18,7 +18,6 @@
 # find current contact information at www.suse.com.
 
 require "cwm/common_widgets"
-Yast.import "NetworkService"
 
 module Y2Network
   module Widgets
@@ -31,7 +30,7 @@
 
       def init
         self.value = @config.routing.forward_ipv6
-        disable if Yast::NetworkService.network_manager?
+        disable if @config.backend?(:network_manager)
       end
 
       def store
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/widgets/routing_buttons.rb 
new/yast2-network-4.3.10/src/lib/y2network/widgets/routing_buttons.rb
--- old/yast2-network-4.3.5/src/lib/y2network/widgets/routing_buttons.rb        
2020-06-11 16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/y2network/widgets/routing_buttons.rb       
2020-06-26 10:09:04.000000000 +0200
@@ -43,7 +43,7 @@
       end
 
       def init
-        disable if Yast::NetworkService.network_manager?
+        disable if @config.backend?(:network_manager)
       end
     end
 
@@ -69,7 +69,7 @@
       end
 
       def init
-        disable if Yast::NetworkService.network_manager?
+        disable if @config.backend?(:network_manager)
       end
     end
 
@@ -92,7 +92,7 @@
       end
 
       def init
-        disable if Yast::NetworkService.network_manager?
+        disable if @table&.config&.backend?(:network_manager)
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/src/lib/y2network/widgets/routing_table.rb 
new/yast2-network-4.3.10/src/lib/y2network/widgets/routing_table.rb
--- old/yast2-network-4.3.5/src/lib/y2network/widgets/routing_table.rb  
2020-06-11 16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/src/lib/y2network/widgets/routing_table.rb 
2020-06-26 10:09:04.000000000 +0200
@@ -23,7 +23,7 @@
 require "y2network/interface"
 
 Yast.import "Label"
-Yast.import "NetworkService"
+Yast.import "Lan"
 
 module Y2Network
   module Widgets
@@ -60,7 +60,7 @@
       # TODO: just workaround to make it work with old hash based CWM
       def init
         redraw_table
-        disable if Yast::NetworkService.network_manager?
+        disable if config.backend?(:network_manager)
       end
 
       def selected_route
@@ -92,6 +92,10 @@
       def redraw_table
         change_items(items)
       end
+
+      def config
+        Yast::Lan.yast_config
+      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/src/modules/Lan.rb 
new/yast2-network-4.3.10/src/modules/Lan.rb
--- old/yast2-network-4.3.5/src/modules/Lan.rb  2020-06-11 16:13:54.000000000 
+0200
+++ new/yast2-network-4.3.10/src/modules/Lan.rb 2020-06-26 10:09:04.000000000 
+0200
@@ -136,58 +136,7 @@
     # function for use from autoinstallation (Fate #301032)
     def isAnyInterfaceDown
       down = false
-      link_status = {}
-      net_devices = Builtins.splitstring(
-        Ops.get_string(
-          Convert.convert(
-            SCR.Execute(
-              path(".target.bash_output"),
-              "/usr/bin/ls /sys/class/net/ | /usr/bin/grep -v lo | /usr/bin/tr 
'\n' ','"
-            ),
-            from: "any",
-            to:   "map <string, any>"
-          ),
-          "stdout",
-          ""
-        ),
-        ","
-      )
-      net_devices = Builtins.filter(net_devices) do |item|
-        Ops.greater_than(Builtins.size(item), 0)
-      end
-      Builtins.foreach(net_devices) do |net_dev|
-        row = Builtins.splitstring(
-          Ops.get_string(
-            SCR.Execute(
-              path(".target.bash_output"),
-              Builtins.sformat(
-                "/usr/sbin/ip address show dev %1 | /usr/bin/grep 
'inet\\|link' | " \
-                  "/usr/bin/sed 's/^ \\+//g'| /usr/bin/cut -d' ' -f-2",
-                net_dev.shellescape
-              )
-            ),
-            "stdout",
-            ""
-          ),
-          "\n"
-        )
-        tmp_mac = ""
-        addr = false
-        Builtins.foreach(row) do |column|
-          tmp_col = Builtins.splitstring(column, " ")
-          next if Ops.less_than(Builtins.size(tmp_col), 2)
-
-          if Builtins.issubstring(Ops.get(tmp_col, 0, ""), "link/ether")
-            tmp_mac = Ops.get(tmp_col, 1, "")
-          end
-          if Builtins.issubstring(Ops.get(tmp_col, 0, ""), "inet") &&
-              !Builtins.issubstring(Ops.get(tmp_col, 0, ""), "inet6")
-            addr = true
-          end
-        end
-        Ops.set(link_status, tmp_mac, addr) if 
Ops.greater_than(Builtins.size(tmp_mac), 0)
-        Builtins.y2debug("link_status %1", link_status)
-      end
+      link_status = devices_link_status
 
       log.info("link_status #{link_status}")
       configurations = (Yast::Lan.system_config&.interfaces&.map(&:name) || [])
@@ -224,16 +173,17 @@
         _("Detect network devices"),
         # Progress stage 2/7
         _("Read driver information"),
-        # Progress stage 3/7 - multiple devices may be present, really plural
+        # Progress stage 3/7
+        _("Detect current status"),
+        # Progress stage 4/7 - multiple devices may be present, really plural
         _("Read device configuration"),
-        # Progress stage 4/7
-        _("Read network configuration"),
         # Progress stage 5/7
-        _("Read installation information"),
+        _("Read network configuration"),
         # Progress stage 6/7
-        _("Read routing configuration"),
+        _("Read installation information"),
         # Progress stage 7/7
-        _("Detect current status")
+        _("Read routing configuration")
+
       ]
 
       steps << _("Read firewall configuration") if firewalld.installed?
@@ -317,15 +267,21 @@
 
       return false if Abort()
 
-      ProgressNextStage(_("Reading device configuration...")) if @gui
-      read_config
+      begin
+        ProgressNextStage(_("Detecting current status...")) if @gui
+        NetworkService.Read
+        Builtins.sleep(sl)
+
+        return false if Abort()
 
-      Builtins.sleep(sl)
+        ProgressNextStage(_("Reading device configuration...")) if @gui
+        read_config
 
-      return false if Abort()
+        Builtins.sleep(sl)
 
-      ProgressNextStage(_("Reading network configuration...")) if @gui
-      begin
+        return false if Abort()
+
+        ProgressNextStage(_("Reading network configuration...")) if @gui
         NetworkConfig.Read
 
         @ipv6 = readIPv6
@@ -337,12 +293,6 @@
 
         return false if Abort()
 
-        ProgressNextStage(_("Detecting current status...")) if @gui
-        NetworkService.Read
-        Builtins.sleep(sl)
-
-        return false if Abort()
-
         if firewalld.installed? && !firewalld.read?
           ProgressNextStage(_("Reading firewall configuration...")) if @gui
           firewalld.read
@@ -415,18 +365,16 @@
       nil
     end
 
-    NM_DHCP_TIMEOUT = 45
-
     # Update the SCR according to network settings
     # @return true on success
     def Write(gui: true, apply_config: !write_only)
-      Builtins.y2milestone("Writing configuration")
+      log.info("Writing configuration")
 
       # Query modified flag in all components, not just LanItems - DNS,
       # Routing, NetworkConfig too in order not to discard changes made
       # outside LanItems (bnc#439235)
       if !Modified()
-        Builtins.y2milestone("No changes to network setup -> nothing to write")
+        log.info("No changes to network setup -> nothing to write")
         return true
       end
 
@@ -534,7 +482,7 @@
         # Progress step 9
         ProgressNextStage(_("Activating network services..."))
 
-        activate_network_service
+        select_network_service ? activate_network_service : 
NetworkService.disable
 
         Builtins.sleep(sl)
       end
@@ -546,21 +494,7 @@
       update_mta_config if !apply_config
       Builtins.sleep(sl)
 
-      if NetworkService.is_network_manager
-        network = false
-        timeout = NM_DHCP_TIMEOUT
-        while Ops.greater_than(timeout, 0)
-          if NetworkService.isNetworkRunning
-            network = true
-            break
-          end
-          Builtins.y2milestone("waiting for network ... %1", timeout)
-          Builtins.sleep(1000)
-          timeout = Ops.subtract(timeout, 1)
-        end
-
-        Popup.Error(_("No network running")) unless network
-      end
+      ensure_network_running if yast_config.backend?(:network_manager)
 
       # Final progress step
       ProgressNextStage(_("Finished"))
@@ -667,18 +601,10 @@
     # @return dumped settings
     def Export
       profile = 
Y2Network::AutoinstProfile::NetworkingSection.new_from_network(yast_config)
-      ay = {
-        "dns"                  => profile.dns&.to_hashes || {},
-        "net-udev"             => 
profile.udev_rules&.udev_rules&.map(&:to_hashes) || [],
-        "s390-devices"         => 
profile.s390_devices&.to_hashes&.fetch("devices", []) || [],
-        "config"               => NetworkConfig.Export,
-        "interfaces"           => 
profile.interfaces&.interfaces&.map(&:to_hashes) || [],
-        "ipv6"                 => @ipv6,
-        "routing"              => profile.routing&.to_hashes || {},
-        "managed"              => NetworkService.is_network_manager,
-        "start_immediately"    => autoinst.start_immediately,
-        "keep_install_network" => autoinst.keep_install_network
-      }
+      ay = profile.to_hashes
+      ay["ipv6"] = @ipv6
+      ay["config"] = NetworkConfig.Export unless ay["managed"]
+
       log.info("Exported map: #{ay}")
       deep_copy(ay)
     end
@@ -736,7 +662,7 @@
     def Packages
       pkgs = []
 
-      if NetworkService.is_network_manager
+      if yast_config&.backend?(:network_manager)
         pkgs << "NetworkManager" if !PackageSystem.Installed("NetworkManager")
       elsif !PackageSystem.Installed("wpa_supplicant")
         # we have to add wpa_supplicant when wlan is in game, wicked relies on 
it
@@ -773,6 +699,7 @@
     #
     # @return [Array<String>] list of ntp servers obtained byg DHCP
     def dhcp_ntp_servers
+      # Used before the config has been read
       return [] if !NetworkService.isNetworkRunning || 
Yast::NetworkService.is_network_manager
 
       ReadWithCacheNoGUI()
@@ -840,8 +767,26 @@
     publish function: :AutoPackages, type: "map ()"
     publish function: :HaveXenBridge, type: "boolean ()"
 
+    NM_DHCP_TIMEOUT = 45
+
   private
 
+    def ensure_network_running
+      network = false
+      timeout = NM_DHCP_TIMEOUT
+      while timeout > 0
+        if NetworkService.isNetworkRunning
+          network = true
+          break
+        end
+        log.info("waiting for network ... #{timeout}")
+        sleep(1)
+        timeout -= 1
+      end
+
+      Popup.Error(_("No network running")) unless network
+    end
+
     # @return [Array<Y2Network::Config>]
     attr_reader :configs
 
@@ -894,13 +839,58 @@
     # It clears already read configuration.
     def read_config
       system_config = Y2Network::Config.from(:sysconfig)
+      system_config.backend = NetworkService.cached_name
       Yast::Lan.add_config(:system, system_config)
       Yast::Lan.add_config(:yast, system_config.copy)
     end
 
+    def select_network_service
+      NetworkService.use(yast_config&.backend&.id)
+    end
+
     def firewalld
       Y2Firewall::Firewalld.instance
     end
+
+    # Obtains the list of the system network devices names through the sysfs
+    #
+    # @return [Array<String>] names of the system network devices
+    def devices_from_sys
+      interfaces = Yast::Execute.stdout.on_target!("/usr/bin/ls", 
"/sys/class/net").split("\n")
+      interfaces.delete("lo")
+      interfaces
+    end
+
+    # Returns the mac address and whether the device has an ip associated or
+    # not of the given interface name
+    #
+    # @return [Array(2)<String, Boolean>] mac address and ip assignation status
+    def link_status(name)
+      addr_show = ["/usr/sbin/ip", "address", "show", name]
+      inet_link = ["grep", "inet\\|link"]
+      row = Yast::Execute.stdout.on_target!(addr_show, 
inet_link).split("\n").map(&:strip)
+      addr = false
+      tmp_mac = nil
+      row.each do |column|
+        tmp_col = column.split(" ")
+        next if tmp_col.size < 2
+
+        tmp_mac = tmp_col[1] if tmp_col[0] == "link/ether"
+        addr = true if tmp_col[0] == "inet"
+      end
+
+      [tmp_mac, addr]
+    end
+
+    # Convenience method to obtain the mac and ip assignment status of the
+    # system network devices
+    def devices_link_status
+      devices_from_sys.each_with_object({}) do |name, hash|
+        tmp_mac, addr = link_status(name)
+        hash[tmp_mac] ||= addr if tmp_mac
+        log.debug("link_status #{hash.inspect}")
+      end
+    end
   end
 
   Lan = LanClass.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/test/lan_test.rb 
new/yast2-network-4.3.10/test/lan_test.rb
--- old/yast2-network-4.3.5/test/lan_test.rb    2020-06-11 16:13:54.000000000 
+0200
+++ new/yast2-network-4.3.10/test/lan_test.rb   2020-06-26 10:09:04.000000000 
+0200
@@ -32,17 +32,20 @@
   subject { Yast::Lan }
 
   let(:system_config) { Y2Network::Config.new(interfaces: [], source: 
:sysconfig) }
+  let(:backend) { :wicked }
 
   describe "#Packages" do
+    let(:yast_config) do
+      Y2Network::Config.new(source: :autoinst).tap do |config|
+        config.backend = backend
+      end
+    end
+
     before(:each) do
-      allow(Yast::NetworkService)
-        .to receive(:is_network_manager)
-        .and_return(nm_enabled)
+      Yast::Lan.add_config(:yast, yast_config)
     end
 
     context "When NetworkManager is not going to be installed" do
-      let(:nm_enabled) { false }
-
       before(:each) do
         allow(Yast::PackageSystem)
           .to receive(:Installed)
@@ -63,12 +66,10 @@
     end
 
     context "When NetworkManager is selected for the target" do
-      let(:nm_enabled) { true }
+      let(:backend) { :network_manager }
 
       it "lists NetworkManager package" do
-        expect(Yast::NetworkService)
-          .to receive(:is_network_manager)
-          .and_return(true)
+        expect(yast_config).to 
receive(:backend?).with(:network_manager).and_call_original
         expect(Yast::PackageSystem)
           .to receive(:Installed)
           .with("NetworkManager")
@@ -443,4 +444,35 @@
         .from(nil).to(system_config)
     end
   end
+
+  describe "#Export" do
+    let(:backend) { :wicked }
+    let(:yast_config) do
+      Y2Network::Config.new(source: :autoinst).tap do |config|
+        config.hostname.static = "yasties"
+        config.hostname.dhcp_hostname = :any
+        config.backend = backend
+      end
+    end
+
+    before do
+      Yast::Lan.add_config(:yast, yast_config)
+    end
+
+    it "exports the current network settings" do
+      exported_profile = Yast::Lan.Export
+      expect(exported_profile["dns"]).to eql("hostname" => "yasties", 
"dhcp_hostname" => true)
+      expect(exported_profile).to_not include("interfaces")
+      expect(exported_profile).to_not include("net-udev")
+      expect(exported_profile).to_not include("s390-devices")
+    end
+
+    context "when NetworkManager is the network service" do
+      let(:backend) { :network_manager }
+
+      it "exports the managed attribute as true" do
+        expect(subject.Export).to include("managed" => true)
+      end
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/test/network_autoyast_test.rb 
new/yast2-network-4.3.10/test/network_autoyast_test.rb
--- old/yast2-network-4.3.5/test/network_autoyast_test.rb       2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/test/network_autoyast_test.rb      2020-06-26 
10:09:04.000000000 +0200
@@ -128,41 +128,30 @@
     Yast.import "Mode"
 
     let(:network_autoyast) { Yast::NetworkAutoYast.instance }
+    let(:control_use_nm) { "always" }
+    let(:backend) { :network_manager }
+    let(:installed) { true }
+    let(:net_section) { { "managed" => true } }
+    let(:yast_config) do
+      Y2Network::Config.new(source: :autoinst).tap do |config|
+        config.backend = backend
+      end
+    end
 
     before(:each) do
       allow(Yast::Mode).to receive(:autoinst).and_return(true)
-    end
-
-    def product_use_nm(nm_used)
-      allow(Yast::ProductFeatures)
-        .to receive(:GetStringFeature)
-        .with("network", "network_manager")
-        .and_return nm_used
-    end
-
-    def networking_section(net_section)
+      allow(Yast::ProductFeatures).to receive(:GetStringFeature)
+        .with("network", "network_manager").and_return(control_use_nm)
+      allow(Yast::Package).to receive(:Installed).and_return(installed)
       allow(network_autoyast).to 
receive(:ay_networking_section).and_return(net_section)
-    end
-
-    def nm_installed(installed)
-      allow(Yast::Package)
-        .to receive(:Installed)
-        .and_return installed
+      Yast::Lan.add_config(:yast, yast_config)
     end
 
     context "in SLED product" do
-      before(:each) do
-        product_use_nm("always")
-        nm_installed(true)
-        networking_section("managed" => true)
-      end
-
       it "enables NetworkManager" do
-        expect(Yast::NetworkService)
-          .to receive(:is_backend_available)
-          .with(:network_manager)
-          .and_return true
-        expect(Yast::NetworkService).to 
receive(:use_network_manager).and_return nil
+        expect(Yast::NetworkService).to receive(:is_backend_available)
+          .with(:network_manager).and_return(true)
+        expect(Yast::NetworkService).to receive(:use).with(:network_manager)
         expect(Yast::NetworkService).to receive(:EnableDisableNow).and_return 
nil
 
         network_autoyast.set_network_service
@@ -170,14 +159,13 @@
     end
 
     context "in SLES product" do
-      before(:each) do
-        product_use_nm("never")
-        nm_installed(false)
-        networking_section({})
-      end
+      let(:control_use_nm) { "never" }
+      let(:installed) { false }
+      let(:net_section) { {} }
 
       it "enables wicked" do
-        expect(Yast::NetworkService).to receive(:use_wicked).and_return nil
+        expect(Yast::PackageSystem).to 
receive(:Installed).and_return(installed)
+        expect(Yast::NetworkService).to receive(:use).with(:wicked)
         expect(Yast::NetworkService).to receive(:EnableDisableNow).and_return 
nil
 
         network_autoyast.set_network_service
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/test/y2network/autoinst_profile/dns_section_test.rb 
new/yast2-network-4.3.10/test/y2network/autoinst_profile/dns_section_test.rb
--- old/yast2-network-4.3.5/test/y2network/autoinst_profile/dns_section_test.rb 
2020-06-11 16:13:54.000000000 +0200
+++ 
new/yast2-network-4.3.10/test/y2network/autoinst_profile/dns_section_test.rb    
    2020-06-26 10:09:04.000000000 +0200
@@ -38,7 +38,7 @@
       instance_double(
         Y2Network::Hostname,
         hostname:      "linux",
-        dhcp_hostname: true
+        dhcp_hostname: :any
       )
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/test/y2network/autoinst_profile/interface_section_test.rb
 
new/yast2-network-4.3.10/test/y2network/autoinst_profile/interface_section_test.rb
--- 
old/yast2-network-4.3.5/test/y2network/autoinst_profile/interface_section_test.rb
   2020-06-11 16:13:54.000000000 +0200
+++ 
new/yast2-network-4.3.10/test/y2network/autoinst_profile/interface_section_test.rb
  2020-06-26 10:09:04.000000000 +0200
@@ -74,6 +74,29 @@
     end
   end
 
+  describe "#to_hashes" do
+    subject(:section) do
+      described_class.new_from_hashes(
+        "device"  => "eth0",
+        "aliases" => { "alias0" => { "IPADDR" => "10.100.0.1", "PREFIXLEN" => 
"24" } }
+      )
+    end
+
+    it "exports the aliases key" do
+      expect(section.to_hashes["aliases"]).to eq(section.aliases)
+    end
+
+    context "when the list of aliases is empty" do
+      subject(:section) do
+        described_class.new_from_hashes("device" => "eth0", "aliases" => {})
+      end
+
+      it "does not export the aliases key" do
+        expect(section.to_hashes).to_not have_key("aliases")
+      end
+    end
+  end
+
   describe "#wireless_keys" do
     it "returns array" do
       section = described_class.new_from_hashes({})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.3.5/test/y2network/backend_test.rb 
new/yast2-network-4.3.10/test/y2network/backend_test.rb
--- old/yast2-network-4.3.5/test/y2network/backend_test.rb      1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-network-4.3.10/test/y2network/backend_test.rb     2020-06-26 
10:09:04.000000000 +0200
@@ -0,0 +1,73 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "../test_helper"
+require "y2network/backend"
+
+describe Y2Network::Backend do
+  let(:supported_backends) { [:netconfig, :network_manager, :wicked] }
+  let(:installed_backends) { [:netconfig, :wicked] }
+  let(:network_manager) { described_class.by_id(:network_manager) }
+
+  describe "#all" do
+    it "returns all the supported backends" do
+      expect(described_class.all.map(&:id).sort).to eql(supported_backends)
+    end
+  end
+
+  describe "#available" do
+    before do
+      described_class.all.each do |backend|
+        allow(backend).to receive(:available?).and_return(true)
+      end
+    end
+
+    it "returns all the supported and installed backends" do
+      expect(network_manager).to receive(:available?).and_return(false)
+      expect(described_class.available.map(&:id).sort).to 
eql(installed_backends)
+    end
+  end
+
+  describe "#by_id" do
+    it "returns the backend with the given id when present" do
+      expect(described_class.by_id(:wicked).class).to 
eql(Y2Network::Backends::Wicked)
+      expect(described_class.by_id(:wicked).id).to eql(:wicked)
+    end
+
+    it "returns nil when the backend is not supported" do
+      expect(described_class.by_id(:networkd)).to be_nil
+    end
+  end
+
+  describe ".label" do
+    it "raises an exception when not implemented" do
+      expect { described_class.new(:networkd).label }.to 
raise_error(NotImplementedError)
+    end
+
+    it "returns the translated backend label when implemented" do
+      expect(network_manager.label).to eq("Network Manager")
+    end
+  end
+
+  describe ".id" do
+    it "returns the backend id" do
+      expect(network_manager.id).to eql(:network_manager)
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-network-4.3.5/test/y2network/clients/auto_test.rb 
new/yast2-network-4.3.10/test/y2network/clients/auto_test.rb
--- old/yast2-network-4.3.5/test/y2network/clients/auto_test.rb 2020-06-11 
16:13:54.000000000 +0200
+++ new/yast2-network-4.3.10/test/y2network/clients/auto_test.rb        
2020-06-26 10:09:04.000000000 +0200
@@ -139,19 +139,15 @@
 
   describe "#modified" do
     it "sets the network config as modified" do
-      expect(Yast::Lan).to receive(:SetModified)
-
-      subject.modified
+      subject.class.modified = false
+      expect { subject.modified }.to change { subject.modified? 
}.from(false).to(true)
     end
   end
 
   describe "#modified?" do
-    let(:modified) { :true_or_false }
-
-    it "returns whether lan configuration has been modified or not" do
-      allow(Yast::Lan).to receive(:Modified).and_return(modified)
-
-      expect(subject.modified?).to eql(modified)
+    it "returns whether modified is called or not" do
+      subject.modified
+      expect(subject.modified?).to eq true
     end
   end
 


Reply via email to