Hello community,

here is the log from the commit of package yast2-network for openSUSE:Factory 
checked in at 2012-11-06 16:25:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-network (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-network.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-network", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes      
2012-10-11 11:38:39.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 
2012-11-06 16:25:22.000000000 +0100
@@ -1,0 +2,22 @@
+Tue Nov  6 10:44:59 UTC 2012 - [email protected]
+
+- Fixed testsuite. tests/include.ycp, tests/udev.ycp failed when
+missing /etc/sysconfig/console. 
+
+-------------------------------------------------------------------
+Thu Oct 25 21:04:58 UTC 2012 - [email protected]
+
+- initialize s390 specific device variables when switching interfaces
+- s390 code cleanup. chan_mode variable is not shared between different
+device types anymore. qeth_macaddress is set according sysconfig now.
+- bnc#747844
+- 2.24.8
+
+-------------------------------------------------------------------
+Wed Oct 17 12:42:29 UTC 2012 - [email protected]
+
+- Refactoring editing interface names.
+- Added nic name checking according bnc#784952 
+- 2.24.7
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-network.spec ++++++
--- /var/tmp/diff_new_pack.JtaexE/_old  2012-11-06 16:25:24.000000000 +0100
+++ /var/tmp/diff_new_pack.JtaexE/_new  2012-11-06 16:25:24.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-network
-Version:        2.24.6
+Version:        2.24.8
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -37,8 +37,8 @@
 # Wizard::SetDesktopTitleAndIcon
 # yast2 v2.23.0 - support for shel (un)quoting
 # yast2 v2.23.6 - updated API for IPv6
-BuildRequires:  yast2 >= 2.21.22
-Requires:       yast2 >= 2.23.5
+BuildRequires:  yast2 >= 2.23.6
+Requires:       yast2 >= 2.23.6
 
 #netconfig (FaTE #303618)
 Requires:       sysconfig >= 0.71.2

++++++ yast2-network-2.24.6.tar.bz2 -> yast2-network-2.24.8.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-2.24.6/VERSION 
new/yast2-network-2.24.8/VERSION
--- old/yast2-network-2.24.6/VERSION    2012-10-03 11:06:49.000000000 +0200
+++ new/yast2-network-2.24.8/VERSION    2012-11-06 08:39:56.000000000 +0100
@@ -1 +1 @@
-2.24.6
+2.24.8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-2.24.6/src/lan/complex.ycp 
new/yast2-network-2.24.8/src/lan/complex.ycp
--- old/yast2-network-2.24.6/src/lan/complex.ycp        2012-09-20 
10:28:35.000000000 +0200
+++ new/yast2-network-2.24.8/src/lan/complex.ycp        2012-11-06 
08:39:45.000000000 +0100
@@ -249,7 +249,8 @@
 
         LanItems::startmode = "hotplug";
         LanItems::bootproto = "none";
-        LanItems::GetReplacedItemUdev("KERNELS", 
LanItems::getCurrentItem()["hwinfo", "busid"]:"");
+        // if particular bond slave uses mac based persistency, overwrite to 
bus id based one. Don't touch otherwise.
+        LanItems::ReplaceItemUdev( "ATTR{address}", "KERNELS", 
LanItems::getCurrentItem()["hwinfo", "busid"]:"");
 
         LanItems::Commit();
     });
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-2.24.6/src/lan/hardware.ycp 
new/yast2-network-2.24.8/src/lan/hardware.ycp
--- old/yast2-network-2.24.6/src/lan/hardware.ycp       2012-09-20 
10:28:35.000000000 +0200
+++ new/yast2-network-2.24.8/src/lan/hardware.ycp       2012-11-06 
08:39:56.000000000 +0100
@@ -372,8 +372,122 @@
     return ret;
 }
 
+/**
+ * Checks if given name can be accepted as nic's new one.
+ *
+ * @returns false and pops up an explanation if the name is invalid
+ */
+boolean CheckUdevNicName( string name)
+{
+    // when dev_name changed, rename ifcfg (both in NetworkInterfaces and 
LanItems)
+    boolean error = false;
+
+    if( UsedNicName( name) )
+    {
+        Popup::Error(_("Configuration name already exists."));
+        return false;
+    }
+    if( !ValidNicName( name) )
+    {
+        Popup::Error(_("Invalid configuration name."));
+        return false;
+    } 
+
+    return true;
+}
+
+/**
+ * Dialog for editing nic's udev rules.
+ *
+ * @returns nic name. New one if `ok, old one otherwise.
+ */
+string EditUdevRulesDialog()
+{
+    UI::OpenDialog(
+            `VBox(
+                `RadioButtonGroup(`id(`udev_type),
+                    `VBox(
+                        //make sure there is enough space (#367239)
+                        `HSpacing(30),
+                        `Label(_("Rule by:")),
+                        `Left(`RadioButton(`id(`mac), sformat("MAC address : 
%1", LanItems::getCurrentItem()["hwinfo", "mac"]:""))),
+                        `Left(`RadioButton(`id(`busid), sformat("BusID : %1", 
LanItems::getCurrentItem()["hwinfo", "busid"]:"") ))
+                        )
+                    ),
+                `Left(
+                    `HBox(
+                        `CheckBox(`id(`change_dev_name), `opt(`notify), 
_("Change DeviceName"), false),
+                        `InputField(`id(`dev_name), "", 
LanItems::GetItemUdev("NAME"))
+                        )
+                    ),
+                `VSpacing(0.5),
+                `HBox( `PushButton (`id(`ok), `opt(`default), Label::OKButton 
()),
+                    `PushButton (`id(`cancel), Label::CancelButton ())
+                    )
+                )
+            );
+
+    if (size(LanItems::GetItemUdev("ATTR{address}"))>0) 
+    {
+        UI::ChangeWidget(`id(`udev_type), `CurrentButton, `mac);
+    }
+    else 
+    {
+        if (size(LanItems::GetItemUdev("KERNELS"))>0) 
+        {
+            UI::ChangeWidget(`id(`udev_type), `CurrentButton, `busid);
+        }
+        else 
+            y2error("Unknown udev rule ");
+    }
+
+    UI::ChangeWidget(`dev_name, `Enabled, false);
+
+    any ret = nil;
+    while( ret != `cancel && ret != `abort && ret != `ok)
+    {
+        ret = UI::UserInput();
+        boolean change_name_active = 
(boolean)UI::QueryWidget(`change_dev_name, `Value);
+
+        if (ret == `change_dev_name) 
+        {
+            UI::ChangeWidget(`dev_name, `Enabled, change_name_active);
+        }
+
+        if(ret == `ok)
+        {
+            string old_name = LanItems::GetItemUdev("NAME");
+            string new_name = (string)UI::QueryWidget(`dev_name, `Value);
+            string rule_key = UI::QueryWidget(`udev_type, 
`CurrentButton)==`mac ? "ATTR{address}" : "KERNELS";
+            string rule_value = UI::QueryWidget(`udev_type, 
`CurrentButton)==`mac ? LanItems::getCurrentItem()["hwinfo", "mac"]:"" : 
LanItems::getCurrentItem()["hwinfo", "busid"]:"";
+
+            if( change_name_active && (new_name != old_name))
+            {
+                if( CheckUdevNicName( new_name))
+                {
+                    LanItems::SetItemUdev("NAME", new_name);
 
+                    NetworkInterfaces::Delete2(old_name);
+                    LanItems::Items[LanItems::current, "ifcfg"] = 
LanItems::GetItemUdev("NAME");
+                }
+                else
+                {
+                    UI::SetFocus( `dev_name);
+                    ret = nil;
 
+                    continue;
+                }
+            }
+
+            // update udev rules
+            string old_key = isempty( LanItems::GetItemUdev( "KERNELS")) ? 
"ATTR{address}" : "KERNELS"; 
+            LanItems::ReplaceItemUdev( old_key, rule_key, rule_value);
+        }
+    }
+    UI::CloseDialog();
+
+    return LanItems::Items[LanItems::current, "ifcfg"]:"";
+}
 
 symbol handleHW (string key, map event) {
  if (event["ID"]:nil==`cancel) LanItems::Rollback();
@@ -468,62 +582,7 @@
             }
        }
   if (ret==`change_udev){
-   UI::OpenDialog(
-       `VBox(
-         `RadioButtonGroup(`id(`udev_type),
-               `VBox(
-                    //make sure there is enough space (#367239)
-                    `HSpacing(30),
-                    `Label(_("Rule by:")),
-                    `Left(`RadioButton(`id(`mac), sformat("MAC address : %1", 
LanItems::getCurrentItem()["hwinfo", "mac"]:""))),
-                    `Left(`RadioButton(`id(`busid), sformat("BusID : %1", 
LanItems::getCurrentItem()["hwinfo", "busid"]:"") ))
-                    )
-         ),
-         `Left(
-             `HBox(
-                 `CheckBox(`id(`change_dev_name), `opt(`notify), _("Change 
DeviceName"), false),
-                 `InputField(`id(`dev_name), "", LanItems::GetItemUdev("NAME"))
-               )
-         ),
-          `VSpacing(0.5),
-          `HBox( `PushButton (`id(`ok), `opt(`default), Label::OKButton ()),
-                 `PushButton (`id(`cancel), Label::CancelButton ())
-         )
-       )
-
-   );
-   if (size(LanItems::GetItemUdev("ATTR{address}"))>0) 
UI::ChangeWidget(`id(`udev_type), `CurrentButton, `mac);
-    else if (size(LanItems::GetItemUdev("KERNELS"))>0) 
UI::ChangeWidget(`id(`udev_type), `CurrentButton, `busid);
-     else y2error("Unknown udev rule ");
-   UI::ChangeWidget(`dev_name, `Enabled, false);
-   any ret = nil;
-   while(ret!=`cancel && ret!=`ok){
-   ret = UI::UserInput();
-    if (ret == `change_dev_name) UI::ChangeWidget(`dev_name, `Enabled, 
(boolean)UI::QueryWidget(`change_dev_name, `Value));
-   }
-   if (ret == `ok){
-   string old_name = LanItems::GetItemUdev("NAME");
-   string new_name = (string)UI::QueryWidget(`dev_name, `Value);
-   // write new udev rule
-   string rule_key = UI::QueryWidget(`udev_type, `CurrentButton)==`mac ? 
"ATTR{address}" : "KERNELS";
-   string rule_value = UI::QueryWidget(`udev_type, `CurrentButton)==`mac ? 
LanItems::getCurrentItem()["hwinfo", "mac"]:"" : 
LanItems::getCurrentItem()["hwinfo", "busid"]:"";
-y2internal("LanItems::GetReplacedItemUdev(%1, %2) %3",rule_key, rule_value,  
LanItems::GetReplacedItemUdev(rule_key, rule_value));
-   if ((boolean)UI::QueryWidget(`change_dev_name, `Value)){
-   // when dev_name changed, rename ifcfg (both in NetworkInterfaces and 
LanItems)
-    if (new_name!=old_name){
-    if (contains(NetworkInterfaces::List(""), new_name)){
-     Popup::Error(_("Configuration name already exists."));
-     ret=nil;
-    } else{
-      y2internal("LanItems::GetReplacedItemUdev2 %1", 
LanItems::GetReplacedItemUdev("NAME", new_name));
-        NetworkInterfaces::Delete2(old_name);
-        LanItems::Items[LanItems::current, 
"ifcfg"]=LanItems::GetItemUdev("NAME");
-     }
-     }
-    }
-   }
-   UI::CloseDialog();
-   UI::ChangeWidget(`device_name, `Value, LanItems::Items[LanItems::current, 
"ifcfg"]:"");
+   UI::ChangeWidget(`device_name, `Value, EditUdevRulesDialog() );
   }
   if (ret==`blink){
     string device = LanItems::device;
@@ -608,7 +667,7 @@
                `VSpacing(1),
                `HBox(
                        /* TextEntry label */
-                       `InputField(`id(`chan_mode), `opt(`hstretch), _("&Port 
Name"), LanItems::chan_mode),
+                       `InputField(`id(`qeth_portname), `opt(`hstretch), 
_("&Port Name"), LanItems::qeth_portname),
                        `ComboBox(`id(`qeth_portnumber), _("Port Number"), 
[`item(`id("0"), "0", true), `item(`id("1"), "1")])
                ),
                `VSpacing(1),
@@ -712,7 +771,7 @@
            `Frame(_("S/390 Device Settings"), `HBox(`HSpacing(2), `VBox(
                `VSpacing(1),
                /* TextEntry label, #42789 */
-               `InputField(`id(`chan_mode), `opt(`hstretch), _("&Peer Name"), 
""),
+               `InputField(`id(`iucv_user), `opt(`hstretch), _("&Peer Name"), 
LanItems::iucv_user),
                `VSpacing(1)
                ), `HSpacing(2))),
            `HSpacing(6)
@@ -742,10 +801,20 @@
        UI::ChangeWidget(`id(`qeth_macaddress), `ValidChars, 
":0123456789abcdefABCDEF");
     }
 
-    if (LanItems::type != "hsi")
-        UI::SetFocus(`id(`chan_mode));
-    else
-        UI::SetFocus(`id(`qeth_options));
+    switch( LanItems::type)
+    {
+        case "hsi":
+            UI::SetFocus(`id(`qeth_options));
+            break;
+        case "qeth":
+            UI::SetFocus(`id(`qeth_portname));
+            break;
+        case "iucv":
+            UI::SetFocus(`id(`iucv_user));
+            break;
+        default:
+            UI::SetFocus(`id(`chan_mode));
+    }
 
     // FIXME: no spaces
     // UI::ChangeWidget(`id(`key), `ValidChars, 
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_:;");
@@ -769,19 +838,27 @@
        else if(ret == `next) {
        if(LanItems::type == "iucv") {
            // #176330, must be static
-           LanItems::nm_name = "static-iucv-id-" + (string) 
UI::QueryWidget(`id(`chan_mode), `Value);
-           LanItems::device = "id-" + (string) 
UI::QueryWidget(`id(`chan_mode), `Value);
+           LanItems::nm_name = "static-iucv-id-" + (string) 
UI::QueryWidget(`id(`iucv_user), `Value);
+           LanItems::device = "id-" + (string) 
UI::QueryWidget(`id(`iucv_user), `Value);
+            LanItems::iucv_user = (string) UI::QueryWidget(`id(`iucv_user), 
`Value);
        }
-        LanItems::chan_mode = (string) UI::QueryWidget(`id(`chan_mode), 
`Value);
 
+       if(LanItems::type == "ctc")
+        {
+            LanItems::chan_mode = (string) UI::QueryWidget(`id(`chan_mode), 
`Value);
+        }
        if(LanItems::type == "lcs")
+        {
            LanItems::lcs_timeout = (string) UI::QueryWidget(`id(`lcs_timeout), 
`Value);
+            LanItems::chan_mode = (string) UI::QueryWidget(`id(`chan_mode), 
`Value);
+        }
        if(LanItems::type == "qeth" || LanItems::type == "hsi") {
            LanItems::qeth_options = (string) 
UI::QueryWidget(`id(`qeth_options), `Value);
            LanItems::ipa_takeover = (boolean) 
UI::QueryWidget(`id(`ipa_takeover), `Value);
            LanItems::qeth_layer2 = (boolean) 
UI::QueryWidget(`id(`qeth_layer2), `Value);
            LanItems::qeth_macaddress = (string) 
UI::QueryWidget(`id(`qeth_macaddress), `Value);
            LanItems::qeth_portnumber = (string) 
UI::QueryWidget(`id(`qeth_portnumber), `Value);
+            LanItems::qeth_portname = (string) 
UI::QueryWidget(`id(`qeth_portname), `Value);
        }
            string read = (string) UI::QueryWidget(`id(`qeth_chan_read), 
`Value);
            string write = (string) UI::QueryWidget(`id(`qeth_chan_write), 
`Value);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-2.24.6/src/modules/LanItems.ycp 
new/yast2-network-2.24.8/src/modules/LanItems.ycp
--- old/yast2-network-2.24.6/src/modules/LanItems.ycp   2012-10-03 
10:59:17.000000000 +0200
+++ new/yast2-network-2.24.8/src/modules/LanItems.ycp   2012-11-06 
08:39:56.000000000 +0100
@@ -122,12 +122,14 @@
 list<string> nilliststring = nil; // to save some casting
 
 /* s390 options */
-// portname is in ifcfg, others are in hwcfg
-global string portname = "";
+global string qeth_portname = "";
 global string qeth_portnumber = "";
+// * ctc as PROTOCOL (or ctc mode, number in { 0, 1, .., 4 }, default: 0)
 global string chan_mode = "0";
 global string qeth_options = "";
 global boolean ipa_takeover = false;
+// * iucv as ROUTER (or iucv user, a zVM guest, string of 1 to 8 chars )
+global string iucv_user = "";
 // #84148
 // 26bdd00.pdf
 // Ch 7: qeth device driver for OSA-Express (QDIO) and HiperSockets
@@ -241,17 +243,34 @@
  return value;
 }
 
-global list<string> GetReplacedItemUdev(string r_key, string r_val){
- list <string> new_rules=[];
- foreach(string row, getUdevFallback(), {
-  if (r_key=="NAME"){
-   if (issubstring(row, "NAME")) row = sformat("NAME=\"%1\"", r_val);
-  } else if (issubstring(row, "ATTR{address}") || issubstring(row, "KERNELS")) 
row = sformat("%1==\"%2\"", r_key, r_val);
+global list<string> ReplaceItemUdev(string replace_key, string new_key, string 
new_val)
+{
+    list<string> new_rules=[];
+    // udev syntax distinguishes among others:
+    // =    for assignment
+    // ==   for equality checks
+    string operator = new_key == "NAME" ? "=" : "==";
 
-  new_rules = add(new_rules, row);
- });
- Items[current, "udev", "net"]=new_rules;
- return new_rules;
+    foreach(string row, getUdevFallback(), 
+    {
+        if( issubstring( row, replace_key))
+            row = sformat( "%1%2\"%3\"", new_key, operator, new_val);
+
+        new_rules = add( new_rules, row);
+    });
+
+    y2debug("LanItems::ReplaceItemUdev: udev rules %1", Items[ current, 
"udev", "net"]:[] );
+
+    Items[current, "udev", "net"] = new_rules;
+
+    y2debug("LanItems::ReplaceItemUdev(%1, %2, %3) %4", replace_key, new_key, 
new_val, new_rules);
+
+    return new_rules;
+}
+
+global list<string> SetItemUdev(string rule_key, string rule_val)
+{
+    return ReplaceItemUdev( rule_key, rule_key, rule_val);
 }
 
 global void WriteUdevDriverRules(){
@@ -1009,7 +1028,8 @@
     wl_power = GetDeviceVar (devmap, defaults, "WIRELESS_POWER") == "yes";
     wl_ap_scanmode = GetDeviceVar (devmap, defaults, "WIRELESS_AP_SCANMODE");
     /* s/390 options */
-    portname = GetDeviceVar (devmap, defaults, "PORTNAME");
+    /* We always have to set the MAC Address for qeth Layer2 support */
+    qeth_macaddress = GetDeviceVar (devmap, defaults, "LLADDR");
     
     aliases = devmap["_aliases"]:$[];
 
@@ -1028,6 +1048,7 @@
     "REMOTE_IPADDR": "",
     "NETMASK": "",
     "MTU": "",
+    "LLADDR": "00:00:00:00:00:00",
     "ETHTOOL_OPTIONS": "",
     "NAME": "",
     "STARTMODE": "manual",
@@ -1053,7 +1074,6 @@
     "WIRELESS_BITRATE": "auto",
     "WIRELESS_AP": "",
     "WIRELESS_POWER": "",
-    "PORTNAME": "", 
     // aliases = devmap["_aliases"]:$[]; // ?
     "WIRELESS_EAP_MODE": "",
     "WIRELESS_WPA_IDENTITY": "",
@@ -1069,9 +1089,24 @@
 
     // default options for bonding (bnc#404449)
     "BONDING_MODULE_OPTS": "mode=active-backup miimon=100",
+
     ];
 
 /**
+ * Default values used when creating an emulated NIC for physical s390 
hardware.
+ */
+map<string, string> s390_defaults = $[  
+    "CHAN_MODE": "0",
+    "QETH_PORTNAME": "", 
+    "QETH_PORTNUMBER": "",
+    "QETH_OPTIONS": "",
+    "QETH_LAYER2": "no",
+    "QETH_CHANIDS": "",
+    "IPA_TAKEOVER": "no",
+    "IUCV_USER": "",
+];
+
+/**
  * Select the given device
  * @param dev device to select ("" for new device, default values)
  * @return true if success
@@ -1516,9 +1551,16 @@
     if(issubstring(type, "-")) type = regexpsub(type, "([^-]+)-.*$", "\\1");
     y2debug("type=%1", type);
 
-    /* We always have to set the MAC Address for qeth Layer2 support */
-    if (qeth_layer2 ) {
-       qeth_macaddress = devmap["LLADDR"]:"00:00:00:00:00:00";
+    if( Arch::s390()) 
+    {
+        chan_mode = s390_defaults[ "CHAN_MODE"]:"";
+        qeth_portname =  s390_defaults[ "QETH_PORTNAME"]:"";
+        qeth_portnumber = s390_defaults[ "QETH_PORTNUMBER"]:"";
+        qeth_options = s390_defaults[ "QETH_OPTIONS"]:"";
+        qeth_layer2 = s390_defaults[ "QETH_LAYER2"]:"" == "yes";
+        qeth_chanids = s390_defaults[ "QETH_CHANIDS"]:"";
+        ipa_takeover = s390_defaults[ "IPA_TAKEOVER"]:"" == "yes";
+        iucv_user = s390_defaults[ "IUCV_USER"]:"";
     }
 
 }
@@ -1570,7 +1612,7 @@
   case "qeth":
   case "hsi":
        string portnumber_param = (size(qeth_portnumber)>0) ? sformat("-n %1", 
qeth_portnumber) : "";
-       string portname_param=(size(chan_mode)>0) ? sformat("-p %1", chan_mode) 
: "";
+       string portname_param=(size(qeth_portname)>0) ? sformat("-p %1", 
qeth_portname) : "";
         string options_param=(size(qeth_options)>0) ? sformat("-o %1", 
qeth_options) : "";
        command1=sformat("qeth_configure %1 %2 %3 %4 %5 1", options_param, 
qeth_layer2?"-l":"", portname_param, portnumber_param, qeth_chanids);
        command2=sformat("ls /sys/devices/qeth/%1/net/|head -n1|tr -d '\n'", 
(splitstring(qeth_chanids, " "))[0]:"");
@@ -1583,7 +1625,7 @@
        break;
   case "iucv":
                                        // router
-       command1=sformat("iucv_configure %1 1", chan_mode);
+       command1=sformat("iucv_configure %1 1", iucv_user);
        command2=sformat("ls /sys/devices/%1/*/net/|head -n1|tr -d '\n'", type);
        break;
   default:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-2.24.6/src/modules/LanUdevAuto.ycp 
new/yast2-network-2.24.8/src/modules/LanUdevAuto.ycp
--- old/yast2-network-2.24.6/src/modules/LanUdevAuto.ycp        2012-09-20 
10:28:35.000000000 +0200
+++ new/yast2-network-2.24.8/src/modules/LanUdevAuto.ycp        2012-11-06 
08:39:56.000000000 +0100
@@ -166,22 +166,15 @@
     LanItems::type=rule["type"]:"";
     LanItems::qeth_chanids=rule["chanids"]:"";
     LanItems::qeth_layer2 = rule["layer2"]:false;
-    switch(rule["type"]:""){
-     case "qeth":
-               LanItems::chan_mode=rule["portname"]:"";
-               break;
-     case "ctc":
-               LanItems::chan_mode=rule["protocol"]:"";
-               break;
-     case "iucv":
-               LanItems::chan_mode=rule["router"]:"";
-               break;
-    }
+    LanItems::qeth_portname=rule["portname"]:"";
+    LanItems::chan_mode=rule["protocol"]:"";
+    LanItems::iucv_user=rule["router"]:"";
+
     y2milestone("rule:%1", rule);
     y2milestone("type:%1", LanItems::type);
     y2milestone("chanids:%1", LanItems::qeth_chanids);
     y2milestone("layer2:%1", LanItems::qeth_layer2);
-    y2milestone("portname:%1", LanItems::chan_mode);
+    y2milestone("portname:%1", LanItems::qeth_portname);
     LanItems::createS390Device();
     y2milestone("rule %1", rule);
    });
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-2.24.6/src/routines/routines.ycp 
new/yast2-network-2.24.8/src/routines/routines.ycp
--- old/yast2-network-2.24.6/src/routines/routines.ycp  2012-10-03 
11:00:59.000000000 +0200
+++ new/yast2-network-2.24.8/src/routines/routines.ycp  2012-11-06 
08:39:46.000000000 +0100
@@ -415,6 +415,26 @@
 }
 
 /**
+ * Validates given name for use as a nic name in sysconfig. See bnc#784952
+ */
+boolean ValidNicName( string name)
+{
+    // 16 is the kernel limit on interface name size (IFNAMSIZ)
+    if( !regexpmatch( name, "^[[:alnum:]._:-]{1,15}$") )
+        return false;
+
+    return true;
+}
+
+/**
+ * Checks if given nic name is used already.
+ */
+boolean UsedNicName( string name)
+{
+    return contains(NetworkInterfaces::List(""), name);
+}
+
+/**
  * Simple convertor from subclass to controller type.
  * @param hwdevice map with card info containing "subclass"
  * @return short device name
@@ -772,31 +792,81 @@
     return Hardware;
 }
 
-define boolean SetAllLinksUp() 
+/*
+ * TODO - begin:
+ * Following functions should be generalized and ported into yast-yast2
+ */
+
+boolean IsEmptyString( string str)
+{
+    return ( str == nil) || isempty( str);
+}
+
+/**
+ * @param Shell command to run
+ * @return Hash in form $[ "exit": <command-exit-status>, "output": [ <1st 
line>, <2nd line>, ... ] ] 
+ */
+map< string, any> RunAndRead( string command)
 {
-    string command =  "ls /sys/class/net|grep -v \"^lo$\"";
-    map<string, any> output = (map<string, 
any>)SCR::Execute(.target.bash_output, command);
+    map< string, any> ret = $[ "exit": false, "output": [] ];
+    map result = ( map) SCR::Execute( .target.bash_output, command);
+    string output = result[ "stdout"]:"";
+
+    if( regexpmatch( output, ".*\n$"))
+        output = substring( output, 0, size( output) -1 );
 
-    if (output["exit"]:-1==0)
+    ret[ "output"] = splitstring( output, "\n");
+    ret[ "exit"] = result[ "exit"]:1 == 0;
+
+    if( ( ret[ "exit"]:false == false) || ( IsEmptyString( result[ 
"stderr"]:"") == false) )
     {
-        list<string> interfaces = filter(string s, 
splitstring(output["stdout"]:"", "\n"), {return (size(s)>0);});
+        y2error( "RunAndRead <%1>: Command execution failed.\n%2", command, 
result[ "stderr"]:"");
+    }
+
+    return ret;
+}
+
+/**
+ * @param Shell command to run
+ * @return whether command execution succeeds
+ */
+boolean Run( string command)
+{
+    boolean ret = SCR::Execute( .target.bash, command) == 0;
+
+    if( !ret)
+    {    
+        y2error( "Run <%1>: Command execution failed.", command);
+    }    
         
-        y2milestone("interfaces %1", interfaces);
+    return ret;
+}            
+/* TODO - end */
 
-        foreach(string ifc, interfaces, 
-        {
-// TODO: do some tests before uncomment block bellow
-//   if ((integer)SCR::Execute(.target.bash, sformat("ip link show %1|head 
-n1|grep -q \"[^[:alpha:]]UP[^[:alpha:]]\"", ifc))!=0)
-//    {
-            y2milestone("Setting link up for interface %1", ifc);
-            SCR::Execute(.target.bash, sformat("ip link set %1 up", ifc));
-//    } else y2milestone("Link for %1 interface is already up, nothing to do", 
ifc);
-        });
-     } 
-    else 
-        y2error("Error while execute %1 : %2", command, output);
+/**
+ * Return list of all interfaces present in the system (not only configured 
ones as NetworkInterfaces::List does).
+ *
+ * @return list of interface names.
+ */
+define list<string> GetAllInterfaces()
+{
+    map<string, any> result = RunAndRead( "ls /sys/class/net");
 
-    return true;
+    return result[ "exit"]:false ? result[ "output"]:[] : [];
+}
+
+define boolean SetAllLinksUp() 
+{
+    list< string> interfaces = GetAllInterfaces();
+    boolean ret = size( interfaces) > 0;
+
+    foreach(string ifc, interfaces, 
+    {
+        y2milestone("Setting link up for interface %1", ifc);
+        ret = Run( sformat("ip link set %1 up", ifc) ) && ret;
+    });
+
+    return ret;
 }
 
 boolean validPrefixOrNetmask(string ip, string mask){
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-2.24.6/testsuite/tests/include.out 
new/yast2-network-2.24.8/testsuite/tests/include.out
--- old/yast2-network-2.24.6/testsuite/tests/include.out        2012-09-20 
10:28:35.000000000 +0200
+++ new/yast2-network-2.24.8/testsuite/tests/include.out        2012-11-06 
11:38:17.000000000 +0100
@@ -0,0 +1,18 @@
+Read   .target.tmpdir nil
+Log    Failed to set temporary directory: nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .sysconfig.console.CONSOLE_ENCODING nil
+Execute        .target.bash_output "locale -k charmap" $["exit":0, 
"stderr":"", "stdout":""]
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-2.24.6/testsuite/tests/include.ycp 
new/yast2-network-2.24.8/testsuite/tests/include.ycp
--- old/yast2-network-2.24.6/testsuite/tests/include.ycp        2012-09-20 
10:28:35.000000000 +0200
+++ new/yast2-network-2.24.8/testsuite/tests/include.ycp        2012-11-06 
11:37:43.000000000 +0100
@@ -1,4 +1,20 @@
 // A basic syntax check
 {
-       include "network/lan/hardware.ycp";
+    // wonderful, isn't it? Believe me, you can't live without it.
+    // At least if you need Encoding.ycp which is included by whatever.
+    import "Testsuite";
+
+    map EXEC = $[
+        "target": $[
+            "bash_output": $[
+                "stdout": "",
+                "stderr": "",
+                "exit": 0
+            ],
+        ],
+    ];
+
+    Testsuite::Init( [ $[], $[], EXEC ], nil);
+
+    include "network/lan/hardware.ycp";
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-2.24.6/testsuite/tests/udev.out 
new/yast2-network-2.24.8/testsuite/tests/udev.out
--- old/yast2-network-2.24.6/testsuite/tests/udev.out   1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-network-2.24.8/testsuite/tests/udev.out   2012-11-06 
11:38:28.000000000 +0100
@@ -0,0 +1,16 @@
+Read   .target.tmpdir nil
+Log    Failed to set temporary directory: nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .sysconfig.console.CONSOLE_ENCODING nil
+Execute        .target.bash_output "locale -k charmap" $["exit":0, 
"stderr":"", "stdout":""]
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
+Read   .probe.architecture nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-2.24.6/testsuite/tests/udev.ycp 
new/yast2-network-2.24.8/testsuite/tests/udev.ycp
--- old/yast2-network-2.24.6/testsuite/tests/udev.ycp   1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-network-2.24.8/testsuite/tests/udev.ycp   2012-11-06 
11:37:46.000000000 +0100
@@ -0,0 +1,56 @@
+{
+    import "Assert";
+    import "Testsuite";
+
+    map EXEC = $[
+        "target": $[
+            "bash_output": $[
+                "stdout": "",
+                "stderr": "",
+                "exit": 0
+            ],
+        ],
+    ];
+
+    Testsuite::Init( [ $[], $[], EXEC ], nil);
+
+    import "LanItems";
+
+    include "network/routines.ycp";
+
+    // valid
+    Assert::Equal( true, ValidNicName( "eth0") );
+    Assert::Equal( true, ValidNicName( "eth_0") );
+    Assert::Equal( true, ValidNicName( "eth-0") );
+    Assert::Equal( true, ValidNicName( "eth.0") );
+    Assert::Equal( true, ValidNicName( "eth:0") );
+    // invalid: too long
+    Assert::Equal( false, ValidNicName( "0123456789012345") );
+    // invalid: wrong char
+    Assert::Equal( false, ValidNicName( "eth0?") );
+
+    // create Items hash, it's easier to create by hand than use LanItems::Read
+    // due to embedded ReadHardware and co (too many faked inputs which are not
+    // in fact needed).
+    LanItems::Items[ 0] = $[ 
+        "ifcfg" : "eth1",
+        "udev" : $[
+            "net" : [ 
+                "KERNELS=\"invalid\"", 
+                "NAME=\"eth1\"" 
+            ],
+            "driver" : nil,
+        ]
+    ];
+
+    LanItems::FindAndSelect( "eth1");
+
+    list<string> new_rules = LanItems::SetItemUdev( "NAME", "nic_name");
+    Assert::Equal( true, contains( new_rules, "NAME=\"nic_name\""));
+
+    new_rules = LanItems::SetItemUdev( "KERNELS", "0000:00:19.x");
+    Assert::Equal( true, contains( new_rules, "KERNELS==\"0000:00:19.x\""));
+
+    new_rules = LanItems::ReplaceItemUdev( "KERNELS", "ATTR{address}", 
"xx:01:02:03:04:05");
+    Assert::Equal( true, contains( new_rules, 
"ATTR{address}==\"xx:01:02:03:04:05\""));
+}

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to