From 80f85801b57a030459cb6846bb229ca87d18cc5a Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 12 Jan 2009 15:48:44 -0800 Subject: Use new interfaces routines Unify all code that does name -> interface attribute translation into one place. No need to pass interface path to scripts, and handle addresses correctly in DHCP code. Use 'undef' consitently for false in perl code. --- tests/interface.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/interface.pl b/tests/interface.pl index 5fe4278..989d6c5 100644 --- a/tests/interface.pl +++ b/tests/interface.pl @@ -19,12 +19,18 @@ foreach my $arg (@ARGV) { my $vif = $intf->vif(); print "vif=$vif " if $vif; - printf "path = '%s' device=%s\n", $intf->path(), $intf->physicalDevice(); + printf "path = '%s'\ndevice=%s\n", $intf->path(), $intf->physicalDevice(); - foreach my $attr (qw(exists configured disabled dhcp address up running)) { - my $val = $intf->$attr(); + my @addresses = $intf->address(); + if ($#addresses eq -1) { + print "address is no set\n"; + } else { + print "address ", join(' ',@addresses), "\n"; + } - if ($val) { + foreach my $attr (qw(exists configured disabled using up running)) { + my $val = $intf->$attr(); + if (defined $val) { print "\t$attr = $val\n"; } else { print "\t$attr is not set\n"; -- cgit v1.2.3