summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2010-06-03 16:30:32 -0700
committerMohit Mehta <mohit.mehta@vyatta.com>2010-06-03 16:30:32 -0700
commitd55eab15f9411a6c8cb76c403b4ded440a4ebd99 (patch)
treef4a00d04ae66999ea2a69e1153d7bdb3f4914cea /lib
parent69ea2a2512206d40c903eff1db03cfb78191bc53 (diff)
downloadvyatta-cfg-d55eab15f9411a6c8cb76c403b4ded440a4ebd99.tar.gz
vyatta-cfg-d55eab15f9411a6c8cb76c403b4ded440a4ebd99.zip
move list functions to vrrp perl module
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Vyatta/Keepalived.pm32
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/Vyatta/Keepalived.pm b/lib/Vyatta/Keepalived.pm
index 870af98..d6611f8 100755
--- a/lib/Vyatta/Keepalived.pm
+++ b/lib/Vyatta/Keepalived.pm
@@ -28,11 +28,12 @@ use warnings;
our @EXPORT = qw(get_conf_file get_state_script get_state_file
vrrp_log vrrp_get_init_state get_changes_file
start_daemon restart_daemon stop_daemon
- vrrp_get_config);
+ vrrp_get_config list_vrrp_intf list_vrrp_group);
use base qw(Exporter);
use Vyatta::Config;
use Vyatta::Interface;
+use Vyatta::Misc;
use POSIX;
my $daemon = '/usr/sbin/keepalived';
@@ -310,5 +311,34 @@ sub vrrp_get_init_state {
return $init_state;
}
+sub list_vrrp_intf {
+ my $config = new Vyatta::Config;
+ my @intfs = ();
+
+ foreach my $name ( getInterfaces() ) {
+ my $intf = new Vyatta::Interface($name);
+ next unless $intf;
+ my $path = $intf->path();
+ $config->setLevel($path);
+ push @intfs, $name if $config->existsOrig("vrrp");
+ }
+
+ return @intfs;
+}
+
+sub list_vrrp_group {
+ my ($name) = @_;
+ my $config = new Vyatta::Config;
+ my $path;
+
+ my $intf = new Vyatta::Interface($name);
+ next unless $intf;
+ $path = $intf->path();
+ $path .= " vrrp vrrp-group";
+ $config->setLevel($path);
+ my @groups = $config->listOrigNodes();
+ return @groups;
+}
+
1;
#end of file