[cisco-stats] Added support for Port-channels to generate_cisco_port_configuration_ov...
authorMaximilian Wilhelm <max@rfc2324.org>
Sun, 6 Jan 2008 00:42:34 +0000 (01:42 +0100)
committerMaximilian Wilhelm <max@rfc2324.org>
Sun, 6 Jan 2008 00:42:34 +0000 (01:42 +0100)
  generate_cisco_port_configuration_overview will now detect and show
  Port-channels and interfaces joint in the Channel-group.

Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>

cisco-stats/generate_cisco_port_configuration_overview

index a1a133d..44f3685 100755 (executable)
@@ -134,6 +134,9 @@ while (my $line = <RUNNING_CONFIG>) { # Read device configuration {{{
                                mode => undef,
                                desc => undef,
                                disabled => undef,
+
+                               channel_group => undef,
+                               channel_mode => undef,
                        };
 
                        # Act on this interface util finding next
@@ -265,6 +268,16 @@ while (my $line = <RUNNING_CONFIG>) { # Read device configuration {{{
                $current_int->{disabled} = 'shutdown';
        } # }}}
 
+       # Is this interface member of a Port-channel?
+       elsif ($line =~ /^ channel-group ([0-9]+) mode (active|auto|desirable|on|passive)$/ ) { # {{{
+               if (defined $current_int->{channel_group}) {
+                       die "Error: Trying to reset channel-group membership on interface $current_int->{name} at line $line_num\n";
+               }
+
+               $current_int->{channel_group} = $1;
+               $current_int->{channel_mode} = $2;
+       } # }}}
+
        # End interface stanza
        elsif ($line =~ m/^!$/) { # {{{
                $current_int = undef;
@@ -349,6 +362,12 @@ sub print_interfaces ($) { # print_interfaces (\%interfaces_of_$type) {{{
                }
                $int_string .= "$int_ref->{mode}]";
 
+               if ($int_ref->{channel_group}) {
+                       # Ignore channel_mode here...
+                       $int_string .= " [Channelgrp $int_ref->{channel_group}]";
+                       $int_class .= " channel_port";
+               }
+
                # Is the port shutdown?
                if ($int_ref->{disabled}) {
                        $int_class .= " linethrough";
@@ -440,6 +459,10 @@ print '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1
                color: #000000;
          }
 
+         .channel_port {
+               font-style: italic;
+         }
+
          .x {
                text-align: center;
                vertical-align: middle;