[yast-commit] r65484 - in /trunk/network: src/lan/YaPI/NETWORK.pm testsuite/tests/Network_YaPI.out testsuite/tests/Network_YaPI.ycp
Author: mvidner Date: Wed Aug 31 16:51:00 2011 New Revision: 65484 URL: http://svn.opensuse.org/viewcvs/yast?rev=65484&view=rev Log: YaPI::NETWORK: Handle ETHERDEVICE and VLAN_ID. Author: Justus Winter <winter@pre-sense.de> Modified: trunk/network/src/lan/YaPI/NETWORK.pm trunk/network/testsuite/tests/Network_YaPI.out trunk/network/testsuite/tests/Network_YaPI.ycp Modified: trunk/network/src/lan/YaPI/NETWORK.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/YaPI/NETWORK.pm?rev=65484&r1=65483&r2=65484&view=diff ============================================================================== --- trunk/network/src/lan/YaPI/NETWORK.pm (original) +++ trunk/network/src/lan/YaPI/NETWORK.pm Wed Aug 31 16:51:00 2011 @@ -44,6 +44,12 @@ } } $configuration{'mtu'} = LanItems->mtu; + if (LanItems->vlan_id){ + $configuration{'vlan_id'} = LanItems->vlan_id; + } + if (LanItems->vlan_etherdevice){ + $configuration{'vlan_etherdevice'} = LanItems->vlan_etherdevice; + } $interfaces{LanItems->interfacename}=\%configuration; } elsif (LanItems->getCurrentItem()->{'hwinfo'}->{'type'} eq "eth") { my $device = LanItems->getCurrentItem()->{"hwinfo"}->{"dev_name"}; @@ -158,6 +164,12 @@ if (defined $ifc->{'mtu'}) { $config{"MTU"} = $ifc->{'mtu'}; } + if (defined $ifc->{'vlan_id'}) { + $config{"VLAN_ID"} = $ifc->{'vlan_id'}; + } + if (defined $ifc->{'vlan_etherdevice'}) { + $config{"ETHERDEVICE"} = $ifc->{'vlan_etherdevice'}; + } NetworkInterfaces->Current(\%config); NetworkInterfaces->Commit(); NetworkInterfaces->Write(""); Modified: trunk/network/testsuite/tests/Network_YaPI.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/testsuite/tests/Network_YaPI.out?rev=65484&r1=65483&r2=65484&view=diff ============================================================================== --- trunk/network/testsuite/tests/Network_YaPI.out (original) +++ trunk/network/testsuite/tests/Network_YaPI.out Wed Aug 31 16:51:00 2011 @@ -12,7 +12,7 @@ Execute .target.bash "rpm -q --whatprovides SuSEfirewall2" 0 Read .init.scripts.exists "SuSEfirewall2_init" false Read .sysconfig.sysctl.IP_FORWARD nil -Dir .network.section: ["eth0", "eth1", "eth2", "eth3", "eth4"] +Dir .network.section: ["eth0", "eth1", "eth2", "eth3", "eth4", "eth5", "eth5.23"] Dir .network.value."eth0": ["BOOTPROTO", "STARTMODE"] Read .network.value."eth0".BOOTPROTO "dhcp4" Read .network.value."eth0".STARTMODE "manual" @@ -36,6 +36,15 @@ Read .network.value."eth4".IPADDR "1.2.3.7" Read .network.value."eth4".NETMASK "255.255.255.0" Read .network.value."eth4".STARTMODE "auto" +Dir .network.value."eth5": ["BOOTPROTO", "STARTMODE"] +Read .network.value."eth5".BOOTPROTO "static" +Read .network.value."eth5".STARTMODE "auto" +Dir .network.value."eth5.23": ["BOOTPROTO", "ETHERDEVICE", "IPADDR", "STARTMODE", "VLAN_ID"] +Read .network.value."eth5.23".BOOTPROTO "static" +Read .network.value."eth5.23".ETHERDEVICE "eth5" +Read .network.value."eth5.23".IPADDR "1.2.3.8/24" +Read .network.value."eth5.23".STARTMODE "auto" +Read .network.value."eth5.23".VLAN_ID "23" Read .target.size "/etc/install.inf" 27 Dir .etc.install_inf: [] Read .target.string "/proc/cmdline" "laptop.suse.cz" @@ -51,7 +60,7 @@ Read .target.lstat "/etc/sysconfig/network/ifcfg-tr-usb" nil Execute .target.bash_output "hostname --fqdn" $["exit":0, "stdout":"laptop.suse.cz"] Execute .target.bash_output "hostname --fqdn" $["exit":0, "stdout":"laptop.suse.cz"] -Return $["dns":$["nameservers":["208.67.222.222", "208.67.220.220"], "searches":["suse.cz", "suse.de"]], "hostname":$["dhcp_hostname":"1", "domain":"suse.cz", "name":"laptop"], "interfaces":$["eth0":$["bootproto":"dhcp4", "mtu":"", "startmode":"manual"], "eth1":$["bootproto":"static", "ipaddr":"1.2.3.4/24", "mtu":"1234", "startmode":"auto"], "eth2":$["bootproto":"static", "ipaddr":"1.2.3.5/24", "mtu":"", "startmode":"auto"], "eth3":$["bootproto":"static", "ipaddr":"1.2.3.6/24", "mtu":"", "startmode":"auto"], "eth4":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":"", "startmode":"auto"]], "routes":$["default":$["via":"10.20.30.40"]]] +Return $["dns":$["nameservers":["208.67.222.222", "208.67.220.220"], "searches":["suse.cz", "suse.de"]], "hostname":$["dhcp_hostname":"1", "domain":"suse.cz", "name":"laptop"], "interfaces":$["eth0":$["bootproto":"dhcp4", "mtu":"", "startmode":"manual"], "eth1":$["bootproto":"static", "ipaddr":"1.2.3.4/24", "mtu":"1234", "startmode":"auto"], "eth2":$["bootproto":"static", "ipaddr":"1.2.3.5/24", "mtu":"", "startmode":"auto"], "eth3":$["bootproto":"static", "ipaddr":"1.2.3.6/24", "mtu":"", "startmode":"auto"], "eth4":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":"", "startmode":"auto"], "eth5":$["bootproto":"static", "ipaddr":"", "mtu":"", "startmode":"auto"], "eth5.23":$["bootproto":"static", "ipaddr":"1.2.3.8/24", "mtu":"", "startmode":"auto", "vlan_etherdevice":"eth5", "vlan_id":"23"]], "routes":$["default":$["via":"10.20.30.40"]]] Return $["error":"", "exit":"0"] Write .network.value."eth0".BOOTPROTO "dhcp4" true Write .network.value."eth0".STARTMODE "auto" true @@ -79,6 +88,14 @@ Write .network nil true Read .init.scripts.exists "network" false Return $["error":"", "exit":"0"] +Write .network.value."eth5.23".BOOTPROTO "static" true +Write .network.value."eth5.23".ETHERDEVICE "eth5" true +Write .network.value."eth5.23".IPADDR "1.2.3.8/24" true +Write .network.value."eth5.23".STARTMODE "auto" true +Write .network.value."eth5.23".VLAN_ID "42" true +Write .network nil true +Read .init.scripts.exists "network" false +Return $["error":"", "exit":"0"] Read .target.size "/etc/sysconfig/network/routes" 27 Read .routes [$["destination":"default", "gateway":"10.20.30.40"]] Read .init.scripts.exists "SuSEfirewall2_init" false @@ -95,4 +112,4 @@ Read .target.lstat "/etc/sysconfig/network/ifcfg-tr-usb" nil Execute .target.bash_output "hostname --fqdn" $["exit":0, "stdout":"laptop.suse.cz"] Execute .target.bash_output "hostname --fqdn" $["exit":0, "stdout":"laptop.suse.cz"] -Return $["dns":$["nameservers":["208.67.222.222", "208.67.220.220"], "searches":["suse.cz", "suse.de"]], "hostname":$["dhcp_hostname":"1", "domain":"suse.cz", "name":"laptop"], "interfaces":$["eth0":$["bootproto":"dhcp4", "mtu":"", "startmode":"auto"], "eth1":$["bootproto":"static", "ipaddr":"1.2.3.4/24", "mtu":"1234", "startmode":"auto"], "eth2":$["bootproto":"static", "ipaddr":"1.2.3.5/24", "mtu":"", "startmode":"auto"], "eth3":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":"", "startmode":"auto"], "eth4":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":"", "startmode":"auto"]], "routes":$["default":$["via":"10.20.30.40"]]] +Return $["dns":$["nameservers":["208.67.222.222", "208.67.220.220"], "searches":["suse.cz", "suse.de"]], "hostname":$["dhcp_hostname":"1", "domain":"suse.cz", "name":"laptop"], "interfaces":$["eth0":$["bootproto":"dhcp4", "mtu":"", "startmode":"auto"], "eth1":$["bootproto":"static", "ipaddr":"1.2.3.4/24", "mtu":"1234", "startmode":"auto"], "eth2":$["bootproto":"static", "ipaddr":"1.2.3.5/24", "mtu":"", "startmode":"auto"], "eth3":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":"", "startmode":"auto"], "eth4":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":"", "startmode":"auto"], "eth5":$["bootproto":"static", "ipaddr":"", "mtu":"", "startmode":"auto"], "eth5.23":$["bootproto":"static", "ipaddr":"1.2.3.8/24", "mtu":"", "startmode":"auto", "vlan_etherdevice":"eth5", "vlan_id":"42"]], "routes":$["default":$["via":"10.20.30.40"]]] Modified: trunk/network/testsuite/tests/Network_YaPI.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/testsuite/tests/Network_YaPI.ycp?rev=65484&r1=65483&r2=65484&view=diff ============================================================================== --- trunk/network/testsuite/tests/Network_YaPI.ycp (original) +++ trunk/network/testsuite/tests/Network_YaPI.ycp Wed Aug 31 16:51:00 2011 @@ -32,6 +32,8 @@ "eth2":$[], "eth3":$[], "eth4":$[], + "eth5":$[], + "eth5.23":$[], ], "value" : $[ "eth0" : $[ @@ -62,6 +64,17 @@ "IPADDR" : "1.2.3.7", "NETMASK" : "255.255.255.0", ], + "eth5" : $[ + "STARTMODE" : "auto", + "BOOTPROTO" : "static", + ], + "eth5.23" : $[ + "STARTMODE" : "auto", + "BOOTPROTO" : "static", + "IPADDR" : "1.2.3.8/24", + "VLAN_ID" : "23", + "ETHERDEVICE" : "eth5", + ], ], ], "routes" : [ $["destination":"default", "gateway":"10.20.30.40"] ] @@ -89,7 +102,12 @@ // test incorrect default route (invalid gw IP) TEST(``(YaPI::NETWORK::Write($["route":$["default":$["via":"10.20.30"]]])), [READ], nil); +// test setting the network prefix length for an interface that was previously configured via netmask TEST(``(YaPI::NETWORK::Write($["interface":$["eth3":$["bootproto":"static", "ipaddr":"1.2.3.7/24"]]])), [READ], nil); + +// test vlan_id change +TEST(``(YaPI::NETWORK::Write($["interface":$["eth5.23":$["bootproto":"static", "ipaddr":"1.2.3.8/24", "vlan_etherdevice":"eth5", "vlan_id":"42"]]])), [READ], nil); + TEST(``(YaPI::NETWORK::Read()), [READ, $[], EXEC], nil); } -- 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