diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-12-02 10:45:02 -0800 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-12-02 11:21:20 -0800 |
commit | 82352ef62085b9e4bb98daf3c1e5a940148815f1 (patch) | |
tree | d6360ada3c7efa6f40460a0d6e034e5bcf99c8fb | |
parent | 49e19e4097942b8c5109061706b7c762c123834b (diff) | |
download | vyatta-cfg-82352ef62085b9e4bb98daf3c1e5a940148815f1.tar.gz vyatta-cfg-82352ef62085b9e4bb98daf3c1e5a940148815f1.zip |
Add vrrp interface support to Interface library
-rwxr-xr-x | lib/Vyatta/Interface.pm | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index e22ae60..5e10819 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -138,7 +138,32 @@ sub get_all_cfg_interfaces { } } } - + # special case for vrrp + for my $eth ($cfg->$vfunc('interfaces ethernet')) { + for my $vrid ($cfg->$vfunc("interfaces ethernet $eth vrrp vrrp-group")) { + push @ret_ifs, { 'name' => $eth."v".$vrid, + 'path' => "interfaces ethernet $eth vrrp vrrp-group $vrid interface" }; + } + for my $vif ($cfg->$vfunc("interfaces ethernet $eth vif")) { + for my $vrid ($cfg->$vfunc("interfaces ethernet $eth vif $vif vrrp vrrp-group")) { + push @ret_ifs, { 'name' => $eth.".".$vif."v".$vrid, + 'path' => "interfaces ethernet $eth vif $vif vrrp vrrp-group $vrid interface" }; + } + } + } + for my $bond ($cfg->$vfunc('interfaces bonding')) { + for my $vrid ($cfg->$vfunc("interfaces bonding $bond vrrp vrrp-group")) { + push @ret_ifs, { 'name' => $bond."v".$vrid, + 'path' => "interfaces bonding $bond vrrp vrrp-group $vrid interface" }; + } + for my $vif ($cfg->$vfunc("interfaces bonding $bond vif")) { + for my $vrid ($cfg->$vfunc("interfaces bonding $bond vif $vif vrrp vrrp-group")) { + push @ret_ifs, { 'name' => $bond.".".$vif."v".$vrid, + 'path' => "interfaces bonding $bond vif $vif vrrp vrrp-group $vrid interface" }; + } + } + } + # now special cases for pppo*/adsl for my $eth ($cfg->$vfunc('interfaces ethernet')) { for my $ep ($cfg->$vfunc("interfaces ethernet $eth pppoe")) { @@ -221,7 +246,7 @@ sub new { my $that = shift; my $name = pop; my $class = ref($that) || $that; - my ($dev, $vif); + my ($dev, $vif, $vrid); # need argument to constructor return unless $name; @@ -240,7 +265,14 @@ sub new { } # Strip off vif from name - if ( $name =~ m/(\w+)\.(\d+)/ ) { + if ( $name =~ m/(\w+)\.(\d+)v(\d+)/ ){ + $dev = $1; + $vif = $2; + $vrid = $3; + } elsif ( $name =~ m/(\w+)\v(\d+)/ ) { + $dev = $1; + $vrid = $2; + } elsif ( $name =~ m/(\w+)\.(\d+)/ ) { $dev = $1; $vif = $2; } else { @@ -260,6 +292,7 @@ sub new { my $path = "interfaces $type $dev"; $path .= " $vifpath $vif" if $vif; + $path .= " vrrp vrrp-group $vrid interface" if $vrid; my $self = { name => $name, |