summaryrefslogtreecommitdiff
path: root/scripts/vyatta-wanloadbalance.pl
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-07-17 15:06:04 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-07-17 15:06:04 -0700
commit25d9851b65fed9297caaa01b47ec6bae76d8c954 (patch)
treef408dedd6fddd8cc156002f56f0618b5b0efa261 /scripts/vyatta-wanloadbalance.pl
parentc1e5c748aac314a2f0652393fbb9f8c079055106 (diff)
downloadvyatta-wanloadbalance-25d9851b65fed9297caaa01b47ec6bae76d8c954.tar.gz
vyatta-wanloadbalance-25d9851b65fed9297caaa01b47ec6bae76d8c954.zip
reworked target code to support multiple targets and different target types.
user can now specify a sequence of targets to test (ordered by rule number). The first success satifies the success criteria for the test and no further tests will be performed on the interface for this period. Additional test types can be coded and added to the target framework. configuration has changed as a result of the rework.
Diffstat (limited to 'scripts/vyatta-wanloadbalance.pl')
-rw-r--r--scripts/vyatta-wanloadbalance.pl52
1 files changed, 39 insertions, 13 deletions
diff --git a/scripts/vyatta-wanloadbalance.pl b/scripts/vyatta-wanloadbalance.pl
index 397591b..cfc8755 100644
--- a/scripts/vyatta-wanloadbalance.pl
+++ b/scripts/vyatta-wanloadbalance.pl
@@ -25,7 +25,6 @@ sub write_health {
my $valid = "false";
-
if ($config->exists("load-balancing wan disable-source-nat")) {
print FILE_LCK "disable-source-nat\n";
}
@@ -44,6 +43,7 @@ sub write_health {
$config->setLevel("load-balancing wan interface-health");
my @eths = $config->listNodes();
foreach my $ethNode (@eths) {
+ $config->setLevel("load-balancing wan interface-health");
print FILE_LCK "\tinterface " . $ethNode . " {\n";
@@ -51,17 +51,7 @@ sub write_health {
if (defined $option) {
print FILE_LCK "\t\tfailure-ct " . $option . "\n";
}
-
- $option = $config->returnValue("$ethNode ping");
- if (defined $option) {
- print FILE_LCK "\t\ttarget " . $option . "\n";
- }
-
- $option = $config->returnValue("$ethNode resp-time");
- if (defined $option) {
- print FILE_LCK "\t\tping-resp " . $option*1000 . "\n";
- }
-
+
$option = $config->returnValue("$ethNode success-count");
if (defined $option) {
print FILE_LCK "\t\tsuccess-ct " . $option . "\n";
@@ -69,13 +59,49 @@ sub write_health {
$option = $config->returnValue("$ethNode nexthop");
if (defined $option) {
- print FILE_LCK "\t\tnexthop " . $option . "\n";
+ print FILE_LCK "\t\tnexthop " . $option . "\n";
$valid = "true";
}
else {
print "nexthop must be specified\n";
exit 1;
}
+
+ $config->setLevel("load-balancing wan interface-health $ethNode rule");
+ my @rules = $config->listNodes();
+ foreach my $rule (@rules) {
+ print FILE_LCK "\t\trule " . $rule . " {\n";
+
+# my $icmp = $config->returnValue("$rule icmp");
+# if (defined $icmp) {
+ print FILE_LCK "\t\t\ttype icmp {\n";
+# }
+
+# my $ttl = $config->returnValue("$rule ttl");
+# if (defined $ttl) {
+# print FILE_LCK "\t\t\ttype udp {\n";
+# print FILE_LCK "\t\t\t\tttl " . $ttl . "\n";
+# }
+
+# if (defined $icmp && defined $ttl) {
+# print "Only a single test type can be defined (ttl or icmp)\n";
+# exit 1;
+# }
+
+ $option = $config->returnValue("$rule target");
+ if (defined $option) {
+ print FILE_LCK "\t\t\t\ttarget " . $option . "\n";
+ }
+
+ $option = $config->returnValue("$rule resp-time");
+ if (defined $option) {
+ 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";