summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2009-12-07 10:50:45 -0800
committerMichael Larson <slioch@slioch.vyatta.com>2009-12-07 10:50:45 -0800
commit6d7ccdf7a80830601c5a4a738757ab80c83b116f (patch)
treea0a060f0b659c66a2b54d09cb4801c5906397771 /scripts
parent858f1f6a75d273e16d050f4b8abc8c8e06c4dbd8 (diff)
downloadvyatta-wanloadbalance-6d7ccdf7a80830601c5a4a738757ab80c83b116f.tar.gz
vyatta-wanloadbalance-6d7ccdf7a80830601c5a4a738757ab80c83b116f.zip
small modification to test type configuration--improved layout.
NOTE: layout is not compatible with earlier kenwood configurations for WLB. ttl limit for ttl test has been removed as a leaf of the ttl test type, but is now configurable as a sibling (but with a default value of 1).
Diffstat (limited to 'scripts')
-rw-r--r--scripts/vyatta-wanloadbalance.pl30
1 files changed, 13 insertions, 17 deletions
diff --git a/scripts/vyatta-wanloadbalance.pl b/scripts/vyatta-wanloadbalance.pl
index 86f6b80..43e537d 100644
--- a/scripts/vyatta-wanloadbalance.pl
+++ b/scripts/vyatta-wanloadbalance.pl
@@ -70,29 +70,25 @@ sub write_health {
print "nexthop must be specified\n";
exit 1;
}
-
+
$config->setLevel("load-balancing wan interface-health $ethNode test");
my @rules = $config->listNodes();
foreach my $rule (@rules) {
print FILE_LCK "\t\trule " . $rule . " {\n";
-
- my $icmp = $config->exists("$rule ping");
- if (defined $icmp) {
- print FILE_LCK "\t\t\ttype ping {\n";
- }
- my $udp = $config->returnValue("$rule ttl");
- if (defined $udp) {
+ my $test_type = $config->returnValue("$rule type");
+ if ((defined $test_type) && ($test_type eq "ttl")) {
print FILE_LCK "\t\t\ttype udp {\n";
- print FILE_LCK "\t\t\t\tttl $udp\n";
+ my $ttl_limit = $config->returnValue("$rule ttl-limit");
+ if (defined $ttl_limit) {
+ print FILE_LCK "\t\t\t\tttl $ttl_limit\n";
+ }
}
-
- if (defined $icmp && defined $udp) {
- print "Only a single test type can be defined (ttl or icmp)\n";
- exit 1;
+ else {
+ print FILE_LCK "\t\t\ttype ping {\n";
}
-
- $option = $config->returnValue("$rule target");
+
+ my $option = $config->returnValue("$rule target");
if (defined $option) {
print FILE_LCK "\t\t\t\ttarget " . $option . "\n";
}
@@ -102,13 +98,13 @@ sub write_health {
print FILE_LCK "\t\t\t\tresp-time " . $option*1000 . "\n";
}
print FILE_LCK "\t\t\t}\n";
-
+
print FILE_LCK "\t\t}\n";
}
print FILE_LCK "\t}\n";
}
print FILE_LCK "}\n\n";
-
+
if ($valid eq "false") {
print "A valid WAN load-balance configuration requires an interface with a nexthop\n";
}