summaryrefslogtreecommitdiff
path: root/tests/interface.pl
blob: 5fe427876cc4902e2a09b1349a48425b93db7ba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/bin/perl

# Standalone test for Vyatta::Interface, not intended to be used
# directly


use strict;
use warnings;
use Vyatta::Interface;

foreach my $arg (@ARGV) {
    print "$arg : ";
    my $intf = new Vyatta::Interface($arg);

    if (! $intf) {
	print "undefined\n";
	next;
    }
    
    my $vif = $intf->vif();
    print "vif=$vif " if $vif;
    printf "path = '%s' device=%s\n", $intf->path(), $intf->physicalDevice();

    foreach my $attr (qw(exists configured disabled dhcp address up running)) {
	my $val = $intf->$attr();

	if ($val) {
	    print "\t$attr = $val\n";
	} else {
	    print "\t$attr is not set\n";
	}
    }
}

exit 0;