Changeset 170 for trunk/klask


Ignore:
Timestamp:
Jul 18, 2016, 6:11:38 PM (8 years ago)
Author:
g7moreau
Message:
  • Add verbose description on switch
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r169 r170  
    11#!/usr/bin/perl -w
    22#
    3 # Copyright (C) 2005-2016 Gabriel Moreau.
     3# Copyright (C) 2005-2016 Gabriel Moreau
    44#
    55# $Id$
     
    103103   J4903A           => { type => 1, model => 'HP2824',         match => 'J4903A.+?Switch 2824,'             },
    104104   J4110A           => { type => 1, model => 'HP8000M',        match => 'HP J4110A ProCurve Switch 8000M'   },
    105    JE074A           => { type => 2, model => 'HP5120-24G',     match => 'HP Comware.+?A5120-24G EI'         },
    106    JE069A           => { type => 2, model => 'HP5120-48G',     match => 'HP Comware.+?A5120-48G EI Switch with 2 Interface Slots'   },
    107    JD377A           => { type => 2, model => 'HP5500-24G',     match => 'HP Comware.+?A5500-24G EI'         },
    108    JD374A           => { type => 2, model => 'HP5500-24F',     match => 'HP Comware.+?A5500-24G-SFP EI'     },
     105   JE074A           => { type => 2, model => 'HP5120-24G',     match => 'HP Comware.+?A5120-24G EI Switch with 2 Interface Slots'      },
     106   JE069A           => { type => 2, model => 'HP5120-48G',     match => 'HP Comware.+?A5120-48G EI Switch with 2 Interface Slots'      },
     107   JD377A           => { type => 2, model => 'HP5500-24G',     match => 'HP Comware.+?A5500-24G EI Switch with 2 Interface Slots'      },
     108   JD374A           => { type => 2, model => 'HP5500-24F',     match => 'HP Comware.+?A5500-24G-SFP EI Switch with 2 Interface Slots'  },
    109109   # BayStack
    110110   BS350T           => { type => 1, model => 'BS350T',         match => 'BayStack 350T HW'                  },
     
    293293# va rechercher le nom des switchs pour savoir qui est qui
    294294sub init_switch_names {
    295    my $verbose = shift;
     295   my ($verbose, $verb_description) = @_;
    296296
    297297   printf "%-26s                %-25s %s\n",'Switch','Description','Type' if $verbose;
     
    324324         );
    325325      $sw->{description} = $result->{$OID_NUMBER{sysName}} || $sw->{hostname};
    326       $sw->{model} = get_switch_model( $result->{$OID_NUMBER{sysDescription}});
     326      $sw->{model} = get_switch_model($result->{$OID_NUMBER{sysDescription}});
     327      if ($verb_description) {
     328         my $desc = $result->{$OID_NUMBER{sysDescription}};
     329         $desc =~ s/[\n\r]/ /g;
     330         print "   description: $desc\n"
     331         }
    327332      #$sw->{location} = $result->{"1.3.6.1.2.1.1.6.0"} || $sw->{hostname};
    328333      #$sw->{contact} = $result->{"1.3.6.1.2.1.1.4.0"} || $sw->{hostname};
     
    866871
    867872sub cmd_updatedb {
    868    my @network = @_;
     873   @ARGV = @_;
     874
     875   my ($verbose, $verb_description);
     876
     877   GetOptions(
     878      'verbose|v' => \$verbose,
     879      'verb_description|d' => \$verb_description,
     880      );
     881
     882   my @network = @ARGV;
    869883      @network = get_list_network() if not @network;
    870884
     
    884898   my $detected_computer = 0;
    885899
    886    init_switch_names('yes');    #nomme les switchs
     900   init_switch_names('yes', $verb_description);    #nomme les switchs
    887901
    888902   { # Remplis le champs portignore des ports d'inter-connection pour chaque switch
Note: See TracChangeset for help on using the changeset viewer.