summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-01-20 10:15:11 +1100
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-01-20 10:15:11 +1100
commitabe20d48f6a96a2f636672d50b9274c71acf7d9f (patch)
tree213a492082311993fd4c2eab8c07f46d0ca72332
parent05f12fecffab242122c2702c049b48500ae8081a (diff)
downloadvyatta-cfg-abe20d48f6a96a2f636672d50b9274c71acf7d9f.tar.gz
vyatta-cfg-abe20d48f6a96a2f636672d50b9274c71acf7d9f.zip
update unit tests
Add more unit tests.
-rw-r--r--tests/interface.pl11
-rw-r--r--tests/isip.pl23
2 files changed, 30 insertions, 4 deletions
diff --git a/tests/interface.pl b/tests/interface.pl
index c2a1a1b..86ec96e 100644
--- a/tests/interface.pl
+++ b/tests/interface.pl
@@ -12,11 +12,14 @@ use Vyatta::Misc;
my @interfaces = getInterfaces();
print "Interfaces: ", join(' ',@interfaces),"\n";
-print "IP addresses = ";
-foreach my $addr (Vyatta::Misc::getInterfacesIPadresses('all')) {
- print $addr, '(', is_ip_v4_or_v6($addr), ') ';
+print "IP\n";
+foreach my $type (qw/all broadcast multicast pointtopoint/) {
+ print "\t$type = ";
+ foreach my $addr (Vyatta::Misc::getInterfacesIPadresses($type)) {
+ print $addr, '(', is_ip_v4_or_v6($addr), ') ';
+ }
+ print "\n";
}
-print "\n";
foreach my $arg (@interfaces) {
diff --git a/tests/isip.pl b/tests/isip.pl
new file mode 100644
index 0000000..35a04b7
--- /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;