[yast-commit] r65079 - in /branches/SuSE-Code-11-SP2-Branch/yast2: ./ library/network/src/ library/network/testsuite/tests/ package/
Author: mvidner Date: Thu Jul 28 16:25:36 2011 New Revision: 65079 URL: http://svn.opensuse.org/viewcvs/yast?rev=65079&view=rev Log: Fixed NetworkInterfaces::GetTypeFromIfcfg to recognize bridges (bnc#704999). otherwise yast2 lan would erroneously put INTERFACETYPE=br in ifcfg Added test cases, using the new Assert module Added: branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.err branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.out branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.ycp (with props) Modified: branches/SuSE-Code-11-SP2-Branch/yast2/VERSION branches/SuSE-Code-11-SP2-Branch/yast2/library/network/src/NetworkInterfaces.ycp branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes Modified: branches/SuSE-Code-11-SP2-Branch/yast2/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2/VERSION?rev=65079&r1=65078&r2=65079&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/yast2/VERSION (original) +++ branches/SuSE-Code-11-SP2-Branch/yast2/VERSION Thu Jul 28 16:25:36 2011 @@ -1 +1 @@ -2.17.104 +2.17.105 Modified: branches/SuSE-Code-11-SP2-Branch/yast2/library/network/src/NetworkInterfaces.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2/library/network/src/NetworkInterfaces.ycp?rev=65079&r1=65078&r2=65079&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/yast2/library/network/src/NetworkInterfaces.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/yast2/library/network/src/NetworkInterfaces.ycp Thu Jul 28 16:25:36 2011 @@ -182,10 +182,27 @@ list<string> TypeByKeyValue = [ "INTERFACETYPE", - "TUNNEL", ]; list<list<string> > TypeByKeyExistence = [ ["ETHERDEVICE", "vlan"], + ["WIRELESS_MODE", "wlan"], + ["MODEM_DEVICE", "ppp"], + ]; +list<list<string> > TypeByValueMatch = [ + ["BONDING_MASTER", "yes", "bond"], + ["BRIDGE", "yes", "br"], + ["WIRELESS", "yes", "wlan"], + ["TUNNEL", "tap", "tap"], + ["TUNNEL", "tun", "tun"], + ["TUNNEL", "sit", "sit"], + ["TUNNEL", "gre", "gre"], + ["TUNNEL", "ipip", "ipip"], + ["PPPMODE", "pppoe", "ppp"], + ["PPPMODE", "pppoatm", "ppp"], + ["PPPMODE", "capi-adsl", "ppp"], + ["PPPMODE", "pptp", "ppp"], + ["ENCAP", "syncppp", "isdn"], + ["ENCAP", "rawip", "isdn"], ]; /** @@ -193,6 +210,14 @@ */ global string GetTypeFromIfcfg(ifcfg_t ifcfg) { string type = nil; // unknown + foreach(list<string> key_type, TypeByValueMatch, { + string rule_key = key_type[0]:""; + string rule_value = key_type[1]:""; + string rule_type = key_type[2]:""; + if (ifcfg[rule_key]:"" == rule_value) { + type = rule_type; + } + }); foreach(list<string> key_type, TypeByKeyExistence, { string rule_key = key_type[0]:""; string rule_type = key_type[1]:""; Added: branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.err URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.err?rev=65079&view=auto ============================================================================== (empty) Added: branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.out URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.out?rev=65079&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.out (added) +++ branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.out Thu Jul 28 16:25:36 2011 @@ -0,0 +1,4 @@ +Dump NetworkInterfaces::GetTypeFromIfcfg +Return true +Return true +Return true Added: branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.ycp?rev=65079&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.ycp (added) +++ branches/SuSE-Code-11-SP2-Branch/yast2/library/network/testsuite/tests/NetworkInterfaces5-Type.ycp Thu Jul 28 16:25:36 2011 @@ -0,0 +1,40 @@ +// bnc#704999 +{ + +include "testsuite.ycp"; +import "Assert"; +import "NetworkInterfaces"; + +typedef map<string, any> ifcfg_t; + +ifcfg_t mybond = $[ + "BOOTPROTO": "dhcp", + "BONDING_MASTER": "yes", + "BONDING_SLAVE_0": "eth0", + "BONDING_SLAVE_1": "eth1", +]; + +ifcfg_t mybridged = $[ + "BOOTPROTO": "dhcp", + "BRIDGE": "yes", + "BRIDGE_PORTS": "eth0 tap0", +]; + +ifcfg_t myvirt = $[ + "BOOTPROTO": "static", + "TUNNEL": "tap", +]; + +DUMP("NetworkInterfaces::GetTypeFromIfcfg"); +TEST(``( + Assert::Equal("bond", NetworkInterfaces::GetTypeFromIfcfg(mybond)) + ), [], nil); +TEST(``( + Assert::Equal("br", NetworkInterfaces::GetTypeFromIfcfg(mybridged)) + ), [], nil); +TEST(``( + Assert::Equal("tap", NetworkInterfaces::GetTypeFromIfcfg(myvirt)) + ), [], nil); + +/*EOF*/ +} Modified: branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes?rev=65079&r1=65078&r2=65079&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes Thu Jul 28 16:25:36 2011 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Jul 28 16:23:46 CEST 2011 - mvidner@suse.cz + +- Fixed NetworkInterfaces::GetTypeFromIfcfg to recognize bridges (bnc#704999). +- 2.17.105 + +------------------------------------------------------------------- Thu Jul 28 13:46:22 CEST 2011 - jsuchome@suse.cz - adapt the message shown when compliance check fails -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
mvidner@svn2.opensuse.org