summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-12-21 10:52:40 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-12-21 10:52:40 -0800
commitd234dbf62a065de2b799f9b57c1b476c07a6bc17 (patch)
tree276dcc9e0854cb549e1f42ae29b6ee518c823e48 /tests
parent7f58b680525bcf9a07f9f1e4c1a6fc4aa7815dae (diff)
downloadvyatta-cfg-system-d234dbf62a065de2b799f9b57c1b476c07a6bc17.tar.gz
vyatta-cfg-system-d234dbf62a065de2b799f9b57c1b476c07a6bc17.zip
Move interface support from vyatta-cfg to vyatta-cfg-system
All the other interface types are in vyatta-cfg-system, only loopback and ethernet were in vyatta-cfg
Diffstat (limited to 'tests')
-rw-r--r--tests/interface.pl52
-rw-r--r--tests/isip.pl23
2 files changed, 75 insertions, 0 deletions
diff --git a/tests/interface.pl b/tests/interface.pl
new file mode 100644
index 00000000..9ebeb60b
--- /dev/null
+++ b/tests/interface.pl
@@ -0,0 +1,52 @@
+#! /usr/bin/perl
+
+# Standalone test for Vyatta::Interface, not intended to be used
+# directly
+
+
+use strict;
+use warnings;
+use Vyatta::Interface;
+use Vyatta::Misc;
+
+my @interfaces = getInterfaces();
+print "Interfaces: ", join(' ',@interfaces),"\n";
+
+print "IP\n";
+foreach my $type (qw/all broadcast multicast pointtopoint loopback/) {
+ print "\t$type = ";
+ foreach my $addr (Vyatta::Misc::getInterfacesIPadresses($type)) {
+ print $addr, '(', is_ip_v4_or_v6($addr), ') ';
+ }
+ print "\n";
+}
+
+
+foreach my $arg (@interfaces) {
+ 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'\ndevice=%s\n", $intf->path(), $intf->physicalDevice();
+
+ my @addresses = $intf->address();
+ if ($#addresses eq -1) {
+ print "address is no set\n";
+ } else {
+ print "address ", join(' ',@addresses), "\n";
+ }
+
+ foreach my $attr (qw(exists configured disabled using_dhcp flags up running)) {
+ my $val = $intf->$attr();
+ print " $attr=$val" if ($val);
+ }
+ print "\n";
+}
+
+exit 0;
diff --git a/tests/isip.pl b/tests/isip.pl
new file mode 100644
index 00000000..35a04b7a
--- /dev/null
+++ b/tests/isip.pl
@@ -0,0 +1,23 @@
+#! /usr/bin/perl
+
+# Standalone test for Vyatta::Misc::isIPInterfaces
+
+use strict;
+use warnings;
+use Vyatta::Misc;
+use Vyatta::Interface;
+
+my $vc;
+my @interfaces = getInterfaces();
+print "Interfaces: ", join(' ',@interfaces),"\n";
+
+foreach my $lip (@ARGV) {
+ print $lip, " is";
+ if (Vyatta::Misc::isIPinInterfaces($vc, $lip, @interfaces)) {
+ print " in\n";
+ } else {
+ print " not in\n";
+ }
+}
+
+exit 0;