summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-01-07 15:02:18 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-01-07 15:02:18 -0800
commit73026e8580afbbbbb18970679ff7207676b51ba6 (patch)
tree04d0aaa60de3ca48072f04dccdced9be483c674e /tests
parentebb8b5cdec70e45d155652f759eeb3bb889410c6 (diff)
downloadvyatta-cfg-73026e8580afbbbbb18970679ff7207676b51ba6.tar.gz
vyatta-cfg-73026e8580afbbbbb18970679ff7207676b51ba6.zip
New Vyatta::Interface infrastructure
Provide generic module to map interface name to configuration and other attributes. This is first step to ripping the special case code out of DHCP, QoS, ... that all have own rules for mapping name to configuration and configuration to name.
Diffstat (limited to 'tests')
-rw-r--r--tests/interface.pl35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/interface.pl b/tests/interface.pl
new file mode 100644
index 0000000..5fe4278
--- /dev/null
+++ b/tests/interface.pl
@@ -0,0 +1,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;