Mailinglist Archive: yast-commit (1809 mails)

< Previous Next >
[yast-commit] r58513 - in /trunk/network: package/yast2-network.changes src/lan/YaPI/NETWORK.pm testsuite/tests/Network_YaPI.out
  • From: mzugec@xxxxxxxxxxxxxxxx
  • Date: Thu, 03 Sep 2009 18:19:09 -0000
  • Message-id: <E1MjGtp-0005Aw-HV@xxxxxxxxxxxxxxxx>
Author: mzugec
Date: Thu Sep 3 20:19:09 2009
New Revision: 58513

URL: http://svn.opensuse.org/viewcvs/yast?rev=58513&view=rev
Log:
YaPI: read interfaces from system (not only fake data)

Modified:
trunk/network/package/yast2-network.changes
trunk/network/src/lan/YaPI/NETWORK.pm
trunk/network/testsuite/tests/Network_YaPI.out

Modified: trunk/network/package/yast2-network.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/package/yast2-network.changes?rev=58513&r1=58512&r2=58513&view=diff
==============================================================================
--- trunk/network/package/yast2-network.changes (original)
+++ trunk/network/package/yast2-network.changes Thu Sep 3 20:19:09 2009
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Thu Sep 3 20:18:48 CEST 2009 - mzugec@xxxxxxx
+
+- YaPI: read interfaces from system (not only fake data)
+
+-------------------------------------------------------------------
Mon Aug 31 15:09:48 CEST 2009 - mzugec@xxxxxxx

- YaPI: added testsuite

Modified: trunk/network/src/lan/YaPI/NETWORK.pm
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/YaPI/NETWORK.pm?rev=58513&r1=58512&r2=58513&view=diff
==============================================================================
--- trunk/network/src/lan/YaPI/NETWORK.pm (original)
+++ trunk/network/src/lan/YaPI/NETWORK.pm Thu Sep 3 20:19:09 2009
@@ -4,9 +4,11 @@
use YaST::YCP qw(:LOGGING);
use YaPI;
use Data::Dumper;
+use Switch;

# ------------------- imported modules
-#YaST::YCP::Import ("Lan");
+YaST::YCP::Import ("LanItems");
+YaST::YCP::Import ("NetworkInterfaces");
YaST::YCP::Import ("DNS");
YaST::YCP::Import ("Routing");
# -------------------------------------
@@ -24,13 +26,33 @@

DNS->Read();
Routing->Read();
+ LanItems->Read();
+ NetworkInterfaces->Read();

-# FIXME: interfaces are a fake data, replace with real data from system
- my %ret = ('interfaces'=>{
- 'eth0'=>{'bootproto'=>'dhcp'},
- 'eth1'=>{'bootproto'=>'static',
'ipaddr'=>'192.168.3.27/24'}},
+ my %interfaces = ();
+ foreach my $devnum (keys %{LanItems->Items}){
+ my $devname= %{LanItems->Items}->{$devnum}->{'hwinfo'}->{'dev_name'};
+ my $name = %{LanItems->Items}->{$devnum}->{'ifcfg'};
+ if ($name ne ""){
+ my %configuration = ();
+ NetworkInterfaces->Select($name);
+ my %config = %{NetworkInterfaces->Current};
+ my $bootproto = %config->{'BOOTPROTO'};
+ switch($bootproto){
+ case "dhcp" {
+ %configuration = ( 'bootproto' => 'dhcp' );
+ }
+ case "static" {
+ %configuration = ( 'bootproto' => 'static' );
+ %configuration->{'ipaddr'} = %config->{'IPADDR'} . "/" .
%config->{'PREFIXLEN'}
+ }
+ }
+ $interfaces{$name}=\%configuration;
+ }
+ }
+
+ my %ret = ('interfaces'=>\%interfaces,
'routes'=>{'default'=>{'via'=>Routing->GetGateway()}},
-# 'dns'=>{'dnsservers'=>join(' ', @{DNS->nameservers}),
'dnsdomains'=>join(' ', @{DNS->searchlist})},
'dns'=>{'dnsservers'=>\@{DNS->nameservers},
'dnsdomains'=>\@{DNS->searchlist}},
'hostname'=>{'name'=>DNS->hostname, 'domain'=>DNS->domain}
);

Modified: trunk/network/testsuite/tests/Network_YaPI.out
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/testsuite/tests/Network_YaPI.out?rev=58513&r1=58512&r2=58513&view=diff
==============================================================================
--- trunk/network/testsuite/tests/Network_YaPI.out (original)
+++ trunk/network/testsuite/tests/Network_YaPI.out Thu Sep 3 20:19:09 2009
@@ -19,4 +19,17 @@
Read .routes [$["destination":"default", "gateway":"10.20.30.40"]]
Read .sysconfig.sysctl.IP_FORWARD nil
Dir .network.section: []
-Return $["dns":$["dnsdomains":"suse.cz suse.de", "dnsservers":"208.67.222.222
208.67.220.220"], "hostname":$["domain":"suse.cz", "name":"laptop"],
"interfaces":$["eth0":$["bootproto":"dhcp"], "eth1":$["bootproto":"static",
"ipaddr":"192.168.3.27/24"]], "routes":$["default":$["via":"10.20.30.40"]]]
+Read .target.size "/etc/install.inf" 27
+Dir .etc.install_inf: []
+Read .target.string "/proc/cmdline" "laptop.suse.cz"
+Read .probe.netcard nil
+Log hardware detection failure
+Read .etc.install_inf.BrokenModules nil
+Read .udev_persistent.net nil
+Dir .modules.options: []
+Read .udev_persistent.drivers nil
+Read .target.lstat "/etc/sysconfig/network/ifcfg-eth-pcmcia" nil
+Read .target.lstat "/etc/sysconfig/network/ifcfg-eth-usb" nil
+Read .target.lstat "/etc/sysconfig/network/ifcfg-tr-pcmcia" nil
+Read .target.lstat "/etc/sysconfig/network/ifcfg-tr-usb" nil
+Return $["dns":$["dnsdomains":["suse.cz", "suse.de"],
"dnsservers":["208.67.222.222", "208.67.220.220"]],
"hostname":$["domain":"suse.cz", "name":"laptop"], "interfaces":$[],
"routes":$["default":$["via":"10.20.30.40"]]]

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages