summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2012-09-17 14:05:57 -0700
committerJohn Southworth <john.southworth@vyatta.com>2012-09-17 14:05:57 -0700
commiteb3aa9d0ac4ddf96e685f25e22af9272352f2949 (patch)
tree3bb6c355cdf19ef23caec1f6ecce4558c1172602
parent40380dfd2dad22861f1b9589ec7f80278043f0c1 (diff)
downloadvyatta-op-eb3aa9d0ac4ddf96e685f25e22af9272352f2949.tar.gz
vyatta-op-eb3aa9d0ac4ddf96e685f25e22af9272352f2949.zip
Bugfix 8300: show proper output for 'show interfaces vrrp'; also fixes bug 8317
-rwxr-xr-xscripts/vyatta-show-interfaces.pl47
-rw-r--r--templates/monitor/interfaces/vrrp/node.tag/node.def2
-rw-r--r--templates/show/interfaces/vrrp/node.def2
-rw-r--r--templates/show/interfaces/vrrp/node.tag/node.def2
4 files changed, 47 insertions, 6 deletions
diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl
index 22022f7..ae1ab3c 100755
--- a/scripts/vyatta-show-interfaces.pl
+++ b/scripts/vyatta-show-interfaces.pl
@@ -38,6 +38,7 @@ use warnings;
# valid actions
#
my %action_hash = (
+ 'allowed' => \&run_allowed,
'show' => \&run_show_intf,
'show-brief' => \&run_show_intf_brief,
'show-count' => \&run_show_counters,
@@ -160,6 +161,34 @@ sub get_intf_for_type {
return @list;
}
+# Find vlan interfaces
+sub get_vlan_intf() {
+ my @interfaces = getInterfaces();
+ my @list = ();
+
+ foreach my $name (@interfaces) {
+ my $intf = new Vyatta::Interface($name);
+ next unless $intf && defined($intf->vif());
+ push @list, $name;
+ }
+
+ return @list;
+}
+
+# Find vlan interfaces
+sub get_vrrp_intf() {
+ my @interfaces = getInterfaces();
+ my @list = ();
+
+ foreach my $name (@interfaces) {
+ my $intf = new Vyatta::Interface($name);
+ next unless $intf && defined($intf->vrid());
+ push @list, $name;
+ }
+
+ return @list;
+}
+
# This function has to deal with both 32 and 64 bit counters
sub get_counter_val {
my ($clear, $now) = @_;
@@ -183,6 +212,11 @@ sub get_counter_val {
# The "action" routines
#
+sub run_allowed {
+ my @intfs = @_;
+ print "@intfs";
+}
+
sub run_show_intf {
my @intfs = @_;
@@ -408,7 +442,7 @@ sub intf_sort {
}
sub usage {
- print "Usage: $0 [intf=NAME|intf-type=TYPE] action=ACTION\n";
+ print "Usage: $0 [intf=NAME|intf-type=TYPE|vif|vrrp] action=ACTION\n";
print " NAME = ", join(' | ', get_intf_for_type()), "\n";
print " TYPE = ", join(' | ', Vyatta::Interface::interface_types()), "\n";
print " ACTION = ", join(' | ', keys %action_hash), "\n";
@@ -418,15 +452,18 @@ sub usage {
#
# main
#
-my @intf_list = ();
-my ($intf_type, $intf);
+my ($intf_type, $intf, $vif_only, $vrrp_only);
my $action = 'show';
GetOptions("intf-type=s" => \$intf_type,
+ "vif" => \$vif_only,
+ "vrrp" => \$vrrp_only,
"intf=s" => \$intf,
"action=s" => \$action,
) or usage();
+my @intf_list;
+
if ($intf) {
die "Invalid interface [$intf]\n"
unless is_valid_intf($intf);
@@ -434,6 +471,10 @@ if ($intf) {
push @intf_list, $intf;
} elsif ($intf_type) {
@intf_list = get_intf_for_type($intf_type);
+} elsif ($vif_only) {
+ @intf_list = get_vlan_intf();
+} elsif ($vrrp_only) {
+ @intf_list = get_vrrp_intf();
} else {
# get all interfaces
@intf_list = get_intf_for_type();
diff --git a/templates/monitor/interfaces/vrrp/node.tag/node.def b/templates/monitor/interfaces/vrrp/node.tag/node.def
index 043cc89..94c75d9 100644
--- a/templates/monitor/interfaces/vrrp/node.tag/node.def
+++ b/templates/monitor/interfaces/vrrp/node.tag/node.def
@@ -1,4 +1,4 @@
help: Monitor specified vrrp interface
-allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show vrrp
+allowed: ${vyatta_bindir}/vyatta-show-interfaces.pl --vrrp --action=allowed
run: bmon -p $4
diff --git a/templates/show/interfaces/vrrp/node.def b/templates/show/interfaces/vrrp/node.def
index 1d381f3..7b973c9 100644
--- a/templates/show/interfaces/vrrp/node.def
+++ b/templates/show/interfaces/vrrp/node.def
@@ -1,2 +1,2 @@
help: Show vrrp interface information
-run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf-type=vrrp --action=show-brief
+run: ${vyatta_bindir}/vyatta-show-interfaces.pl --vrrp --action=show-brief
diff --git a/templates/show/interfaces/vrrp/node.tag/node.def b/templates/show/interfaces/vrrp/node.tag/node.def
index c1d8891..3e261a7 100644
--- a/templates/show/interfaces/vrrp/node.tag/node.def
+++ b/templates/show/interfaces/vrrp/node.tag/node.def
@@ -1,3 +1,3 @@
help: Show specified vrrp interface information
-allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show vrrp
+allowed: ${vyatta_bindir}/vyatta-show-interfaces.pl --vrrp --action=allowed
run: ${vyatta_bindir}/vyatta-show-interfaces.pl --intf="$4"